Title: [143616] trunk
Revision
143616
Author
commit-qu...@webkit.org
Date
2013-02-21 09:31:34 -0800 (Thu, 21 Feb 2013)

Log Message

Need to re-layout fixed position elements after scale when using settings()->fixedElementsLayoutRelativeToFrame()
https://bugs.webkit.org/show_bug.cgi?id=105486

Patch by Tien-Ren Chen <trc...@chromium.org> on 2013-02-21
Reviewed by James Robinson.

In settings()->fixedElementsLayoutRelativeToFrame() mode, fixed-position
elements are layout relative to the current visible viewport, which can
be different from the layout viewport when using fixed-layout mode.
We need to re-layout fixed-position elements in case of visible content
size changes.

The test is currently chromium-specific due to difficulties to make this
test works on Mac. The mac port seems to work very differently with
visible content size when a page is scaled. And there is no reliable way
to hide scrollbars in mac-wk1 that doesn't cause a side effect.

Source/WebCore:

Test: platform/chromium/fast/repaint/relayout-fixed-position-after-scale.html

* page/FrameView.cpp:
(WebCore::FrameView::visibleContentsResized):
* page/FrameView.h:
(FrameView):
* page/Page.cpp:
(WebCore::Page::setPageScaleFactor):

LayoutTests:

* platform/chromium/fast/repaint/relayout-fixed-position-after-scale-expected.html: Added.
* platform/chromium/fast/repaint/relayout-fixed-position-after-scale.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (143615 => 143616)


--- trunk/LayoutTests/ChangeLog	2013-02-21 17:18:55 UTC (rev 143615)
+++ trunk/LayoutTests/ChangeLog	2013-02-21 17:31:34 UTC (rev 143616)
@@ -1,3 +1,24 @@
+2013-02-21  Tien-Ren Chen  <trc...@chromium.org>
+
+        Need to re-layout fixed position elements after scale when using settings()->fixedElementsLayoutRelativeToFrame()
+        https://bugs.webkit.org/show_bug.cgi?id=105486
+
+        Reviewed by James Robinson.
+
+        In settings()->fixedElementsLayoutRelativeToFrame() mode, fixed-position
+        elements are layout relative to the current visible viewport, which can
+        be different from the layout viewport when using fixed-layout mode.
+        We need to re-layout fixed-position elements in case of visible content
+        size changes.
+
+        The test is currently chromium-specific due to difficulties to make this
+        test works on Mac. The mac port seems to work very differently with
+        visible content size when a page is scaled. And there is no reliable way
+        to hide scrollbars in mac-wk1 that doesn't cause a side effect.
+
+        * platform/chromium/fast/repaint/relayout-fixed-position-after-scale-expected.html: Added.
+        * platform/chromium/fast/repaint/relayout-fixed-position-after-scale.html: Added.
+
 2013-02-21  Mihnea Ovidenie  <mih...@adobe.com>
 
         [CSS Regions]  border-radius on a region causes overflow to be hidden

Added: trunk/LayoutTests/platform/chromium/fast/repaint/relayout-fixed-position-after-scale-expected.html (0 => 143616)


--- trunk/LayoutTests/platform/chromium/fast/repaint/relayout-fixed-position-after-scale-expected.html	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/repaint/relayout-fixed-position-after-scale-expected.html	2013-02-21 17:31:34 UTC (rev 143616)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.fixed_size {
+    position:absolute;
+    background-color:#ccffcc;
+    width:25px;
+    height:25px;
+}
+.percentage_size {
+    position:absolute;
+    background-color:#ccccff;
+    width:10%;
+    height:10%;
+}
+</style>
+</head>
+<body style="width:800px;height:600px;margin:0;">
+<div class="fixed_size" style="left:5px;top:10px"></div>
+<div class="fixed_size" style="right:15px;top:20px"></div>
+<div class="fixed_size" style="left:25px;bottom:30px"></div>
+<div class="fixed_size" style="right:35px;bottom:40px"></div>
+<div class="percentage_size" style="left:40%;top:35%"></div>
+<div class="percentage_size" style="right:30%;top:25%"></div>
+<div class="percentage_size" style="left:20%;bottom:15%"></div>
+<div class="percentage_size" style="right:10%;bottom:5%"></div>
+</body>
+</html>

Added: trunk/LayoutTests/platform/chromium/fast/repaint/relayout-fixed-position-after-scale.html (0 => 143616)


--- trunk/LayoutTests/platform/chromium/fast/repaint/relayout-fixed-position-after-scale.html	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/repaint/relayout-fixed-position-after-scale.html	2013-02-21 17:31:34 UTC (rev 143616)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This test is successful if fixed position elements re-layout correctly on page scale changes</title>
+<style>
+.fixed_size {
+    position:fixed;
+    background-color:#ccffcc;
+    width:50px;
+    height:50px;
+}
+.percentage_size {
+    position:fixed;
+    background-color:#ccccff;
+    width:10%;
+    height:10%;
+}
+</style>
+</head>
+<body _onload_="runTest();" style="width:1600px;height:1200px;margin:0;">
+<div class="fixed_size" style="left:10px;top:20px"></div>
+<div class="fixed_size" style="right:30px;top:40px"></div>
+<div class="fixed_size" style="left:50px;bottom:60px"></div>
+<div class="fixed_size" style="right:70px;bottom:80px"></div>
+<div class="percentage_size" style="left:40%;top:35%"></div>
+<div class="percentage_size" style="right:30%;top:25%"></div>
+<div class="percentage_size" style="left:20%;bottom:15%"></div>
+<div class="percentage_size" style="right:10%;bottom:5%"></div>
+<script>
+function runTest() {
+    if (window.internals) {
+        window.internals.settings.setFixedElementsLayoutRelativeToFrame(true);
+
+        // Force scrollbar to hide and re-layout immediately.
+        window.internals.setPageScaleFactor(0.1, 0, 0);
+        document.body.offsetTop;
+
+        window.internals.setPageScaleFactor(0.5, 0, 0);
+    }
+}
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (143615 => 143616)


--- trunk/Source/WebCore/ChangeLog	2013-02-21 17:18:55 UTC (rev 143615)
+++ trunk/Source/WebCore/ChangeLog	2013-02-21 17:31:34 UTC (rev 143616)
@@ -1,3 +1,30 @@
+2013-02-21  Tien-Ren Chen  <trc...@chromium.org>
+
+        Need to re-layout fixed position elements after scale when using settings()->fixedElementsLayoutRelativeToFrame()
+        https://bugs.webkit.org/show_bug.cgi?id=105486
+
+        Reviewed by James Robinson.
+
+        In settings()->fixedElementsLayoutRelativeToFrame() mode, fixed-position
+        elements are layout relative to the current visible viewport, which can
+        be different from the layout viewport when using fixed-layout mode.
+        We need to re-layout fixed-position elements in case of visible content
+        size changes.
+
+        The test is currently chromium-specific due to difficulties to make this
+        test works on Mac. The mac port seems to work very differently with
+        visible content size when a page is scaled. And there is no reliable way
+        to hide scrollbars in mac-wk1 that doesn't cause a side effect.
+
+        Test: platform/chromium/fast/repaint/relayout-fixed-position-after-scale.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::visibleContentsResized):
+        * page/FrameView.h:
+        (FrameView):
+        * page/Page.cpp:
+        (WebCore::Page::setPageScaleFactor):
+
 2013-02-21  Xan Lopez  <xlo...@rim.com>
 
         [BlackBerry] LayerFilterRenderer: fix inclusion of Vector.h

Modified: trunk/Source/WebCore/page/FrameView.cpp (143615 => 143616)


--- trunk/Source/WebCore/page/FrameView.cpp	2013-02-21 17:18:55 UTC (rev 143615)
+++ trunk/Source/WebCore/page/FrameView.cpp	2013-02-21 17:31:34 UTC (rev 143616)
@@ -2049,6 +2049,8 @@
     if (!frame()->view())
         return;
 
+    setViewportConstrainedObjectsNeedLayout();
+
     if (!useFixedLayout() && needsLayout())
         layout();
 

Modified: trunk/Source/WebCore/page/FrameView.h (143615 => 143616)


--- trunk/Source/WebCore/page/FrameView.h	2013-02-21 17:18:55 UTC (rev 143615)
+++ trunk/Source/WebCore/page/FrameView.h	2013-02-21 17:31:34 UTC (rev 143616)
@@ -111,6 +111,7 @@
 
     bool needsLayout() const;
     void setNeedsLayout();
+    void setViewportConstrainedObjectsNeedLayout();
 
     bool needsFullRepaint() const { return m_doFullRepaint; }
 
@@ -485,8 +486,6 @@
 
     bool doLayoutWithFrameFlattening(bool allowSubtree);
 
-    void setViewportConstrainedObjectsNeedLayout();
-
     virtual AXObjectCache* axObjectCache() const;
     void notifyWidgetsInAllFrames(WidgetNotification);
     void removeFromAXObjectCache();

Modified: trunk/Source/WebCore/page/Page.cpp (143615 => 143616)


--- trunk/Source/WebCore/page/Page.cpp	2013-02-21 17:18:55 UTC (rev 143615)
+++ trunk/Source/WebCore/page/Page.cpp	2013-02-21 17:31:34 UTC (rev 143616)
@@ -748,6 +748,9 @@
     mainFrame()->deviceOrPageScaleFactorChanged();
 #endif
 
+    if (view)
+        view->setViewportConstrainedObjectsNeedLayout();
+
     if (view && view->scrollPosition() != origin) {
         if (!m_settings->applyPageScaleFactorInCompositor() && document->renderer() && document->renderer()->needsLayout() && view->didFirstLayout())
             view->layout();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to