diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-23 09:28:44 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-23 09:28:44 +0200 |
| commit | 815f1ed417bd26fbe2abbdf20ac5d3423b30796c (patch) | |
| tree | 923c9a9e2834ccab60f5caecfb8f0ac410c1dd9e /Source/WebKit/blackberry/Api/WebPage.cpp | |
| parent | b4ad5d9d2b96baacd0180ead50de5195ca78af2d (diff) | |
| download | qtwebkit-815f1ed417bd26fbe2abbdf20ac5d3423b30796c.tar.gz | |
Imported WebKit commit e65cbc5b6ac32627c797e7fc7f46eb7794410c92 (http://svn.webkit.org/repository/webkit/trunk@123308)
New snapshot with better configure tests
Diffstat (limited to 'Source/WebKit/blackberry/Api/WebPage.cpp')
| -rw-r--r-- | Source/WebKit/blackberry/Api/WebPage.cpp | 154 |
1 files changed, 127 insertions, 27 deletions
diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index 2e5098d37..b5686707f 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -19,6 +19,8 @@ #include "config.h" #include "WebPage.h" +#include "AboutData.h" +#include "AboutTemplate.html.cpp" #include "ApplicationCacheStorage.h" #include "AutofillManager.h" #include "BackForwardController.h" @@ -155,6 +157,8 @@ #include <BlackBerryPlatformMouseEvent.h> #include <BlackBerryPlatformScreen.h> #include <BlackBerryPlatformSettings.h> +#include <BlackBerryPlatformWebKitCredits.h> +#include <BuildInformation.h> #include <JavaScriptCore/APICast.h> #include <JavaScriptCore/JSContextRef.h> #include <JavaScriptCore/JSStringRef.h> @@ -615,6 +619,84 @@ private: } }; +bool WebPagePrivate::loadAbout(const char* aboutURL) +{ + if (strncasecmp(aboutURL, "about:", 6)) + return false; + + // First 6 chars are "about:". + String aboutWhat(aboutURL + 6); + + String result; + + if (equalIgnoringCase(aboutWhat, "credits")) { + result.append(writeHeader("Credits")); + result.append(String("<style> .about {padding:14px;} </style>")); + result.append(String(BlackBerry::Platform::WEBKITCREDITS)); + result.append(String("</body></html>")); + } else if (aboutWhat.startsWith("cache?query=", false)) { + BlackBerry::Platform::Client* client = BlackBerry::Platform::Client::get(); + ASSERT(client); + std::string key(aboutWhat.substring(12, aboutWhat.length() - 12).utf8().data()); // 12 is length of "cache?query=". + result.append(String("<html><head><title>BlackBerry Browser Disk Cache</title></head><body>")); + result.append(String(key.data())); + result.append(String("<hr>")); + result.append(String(client->generateHtmlFragmentForCacheHeaders(key).data())); + result.append(String("</body></html>")); + } else if (equalIgnoringCase(aboutWhat, "cache")) { + BlackBerry::Platform::Client* client = BlackBerry::Platform::Client::get(); + ASSERT(client); + result.append(String("<html><head><title>BlackBerry Browser Disk Cache</title></head><body>")); + result.append(String(client->generateHtmlFragmentForCacheKeys().data())); + result.append(String("</body></html>")); +#if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD + } else if (equalIgnoringCase(aboutWhat, "cache/disable")) { + BlackBerry::Platform::Client* client = BlackBerry::Platform::Client::get(); + ASSERT(client); + client->setDiskCacheEnabled(false); + result.append(String("<html><head><title>BlackBerry Browser Disk Cache</title></head><body>Http disk cache is disabled.</body></html>")); + } else if (equalIgnoringCase(aboutWhat, "cache/enable")) { + BlackBerry::Platform::Client* client = BlackBerry::Platform::Client::get(); + ASSERT(client); + client->setDiskCacheEnabled(true); + result.append(String("<html><head><title>BlackBerry Browser Disk Cache</title></head><body>Http disk cache is enabled.</body></html>")); + } else if (equalIgnoringCase(aboutWhat, "cookie")) { + result.append(String("<html><head><title>BlackBerry Browser cookie information</title></head><body>")); + result.append(cookieManager().generateHtmlFragmentForCookies()); + result.append(String("</body></html>")); + } else if (equalIgnoringCase(aboutWhat, "version")) { + result.append(writeHeader("Version")); + result.append(String("<div class='box'><div class='box-title'>Build Time</div><br>")); + result.append(String(BlackBerry::Platform::BUILDTIME)); + result.append(String("</div><br><div style='font-size:10px;text-align:center;'>Also see the <A href='about:build'>build information</A>.</body></html>")); + } else if (BlackBerry::Platform::debugSetting() > 0 && equalIgnoringCase(aboutWhat, "config")) { + result = configPage(); + } else if (BlackBerry::Platform::debugSetting() > 0 && equalIgnoringCase(aboutWhat, "build")) { + result.append(writeHeader("Build")); + result.append(String("<div class='box'><div class='box-title'>Basic</div><table>")); + result.append(String("<tr><td>Built On: </td><td>")); + result.append(String(BlackBerry::Platform::BUILDCOMPUTER)); + result.append(String("</td></tr>")); + result.append(String("<tr><td>Build User: </td><td>")); + result.append(String(BlackBerry::Platform::BUILDUSER)); + result.append(String("</td></tr>")); + result.append(String("<tr><td>Build Time: </td><td>")); + result.append(String(BlackBerry::Platform::BUILDTIME)); + result.append(String("</table></div><br>")); + result.append(String(BlackBerry::Platform::BUILDINFO_WEBKIT)); + result.append(String(BlackBerry::Platform::BUILDINFO_PLATFORM)); + result.append(String(BlackBerry::Platform::BUILDINFO_LIBWEBVIEW)); + result.append(String("</body></html>")); + } else if (equalIgnoringCase(aboutWhat, "memory")) { + result = memoryPage(); +#endif + } else + return false; + + loadString(result.latin1().data(), aboutURL, "text/html"); + return true; +} + void WebPagePrivate::load(const char* url, const char* networkToken, const char* method, Platform::NetworkRequest::CachePolicy cachePolicy, const char* data, size_t dataLength, const char* const* headers, size_t headersLength, bool isInitial, bool mustHandleInternally, bool forceDownload, const char* overrideContentType, const char* suggestedSaveName) { stopCurrentLoad(); @@ -665,6 +747,8 @@ void WebPagePrivate::load(const char* url, const char* networkToken, const char* void WebPage::load(const char* url, const char* networkToken, bool isInitial) { + if (d->loadAbout(url)) + return; d->load(url, networkToken, "GET", Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, isInitial, false); } @@ -1174,8 +1258,6 @@ bool WebPagePrivate::shouldZoomAboutPoint(double scale, const FloatPoint&, bool *clampedScale = scale; if (currentScale() == scale) { - // Make sure backingstore updates resume from pinch zoom in the case where the final zoom level doesn't change. - m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::None); m_client->zoomChanged(m_webPage->isMinZoomed(), m_webPage->isMaxZoomed(), !shouldZoomOnEscape(), currentScale()); return false; } @@ -1367,6 +1449,7 @@ void WebPagePrivate::unscheduleZoomAboutPoint() void WebPagePrivate::zoomAboutPointTimerFired(Timer<WebPagePrivate>*) { zoomAboutPoint(m_delayedZoomArguments.scale, m_delayedZoomArguments.anchor, m_delayedZoomArguments.enforceScaleClamping, m_delayedZoomArguments.forceRendering); + m_backingStore->d->resumeScreenAndBackingStoreUpdates(m_delayedZoomArguments.forceRendering ? BackingStore::RenderAndBlit : BackingStore::None); } void WebPagePrivate::setNeedsLayout() @@ -3076,20 +3159,25 @@ IntRect WebPagePrivate::blockZoomRectForNode(Node* node) clipToTransformedContentsRect(blockRect); #if DEBUG_BLOCK_ZOOM - // Re-paint the backingstore to screen to erase other annotations. - m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::Blit); - - // Render a black square over the calculated block and a gray square over the original block for visual inspection. - originalRect = mapToTransformed(originalRect); - clipToTransformedContentsRect(originalRect); - IntRect renderRect = mapFromTransformedContentsToTransformedViewport(blockRect); - IntRect originalRenderRect = mapFromTransformedContentsToTransformedViewport(originalRect); - IntSize viewportSize = transformedViewportSize(); - renderRect.intersect(IntRect(0, 0, viewportSize.width(), viewportSize.height())); - originalRenderRect.intersect(IntRect(0, 0, viewportSize.width(), viewportSize.height())); - m_backingStore->d->clearWindow(renderRect, 0, 0, 0); - m_backingStore->d->clearWindow(originalRenderRect, 120, 120, 120); - m_backingStore->d->invalidateWindow(renderRect); + if (!m_backingStore->d->isSuspended()) { + // Re-paint the backingstore to screen to erase other annotations. + if (m_backingStore->d->shouldDirectRenderingToWindow()) + m_backingStore->d->renderVisibleContents(); + else + m_backingStore->d->blitVisibleContents(); + + // Render a black square over the calculated block and a gray square over the original block for visual inspection. + originalRect = mapToTransformed(originalRect); + clipToTransformedContentsRect(originalRect); + IntRect renderRect = mapFromTransformedContentsToTransformedViewport(blockRect); + IntRect originalRenderRect = mapFromTransformedContentsToTransformedViewport(originalRect); + IntSize viewportSize = transformedViewportSize(); + renderRect.intersect(IntRect(0, 0, viewportSize.width(), viewportSize.height())); + originalRenderRect.intersect(IntRect(0, 0, viewportSize.width(), viewportSize.height())); + m_backingStore->d->clearWindow(renderRect, 0, 0, 0); + m_backingStore->d->clearWindow(originalRenderRect, 120, 120, 120); + m_backingStore->d->invalidateWindow(renderRect); + } #endif return blockRect; @@ -5865,21 +5953,33 @@ void WebPagePrivate::setCompositor(PassRefPtr<WebPageCompositorPrivate> composit { using namespace BlackBerry::Platform; + // We depend on the current thread being the WebKit thread when it's not the Compositing thread. + // That seems extremely likely to be the case, but let's assert just to make sure. + ASSERT(webKitThreadMessageClient()->isCurrentThread()); + + if (m_backingStore->d->buffer()) + m_backingStore->d->suspendScreenAndBackingStoreUpdates(); + + // This method call always round-trips on the WebKit thread (see WebPageCompositor::WebPageCompositor() and ~WebPageCompositor()), + // and the compositing context must be set on the WebKit thread. How convenient! + if (compositingContext != EGL_NO_CONTEXT) + BlackBerry::Platform::Graphics::setCompositingContext(compositingContext); + // The m_compositor member has to be modified during a sync call for thread // safe access to m_compositor and its refcount. - if (!userInterfaceThreadMessageClient()->isCurrentThread()) { - // We depend on the current thread being the WebKit thread when it's not the Compositing thread. - // That seems extremely likely to be the case, but let's assert just to make sure. - ASSERT(webKitThreadMessageClient()->isCurrentThread()); + userInterfaceThreadMessageClient()->dispatchSyncMessage(createMethodCallMessage(&WebPagePrivate::setCompositorHelper, this, compositor, compositingContext)); - // This method call always round-trips on the WebKit thread (see WebPageCompositor::WebPageCompositor() and ~WebPageCompositor()), - // and the compositing context must be set on the WebKit thread. How convenient! - if (compositingContext != EGL_NO_CONTEXT) - BlackBerry::Platform::Graphics::setCompositingContext(compositingContext); + if (m_backingStore->d->buffer()) // the new compositor, if one was set + m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit); +} - userInterfaceThreadMessageClient()->dispatchSyncMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, this, compositor, compositingContext)); - return; - } +void WebPagePrivate::setCompositorHelper(PassRefPtr<WebPageCompositorPrivate> compositor, EGLContext compositingContext) +{ + using namespace BlackBerry::Platform; + + // The m_compositor member has to be modified during a sync call for thread + // safe access to m_compositor and its refcount. + ASSERT(userInterfaceThreadMessageClient()->isCurrentThread()); m_compositor = compositor; if (m_compositor) { |
