Title: [195445] trunk
Revision
195445
Author
simon.fra...@apple.com
Date
2016-01-21 22:45:05 -0800 (Thu, 21 Jan 2016)

Log Message

REGRESSION (r168244): Content in horizontal-bt page is offset such that only the end is viewable and there is a white gap at the top
https://bugs.webkit.org/show_bug.cgi?id=136019

Reviewed by Dan Bernstein.

Source/WebCore:

In horizontal-bt documents (where the page starts scrolled to the bottom, and scrolling up goes into negative scroll positions),
the position of the root content layer would be set incorrectly by the scrolling thread, resulting in misplaced
content.

Fix by having the renamed "yPositionForRootContentLayer" take scroll origin into
account, and being more consistent about using scrollOrigin to position this layer.

Test: fast/scrolling/programmatic-horizontal-bt-document-scroll.html

* page/FrameView.cpp:
(WebCore::FrameView::yPositionForFooterLayer): Moved
(WebCore::FrameView::positionForRootContentLayer): Take scrollOrigin, and subtract it from the computed value.
(WebCore::FrameView::yPositionForRootContentLayer): Renamed.
* page/FrameView.h:
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): We've already pushed the new scrollPosition onto the FrameView,
so we can just use the member function to compute the positionForContentsLayer.
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition): This is the bug fix; FrameView::positionForRootContentLayer()
now takes scrollOrigin into account.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateRootLayerPosition): Rather than using the documentRect, position the root content layer
in terms of the scroll origin (which is -documentRect.location()).

Source/WebKit2:

Now call frameView.positionForRootContentLayer(), and add a FIXME questioning the
behavior in horizontal b-t documents. However, this code isn't hit now that we always
do extended backgrounds, so never have shadow layers.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::shadowLayerPositionForFrame):

LayoutTests:

Test that scrolls a horizontal-bt document.

* fast/scrolling/programmatic-horizontal-bt-document-scroll-expected.html: Added.
* fast/scrolling/programmatic-horizontal-bt-document-scroll.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (195444 => 195445)


--- trunk/LayoutTests/ChangeLog	2016-01-22 06:44:52 UTC (rev 195444)
+++ trunk/LayoutTests/ChangeLog	2016-01-22 06:45:05 UTC (rev 195445)
@@ -1,3 +1,15 @@
+2016-01-21  Simon Fraser  <simon.fra...@apple.com>
+
+        REGRESSION (r168244): Content in horizontal-bt page is offset such that only the end is viewable and there is a white gap at the top
+        https://bugs.webkit.org/show_bug.cgi?id=136019
+
+        Reviewed by Dan Bernstein.
+
+        Test that scrolls a horizontal-bt document.
+
+        * fast/scrolling/programmatic-horizontal-bt-document-scroll-expected.html: Added.
+        * fast/scrolling/programmatic-horizontal-bt-document-scroll.html: Added.
+
 2016-01-21  Brady Eidson  <beid...@apple.com>
 
         Modern IDB: Support populating/extracting database metadata with SQLite backend.

Added: trunk/LayoutTests/fast/scrolling/programmatic-horizontal-bt-document-scroll-expected.html (0 => 195445)


--- trunk/LayoutTests/fast/scrolling/programmatic-horizontal-bt-document-scroll-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/programmatic-horizontal-bt-document-scroll-expected.html	2016-01-22 06:45:05 UTC (rev 195445)
@@ -0,0 +1,32 @@
+<html>
+<head>
+    <style>
+        body {
+            margin: 0;
+            height: 1100px;
+        }
+        .origin {
+            position: absolute;
+            top: 500px;
+            left: 0;
+            width: 10px;
+            height: 10px;
+            background-color: blue;
+        }
+        
+        #indicator {
+            position: absolute;
+            left: 0;
+            top: 0;
+            width: 100px;
+            height: 100px;
+            background-color: green;
+        }
+    </style>
+</head>
+<body>
+    <div class="origin"></div>
+    <div id="indicator"></div>
+    <div id="result"></div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/scrolling/programmatic-horizontal-bt-document-scroll.html (0 => 195445)


--- trunk/LayoutTests/fast/scrolling/programmatic-horizontal-bt-document-scroll.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/programmatic-horizontal-bt-document-scroll.html	2016-01-22 06:45:05 UTC (rev 195445)
@@ -0,0 +1,39 @@
+<html style="-webkit-writing-mode: horizontal-bt;">
+<head>
+    <style>
+        body {
+            margin: 0;
+        }
+        .origin {
+            position: absolute;
+            top: 0;
+            left: 0;
+            width: 10px;
+            height: 10px;
+            background-color: blue;
+        }
+        
+        #indicator {
+            position: absolute;
+            left: 0;
+            top: -500px;
+            width: 100px;
+            height: 100px;
+            background-color: green;
+        }
+    </style>
+    <script>
+    function runTest()
+    {
+        document.scrollingElement.scrollTop = -500;
+    }
+    
+    window.addEventListener('load', runTest, false);
+    </script>
+</head>
+<body>
+    <div class="origin"></div>
+    <div id="indicator"></div>
+    <div id="result"></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (195444 => 195445)


--- trunk/Source/WebCore/ChangeLog	2016-01-22 06:44:52 UTC (rev 195444)
+++ trunk/Source/WebCore/ChangeLog	2016-01-22 06:45:05 UTC (rev 195445)
@@ -1,3 +1,34 @@
+2016-01-21  Simon Fraser  <simon.fra...@apple.com>
+
+        REGRESSION (r168244): Content in horizontal-bt page is offset such that only the end is viewable and there is a white gap at the top
+        https://bugs.webkit.org/show_bug.cgi?id=136019
+
+        Reviewed by Dan Bernstein.
+
+        In horizontal-bt documents (where the page starts scrolled to the bottom, and scrolling up goes into negative scroll positions),
+        the position of the root content layer would be set incorrectly by the scrolling thread, resulting in misplaced
+        content.
+
+        Fix by having the renamed "yPositionForRootContentLayer" take scroll origin into
+        account, and being more consistent about using scrollOrigin to position this layer.
+
+        Test: fast/scrolling/programmatic-horizontal-bt-document-scroll.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::yPositionForFooterLayer): Moved
+        (WebCore::FrameView::positionForRootContentLayer): Take scrollOrigin, and subtract it from the computed value.
+        (WebCore::FrameView::yPositionForRootContentLayer): Renamed.
+        * page/FrameView.h:
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): We've already pushed the new scrollPosition onto the FrameView,
+        so we can just use the member function to compute the positionForContentsLayer.
+        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition): This is the bug fix; FrameView::positionForRootContentLayer()
+        now takes scrollOrigin into account.
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::updateRootLayerPosition): Rather than using the documentRect, position the root content layer
+        in terms of the scroll origin (which is -documentRect.location()).
+
 2016-01-21  Brady Eidson  <beid...@apple.com>
 
         Modern IDB: Support populating/extracting database metadata with SQLite backend.

Modified: trunk/Source/WebCore/page/FrameView.cpp (195444 => 195445)


--- trunk/Source/WebCore/page/FrameView.cpp	2016-01-22 06:44:52 UTC (rev 195444)
+++ trunk/Source/WebCore/page/FrameView.cpp	2016-01-22 06:45:05 UTC (rev 195445)
@@ -1766,19 +1766,19 @@
     return scrollY;
 }
 
-float FrameView::yPositionForRootContentLayer(const FloatPoint& scrollPosition, float topContentInset, float headerHeight)
+float FrameView::yPositionForFooterLayer(const FloatPoint& scrollPosition, float topContentInset, float totalContentsHeight, float footerHeight)
 {
-    return yPositionForHeaderLayer(scrollPosition, topContentInset) + headerHeight;
+    return yPositionForHeaderLayer(scrollPosition, topContentInset) + totalContentsHeight - footerHeight;
 }
 
-float FrameView::yPositionForFooterLayer(const FloatPoint& scrollPosition, float topContentInset, float totalContentsHeight, float footerHeight)
+FloatPoint FrameView::positionForRootContentLayer(const FloatPoint& scrollPosition, const FloatPoint& scrollOrigin, float topContentInset, float headerHeight)
 {
-    return yPositionForHeaderLayer(scrollPosition, topContentInset) + totalContentsHeight - footerHeight;
+    return FloatPoint(0, yPositionForHeaderLayer(scrollPosition, topContentInset) + headerHeight) - toFloatSize(scrollOrigin);
 }
 
-float FrameView::yPositionForRootContentLayer() const
+FloatPoint FrameView::positionForRootContentLayer() const
 {
-    return yPositionForRootContentLayer(scrollPosition(), topContentInset(), headerHeight());
+    return positionForRootContentLayer(scrollPosition(), scrollOrigin(), topContentInset(), headerHeight());
 }
 
 #if PLATFORM(IOS)

Modified: trunk/Source/WebCore/page/FrameView.h (195444 => 195445)


--- trunk/Source/WebCore/page/FrameView.h	2016-01-22 06:44:52 UTC (rev 195444)
+++ trunk/Source/WebCore/page/FrameView.h	2016-01-22 06:45:05 UTC (rev 195445)
@@ -287,8 +287,8 @@
     // These layers are positioned differently when there is a topContentInset, a header, or a footer. These value need to be computed
     // on both the main thread and the scrolling thread.
     static float yPositionForInsetClipLayer(const FloatPoint& scrollPosition, float topContentInset);
-    WEBCORE_EXPORT static float yPositionForRootContentLayer(const FloatPoint& scrollPosition, float topContentInset, float headerHeight);
-    WEBCORE_EXPORT float yPositionForRootContentLayer() const;
+    WEBCORE_EXPORT static FloatPoint positionForRootContentLayer(const FloatPoint& scrollPosition, const FloatPoint& scrollOrigin, float topContentInset, float headerHeight);
+    WEBCORE_EXPORT FloatPoint positionForRootContentLayer() const;
 
     static float yPositionForHeaderLayer(const FloatPoint& scrollPosition, float topContentInset);
     static float yPositionForFooterLayer(const FloatPoint& scrollPosition, float topContentInset, float totalContentsHeight, float footerHeight);

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (195444 => 195445)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2016-01-22 06:44:52 UTC (rev 195444)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2016-01-22 06:45:05 UTC (rev 195445)
@@ -323,8 +323,7 @@
 
             float topContentInset = frameView.topContentInset();
             FloatPoint positionForInsetClipLayer = FloatPoint(0, FrameView::yPositionForInsetClipLayer(scrollPosition, topContentInset));
-            FloatPoint positionForContentsLayer = FloatPoint(scrolledContentsLayer->position().x(),
-                FrameView::yPositionForRootContentLayer(scrollPosition, topContentInset, frameView.headerHeight()));
+            FloatPoint positionForContentsLayer = frameView.positionForRootContentLayer();
             FloatPoint positionForHeaderLayer = FloatPoint(scrollPositionForFixed.x(), FrameView::yPositionForHeaderLayer(scrollPosition, topContentInset));
             FloatPoint positionForFooterLayer = FloatPoint(scrollPositionForFixed.x(),
                 FrameView::yPositionForFooterLayer(scrollPosition, topContentInset, frameView.totalContentsSize().height(), frameView.footerHeight()));

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm (195444 => 195445)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm	2016-01-22 06:44:52 UTC (rev 195444)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm	2016-01-22 06:45:05 UTC (rev 195445)
@@ -404,8 +404,7 @@
     float topContentInset = this->topContentInset();
     if (m_insetClipLayer && m_scrolledContentsLayer && topContentInset) {
         m_insetClipLayer.get().position = FloatPoint(0, FrameView::yPositionForInsetClipLayer(position, topContentInset));
-        m_scrolledContentsLayer.get().position = FloatPoint(m_scrolledContentsLayer.get().position.x,
-            FrameView::yPositionForRootContentLayer(position, topContentInset, headerHeight()));
+        m_scrolledContentsLayer.get().position = FrameView::positionForRootContentLayer(position, scrollOrigin(), topContentInset, headerHeight());
         if (m_contentShadowLayer)
             m_contentShadowLayer.get().position = m_scrolledContentsLayer.get().position;
     }

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (195444 => 195445)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2016-01-22 06:44:52 UTC (rev 195444)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2016-01-22 06:45:05 UTC (rev 195445)
@@ -2121,9 +2121,8 @@
 void RenderLayerCompositor::updateRootLayerPosition()
 {
     if (m_rootContentLayer) {
-        const IntRect& documentRect = m_renderView.documentRect();
-        m_rootContentLayer->setSize(documentRect.size());        
-        m_rootContentLayer->setPosition(FloatPoint(documentRect.x(), documentRect.y() + m_renderView.frameView().yPositionForRootContentLayer()));
+        m_rootContentLayer->setSize(m_renderView.frameView().contentsSize());
+        m_rootContentLayer->setPosition(m_renderView.frameView().positionForRootContentLayer());
         m_rootContentLayer->setAnchorPoint(FloatPoint3D());
     }
     if (m_clipLayer) {

Modified: trunk/Source/WebKit2/ChangeLog (195444 => 195445)


--- trunk/Source/WebKit2/ChangeLog	2016-01-22 06:44:52 UTC (rev 195444)
+++ trunk/Source/WebKit2/ChangeLog	2016-01-22 06:45:05 UTC (rev 195445)
@@ -1,3 +1,17 @@
+2016-01-21  Simon Fraser  <simon.fra...@apple.com>
+
+        REGRESSION (r168244): Content in horizontal-bt page is offset such that only the end is viewable and there is a white gap at the top
+        https://bugs.webkit.org/show_bug.cgi?id=136019
+
+        Reviewed by Dan Bernstein.
+
+        Now call frameView.positionForRootContentLayer(), and add a FIXME questioning the
+        behavior in horizontal b-t documents. However, this code isn't hit now that we always
+        do extended backgrounds, so never have shadow layers.
+
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::shadowLayerPositionForFrame):
+
 2016-01-21  Dean Jackson  <d...@apple.com>
 
         Move _allowsDoubleTapGestures implementation out of category

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (195444 => 195445)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2016-01-22 06:44:52 UTC (rev 195444)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2016-01-22 06:45:05 UTC (rev 195445)
@@ -693,7 +693,8 @@
     
 static FloatPoint shadowLayerPositionForFrame(FrameView& frameView, FloatPoint origin)
 {
-    FloatPoint position = frameView.renderView()->documentRect().location() + FloatPoint(0, frameView.yPositionForRootContentLayer());
+    // FIXME: correct for b-t documents?
+    FloatPoint position = frameView.positionForRootContentLayer();
     return position + origin.expandedTo(FloatPoint());
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to