Index: Source/web/WebViewImpl.cpp |
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp |
index f9ccfa3e67d41b14b973868bf617c559efcd19a3..bcf6106732449bd91f877e1ab60fd92170c6b057 100644 |
--- a/Source/web/WebViewImpl.cpp |
+++ b/Source/web/WebViewImpl.cpp |
@@ -1715,8 +1715,8 @@ void WebViewImpl::resize(const WebSize& newSize) |
FloatSize(viewportAnchorXCoord, viewportAnchorYCoord)); |
} |
- // Set the fixed layout size from the viewport constraints before resizing. |
- updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()->viewportDescription()); |
+ updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->viewportDescription()); |
+ updateMainFrameLayoutSize(); |
WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); |
if (agentPrivate) |
@@ -2924,34 +2924,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; |
@@ -3018,7 +2990,7 @@ void WebViewImpl::refreshPageScaleFactorAfterLayout() |
return; |
FrameView* view = page()->mainFrame()->view(); |
- updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()->viewportDescription()); |
+ updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->viewportDescription()); |
m_pageScaleConstraintsSet.computeFinalConstraints(); |
if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { |
@@ -3043,9 +3015,9 @@ void WebViewImpl::refreshPageScaleFactorAfterLayout() |
view->layout(); |
} |
-void WebViewImpl::updatePageDefinedPageScaleConstraints(const ViewportDescription& description) |
+void WebViewImpl::updatePageDefinedViewportConstraints(const ViewportDescription& description) |
{ |
- if (!settings()->viewportEnabled() || !isFixedLayoutModeEnabled() || !page() || !m_size.width || !m_size.height) |
+ if (!settings()->viewportEnabled() || !page() || !m_size.width || !m_size.height) |
return; |
ViewportDescription adjustedDescription = description; |
@@ -3058,13 +3030,28 @@ void WebViewImpl::updatePageDefinedPageScaleConstraints(const ViewportDescriptio |
m_pageScaleConstraintsSet.updatePageDefinedConstraints(adjustedDescription, m_size); |
m_pageScaleConstraintsSet.adjustForAndroidWebViewQuirks(adjustedDescription, m_size, page()->settings().layoutFallbackWidth(), deviceScaleFactor(), settingsImpl()->supportDeprecatedTargetDensityDPI(), page()->settings().wideViewportQuirkEnabled(), page()->settings().useWideViewport(), page()->settings().loadWithOverviewMode()); |
- WebSize layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstraints().layoutSize); |
+ updateMainFrameLayoutSize(); |
+} |
+ |
+void WebViewImpl::updateMainFrameLayoutSize() |
+{ |
+ if (m_fixedLayoutSizeLock || !mainFrameImpl()) |
+ return; |
- if (page()->settings().textAutosizingEnabled() && page()->mainFrame() && layoutSize.width != fixedLayoutSize().width) |
- page()->mainFrame()->document()->textAutosizer()->recalculateMultipliers(); |
+ FrameView* view = mainFrameImpl()->frameView(); |
+ if (!view) |
+ return; |
- if (page()->mainFrame() && page()->mainFrame()->view() && !m_fixedLayoutSizeLock) |
- page()->mainFrame()->view()->setFixedLayoutSize(layoutSize); |
+ WebSize layoutSize = m_size; |
+ |
+ if (settings()->viewportEnabled()) { |
+ layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstraints().layoutSize); |
+ |
+ if (page()->settings().textAutosizingEnabled() && layoutSize.width != view->layoutSize().width()) |
+ page()->mainFrame()->document()->textAutosizer()->recalculateMultipliers(); |
+ } |
+ |
+ view->setLayoutSize(layoutSize); |
} |
IntSize WebViewImpl::contentsSize() const |
@@ -3135,18 +3122,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()) |
@@ -3163,9 +3138,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, |
@@ -4192,7 +4167,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: |
@@ -4202,7 +4177,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); |
} |