Title: [195195] releases/WebKitGTK/webkit-2.10
Revision
195195
Author
[email protected]
Date
2016-01-18 03:36:08 -0800 (Mon, 18 Jan 2016)

Log Message

Merge r194404 - Minor cleanup in RenderBox::canBeProgramaticallyScrolled()
https://bugs.webkit.org/show_bug.cgi?id=152515

Reviewed by Tim Horton.

Source/WebCore:

Remove the scrollsOverflow() check in RenderBox::canBeProgramaticallyScrolled(),
since if hasScrollableOverflow is true, scrollsOverflow() must also be true.

Factor clientWidth/Height vs. scrollWidth/Height checks into separate functions,
and call them from two places.

Added a test which is not affected by this particular change, but will verify
that a later change doesn't break anything.

Test: fast/overflow/overflow-hidden-scroll-into-view.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::canBeScrolledAndHasScrollableArea):
(WebCore::RenderBox::canBeProgramaticallyScrolled):
* rendering/RenderBox.h:
(WebCore::RenderBox::hasHorizontalOverflow):
(WebCore::RenderBox::hasVerticalOverflow):
(WebCore::RenderBox::hasScrollableOverflowX):
(WebCore::RenderBox::hasScrollableOverflowY):

LayoutTests:

Test that programmatic scrolling works inside overflow:hidden.

* fast/overflow/overflow-hidden-scroll-into-view-expected.html: Added.
* fast/overflow/overflow-hidden-scroll-into-view.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog (195194 => 195195)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog	2016-01-18 10:57:12 UTC (rev 195194)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog	2016-01-18 11:36:08 UTC (rev 195195)
@@ -1,3 +1,15 @@
+2015-12-22  Simon Fraser  <[email protected]>
+
+        Minor cleanup in RenderBox::canBeProgramaticallyScrolled()
+        https://bugs.webkit.org/show_bug.cgi?id=152515
+
+        Reviewed by Tim Horton.
+
+        Test that programmatic scrolling works inside overflow:hidden.
+
+        * fast/overflow/overflow-hidden-scroll-into-view-expected.html: Added.
+        * fast/overflow/overflow-hidden-scroll-into-view.html: Added.
+
 2015-12-23  Pranjal Jumde  <[email protected]>
 
         Test to check for stack recursion when indexed propertyNames defined using Object.defineProperty are deleted.

Added: releases/WebKitGTK/webkit-2.10/LayoutTests/fast/overflow/overflow-hidden-scroll-into-view-expected.html (0 => 195195)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/fast/overflow/overflow-hidden-scroll-into-view-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/fast/overflow/overflow-hidden-scroll-into-view-expected.html	2016-01-18 11:36:08 UTC (rev 195195)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <title>Tests that scrollIntoView() works inside overflow:hidden</title>
+    <style>
+        .container {
+            height: 200px;
+            width: 200px;
+            border: 1px solid black;
+            background-color: red;
+        }
+        
+        #box {
+            height: 200px;
+            width: 200px;
+            background-color: green;
+        }
+    </style>
+</head>
+<body>
+<div class="container">
+    <div id="box"></div>
+</div>
+</body>
+</html>

Added: releases/WebKitGTK/webkit-2.10/LayoutTests/fast/overflow/overflow-hidden-scroll-into-view.html (0 => 195195)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/fast/overflow/overflow-hidden-scroll-into-view.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/fast/overflow/overflow-hidden-scroll-into-view.html	2016-01-18 11:36:08 UTC (rev 195195)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <title>Tests that scrollIntoView() works inside overflow:hidden</title>
+    <style>
+        .container {
+            height: 200px;
+            width: 200px;
+            overflow: hidden;
+            border: 1px solid black;
+            background-color: red;
+        }
+        
+        #box {
+            margin-top: 500px;
+            height: 200px;
+            width: 200px;
+            background-color: green;
+        }
+    </style>
+    <script>
+        function doTest()
+        {
+            var box = document.getElementById('box');
+            box.scrollIntoView();
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+<div class="container">
+    <div id="box"></div>
+</div>
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog (195194 => 195195)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog	2016-01-18 10:57:12 UTC (rev 195194)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog	2016-01-18 11:36:08 UTC (rev 195195)
@@ -1,3 +1,30 @@
+2015-12-22  Simon Fraser  <[email protected]>
+
+        Minor cleanup in RenderBox::canBeProgramaticallyScrolled()
+        https://bugs.webkit.org/show_bug.cgi?id=152515
+
+        Reviewed by Tim Horton.
+
+        Remove the scrollsOverflow() check in RenderBox::canBeProgramaticallyScrolled(),
+        since if hasScrollableOverflow is true, scrollsOverflow() must also be true.
+        
+        Factor clientWidth/Height vs. scrollWidth/Height checks into separate functions,
+        and call them from two places.
+        
+        Added a test which is not affected by this particular change, but will verify
+        that a later change doesn't break anything.
+
+        Test: fast/overflow/overflow-hidden-scroll-into-view.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::canBeScrolledAndHasScrollableArea):
+        (WebCore::RenderBox::canBeProgramaticallyScrolled):
+        * rendering/RenderBox.h:
+        (WebCore::RenderBox::hasHorizontalOverflow):
+        (WebCore::RenderBox::hasVerticalOverflow):
+        (WebCore::RenderBox::hasScrollableOverflowX):
+        (WebCore::RenderBox::hasScrollableOverflowY):
+
 2015-12-23  Pranjal Jumde  <[email protected]>
 
         Avoids stack recursion when indexed propertyNames defined using Object.defineProperty are deleted.

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBox.cpp (195194 => 195195)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBox.cpp	2016-01-18 10:57:12 UTC (rev 195194)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBox.cpp	2016-01-18 11:36:08 UTC (rev 195195)
@@ -907,7 +907,7 @@
 
 bool RenderBox::canBeScrolledAndHasScrollableArea() const
 {
-    return canBeProgramaticallyScrolled() && (scrollHeight() != roundToInt(clientHeight()) || scrollWidth() != roundToInt(clientWidth()));
+    return canBeProgramaticallyScrolled() && (hasHorizontalOverflow() || hasVerticalOverflow());
 }
 
 bool RenderBox::isScrollableOrRubberbandableBox() const
@@ -923,8 +923,7 @@
     if (!hasOverflowClip())
         return false;
 
-    bool hasScrollableOverflow = hasScrollableOverflowX() || hasScrollableOverflowY();
-    if (scrollsOverflow() && hasScrollableOverflow)
+    if (hasScrollableOverflowX() || hasScrollableOverflowY())
         return true;
 
     return element() && element()->hasEditableStyle();

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBox.h (195194 => 195195)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBox.h	2016-01-18 10:57:12 UTC (rev 195194)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBox.h	2016-01-18 11:36:08 UTC (rev 195195)
@@ -474,12 +474,17 @@
 
     bool hasVerticalScrollbarWithAutoBehavior() const;
     bool hasHorizontalScrollbarWithAutoBehavior() const;
+
     bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY(); }
     bool scrollsOverflowX() const { return hasOverflowClip() && (style().overflowX() == OSCROLL || hasHorizontalScrollbarWithAutoBehavior()); }
     bool scrollsOverflowY() const { return hasOverflowClip() && (style().overflowY() == OSCROLL || hasVerticalScrollbarWithAutoBehavior()); }
-    bool hasScrollableOverflowX() const { return scrollsOverflowX() && scrollWidth() != roundToInt(clientWidth()); }
-    bool hasScrollableOverflowY() const { return scrollsOverflowY() && scrollHeight() != roundToInt(clientHeight()); }
 
+    bool hasHorizontalOverflow() const { return scrollWidth() != roundToInt(clientWidth()); }
+    bool hasVerticalOverflow() const { return scrollHeight() != roundToInt(clientHeight()); }
+
+    bool hasScrollableOverflowX() const { return scrollsOverflowX() && hasHorizontalOverflow(); }
+    bool hasScrollableOverflowY() const { return scrollsOverflowY() && hasVerticalOverflow(); }
+
     bool usesCompositedScrolling() const;
     
     bool hasUnsplittableScrollingOverflow() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to