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

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: Created 7 years, 7 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 2118aa9fbdebd914d0f525f53ae9fe752fa16b48..d84a1250c47795f2af9771ebaca04db86ac6ca10 100644
--- a/Source/WebKit/chromium/src/WebViewImpl.cpp
+++ b/Source/WebKit/chromium/src/WebViewImpl.cpp
@@ -1599,7 +1599,9 @@ void WebViewImpl::resize(const WebSize& newSize)
m_size = newSize;
- bool shouldAnchorAndRescaleViewport = settings()->viewportEnabled() && oldSize.width && oldContentsWidth;
+ bool shouldAnchorAndRescaleViewport = settings()->viewportEnabled()
+ && settings()->deviceSupportsRotation() && oldSize.width && oldContentsWidth;
Rick Byers 2013/06/04 00:25:30 Note that ChromeOS does support rotation (Ctrl-Shi
bokan 2013/06/04 18:52:16 Ah, resizableWindow makes more sense then - I'll c
Rick Byers 2013/06/05 15:04:08 Right.
+
ViewportAnchor viewportAnchor(mainFrameImpl()->frame()->eventHandler());
if (shouldAnchorAndRescaleViewport) {
viewportAnchor.setAnchor(view->visibleContentRect(),
@@ -1609,6 +1611,9 @@ void WebViewImpl::resize(const WebSize& newSize)
// Set the fixed layout size from the viewport constraints before resizing.
updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()->viewportArguments());
+ if (settings()->desktopViewportEnabled() && mainFrameImpl()->frame()->document()->viewportArguments().width == ViewportArguments::ValueAuto)
+ setFixedLayoutSize(newSize);
Rick Byers 2013/06/04 00:25:30 Shouldn't we also be updating the size on resize u
Rick Byers 2013/06/04 00:25:30 Shouldn't we also do this in the ValueDeviceWidth
bokan 2013/06/04 18:52:16 That happens in the method call above, along with
bokan 2013/06/04 18:52:16 Agreed, and I originally had everything behind vie
Rick Byers 2013/06/05 15:04:08 I think this logic belongs inside of updatePageDef
Rick Byers 2013/06/05 15:04:08 You should be able to build content shell easily e
bokan 2013/06/06 19:43:47 Done.
+
WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate();
if (agentPrivate)
agentPrivate->webViewResized(newSize);
@@ -3002,7 +3007,7 @@ void WebViewImpl::updatePageDefinedPageScaleConstraints(const ViewportArguments&
if (!settings()->viewportEnabled() || !isFixedLayoutModeEnabled() || !page() || !m_size.width || !m_size.height)
return;
- m_pageScaleConstraintsSet.updatePageDefinedConstraints(arguments, m_size, page()->settings()->layoutFallbackWidth());
+ m_pageScaleConstraintsSet.updatePageDefinedConstraints(arguments, m_size, settings()->desktopViewportEnabled() ? 0 : page()->settings()->layoutFallbackWidth());
Rick Byers 2013/06/04 00:25:30 Rather than change the code here, can't we change
bokan 2013/06/04 18:52:16 Actually, I already set fallback width to 0 if the
if (settingsImpl()->supportDeprecatedTargetDensityDPI())
m_pageScaleConstraintsSet.adjustPageDefinedConstraintsForAndroidWebView(arguments, m_size, page()->settings()->layoutFallbackWidth(), deviceScaleFactor(), page()->settings()->useWideViewport(), page()->settings()->loadWithOverviewMode());
@@ -3589,7 +3594,7 @@ void WebViewImpl::didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPa
m_newNavigationLoader = 0;
#endif
m_observedNewNavigation = false;
- if (*isNewNavigation && !isNavigationWithinPage)
+ if ((*isNewNavigation && !isNavigationWithinPage) || settings()->desktopViewportEnabled())
Rick Byers 2013/06/04 00:25:30 Why is this different for android/desktop?
bokan 2013/06/04 18:52:16 So I'm not sure why, but sometimes when I'd reload
Rick Byers 2013/06/05 15:04:08 Ok. I'm OK with a temporary hack (eg. relying on
m_pageScaleConstraintsSet.setNeedsReset(true);
// Make sure link highlight from previous page is cleared.
« Source/WebKit/chromium/public/WebSettings.h ('K') | « Source/WebKit/chromium/src/WebSettingsImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698