diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-10 19:10:20 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-10 19:10:20 +0200 |
| commit | 284837daa07b29d6a63a748544a90b1f5842ac5c (patch) | |
| tree | ecd258180bde91fe741e0cfd2638beb3c6da7e8e /Source/WebKit/blackberry/Api/WebPage.cpp | |
| parent | 2e2ba8ff45915f40ed3e014101269c175f2a89a0 (diff) | |
| download | qtwebkit-284837daa07b29d6a63a748544a90b1f5842ac5c.tar.gz | |
Imported WebKit commit 68645295d2e3e09af2c942f092556f06aa5f8b0d (http://svn.webkit.org/repository/webkit/trunk@128073)
New snapshot
Diffstat (limited to 'Source/WebKit/blackberry/Api/WebPage.cpp')
| -rw-r--r-- | Source/WebKit/blackberry/Api/WebPage.cpp | 147 |
1 files changed, 68 insertions, 79 deletions
diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index 2e34c366c..2052b0e82 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -20,6 +20,7 @@ #include "WebPage.h" #include "ApplicationCacheStorage.h" +#include "AuthenticationChallengeManager.h" #include "AutofillManager.h" #include "BackForwardController.h" #include "BackForwardListImpl.h" @@ -29,7 +30,6 @@ #if ENABLE(BATTERY_STATUS) #include "BatteryClientBlackBerry.h" #endif -#include "CString.h" #include "CachedImage.h" #include "Chrome.h" #include "ChromeClientBlackBerry.h" @@ -76,6 +76,7 @@ #include "InspectorBackendDispatcher.h" #include "InspectorClientBlackBerry.h" #include "InspectorController.h" +#include "InspectorInstrumentation.h" #include "InspectorOverlay.h" #include "JavaScriptDebuggerBlackBerry.h" #include "JavaScriptVariant_p.h" @@ -153,7 +154,6 @@ #include <BlackBerryPlatformDeviceInfo.h> #include <BlackBerryPlatformExecutableMessage.h> -#include <BlackBerryPlatformITPolicy.h> #include <BlackBerryPlatformKeyboardEvent.h> #include <BlackBerryPlatformMessageClient.h> #include <BlackBerryPlatformMouseEvent.h> @@ -166,6 +166,8 @@ #include <sys/keycodes.h> #include <unicode/ustring.h> // platform ICU +#include <wtf/text/CString.h> + #ifndef USER_PROCESSES #include <memalloc.h> #endif @@ -567,8 +569,7 @@ void WebPagePrivate::init(const WebString& pageGroupName) m_inRegionScroller = adoptPtr(new InRegionScroller(this)); #if ENABLE(WEBGL) - Platform::Settings* settings = Platform::Settings::instance(); - m_page->settings()->setWebGLEnabled(settings && settings->isWebGLSupported()); + m_page->settings()->setWebGLEnabled(true); #endif #if ENABLE(ACCELERATED_2D_CANVAS) m_page->settings()->setCanvasUsesAcceleratedDrawing(true); @@ -742,6 +743,7 @@ bool WebPagePrivate::executeJavaScript(const char* scriptUTF8, JavaScriptDataTyp JSC::ExecState* exec = m_mainFrame->script()->globalObject(mainThreadNormalWorld())->globalExec(); JSGlobalContextRef context = toGlobalRef(exec); + JSC::JSLockHolder lock(exec); JSType type = JSValueGetType(context, toRef(exec, value)); switch (type) { @@ -1482,8 +1484,8 @@ void WebPage::scrollBy(const Platform::IntSize& delta) void WebPagePrivate::notifyInRegionScrollStopped() { - if (m_inRegionScroller->d->hasNode()) { - enqueueRenderingOfClippedContentOfScrollableNodeAfterInRegionScrolling(m_inRegionScroller->d->node()); + if (m_inRegionScroller->d->isActive()) { + enqueueRenderingOfClippedContentOfScrollableAreaAfterInRegionScrolling(); m_inRegionScroller->d->reset(); } } @@ -1493,9 +1495,16 @@ void WebPage::notifyInRegionScrollStopped() d->notifyInRegionScrollStopped(); } -void WebPagePrivate::enqueueRenderingOfClippedContentOfScrollableNodeAfterInRegionScrolling(Node* scrolledNode) +void WebPagePrivate::enqueueRenderingOfClippedContentOfScrollableAreaAfterInRegionScrolling() { - ASSERT(scrolledNode); + // If no scrolling was even performed, bail out. + if (m_inRegionScroller->d->m_needsActiveScrollableAreaCalculation) + return; + + InRegionScrollableArea* scrollableArea = static_cast<InRegionScrollableArea*>(m_inRegionScroller->d->activeInRegionScrollableAreas()[0]); + ASSERT(scrollableArea); + Node* scrolledNode = scrollableArea->layer()->enclosingElement(); + if (scrolledNode->isDocumentNode()) { Frame* frame = static_cast<const Document*>(scrolledNode)->frame(); ASSERT(frame); @@ -1560,10 +1569,11 @@ void WebPagePrivate::updateViewportSize(bool setFixedReportedSize, bool sendResi if (!m_backingStore) return; ASSERT(m_mainFrame->view()); + IntSize visibleSize = actualVisibleSize(); if (setFixedReportedSize) - m_mainFrame->view()->setFixedReportedSize(actualVisibleSize()); + m_mainFrame->view()->setFixedReportedSize(visibleSize); - IntRect frameRect = IntRect(scrollPosition(), viewportSize()); + IntRect frameRect = IntRect(scrollPosition(), visibleSize); if (frameRect != m_mainFrame->view()->frameRect()) { m_mainFrame->view()->setFrameRect(frameRect); m_mainFrame->view()->adjustViewSize(); @@ -2258,14 +2268,20 @@ bool WebPagePrivate::isActive() const return m_client->isActive(); } -bool WebPagePrivate::authenticationChallenge(const KURL& url, const ProtectionSpace& protectionSpace, Credential& inputCredential) +void WebPagePrivate::authenticationChallenge(const KURL& url, const ProtectionSpace& protectionSpace, const Credential& inputCredential, AuthenticationChallengeClient* client) { WebString username; WebString password; #if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD - if (m_dumpRenderTree) - return m_dumpRenderTree->didReceiveAuthenticationChallenge(inputCredential); + if (m_dumpRenderTree) { + Credential credential(inputCredential, inputCredential.persistence()); + if (m_dumpRenderTree->didReceiveAuthenticationChallenge(credential)) + client->notifyChallengeResult(url, protectionSpace, AuthenticationChallengeSuccess, credential); + else + client->notifyChallengeResult(url, protectionSpace, AuthenticationChallengeCancelled, inputCredential); + return; + } #endif #if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST) @@ -2282,8 +2298,11 @@ bool WebPagePrivate::authenticationChallenge(const KURL& url, const ProtectionSp #else Credential credential(username, password, CredentialPersistenceNone); #endif - inputCredential = credential; - return isConfirmed; + + if (isConfirmed) + client->notifyChallengeResult(url, protectionSpace, AuthenticationChallengeSuccess, credential); + else + client->notifyChallengeResult(url, protectionSpace, AuthenticationChallengeCancelled, inputCredential); } PageClientBlackBerry::SaveCredentialType WebPagePrivate::notifyShouldSaveCredential(bool isNew) @@ -2408,6 +2427,13 @@ Platform::WebContext WebPagePrivate::webContext(TargetDetectionStrategy strategy if (node->isElementNode()) { Element* element = static_cast<Element*>(node->shadowAncestorNode()); + + String webWorksContext(DOMSupport::webWorksContext(element)); + if (!webWorksContext.stripWhiteSpace().isEmpty()) { + context.setFlag(Platform::WebContext::IsWebWorksContext); + context.setWebWorksContext(webWorksContext.utf8().data()); + } + if (DOMSupport::isTextBasedContentEditableElement(element)) { if (!canStartSelection) { // Input fields host node is by spec non-editable unless the field itself has content editable enabled. @@ -2549,8 +2575,8 @@ void WebPagePrivate::clearDocumentData(const Document* documentGoingAway) if (m_currentBlockZoomAdjustedNode && m_currentBlockZoomAdjustedNode->document() == documentGoingAway) m_currentBlockZoomAdjustedNode = 0; - if (m_inRegionScroller->d->hasNode() && m_inRegionScroller->d->node()->document() == documentGoingAway) - m_inRegionScroller->d->reset(); + if (m_inRegionScroller->d->isActive()) + m_inRegionScroller->d->clearDocumentData(documentGoingAway); if (documentGoingAway->frame()) m_inputHandler->frameUnloaded(documentGoingAway->frame()); @@ -2737,7 +2763,7 @@ PassRefPtr<Node> WebPagePrivate::contextNode(TargetDetectionStrategy strategy) return result.node(FatFingersResult::ShadowContentNotAllowed); } - HitTestResult result = eventHandler->hitTestResultAtPoint(contentPos, false /*allowShadowContent*/); + HitTestResult result = eventHandler->hitTestResultAtPoint(contentPos); return result.innerNode(); } @@ -2809,7 +2835,7 @@ Node* WebPagePrivate::nodeForZoomUnderPoint(const IntPoint& point) if (!m_mainFrame) return 0; - HitTestResult result = m_mainFrame->eventHandler()->hitTestResultAtPoint(mapFromTransformed(point), false); + HitTestResult result = m_mainFrame->eventHandler()->hitTestResultAtPoint(mapFromTransformed(point)); Node* node = result.innerNonSharedNode(); @@ -3122,6 +3148,11 @@ void WebPage::blockZoomAnimationFinished() d->zoomBlock(); } +void WebPage::resetBlockZoom() +{ + d->resetBlockZoom(); +} + void WebPagePrivate::resetBlockZoom() { m_currentBlockZoomNode = 0; @@ -3676,28 +3707,12 @@ void WebPagePrivate::setViewportSize(const IntSize& transformedActualVisibleSize if (!m_visible || !m_backingStore->d->isActive()) setShouldResetTilesWhenShown(true); - bool needsLayout = false; bool hasPendingOrientation = m_pendingOrientation != -1; if (m_hasPendingSurfaceSizeChange) { resizeSurfaceIfNeeded(); m_hasPendingSurfaceSizeChange = false; } - if (!hasPendingOrientation) { - // If we are not rotating and we've started a viewport resize with - // the Render tree in dirty state (i.e. it needs layout), lets - // reset the needsLayout flag for now but set our own 'needsLayout'. - // - // Reason: calls like ScrollView::setFixedLayoutSize can trigger a layout - // if the render tree needs it. We want to avoid it till the viewport resize - // is actually done (i.e. ScrollView::setViewportSize gets called - // further down the method). - if (m_mainFrame->view()->needsLayout()) { - m_mainFrame->view()->unscheduleRelayout(); - m_mainFrame->contentRenderer()->setNeedsLayout(false); - needsLayout = true; - } - } // The window buffers might have been recreated, cleared, moved, etc., so: m_backingStore->d->windowFrontBufferState()->clearBlittedRegion(); @@ -3722,6 +3737,7 @@ void WebPagePrivate::setViewportSize(const IntSize& transformedActualVisibleSize setDefaultLayoutSize(transformedActualVisibleSize); // Recompute our virtual viewport. + bool needsLayout = false; static ViewportArguments defaultViewportArguments; if (m_viewportArguments != defaultViewportArguments) { // We may need to infer the width and height for the viewport with respect to the rotation. @@ -3805,16 +3821,17 @@ void WebPagePrivate::setViewportSize(const IntSize& transformedActualVisibleSize // We might need to layout here to get a correct contentsSize so that zoomToFit // is calculated correctly. - while (needsLayout) { + bool stillNeedsLayout = needsLayout; + while (stillNeedsLayout) { setNeedsLayout(); requestLayoutIfNeeded(); - needsLayout = false; + stillNeedsLayout = false; // Emulate the zoomToFitWidthOnLoad algorithm if we're rotating. ++m_nestedLayoutFinishedCount; if (needsLayoutToFindContentSize) { if (setViewMode(viewMode())) - needsLayout = true; + stillNeedsLayout = true; } } m_nestedLayoutFinishedCount = 0; @@ -4028,7 +4045,7 @@ bool WebPagePrivate::handleMouseEvent(PlatformMouseEvent& mouseEvent) } if (!node) { - HitTestResult result = eventHandler->hitTestResultAtPoint(mapFromViewportToContents(mouseEvent.position()), false /*allowShadowContent*/); + HitTestResult result = eventHandler->hitTestResultAtPoint(mapFromViewportToContents(mouseEvent.position())); node = result.innerNode(); } @@ -4082,6 +4099,10 @@ bool WebPage::touchEvent(const Platform::TouchEvent& event) if (d->m_page->defersLoading()) return false; + // FIXME: this checks if node search on inspector is enabled, though it might not be optimized. + if (InspectorInstrumentation::handleMousePress(d->m_mainFrame->page())) + return false; + PluginView* pluginView = d->m_fullScreenPluginView.get(); if (pluginView) return d->dispatchTouchEventToFullScreenPlugin(pluginView, event); @@ -4092,7 +4113,6 @@ bool WebPage::touchEvent(const Platform::TouchEvent& event) tEvent.m_points[i].m_screenPos = d->mapFromTransformed(tEvent.m_points[i].m_screenPos); } - Platform::Gesture tapGesture; if (event.hasGesture(Platform::Gesture::SingleTap)) d->m_pluginMayOpenNewTab = true; else if (tEvent.m_type == Platform::TouchEvent::TouchStart || tEvent.m_type == Platform::TouchEvent::TouchCancel) @@ -5188,7 +5208,7 @@ WebDOMDocument WebPage::document() const WebDOMNode WebPage::nodeAtPoint(int x, int y) { - HitTestResult result = d->m_mainFrame->eventHandler()->hitTestResultAtPoint(d->mapFromTransformed(IntPoint(x, y)), false); + HitTestResult result = d->m_mainFrame->eventHandler()->hitTestResultAtPoint(d->mapFromTransformed(IntPoint(x, y))); Node* node = result.innerNonSharedNode(); return WebDOMNode(node); } @@ -5473,31 +5493,6 @@ void WebPagePrivate::setCompositorDrawsRootLayer(bool compositorDrawsRootLayer) } #if USE(ACCELERATED_COMPOSITING) -void WebPagePrivate::drawLayersOnCommit() -{ - if (!Platform::userInterfaceThreadMessageClient()->isCurrentThread()) { - // This method will only be called when the layer appearance changed due to - // animations. And only if we don't need a one shot drawing sync. - ASSERT(!needsOneShotDrawingSynchronization()); - - if (!m_webPage->isVisible()) - return; - - m_backingStore->d->willDrawLayersOnCommit(); - - Platform::userInterfaceThreadMessageClient()->dispatchMessage( - Platform::createMethodCallMessage(&WebPagePrivate::drawLayersOnCommit, this)); - return; - } - -#if DEBUG_AC_COMMIT - Platform::log(Platform::LogLevelCritical, "%s", WTF_PRETTY_FUNCTION); -#endif - - if (!m_backingStore->d->shouldDirectRenderingToWindow()) - m_backingStore->d->blitVisibleContents(); -} - void WebPagePrivate::scheduleRootLayerCommit() { if (!(m_frameLayers && m_frameLayers->hasLayer()) && !m_overlayLayer) @@ -5626,6 +5621,8 @@ void WebPagePrivate::commitRootLayer(const IntRect& layoutRectForCompositing, if (overlayLayer) overlayLayer->commitOnCompositingThread(); + + scheduleCompositingRun(); } bool WebPagePrivate::commitRootLayerIfNeeded() @@ -5646,7 +5643,9 @@ bool WebPagePrivate::commitRootLayerIfNeeded() if (!m_needsCommit) return false; - if (!(m_frameLayers && m_frameLayers->hasLayer()) && !m_overlayLayer) + // Don't bail if the layers were removed and we now need a one shot drawing sync as a consequence. + if (!(m_frameLayers && m_frameLayers->hasLayer()) && !m_overlayLayer + && !m_needsOneShotDrawingSynchronization) return false; FrameView* view = m_mainFrame->view(); @@ -5744,10 +5743,7 @@ void WebPagePrivate::rootLayerCommitTimerFired(Timer<WebPagePrivate>*) } } - // If the web page needs layout, the commit will fail. - // No need to draw the layers if nothing changed. - if (commitRootLayerIfNeeded()) - drawLayersOnCommit(); + commitRootLayerIfNeeded(); } void WebPagePrivate::resetCompositingSurface() @@ -5888,9 +5884,6 @@ void WebPagePrivate::resumeRootLayerCommit() m_suspendRootLayerCommit = false; m_needsCommit = true; - - // Recreate layer resources if needed. - commitRootLayerIfNeeded(); } bool WebPagePrivate::needsOneShotDrawingSynchronization() @@ -6032,7 +6025,7 @@ void WebPagePrivate::exitFullScreenForElement(Element* element) { #if ENABLE(VIDEO) // TODO: We should not check video tag when we decide to support all elements. - if (!element || !element->hasTagName(HTMLNames::videoTag)) + if (!element || (!element->hasTagName(HTMLNames::videoTag) && !containsVideoTags(element))) return; if (m_webSettings->fullScreenVideoCapable()) { // The Browser chrome has its own fullscreen video widget. @@ -6219,10 +6212,6 @@ void WebPagePrivate::scheduleCompositingRun() void WebPage::setWebGLEnabled(bool enabled) { - if (!Platform::ITPolicy::isWebGLEnabled()) { - d->m_page->settings()->setWebGLEnabled(false); - return; - } d->m_page->settings()->setWebGLEnabled(enabled); } |
