Chromium Code Reviews| Index: Source/web/WebViewImpl.cpp |
| diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp |
| index b809f05932b0600c34a375563b90e8478061b572..87c0dea77655767be120c65147ab8ef68cbf4771 100644 |
| --- a/Source/web/WebViewImpl.cpp |
| +++ b/Source/web/WebViewImpl.cpp |
| @@ -1597,14 +1597,18 @@ void WebViewImpl::resize(const WebSize& newSize) |
| m_size = newSize; |
| - bool shouldAnchorAndRescaleViewport = settings()->viewportEnabled() && oldSize.width && oldContentsWidth; |
| + // On devices where resizes come from screen rotation, we want to anchor the scroll |
| + // when we resize |
| + bool shouldAnchorAndRescaleViewport = settings()->viewportEnabled() |
| + && settings()->anchorScrollPositionOnResize() && oldSize.width && oldContentsWidth; |
| + |
| ViewportAnchor viewportAnchor(mainFrameImpl()->frame()->eventHandler()); |
| if (shouldAnchorAndRescaleViewport) { |
| viewportAnchor.setAnchor(view->visibleContentRect(), |
| FloatSize(viewportAnchorXCoord, viewportAnchorYCoord)); |
| } |
| - // Set the fixed layout size from the viewport constraints before resizing. |
| + // Set the layout size from the viewport constraints before resizing. |
| updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()->viewportArguments()); |
| WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); |
| @@ -2922,34 +2926,6 @@ void WebViewImpl::setDeviceScaleFactor(float scaleFactor) |
| m_layerTreeView->setDeviceScaleFactor(scaleFactor); |
| } |
| -bool WebViewImpl::isFixedLayoutModeEnabled() const |
| -{ |
| - if (!page()) |
| - return false; |
| - |
| - Frame* frame = page()->mainFrame(); |
| - if (!frame || !frame->view()) |
| - return false; |
| - |
| - return frame->view()->useFixedLayout(); |
| -} |
| - |
| -void WebViewImpl::enableFixedLayoutMode(bool enable) |
| -{ |
| - if (!page()) |
| - return; |
| - |
| - Frame* frame = page()->mainFrame(); |
| - if (!frame || !frame->view()) |
| - return; |
| - |
| - frame->view()->setUseFixedLayout(enable); |
| - |
| - if (m_isAcceleratedCompositingActive) |
| - updateLayerTreeViewport(); |
| -} |
| - |
| - |
| void WebViewImpl::enableAutoResizeMode(const WebSize& minSize, const WebSize& maxSize) |
| { |
| m_shouldAutoResize = true; |
| @@ -3033,6 +3009,11 @@ void WebViewImpl::refreshPageScaleFactorAfterLayout() |
| } |
| setPageScaleFactorPreservingScrollOffset(newPageScaleFactor); |
| + // Destroying the frameView turns off forced compositing mode, in the case or a refresh it wont get turned |
| + // back on because we don't set a new page scale so we make sure it's on here |
| + if (pageScaleFactor() && pageScaleFactor() != 1) |
| + enterForceCompositingMode(true); |
|
aelias_OOO_until_Jul13
2013/07/31 22:31:21
This doesn't feel like the right place to put this
|
| + |
| updateLayerTreeViewport(); |
| // Relayout immediately to avoid violating the rule that needsLayout() |
| @@ -3043,7 +3024,7 @@ void WebViewImpl::refreshPageScaleFactorAfterLayout() |
| void WebViewImpl::updatePageDefinedPageScaleConstraints(const ViewportArguments& arguments) |
| { |
| - if (!settings()->viewportEnabled() || !isFixedLayoutModeEnabled() || !page() || !m_size.width || !m_size.height) |
| + if (!settings()->viewportEnabled() || !page() || !m_size.width || !m_size.height) |
| return; |
| m_pageScaleConstraintsSet.updatePageDefinedConstraints(arguments, m_size, page()->settings()->layoutFallbackWidth()); |
| @@ -3051,13 +3032,15 @@ void WebViewImpl::updatePageDefinedPageScaleConstraints(const ViewportArguments& |
| if (settingsImpl()->supportDeprecatedTargetDensityDPI()) |
| m_pageScaleConstraintsSet.adjustPageDefinedConstraintsForAndroidWebView(arguments, m_size, page()->settings()->layoutFallbackWidth(), deviceScaleFactor(), page()->settings()->useWideViewport(), page()->settings()->loadWithOverviewMode()); |
| - WebSize layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstraints().layoutSize); |
| + if (!m_pageScaleConstraintsSet.pageDefinedConstraints().layoutSize.isEmpty()) { |
| + WebSize layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstraints().layoutSize); |
| - if (page()->settings() && page()->settings()->textAutosizingEnabled() && page()->mainFrame() |
| - && layoutSize.width != fixedLayoutSize().width) |
| - page()->mainFrame()->document()->textAutosizer()->recalculateMultipliers(); |
| + if (page()->settings() && page()->settings()->textAutosizingEnabled() && page()->mainFrame() |
| + && layoutSize.width != fixedLayoutSize().width) |
| + page()->mainFrame()->document()->textAutosizer()->recalculateMultipliers(); |
| - setFixedLayoutSize(layoutSize); |
| + setFixedLayoutSize(layoutSize); |
| + } |
| } |
| IntSize WebViewImpl::contentsSize() const |
| @@ -3137,7 +3120,7 @@ WebSize WebViewImpl::fixedLayoutSize() const |
| if (!frame || !frame->view()) |
| return WebSize(); |
| - return frame->view()->fixedLayoutSize(); |
| + return frame->view()->layoutSize(); |
| } |
| void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize) |
| @@ -3149,7 +3132,7 @@ void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize) |
| if (!frame || !frame->view()) |
| return; |
| - frame->view()->setFixedLayoutSize(layoutSize); |
| + frame->view()->setLayoutSize(layoutSize); |
| } |
| void WebViewImpl::performMediaPlayerAction(const WebMediaPlayerAction& action, |
| @@ -4156,4 +4139,12 @@ bool WebViewImpl::shouldDisableDesktopWorkarounds() |
| || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != ViewportArguments::ValueAuto); |
| } |
| +bool WebViewImpl::useDesktopStyleLayoutResizing() |
| +{ |
| + if (!page()) |
| + return true; |
| + |
| + return !page()->settings()->layoutFallbackWidth(); |
| +} |
| + |
| } // namespace WebKit |