Chromium Code Reviews| Index: Source/web/WebViewImpl.cpp |
| diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp |
| index 97a2357b74e8a865e02a2ad8f9d77c9d03a4c906..ab9022896a7e8139393e13d2c840999d1ec34907 100644 |
| --- a/Source/web/WebViewImpl.cpp |
| +++ b/Source/web/WebViewImpl.cpp |
| @@ -1718,8 +1718,7 @@ void WebViewImpl::resize(const WebSize& newSize) |
| FloatSize(viewportAnchorXCoord, viewportAnchorYCoord)); |
| } |
| - // Set the fixed layout size from the viewport constraints before resizing. |
| - updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()->viewportArguments()); |
| + updateMainFrameLayoutSize(); |
|
aelias_OOO_until_Jul13
2013/10/01 05:09:30
Please call:
updatePageDefinedViewportConstraints
bokan
2013/10/02 17:44:01
Done.
|
| WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); |
| if (agentPrivate) |
| @@ -2927,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; |
| @@ -3021,7 +2992,7 @@ void WebViewImpl::refreshPageScaleFactorAfterLayout() |
| return; |
| FrameView* view = page()->mainFrame()->view(); |
| - updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()->viewportArguments()); |
| + updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->viewportArguments()); |
| m_pageScaleConstraintsSet.computeFinalConstraints(); |
| if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { |
| @@ -3046,9 +3017,9 @@ void WebViewImpl::refreshPageScaleFactorAfterLayout() |
| view->layout(); |
| } |
| -void WebViewImpl::updatePageDefinedPageScaleConstraints(const ViewportArguments& arguments) |
| +void WebViewImpl::updatePageDefinedViewportConstraints(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; |
| ViewportArguments adjustedArguments = arguments; |
| @@ -3063,11 +3034,23 @@ void WebViewImpl::updatePageDefinedPageScaleConstraints(const ViewportArguments& |
| WebSize layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstraints().layoutSize); |
| - if (page()->settings().textAutosizingEnabled() && page()->mainFrame() && layoutSize.width != fixedLayoutSize().width) |
| + if (page()->settings().textAutosizingEnabled() && page()->mainFrame() && layoutSize.width != page()->mainFrame()->view()->layoutSize().width()) |
| page()->mainFrame()->document()->textAutosizer()->recalculateMultipliers(); |
|
aelias_OOO_until_Jul13
2013/10/01 05:09:30
Please move this line into updateMainFrameLayoutSi
bokan
2013/10/02 17:44:01
Done.
|
| if (page()->mainFrame() && page()->mainFrame()->view() && !m_fixedLayoutSizeLock) |
| - page()->mainFrame()->view()->setFixedLayoutSize(layoutSize); |
| + page()->mainFrame()->view()->setLayoutSize(layoutSize); |
|
aelias_OOO_until_Jul13
2013/10/01 05:09:30
Just call updateMainFrameLayoutSize from here inst
bokan
2013/10/02 17:44:01
Done.
|
| +} |
| + |
| +void WebViewImpl::updateMainFrameLayoutSize() |
| +{ |
| + FrameView* view = mainFrameImpl()->frameView(); |
| + if (!view) |
| + return; |
| + |
| + if (!settings()->viewportEnabled() && !m_fixedLayoutSizeLock) |
| + view->setLayoutSize(m_size); |
| + else |
| + updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->viewportArguments()); |
|
aelias_OOO_until_Jul13
2013/10/01 05:09:30
I don't like going into complex viewport tag proce
bokan
2013/10/02 17:44:01
Done.
|
| } |
| IntSize WebViewImpl::contentsSize() const |
| @@ -3138,18 +3121,6 @@ void WebViewImpl::resetScrollAndScaleState() |
| resetSavedScrollAndScaleState(); |
| } |
| -WebSize WebViewImpl::fixedLayoutSize() const |
| -{ |
| - if (!page()) |
| - return WebSize(); |
| - |
| - Frame* frame = page()->mainFrame(); |
| - if (!frame || !frame->view()) |
| - return WebSize(); |
| - |
| - return frame->view()->fixedLayoutSize(); |
| -} |
| - |
| void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize) |
| { |
| if (!page()) |
| @@ -3166,9 +3137,9 @@ void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize) |
| m_fixedLayoutSizeLock = layoutSize.width || layoutSize.height; |
| if (m_fixedLayoutSizeLock) |
| - view->setFixedLayoutSize(layoutSize); |
| + view->setLayoutSize(layoutSize); |
| else |
| - view->setFixedLayoutSize(flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstraints().layoutSize)); |
| + updateMainFrameLayoutSize(); |
| } |
| void WebViewImpl::performMediaPlayerAction(const WebMediaPlayerAction& action, |
| @@ -4188,7 +4159,7 @@ void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event) |
| bool WebViewImpl::shouldDisableDesktopWorkarounds() |
| { |
| - if (!settings()->viewportEnabled() || !isFixedLayoutModeEnabled()) |
| + if (!settings()->viewportEnabled()) |
| return false; |
| // A document is considered adapted to small screen UAs if one of these holds: |
| @@ -4198,7 +4169,10 @@ bool WebViewImpl::shouldDisableDesktopWorkarounds() |
| const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefinedConstraints(); |
| - return fixedLayoutSize().width == m_size.width |
| + if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| + return false; |
| + |
| + return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| || (constraints.minimumScale == constraints.maximumScale && constraints.minimumScale != -1); |
| } |