Title: [198758] trunk
Revision
198758
Author
mmaxfi...@apple.com
Date
2016-03-28 14:37:39 -0700 (Mon, 28 Mar 2016)

Log Message

[RTL Scrollbars] Position:sticky can be positioned under vertical RTL scrollbar
https://bugs.webkit.org/show_bug.cgi?id=155949

Reviewed by Simon Fraser.

Source/WebCore:

When performing sticky positioning logic, we were setting the clip rect's position
equal to the scrollPosition of the layer. This computation assumes that the top
left of the scroll position is the same as the top left of the clip rect. When
using RTL scrollbars, this is not true, so this code simply needs to be made aware
of the presence of an RTL scrollbar.

Tests: fast/scrolling/rtl-scrollbars-sticky-document-2.html
       fast/scrolling/rtl-scrollbars-sticky-document.html
       fast/scrolling/rtl-scrollbars-sticky-iframe-2.html
       fast/scrolling/rtl-scrollbars-sticky-iframe.html
       fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-2.html
       fast/scrolling/rtl-scrollbars-sticky-overflow-scroll.html

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::constrainingRectForStickyPosition):

LayoutTests:

* platform/ios-simulator/TestExpectations:
* fast/scrolling/rtl-scrollbars-sticky-document-2-expected.html: Added.
* fast/scrolling/rtl-scrollbars-sticky-document-2.html: Added.
* fast/scrolling/rtl-scrollbars-sticky-document-expected.html: Added.
* fast/scrolling/rtl-scrollbars-sticky-document.html: Added.
* fast/scrolling/rtl-scrollbars-sticky-iframe-2-expected.html: Added.
* fast/scrolling/rtl-scrollbars-sticky-iframe-2.html: Added.
* fast/scrolling/rtl-scrollbars-sticky-iframe-expected.html: Added.
* fast/scrolling/rtl-scrollbars-sticky-iframe.html: Added.
* fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-2-expected.html: Added.
* fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-2.html: Added.
* fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-expected.html: Added.
* fast/scrolling/rtl-scrollbars-sticky-overflow-scroll.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (198757 => 198758)


--- trunk/LayoutTests/ChangeLog	2016-03-28 20:59:56 UTC (rev 198757)
+++ trunk/LayoutTests/ChangeLog	2016-03-28 21:37:39 UTC (rev 198758)
@@ -1,3 +1,24 @@
+2016-03-28  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [RTL Scrollbars] Position:sticky can be positioned under vertical RTL scrollbar
+        https://bugs.webkit.org/show_bug.cgi?id=155949
+
+        Reviewed by Simon Fraser.
+
+        * platform/ios-simulator/TestExpectations:
+        * fast/scrolling/rtl-scrollbars-sticky-document-2-expected.html: Added.
+        * fast/scrolling/rtl-scrollbars-sticky-document-2.html: Added.
+        * fast/scrolling/rtl-scrollbars-sticky-document-expected.html: Added.
+        * fast/scrolling/rtl-scrollbars-sticky-document.html: Added.
+        * fast/scrolling/rtl-scrollbars-sticky-iframe-2-expected.html: Added.
+        * fast/scrolling/rtl-scrollbars-sticky-iframe-2.html: Added.
+        * fast/scrolling/rtl-scrollbars-sticky-iframe-expected.html: Added.
+        * fast/scrolling/rtl-scrollbars-sticky-iframe.html: Added.
+        * fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-2-expected.html: Added.
+        * fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-2.html: Added.
+        * fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-expected.html: Added.
+        * fast/scrolling/rtl-scrollbars-sticky-overflow-scroll.html: Added.
+
 2016-03-28  Zalan Bujtas  <za...@apple.com>
 
         Setup cloned continuation renderer properly.

Added: trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-document-2-expected.html (0 => 198758)


--- trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-document-2-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-document-2-expected.html	2016-03-28 21:37:39 UTC (rev 198758)
@@ -0,0 +1,15 @@
+<!DOCTYPE html><!-- webkit-test-runner [ rtlScrollbars=true ] -->
+<html>
+<head>
+</head>
+<body style="margin: 0px;">
+This test makes sure that position-sticky obeys RTL scrollbars when positioning.
+<div style="position: absolute; top: 100px; left: 0px; width: 2000px; height: 2000px;">
+    <div style="position: absolute; left: 850px; top: 0px; width: 100px; height: 100px; background: green;"></div>
+    <div style="position: absolute; left: 950px; top: 0px; width: 685px; height: 100px; background: blue;"></div>
+</div>
+<script>
+window.scroll(850, 0);
+</script>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-document-2.html (0 => 198758)


--- trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-document-2.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-document-2.html	2016-03-28 21:37:39 UTC (rev 198758)
@@ -0,0 +1,14 @@
+<!DOCTYPE html><!-- webkit-test-runner [ rtlScrollbars=true ] -->
+<html>
+<head>
+</head>
+<body style="margin: 0px;">
+This test makes sure that position-sticky obeys RTL scrollbars when positioning.
+<div style="position: absolute; top: 100px; left: 0px; width: 2000px; height: 2000px;">
+    <div style="display: inline-block; position: static; width: 800px; height: 100px; background: blue;"></div><div style="display: inline-block; position: -webkit-sticky; left: 0px; right: 0px; width: 100px; height: 100px; background: green;"></div><div style="display: inline-block; position: static; width: 800px; height: 100px; background: blue;"></div>
+</div>
+<script>
+window.scroll(850, 0);
+</script>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-document-expected.html (0 => 198758)


--- trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-document-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-document-expected.html	2016-03-28 21:37:39 UTC (rev 198758)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ rtlScrollbars=true ] -->
+<html>
+<head>
+</head>
+<body style="margin: 0px;">
+This test makes sure that position-sticky obeys RTL scrollbars when positioning.
+<div style="position: absolute; top: 100px; left: 0px; width: 2000px; height: 2000px;">
+    <div style="position: absolute; left: 0px; top: 0px; width: 685px; height: 100px; background: blue;"></div>
+    <div style="position: absolute; left: 685px; top: 0px; width: 100px; height: 100px; background: green;"></div>
+</div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-document.html (0 => 198758)


--- trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-document.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-document.html	2016-03-28 21:37:39 UTC (rev 198758)
@@ -0,0 +1,11 @@
+<!DOCTYPE html><!-- webkit-test-runner [ rtlScrollbars=true ] -->
+<html>
+<head>
+</head>
+<body style="margin: 0px;">
+This test makes sure that position-sticky obeys RTL scrollbars when positioning.
+<div style="position: absolute; top: 100px; left: 0px; width: 2000px; height: 2000px;">
+    <div style="display: inline-block; position: static; width: 800px; height: 100px; background: blue;"></div><div style="display: inline-block; position: -webkit-sticky; left: 0px; right: 0px; width: 100px; height: 100px; background: green;"></div><div style="display: inline-block; position: static; width: 800px; height: 100px; background: blue;"></div>
+</div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-iframe-2-expected.html (0 => 198758)


--- trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-iframe-2-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-iframe-2-expected.html	2016-03-28 21:37:39 UTC (rev 198758)
@@ -0,0 +1,21 @@
+<!DOCTYPE html><!-- webkit-test-runner [ rtlScrollbars=true ] -->
+<html>
+<head>
+</head>
+<body style="margin: 0px;">
+This test makes sure that position-sticky obeys RTL scrollbars when positioning.
+<iframe style="position: relative; width: 600px; height: 500px; border: 0px solid black;" srcdoc="<!DOCTYPE html>
+<head>
+</head>
+<body>
+<div style='position: absolute; top: 0px; left: 0px; width: 2000px; height: 2000px'>
+    <div style='position: absolute; left: 850px; width: 100px; height: 100px; background: green;'></div>
+    <div style='position: absolute; left: 950px; width: 485px; height: 100px; background: blue;'></div>
+</div>
+<script>
+window.scroll(850, 0);
+</script>
+</body>
+</html">
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-iframe-2.html (0 => 198758)


--- trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-iframe-2.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-iframe-2.html	2016-03-28 21:37:39 UTC (rev 198758)
@@ -0,0 +1,20 @@
+<!DOCTYPE html><!-- webkit-test-runner [ rtlScrollbars=true ] -->
+<html>
+<head>
+</head>
+<body style="margin: 0px;">
+This test makes sure that position-sticky obeys RTL scrollbars when positioning.
+<iframe style="position: relative; width: 600px; height: 500px; border: 0px solid black;" srcdoc="<!DOCTYPE html>
+<head>
+</head>
+<body>
+<div style='position: absolute; top: 0px; left: 0px; width: 2000px; height: 2000px'>
+    <div style='display: inline-block; position: static; width: 800px; height: 100px; background: blue;'></div><div style='display: inline-block; position: -webkit-sticky; left: 0px; right: 0px; width: 100px; height: 100px; background: green;'></div><div style='display: inline-block; position: static; width: 800px; height: 100px; background: blue;'></div>
+</div>
+<script>
+window.scroll(850, 0);
+</script>
+</body>
+</html">
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-iframe-expected.html (0 => 198758)


--- trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-iframe-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-iframe-expected.html	2016-03-28 21:37:39 UTC (rev 198758)
@@ -0,0 +1,18 @@
+<!DOCTYPE html><!-- webkit-test-runner [ rtlScrollbars=true ] -->
+<html>
+<head>
+</head>
+<body style="margin: 0px;">
+This test makes sure that position-sticky obeys RTL scrollbars when positioning.
+<iframe style="position: relative; width: 600px; height: 500px; border: 0px solid black;" srcdoc="<!DOCTYPE html>
+<head>
+</head>
+<body>
+<div style='position: absolute; top: 0px; left: 0px; width: 2000px; height: 2000px'>
+    <div style='position: absolute; width: 485px; height: 100px; background: blue;'></div>
+    <div style='position: absolute; left: 485px; width: 100px; height: 100px; background: green;'></div>
+</div>
+</body>
+</html">
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-iframe.html (0 => 198758)


--- trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-iframe.html	2016-03-28 21:37:39 UTC (rev 198758)
@@ -0,0 +1,17 @@
+<!DOCTYPE html><!-- webkit-test-runner [ rtlScrollbars=true ] -->
+<html>
+<head>
+</head>
+<body style="margin: 0px;">
+This test makes sure that position-sticky obeys RTL scrollbars when positioning.
+<iframe style="position: relative; width: 600px; height: 500px; border: 0px solid black;" srcdoc="<!DOCTYPE html>
+<head>
+</head>
+<body>
+<div style='position: absolute; top: 0px; left: 0px; width: 2000px; height: 2000px'>
+    <div style='display: inline-block; position: static; width: 800px; height: 100px; background: blue;'></div><div style='display: inline-block; position: -webkit-sticky; left: 0px; right: 0px; width: 100px; height: 100px; background: green;'></div><div style='display: inline-block; position: static; width: 800px; height: 100px; background: blue;'></div>
+</div>
+</body>
+</html">
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-2-expected.html (0 => 198758)


--- trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-2-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-2-expected.html	2016-03-28 21:37:39 UTC (rev 198758)
@@ -0,0 +1,18 @@
+<!DOCTYPE html><!-- webkit-test-runner [ rtlScrollbars=true ] -->
+<html>
+<head>
+</head>
+<body style="margin: 0px;">
+This test makes sure that position-sticky obeys RTL scrollbars when positioning.
+<div id="scrolling" style="position: relative; width: 600px; height: 500px; overflow: scroll;">
+    <div style="position: absolute; top: 0px; left: 0px; width: 2000px; height: 1px;">
+    <div style="position: absolute; left: 1000px; width: 100px; height: 100px; background: green;"></div>
+    <div style="position: absolute; left: 1100px; width: 485px; height: 100px; background: blue;"></div>
+</div>
+</div>
+<script>
+var scrollingElement = document.getElementById("scrolling");
+scrollingElement.scrollLeft = 1000;
+</script>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-2.html (0 => 198758)


--- trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-2.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-2.html	2016-03-28 21:37:39 UTC (rev 198758)
@@ -0,0 +1,17 @@
+<!DOCTYPE html><!-- webkit-test-runner [ rtlScrollbars=true ] -->
+<html>
+<head>
+</head>
+<body style="margin: 0px;">
+This test makes sure that position-sticky obeys RTL scrollbars when positioning.
+<div id="scrolling" style="position: relative; width: 600px; height: 500px; overflow: scroll;">
+<div style="position: absolute; top: 0px; left: 0px; width: 2000px;">
+    <div style="display: inline-block; position: static; width: 800px; height: 100px; background: blue;"></div><div style="display: inline-block; position: -webkit-sticky; left: 0px; right: 0px; width: 100px; height: 100px; background: green;"></div><div style="display: inline-block; position: static; width: 800px; height: 100px; background: blue;"></div>
+</div>
+</div>
+<script>
+var scrollingElement = document.getElementById("scrolling");
+scrollingElement.scrollLeft = 1000;
+</script>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-expected.html (0 => 198758)


--- trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-expected.html	2016-03-28 21:37:39 UTC (rev 198758)
@@ -0,0 +1,14 @@
+<!DOCTYPE html><!-- webkit-test-runner [ rtlScrollbars=true ] -->
+<html>
+<head>
+</head>
+<body style="margin: 0px;">
+This test makes sure that position-sticky obeys RTL scrollbars when positioning.
+<div style="position: relative; width: 600px; height: 500px; overflow: scroll;">
+    <div style="position: absolute; top: 0px; left: 0px; width: 2000px; height: 1px;">
+    <div style="position: absolute; width: 485px; height: 100px; background: blue;"></div>
+    <div style="position: absolute; left: 485px; width: 100px; height: 100px; background: green;"></div>
+</div>
+</div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-overflow-scroll.html (0 => 198758)


--- trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-overflow-scroll.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/rtl-scrollbars-sticky-overflow-scroll.html	2016-03-28 21:37:39 UTC (rev 198758)
@@ -0,0 +1,13 @@
+<!DOCTYPE html><!-- webkit-test-runner [ rtlScrollbars=true ] -->
+<html>
+<head>
+</head>
+<body style="margin: 0px;">
+This test makes sure that position-sticky obeys RTL scrollbars when positioning.
+<div style="position: relative; width: 600px; height: 500px; overflow: scroll;">
+<div style="position: absolute; top: 0px; left: 0px; width: 2000px;">
+    <div style="display: inline-block; position: static; width: 800px; height: 100px; background: blue;"></div><div style="display: inline-block; position: -webkit-sticky; left: 0px; right: 0px; width: 100px; height: 100px; background: green;"></div><div style="display: inline-block; position: static; width: 800px; height: 100px; background: blue;"></div>
+</div>
+</div>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (198757 => 198758)


--- trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-03-28 20:59:56 UTC (rev 198757)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-03-28 21:37:39 UTC (rev 198758)
@@ -3003,3 +3003,9 @@
 webkit.org/b/94458 [ Debug ] http/tests/security/aboutBlank/window-open-self-about-blank.html [ Pass Crash ]
 
 webkit.org/b/155565 [ Debug ] mathml/very-large-stretchy-operators.html [ Skip ]
+
+# RTL Scrollbars are not implemented on iOS.
+fast/scrolling/rtl-scrollbars-sticky-document-2.html [ ImageOnlyFailure ]
+fast/scrolling/rtl-scrollbars-sticky-document.html [ ImageOnlyFailure ]
+fast/scrolling/rtl-scrollbars-sticky-iframe-2.html [ ImageOnlyFailure ]
+fast/scrolling/rtl-scrollbars-sticky-iframe.html [ ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (198757 => 198758)


--- trunk/Source/WebCore/ChangeLog	2016-03-28 20:59:56 UTC (rev 198757)
+++ trunk/Source/WebCore/ChangeLog	2016-03-28 21:37:39 UTC (rev 198758)
@@ -1,3 +1,26 @@
+2016-03-28  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [RTL Scrollbars] Position:sticky can be positioned under vertical RTL scrollbar
+        https://bugs.webkit.org/show_bug.cgi?id=155949
+
+        Reviewed by Simon Fraser.
+
+        When performing sticky positioning logic, we were setting the clip rect's position
+        equal to the scrollPosition of the layer. This computation assumes that the top
+        left of the scroll position is the same as the top left of the clip rect. When
+        using RTL scrollbars, this is not true, so this code simply needs to be made aware
+        of the presence of an RTL scrollbar.
+
+        Tests: fast/scrolling/rtl-scrollbars-sticky-document-2.html
+               fast/scrolling/rtl-scrollbars-sticky-document.html
+               fast/scrolling/rtl-scrollbars-sticky-iframe-2.html
+               fast/scrolling/rtl-scrollbars-sticky-iframe.html
+               fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-2.html
+               fast/scrolling/rtl-scrollbars-sticky-overflow-scroll.html
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::constrainingRectForStickyPosition):
+
 2016-03-28  Antonio Gomes  <toniki...@webkit.org>
 
         Rename PlatformWheelEvent::isEndGesture to isEndOfMomentumScroll.

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (198757 => 198758)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2016-03-28 20:59:56 UTC (rev 198757)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2016-03-28 21:37:39 UTC (rev 198758)
@@ -443,14 +443,19 @@
     RenderLayer* enclosingClippingLayer = layer()->enclosingOverflowClipLayer(ExcludeSelf);
     if (enclosingClippingLayer) {
         RenderBox& enclosingClippingBox = downcast<RenderBox>(enclosingClippingLayer->renderer());
-        LayoutRect clipRect = enclosingClippingBox.overflowClipRect(LayoutPoint(), 0); // FIXME: make this work in regions.
+        LayoutRect clipRect = enclosingClippingBox.overflowClipRect(LayoutPoint(), nullptr); // FIXME: make this work in regions.
         clipRect.contract(LayoutSize(enclosingClippingBox.paddingLeft() + enclosingClippingBox.paddingRight(),
             enclosingClippingBox.paddingTop() + enclosingClippingBox.paddingBottom()));
 
         FloatRect constrainingRect = enclosingClippingBox.localToContainerQuad(FloatRect(clipRect), &view()).boundingBox();
 
         FloatPoint scrollOffset = FloatPoint() + enclosingClippingLayer->scrollOffset();
-        constrainingRect.setLocation(scrollOffset);
+
+        float scrollbarOffset = 0;
+        if (enclosingClippingBox.hasLayer() && enclosingClippingBox.style().shouldPlaceBlockDirectionScrollbarOnLeft())
+            scrollbarOffset = enclosingClippingBox.layer()->verticalScrollbarWidth(IgnoreOverlayScrollbarSize);
+
+        constrainingRect.setLocation(FloatPoint(scrollOffset.x() + scrollbarOffset, scrollOffset.y()));
         return constrainingRect;
     }
     
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to