Title: [140869] trunk/Source
Revision
140869
Author
ael...@chromium.org
Date
2013-01-25 15:02:26 -0800 (Fri, 25 Jan 2013)

Log Message

Call FrameView::contentsResized() when setting fixed layout size
https://bugs.webkit.org/show_bug.cgi?id=107922

Reviewed by James Robinson.

In fixed layout mode, we should be calling contentsResized() when the
fixed layout size is changed; on the other hand, we don't need to layout
when the visible contents size changes.

This fixes test WebFrameTest::FixedLayoutInitializeAtMinimumPageScale.

Source/WebCore:

* page/FrameView.cpp:
(WebCore::FrameView::visibleContentsResized):
* platform/ScrollView.cpp:
(WebCore::ScrollView::setFixedLayoutSize):
(WebCore::ScrollView::setUseFixedLayout):

Source/WebKit/chromium:

* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::resize):
(WebKit::WebViewImpl::computePageScaleFactorLimits):
* tests/WebFrameTest.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (140868 => 140869)


--- trunk/Source/WebCore/ChangeLog	2013-01-25 22:45:33 UTC (rev 140868)
+++ trunk/Source/WebCore/ChangeLog	2013-01-25 23:02:26 UTC (rev 140869)
@@ -1,3 +1,22 @@
+2013-01-25  Alexandre Elias  <ael...@chromium.org>
+
+        Call FrameView::contentsResized() when setting fixed layout size
+        https://bugs.webkit.org/show_bug.cgi?id=107922
+
+        Reviewed by James Robinson.
+
+        In fixed layout mode, we should be calling contentsResized() when the
+        fixed layout size is changed; on the other hand, we don't need to layout
+        when the visible contents size changes.
+
+        This fixes test WebFrameTest::FixedLayoutInitializeAtMinimumPageScale.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::visibleContentsResized):
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::setFixedLayoutSize):
+        (WebCore::ScrollView::setUseFixedLayout):
+
 2013-01-25  Tony Gentilcore  <to...@chromium.org>
 
         Fix an ASSERT in BackgroundHTMLParser::appendPartial

Modified: trunk/Source/WebCore/page/FrameView.cpp (140868 => 140869)


--- trunk/Source/WebCore/page/FrameView.cpp	2013-01-25 22:45:33 UTC (rev 140868)
+++ trunk/Source/WebCore/page/FrameView.cpp	2013-01-25 23:02:26 UTC (rev 140869)
@@ -2022,7 +2022,7 @@
     if (!frame()->view())
         return;
 
-    if (needsLayout())
+    if (!useFixedLayout() && needsLayout())
         layout();
 
 #if USE(ACCELERATED_COMPOSITING)

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (140868 => 140869)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2013-01-25 22:45:33 UTC (rev 140868)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2013-01-25 23:02:26 UTC (rev 140869)
@@ -277,6 +277,8 @@
         return;
     m_fixedLayoutSize = newSize;
     updateScrollbars(scrollOffset());
+    if (m_useFixedLayout)
+        contentsResized();
 }
 
 bool ScrollView::useFixedLayout() const
@@ -290,6 +292,7 @@
         return;
     m_useFixedLayout = enable;
     updateScrollbars(scrollOffset());
+    contentsResized();
 }
 
 IntSize ScrollView::contentsSize() const

Modified: trunk/Source/WebKit/chromium/ChangeLog (140868 => 140869)


--- trunk/Source/WebKit/chromium/ChangeLog	2013-01-25 22:45:33 UTC (rev 140868)
+++ trunk/Source/WebKit/chromium/ChangeLog	2013-01-25 23:02:26 UTC (rev 140869)
@@ -1,3 +1,21 @@
+2013-01-25  Alexandre Elias  <ael...@chromium.org>
+
+        Call FrameView::contentsResized() when setting fixed layout size
+        https://bugs.webkit.org/show_bug.cgi?id=107922
+
+        Reviewed by James Robinson.
+
+        In fixed layout mode, we should be calling contentsResized() when the
+        fixed layout size is changed; on the other hand, we don't need to layout
+        when the visible contents size changes.
+
+        This fixes test WebFrameTest::FixedLayoutInitializeAtMinimumPageScale.
+
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::resize):
+        (WebKit::WebViewImpl::computePageScaleFactorLimits):
+        * tests/WebFrameTest.cpp:
+
 2013-01-25  Alec Flett  <alecfl...@chromium.org>
 
         IndexedDB: Move TaskType enum to IDBDatabaseBackendInterface

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (140868 => 140869)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2013-01-25 22:45:33 UTC (rev 140868)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2013-01-25 23:02:26 UTC (rev 140869)
@@ -1651,11 +1651,6 @@
 
 #if ENABLE(VIEWPORT)
     if (settings()->viewportEnabled()) {
-        if (!settingsImpl()->applyPageScaleFactorInCompositor()) {
-            // Relayout immediately to obtain the new content width, which is needed
-            // to calculate the minimum scale limit.
-            view->layout();
-        }
         computePageScaleFactorLimits();
 
         // When the device rotates:
@@ -3088,6 +3083,10 @@
 
     FrameView* view = page()->mainFrame()->view();
 
+    // Layout to refresh to the latest contents width.
+    if (view->needsLayout())
+        view->layout();
+
     m_minimumPageScaleFactor = min(max(m_pageDefinedMinimumPageScaleFactor, minPageScaleFactor), maxPageScaleFactor);
     m_maximumPageScaleFactor = max(min(m_pageDefinedMaximumPageScaleFactor, maxPageScaleFactor), minPageScaleFactor);
     if (!m_webSettings->applyDeviceScaleFactorInCompositor()) {

Modified: trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp (140868 => 140869)


--- trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp	2013-01-25 22:45:33 UTC (rev 140868)
+++ trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp	2013-01-25 23:02:26 UTC (rev 140869)
@@ -238,6 +238,8 @@
 
     WebView* webView = static_cast<WebView*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_viewport_tag.html", true, 0, &client));
 
+    webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    webView->settings()->setApplyPageScaleFactorInCompositor(true);
     webView->settings()->setViewportEnabled(true);
     webView->enableFixedLayoutMode(true);
     webView->resize(WebSize(viewportWidth, viewportHeight));
@@ -245,17 +247,15 @@
 
     EXPECT_EQ(2, webView->deviceScaleFactor());
 
-    // Device scale factor should be a component of page scale factor in fixed-layout, so a scale of 1 becomes 2.
+    // Page scale factor should not be affected by device scale factor.
     webView->setPageScaleFactorLimits(1, 2);
-    EXPECT_EQ(2, webView->pageScaleFactor());
+    EXPECT_EQ(1, webView->pageScaleFactor());
 
     // Force the layout to happen before leaving the test.
     webView->mainFrame()->contentAsText(1024).utf8();
 }
 
-// Test is disabled because it started failing after r140025.
-// See bug for details: webkit.org/b/107206.
-TEST_F(WebFrameTest, DISABLED_FixedLayoutInitializeAtMinimumPageScale)
+TEST_F(WebFrameTest, FixedLayoutInitializeAtMinimumPageScale)
 {
     registerMockedHttpURLLoad("fixed_layout.html");
 
@@ -267,6 +267,8 @@
     // Make sure we initialize to minimum scale, even if the window size
     // only becomes available after the load begins.
     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));
+    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
     webViewImpl->enableFixedLayoutMode(true);
     webViewImpl->settings()->setViewportEnabled(true);
     webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to