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

Unified Diff: Source/WebKit/chromium/src/WebViewImpl.cpp

Issue 15927026: Enabled using viewport on desktop browsers behind experimental flag (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review Fixes 2 Created 7 years, 6 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/WebKit/chromium/src/WebViewImpl.cpp
diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp
index efd4b60e51d1e245c80d2aa75e669379b6862ab9..653ff819c76f67d9dd6faf9d1ca655e3bcdaa708 100644
--- a/Source/WebKit/chromium/src/WebViewImpl.cpp
+++ b/Source/WebKit/chromium/src/WebViewImpl.cpp
@@ -1605,7 +1605,11 @@ void WebViewImpl::resize(const WebSize& newSize)
m_size = newSize;
- bool shouldAnchorAndRescaleViewport = settings()->viewportEnabled() && oldSize.width && oldContentsWidth;
+ // On devices like phones where a resize comes from screen rotation, we want to
+ // adjust the viewport size so that we don't cause a relayout
aelias_OOO_until_Jul13 2013/06/18 01:24:18 This comment doesn't accurately describe what this
+ bool shouldAnchorAndRescaleViewport = settings()->viewportEnabled()
+ && settings()->resizeAffectsLayoutWidth() && oldSize.width && oldContentsWidth;
+
ViewportAnchor viewportAnchor(mainFrameImpl()->frame()->eventHandler());
if (shouldAnchorAndRescaleViewport) {
viewportAnchor.setAnchor(view->visibleContentRect(),
@@ -3019,7 +3023,12 @@ void WebViewImpl::updatePageDefinedPageScaleConstraints(const ViewportArguments&
&& layoutSize.width != fixedLayoutSize().width)
page()->mainFrame()->document()->textAutosizer()->recalculateMultipliers();
- setFixedLayoutSize(layoutSize);
+ // If layoutFallbackWidthIsWindowWidth is set and there's no viewport width set, set the layout size to the window size
+ if (settings()->layoutFallbackWidthIsWindowWidth() && arguments.width == ViewportArguments::ValueAuto)
+ setFixedLayoutSize(m_size);
+ else
+ setFixedLayoutSize(layoutSize);
+
}
IntSize WebViewImpl::contentsSize() const
@@ -3607,7 +3616,10 @@ void WebViewImpl::didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPa
m_newNavigationLoader = 0;
#endif
m_observedNewNavigation = false;
- if (*isNewNavigation && !isNavigationWithinPage)
+
+ // FIXME: Always need reset when layoutFallbackWidthIsWindowWidth is set
+ // this is a hack to fix some page scaling issues when reloading a page. Why is this needed?
aelias_OOO_until_Jul13 2013/06/18 01:24:18 Instead of doing this, try calling setInitialPageS
aelias_OOO_until_Jul13 2013/06/18 01:30:19 On second thought, that probably won't work. I do
+ if ((*isNewNavigation && !isNavigationWithinPage) || settings()->layoutFallbackWidthIsWindowWidth())
m_pageScaleConstraintsSet.setNeedsReset(true);
// Make sure link highlight from previous page is cleared.

Powered by Google App Engine
This is Rietveld 408576698