Title: [211433] trunk
Revision
211433
Author
[email protected]
Date
2017-01-31 08:09:38 -0800 (Tue, 31 Jan 2017)

Log Message

REGRESSION (r209411): Scrolling to a fragment identifier in overflow:scroll inside position:fixed no longer works
https://bugs.webkit.org/show_bug.cgi?id=167630
rdar://problem/30091558

Reviewed by Zalan Bujtas.
Source/WebCore:

r209411 added special handling for scrolling inside position:fixed, but cut off all scrolling, breaking
overflow:scroll inside position:fixed. Fix by only handling the position:fixed case when we get to
the root layer, which is where we scroll the document.

Test: fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::getRectToExpose):

LayoutTests:

* fast/overflow/scroll-anchor-in-overflow-in-position-fixed-expected.txt: Added.
* fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (211432 => 211433)


--- trunk/LayoutTests/ChangeLog	2017-01-31 15:59:52 UTC (rev 211432)
+++ trunk/LayoutTests/ChangeLog	2017-01-31 16:09:38 UTC (rev 211433)
@@ -1,3 +1,14 @@
+2017-01-31  Simon Fraser  <[email protected]>
+
+        REGRESSION (r209411): Scrolling to a fragment identifier in overflow:scroll inside position:fixed no longer works
+        https://bugs.webkit.org/show_bug.cgi?id=167630
+        rdar://problem/30091558
+
+        Reviewed by Zalan Bujtas.
+
+        * fast/overflow/scroll-anchor-in-overflow-in-position-fixed-expected.txt: Added.
+        * fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html: Added.
+
 2017-01-31  Zan Dobersek  <[email protected]>
 
         [EME] InitDataRegistry should use base64url encoding and decoding for keyids

Added: trunk/LayoutTests/fast/overflow/scroll-anchor-in-overflow-in-position-fixed-expected.txt (0 => 211433)


--- trunk/LayoutTests/fast/overflow/scroll-anchor-in-overflow-in-position-fixed-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/overflow/scroll-anchor-in-overflow-in-position-fixed-expected.txt	2017-01-31 16:09:38 UTC (rev 211433)
@@ -0,0 +1,13 @@
+Tests scrolling to an anchor inside overflow:scroll inside position:fixed correctly scrolls the overflow, and not the page
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS scroller.scrollTop is 465
+PASS scroller.scrollLeft is 0
+PASS document.scrollingElement.scrollTop is 800
+PASS document.scrollingElement.scrollLeft is 100
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Anchor is here

Added: trunk/LayoutTests/fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html (0 => 211433)


--- trunk/LayoutTests/fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html	                        (rev 0)
+++ trunk/LayoutTests/fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html	2017-01-31 16:09:38 UTC (rev 211433)
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        body {
+            height: 2000px;
+            width: 2000px;
+        }
+        
+        .fixed {
+            position: fixed;
+            top: 250px;
+            left: 40px;
+            height: 200px;
+            width: 200px;
+            border: 1px solid black;
+        }
+        
+        #scroller {
+            height: 100%;
+            width: 100%;
+            overflow: scroll;
+        }
+        
+        #scroller > a {
+            display: block;
+            height: 50px;
+            margin-top: 600px;
+        }
+    </style>
+    <script src=""
+    <script>
+    description("Tests scrolling to an anchor inside overflow:scroll inside position:fixed correctly scrolls the overflow, and not the page");
+    window.jsTestIsAsync = true;
+
+    function runTest()
+    {
+        window.scrollTo(100, 800);
+        setTimeout(function() {
+            window.location='#anchor';
+            setTimeout(finishTest, 0);
+        }, 0);
+    }
+
+    var scroller;
+    function finishTest()
+    {
+        if (window.location.toString().indexOf("#") == -1) {
+            setTimeout(finishTest, 0);
+            return;
+        }
+        
+        scroller = document.getElementById('scroller');
+        
+        shouldBe('scroller.scrollTop', '465');
+        shouldBe('scroller.scrollLeft', '0');
+
+        shouldBe('document.scrollingElement.scrollTop', '800');
+        shouldBe('document.scrollingElement.scrollLeft', '100');
+
+        window.scrollTo(0, 0);
+        finishJSTest();
+    }
+    </script>
+</head>
+<body _onload_="runTest()">
+
+<div class="fixed">
+    <div id="scroller">
+        <a name="anchor">Anchor is here</a>
+    </div>
+</div>
+
+<script src=""
+
+</body></html>

Modified: trunk/Source/WebCore/ChangeLog (211432 => 211433)


--- trunk/Source/WebCore/ChangeLog	2017-01-31 15:59:52 UTC (rev 211432)
+++ trunk/Source/WebCore/ChangeLog	2017-01-31 16:09:38 UTC (rev 211433)
@@ -1,3 +1,20 @@
+2017-01-31  Simon Fraser  <[email protected]>
+
+        REGRESSION (r209411): Scrolling to a fragment identifier in overflow:scroll inside position:fixed no longer works
+        https://bugs.webkit.org/show_bug.cgi?id=167630
+        rdar://problem/30091558
+
+        Reviewed by Zalan Bujtas.
+        
+        r209411 added special handling for scrolling inside position:fixed, but cut off all scrolling, breaking
+        overflow:scroll inside position:fixed. Fix by only handling the position:fixed case when we get to 
+        the root layer, which is where we scroll the document.
+
+        Test: fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::getRectToExpose):
+
 2017-01-31  Zan Dobersek  <[email protected]>
 
         [EME] InitDataRegistry should use base64url encoding and decoding for keyids

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (211432 => 211433)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2017-01-31 15:59:52 UTC (rev 211432)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2017-01-31 16:09:38 UTC (rev 211433)
@@ -2602,7 +2602,7 @@
 LayoutRect RenderLayer::getRectToExpose(const LayoutRect &visibleRect, const LayoutRect &exposeRect, bool insideFixed, const ScrollAlignment& alignX, const ScrollAlignment& alignY) const
 {
     FrameView& frameView = renderer().view().frameView();
-    if (insideFixed) {
+    if (renderer().isRenderView() && insideFixed) {
         // If the element is inside position:fixed and we're not scaled, no amount of scrolling is going to move things around.
         if (frameView.frameScaleFactor() == 1)
             return visibleRect;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to