Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1457)

Unified Diff: Source/web/WebViewImpl.cpp

Issue 23819019: Refactor fixed layout mode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/web/WebViewImpl.cpp
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index f386bf5e02d5a79d2bfe6bb60eaef6a213dcf79d..0020ac0700fa540fd795c3a7b7168e853501024e 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -1659,6 +1659,12 @@ void WebViewImpl::resize(const WebSize& newSize)
FloatSize(viewportAnchorXCoord, viewportAnchorYCoord));
}
+ // If we're on a desktop style platform, we want to keep the page's layout
+ // size fixed to the size of the WebViewImpl. Desktop-style is indicated
+ // by layoutFallbackWidth == 0
+ if (page() && !page()->settings().layoutFallbackWidth())
kenneth.r.christiansen 2013/09/05 07:54:24 With the move to using @viewport rules internally,
+ view->setLayoutSize(m_size);
+
// Set the fixed layout size from the viewport constraints before resizing.
updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()->viewportArguments());
@@ -2868,18 +2874,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())
@@ -2889,7 +2883,7 @@ void WebViewImpl::enableFixedLayoutMode(bool enable)
if (!frame || !frame->view())
return;
- frame->view()->setUseFixedLayout(enable);
+ page()->settings().setLayoutFallbackWidth(enable ? 980 : 0);
kenneth.r.christiansen 2013/09/05 08:03:07 Hmm... I hope noone are overriding it then. This i
bokan 2013/09/05 20:03:36 Yes, this is a hack to keep the tests working. I'l
if (m_isAcceleratedCompositingActive)
updateLayerTreeViewport();
@@ -2989,7 +2983,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;
ViewportArguments adjustedArguments = arguments;
@@ -3002,10 +2996,10 @@ 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();
- setFixedLayoutSize(layoutSize);
+ setLayoutSize(layoutSize);
}
IntSize WebViewImpl::contentsSize() const
@@ -3076,19 +3070,12 @@ void WebViewImpl::resetScrollAndScaleState()
resetSavedScrollAndScaleState();
}
-WebSize WebViewImpl::fixedLayoutSize() const
+void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize)
{
- if (!page())
- return WebSize();
-
- Frame* frame = page()->mainFrame();
- if (!frame || !frame->view())
- return WebSize();
-
- return frame->view()->fixedLayoutSize();
+ setLayoutSize(layoutSize);
}
-void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize)
+void WebViewImpl::setLayoutSize(const WebSize& layoutSize)
{
if (!page())
return;
@@ -3097,7 +3084,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,

Powered by Google App Engine
This is Rietveld 408576698