Title: [186937] branches/safari-601.1-branch

Diff

Modified: branches/safari-601.1-branch/LayoutTests/ChangeLog (186936 => 186937)


--- branches/safari-601.1-branch/LayoutTests/ChangeLog	2015-07-17 05:32:50 UTC (rev 186936)
+++ branches/safari-601.1-branch/LayoutTests/ChangeLog	2015-07-17 05:32:55 UTC (rev 186937)
@@ -1,5 +1,21 @@
 2015-07-16  Matthew Hanson  <[email protected]>
 
+        Merge r186865. rdar://problem/21823835
+
+    2015-07-15  Wenson Hsieh  <[email protected]>
+
+            Scroll snapping to elements is broken for main frame scrolling
+            https://bugs.webkit.org/show_bug.cgi?id=146957
+
+            Reviewed by Brent Fulgham.
+
+            Tests that basic scroll snap coordinates in the mainframe works.
+
+            * css3/scroll-snap/scroll-snap-coordinate-mainframe-expected.txt: Added.
+            * css3/scroll-snap/scroll-snap-coordinate-mainframe.html: Added.
+
+2015-07-16  Matthew Hanson  <[email protected]>
+
         Merge r186840. rdar://problem/21823681
 
     2015-07-15  Wenson Hsieh  <[email protected]>

Added: branches/safari-601.1-branch/LayoutTests/css3/scroll-snap/scroll-snap-coordinate-mainframe-expected.txt (0 => 186937)


--- branches/safari-601.1-branch/LayoutTests/css3/scroll-snap/scroll-snap-coordinate-mainframe-expected.txt	                        (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/css3/scroll-snap/scroll-snap-coordinate-mainframe-expected.txt	2015-07-17 05:32:55 UTC (rev 186937)
@@ -0,0 +1,8 @@
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Scroll-snap offsets: vertical = { 0, 600, 1200, 1800, 2400, 3000 }
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-601.1-branch/LayoutTests/css3/scroll-snap/scroll-snap-coordinate-mainframe.html (0 => 186937)


--- branches/safari-601.1-branch/LayoutTests/css3/scroll-snap/scroll-snap-coordinate-mainframe.html	                        (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/css3/scroll-snap/scroll-snap-coordinate-mainframe.html	2015-07-17 05:32:55 UTC (rev 186937)
@@ -0,0 +1,47 @@
+<html>
+
+<head>
+    <style>
+        body {
+            margin: 0;
+            -webkit-scroll-snap-type: mandatory;
+        }
+
+        .vertical {
+            width: 100%;
+            height: 600px;
+            -webkit-scroll-snap-coordinate: 0px 0px;
+        }
+    </style>
+
+    <script src=""
+    <script>
+    function runTest()
+    {
+        debug("Scroll-snap offsets: " + window.internals.scrollSnapOffsets(document.body));
+        finishJSTest();
+    }
+
+    function setup()
+    {
+        if (window.testRunner) {
+            window.jsTestIsAsync = true;
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+            setTimeout(runTest, 0);
+        }
+    }
+    </script>
+</head>
+
+<body _onload_="setup()">
+    <div id="child00" class="vertical"><div id="console"></div></div>
+    <div id="child01" class="vertical"></div>
+    <div id="child02" class="vertical"></div>
+    <div id="child03" class="vertical"></div>
+    <div id="child04" class="vertical"></div>
+    <div id="child05" class="vertical"></div>
+    <script src=""
+</body>
+
+</html>

Modified: branches/safari-601.1-branch/Source/WebCore/ChangeLog (186936 => 186937)


--- branches/safari-601.1-branch/Source/WebCore/ChangeLog	2015-07-17 05:32:50 UTC (rev 186936)
+++ branches/safari-601.1-branch/Source/WebCore/ChangeLog	2015-07-17 05:32:55 UTC (rev 186937)
@@ -1,5 +1,30 @@
 2015-07-16  Matthew Hanson  <[email protected]>
 
+        Merge r186865. rdar://problem/21823835
+
+    2015-07-15  Wenson Hsieh  <[email protected]>
+
+            Scroll snapping to elements is broken for main frame scrolling
+            https://bugs.webkit.org/show_bug.cgi?id=146957
+
+            Reviewed by Brent Fulgham.
+
+            Fixes the case of elements with scroll snap coordinates in a scroll snapping mainframe by changing
+            RenderBox::findEnclosingScrollableContainer to return the body's RenderBox when all enclosing elements
+            are not overflow scrollable but the mainframe can scroll.
+
+            Test: css3/scroll-snap/scroll-snap-coordinate-mainframe.html
+
+            * page/FrameView.h: Export isScrollable so that the Internals API can use it.
+            * rendering/RenderBox.cpp: Include MainFrame.h.
+            (WebCore::RenderBox::findEnclosingScrollableContainer): Changed to return the body's RenderBox if
+                none of its parent elements are overflow scrolling.
+            * testing/Internals.cpp:
+            (WebCore::Internals::scrollSnapOffsets): Updated to return snap offsets for the body element,
+                allowing us to call window.internals.scrollSnapOffsets(document.body).
+
+2015-07-16  Matthew Hanson  <[email protected]>
+
         Merge r186857. rdar://problem/21840845
 
     2015-07-15  Enrica Casucci  <[email protected]>

Modified: branches/safari-601.1-branch/Source/WebCore/page/FrameView.h (186936 => 186937)


--- branches/safari-601.1-branch/Source/WebCore/page/FrameView.h	2015-07-17 05:32:50 UTC (rev 186936)
+++ branches/safari-601.1-branch/Source/WebCore/page/FrameView.h	2015-07-17 05:32:55 UTC (rev 186937)
@@ -429,7 +429,7 @@
     // to rubber-band, which the main frame might be allowed to do even if there is no content to scroll to. In that case,
     // callers use Scrollability::ScrollableOrRubberbandable.
     enum class Scrollability { Scrollable, ScrollableOrRubberbandable };
-    bool isScrollable(Scrollability definitionOfScrollable = Scrollability::Scrollable);
+    WEBCORE_EXPORT bool isScrollable(Scrollability definitionOfScrollable = Scrollability::Scrollable);
 
     virtual bool isScrollableOrRubberbandable() override;
     virtual bool hasScrollableOrRubberbandableAncestor() override;

Modified: branches/safari-601.1-branch/Source/WebCore/rendering/RenderBox.cpp (186936 => 186937)


--- branches/safari-601.1-branch/Source/WebCore/rendering/RenderBox.cpp	2015-07-17 05:32:50 UTC (rev 186936)
+++ branches/safari-601.1-branch/Source/WebCore/rendering/RenderBox.cpp	2015-07-17 05:32:55 UTC (rev 186937)
@@ -43,6 +43,7 @@
 #include "HTMLTextAreaElement.h"
 #include "HitTestResult.h"
 #include "InlineElementBox.h"
+#include "MainFrame.h"
 #include "Page.h"
 #include "PaintInfo.h"
 #include "RenderBoxRegionInfo.h"
@@ -4981,6 +4982,9 @@
         if (candidate.hasOverflowClip())
             return &candidate;
     }
+    // If all parent elements are not overflow scrollable, check the body.
+    if (document().body() && frame().mainFrame().view() && frame().mainFrame().view()->isScrollable())
+        return document().body()->renderBox();
     
     return nullptr;
 }

Modified: branches/safari-601.1-branch/Source/WebCore/testing/Internals.cpp (186936 => 186937)


--- branches/safari-601.1-branch/Source/WebCore/testing/Internals.cpp	2015-07-17 05:32:50 UTC (rev 186936)
+++ branches/safari-601.1-branch/Source/WebCore/testing/Internals.cpp	2015-07-17 05:32:55 UTC (rev 186937)
@@ -2885,29 +2885,40 @@
         return String();
 
     RenderBox& box = *element->renderBox();
-    if (!box.canBeScrolledAndHasScrollableArea()) {
-        ec = INVALID_ACCESS_ERR;
-        return String();
+    ScrollableArea* scrollableArea;
+    
+    if (box.isBody()) {
+        FrameView* frameView = box.frame().mainFrame().view();
+        if (!frameView || !frameView->isScrollable()) {
+            ec = INVALID_ACCESS_ERR;
+            return String();
+        }
+        scrollableArea = frameView;
+        
+    } else {
+        if (!box.canBeScrolledAndHasScrollableArea()) {
+            ec = INVALID_ACCESS_ERR;
+            return String();
+        }
+        scrollableArea = box.layer();
     }
 
-    if (!box.layer())
+    if (!scrollableArea)
         return String();
     
-    ScrollableArea& scrollableArea = *box.layer();
-    
     StringBuilder result;
 
-    if (scrollableArea.horizontalSnapOffsets()) {
+    if (scrollableArea->horizontalSnapOffsets()) {
         result.append("horizontal = ");
-        appendOffsets(result, *scrollableArea.horizontalSnapOffsets());
+        appendOffsets(result, *scrollableArea->horizontalSnapOffsets());
     }
 
-    if (scrollableArea.verticalSnapOffsets()) {
+    if (scrollableArea->verticalSnapOffsets()) {
         if (result.length())
             result.append(", ");
 
         result.append("vertical = ");
-        appendOffsets(result, *scrollableArea.verticalSnapOffsets());
+        appendOffsets(result, *scrollableArea->verticalSnapOffsets());
     }
 
     return result.toString();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to