Changeset 118121 in webkit
- Timestamp:
- May 22, 2012 10:03:16 PM (12 years ago)
- Location:
- trunk/Source/WebKit/chromium
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/chromium/ChangeLog
r118117 r118121 1 2012-05-22 Alexandre Elias <aelias@google.com> 2 3 [chromium] Apply viewport tag initial-scale only once 4 https://bugs.webkit.org/show_bug.cgi?id=82949 5 6 Reviewed by Adam Barth. 7 8 First, check that isPageScaleFactorSet return false before setting 9 initial-scale. We need to call dispatchViewportPropertiesDidChange() 10 when the viewport width changes, since that's an input to the viewport 11 tag calculation. When this happens, we shouldn't pop back to initial 12 scale. 13 14 Second, check that isNewNavigation is true when deciding to clear 15 isPageScaleFactorIsSet in didCommitLoad. We only want to clear it on 16 the very first commit, otherwise we'll pop back to initial scale if 17 the user zooms in before the load is complete. 18 19 New test WebFrameTest::FixedLayoutInitializeAtMinimumPageScale. 20 21 * src/ChromeClientImpl.cpp: 22 (WebKit::ChromeClientImpl::dispatchViewportPropertiesDidChange): 23 * src/WebViewImpl.cpp: 24 (WebKit::WebViewImpl::didCommitLoad): 25 1 26 2012-05-21 Shawn Singh <shawnsingh@chromium.org> 2 27 -
trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp
r117170 r118121 666 666 m_webView->setFixedLayoutSize(IntSize(layoutWidth, layoutHeight)); 667 667 668 // FIXME: Investigate the impact this has on layout/rendering if any. 669 // This exposes the correct device scale to javascript and media queries. 668 bool needInitializePageScale = !m_webView->isPageScaleFactorSet(); 670 669 if (useDefaultDeviceScaleFactor && settings->defaultDeviceScaleFactor()) 671 670 m_webView->setDeviceScaleFactor(settings->defaultDeviceScaleFactor()); … … 673 672 m_webView->setDeviceScaleFactor(computed.devicePixelRatio); 674 673 m_webView->setPageScaleFactorLimits(computed.minimumScale, computed.maximumScale); 675 m_webView->setPageScaleFactorPreservingScrollOffset(computed.initialScale * computed.devicePixelRatio); 674 if (needInitializePageScale) 675 m_webView->setPageScaleFactorPreservingScrollOffset(computed.initialScale * computed.devicePixelRatio); 676 676 #endif 677 677 } -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r117915 r118121 3103 3103 #endif 3104 3104 m_observedNewNavigation = false; 3105 if ( !isNavigationWithinPage)3105 if (*isNewNavigation && !isNavigationWithinPage) 3106 3106 m_pageScaleFactorIsSet = false; 3107 3107 -
trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp
r117535 r118121 35 35 #include "Frame.h" 36 36 #include "FrameTestHelpers.h" 37 #include "FrameView.h" 37 38 #include "ResourceError.h" 38 39 #include "WebDocument.h" … … 40 41 #include "WebFormElement.h" 41 42 #include "WebFrameClient.h" 43 #include "WebFrameImpl.h" 42 44 #include "WebRange.h" 43 45 #include "WebScriptSource.h" … … 243 245 // Force the layout to happen before leaving the test. 244 246 webView->mainFrame()->contentAsText(1024).utf8(); 247 } 248 249 TEST_F(WebFrameTest, FixedLayoutInitializeAtMinimumPageScale) 250 { 251 registerMockedHttpURLLoad("fixed_layout.html"); 252 253 FixedLayoutTestWebViewClient client; 254 client.m_screenInfo.horizontalDPI = 160; 255 int viewportWidth = 640; 256 int viewportHeight = 480; 257 client.m_windowRect = WebRect(0, 0, viewportWidth, viewportHeight); 258 259 // Make sure we initialize to minimum scale, even if the window size 260 // only becomes available after the load begins. 261 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client)); 262 webViewImpl->enableFixedLayoutMode(true); 263 webViewImpl->settings()->setViewportEnabled(true); 264 webViewImpl->resize(WebSize(viewportWidth, viewportHeight)); 265 266 int defaultFixedLayoutWidth = 980; 267 float minimumPageScaleFactor = viewportWidth / (float) defaultFixedLayoutWidth; 268 EXPECT_EQ(minimumPageScaleFactor, webViewImpl->pageScaleFactor()); 269 270 // Assume the user has pinch zoomed to page scale factor 2. 271 float userPinchPageScaleFactor = 2; 272 webViewImpl->setPageScaleFactorPreservingScrollOffset(userPinchPageScaleFactor); 273 webViewImpl->mainFrameImpl()->frameView()->layout(); 274 275 // Make sure we don't reset to initial scale if the page continues to load. 276 bool isNewNavigation; 277 webViewImpl->didCommitLoad(&isNewNavigation, false); 278 webViewImpl->didChangeContentsSize(); 279 EXPECT_EQ(userPinchPageScaleFactor, webViewImpl->pageScaleFactor()); 280 281 // Make sure we don't reset to initial scale if the viewport size changes. 282 webViewImpl->resize(WebSize(viewportWidth, viewportHeight + 100)); 283 EXPECT_EQ(userPinchPageScaleFactor, webViewImpl->pageScaleFactor()); 245 284 } 246 285 #endif
Note: See TracChangeset
for help on using the changeset viewer.