Title: [167807] trunk
Revision
167807
Author
[email protected]
Date
2014-04-25 08:27:55 -0700 (Fri, 25 Apr 2014)

Log Message

ScrollingCoordinator is unaware of topContentInset
https://bugs.webkit.org/show_bug.cgi?id=132158
<rdar://problem/16706152>

Reviewed by Darin Adler.

Source/WebCore:
Test: platform/mac/fast/scrolling/scroll-select-bottom-test.html

The calculation of non-fast-scrollable regions does not currently take
the topContentOffset into account. Consequently, the logic that decides
whether to stay on the scrolling thread, or drop down to an individual
page element, can make the wrong choice. This is especially true for
small scrollable regions (such as <select> elements), where the
topContentInset may be quite close to the size of the scrollable
 element itself.

* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::computeNonFastScrollableRegion): Also
include the topContentInset value in our calculation.

LayoutTests:
* platform/mac/fast/scrolling/scroll-select-bottom-test-expected.txt: Added.
* platform/mac/fast/scrolling/scroll-select-bottom-test.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (167806 => 167807)


--- trunk/LayoutTests/ChangeLog	2014-04-25 15:15:52 UTC (rev 167806)
+++ trunk/LayoutTests/ChangeLog	2014-04-25 15:27:55 UTC (rev 167807)
@@ -1,3 +1,14 @@
+2014-04-25  Brent Fulgham  <[email protected]>
+
+        ScrollingCoordinator is unaware of topContentInset
+        https://bugs.webkit.org/show_bug.cgi?id=132158
+        <rdar://problem/16706152>
+
+        Reviewed by Darin Adler.
+
+        * platform/mac/fast/scrolling/scroll-select-bottom-test-expected.txt: Added.
+        * platform/mac/fast/scrolling/scroll-select-bottom-test.html: Added.
+
 2014-04-25  Miyoung Shin  <[email protected]>
 
         Web process is crashed during dispatching touchEvent created by JS.

Added: trunk/LayoutTests/platform/mac/fast/scrolling/scroll-select-bottom-test-expected.txt (0 => 167807)


--- trunk/LayoutTests/platform/mac/fast/scrolling/scroll-select-bottom-test-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/scrolling/scroll-select-bottom-test-expected.txt	2014-04-25 15:27:55 UTC (rev 167807)
@@ -0,0 +1,16 @@
+Put mouse here and flick downwards
+Scrollable Select
+
+
+Tests that a select doesn't pass wheel events to main frame when scrolling at bottom
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+div display height = 111
+Mouse moved to (30, 378)
+PASS Page did not receive wheel events.
+

Added: trunk/LayoutTests/platform/mac/fast/scrolling/scroll-select-bottom-test.html (0 => 167807)


--- trunk/LayoutTests/platform/mac/fast/scrolling/scroll-select-bottom-test.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/scrolling/scroll-select-bottom-test.html	2014-04-25 15:27:55 UTC (rev 167807)
@@ -0,0 +1,150 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.scrollable_region {
+    width: 680px;
+}
+
+.table td, .table th {
+    padding: 2px;
+}
+
+.table th {
+    height: 20px;
+    text-align: left;
+    font-weight: strong;
+}
+
+.table tr:nth-child(odd) {
+    background: #f3f3f3;
+}
+
+.scrollable_select option:nth-child(odd) {
+    background: #f3f3f3;
+}
+
+</style>
+<script src=""
+<script>
+function onLoad() {
+    setupTopLevel();
+}
+</script>
+</head>
+<body _onload_="onLoad();">
+<script>
+
+var clientInset = 100;
+
+var selectTarget;
+var pageScrollPositionBefore;
+var selectScrollPositionBefore;
+var continueCount = 5;
+
+function checkForScroll() {
+
+    // The page should not have scrolled at all.
+    var pageScrollPositionAfter = document.body.scrollTop;
+    var selectScrollPositionAfter = selectTarget.scrollTop;
+
+    //debug("Page before: " + pageScrollPositionBefore + ", select before: " + selectScrollPositionBefore);
+    //debug("Page after:  " + pageScrollPositionAfter + ", select after: " + selectScrollPositionAfter);
+
+    if (pageScrollPositionBefore != pageScrollPositionAfter)
+        testFailed("Page received wheel events.");
+    else
+        testPassed("Page did not receive wheel events.");
+
+    testRunner.notifyDone();
+}
+
+function scrollTest() {
+    // See where our IFrame lives:
+    pageScrollPositionBefore = document.body.scrollTop;
+
+    selectTarget = document.getElementById('target');
+    selectTarget.scrollTop = selectTarget.scrollHeight - selectTarget.clientHeight - 100;
+
+    selectScrollPositionBefore = selectTarget.scrollTop;
+ 
+    // Scroll the #source until we reach the #target.
+    var startPosX = selectTarget.offsetLeft + 20;
+    debug("div display height = " + selectTarget.clientHeight);
+    var startPosY = selectTarget.offsetTop + selectTarget.clientHeight + clientInset - 2; // Very near top (accounting for top content inset).
+    eventSender.mouseMoveTo(startPosX, startPosY);
+    debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'begin', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue', true);
+    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end', true);
+    setTimeout(checkForScroll, 100);
+}
+
+function setupTopLevel() {
+
+    if (window.eventSender) {
+        testRunner.dumpAsText(true);
+        testRunner.waitUntilDone();
+
+        setTimeout(scrollTest, 1000);
+    } else {
+        var messageLocation = document.getElementById('parent');
+        var message = document.createElement('div');
+        message.innerHTML = "<p>This test is better run under DumpRenderTree. To manually test it, place the mouse pointer<br/>"
+            + "inside the select box, and scroll near (but not AT) the bottom of the range. Use the mouse wheel or a two-finger<br/>"
+            + "swipe to scroll through the rest of the select options.<br/><br/>"
+            + "You should not see the page position change if this test is successful.</p>";
+        messageLocation.appendChild(message);
+    }
+
+    if (window.internals)
+        window.internals.setTopContentInset(clientInset);
+}
+
+</script>
+<div id="parent" style="height: 2000px; width: 2000px;">
+    <div id="source" style="height: 100px; width: 500px;">
+        Put mouse here and flick downwards
+    </div>
+        <div class="scrollable_region">
+            <h3>Scrollable Select</h3>
+            <select id="target" class="scrollable_select" size="8">
+                <option>content1</option>
+                <option>content2</option>
+                <option>content3</option>
+                <option>content4</option>
+                <option>content5</option>
+                <option>content6</option>
+                <option>content7</option>
+                <option>content8</option>
+                <option>content9</option>
+                <option>content10</option>
+                <option>content11</option>
+                <option>content12</option>
+                <option>content13</option>
+                <option>content14</option>
+                <option>content15</option>
+                <option>content16</option>
+                <option>content17</option>
+                <option>content18</option>
+                <option>content19</option>
+                <option>content20</option>
+                <option>content21</option>
+            </select>
+        </div>
+    </div>
+</div>
+<div id="console"></div>
+<script>
+description("Tests that a select doesn't pass wheel events to main frame when scrolling at bottom");
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (167806 => 167807)


--- trunk/Source/WebCore/ChangeLog	2014-04-25 15:15:52 UTC (rev 167806)
+++ trunk/Source/WebCore/ChangeLog	2014-04-25 15:27:55 UTC (rev 167807)
@@ -1,3 +1,25 @@
+2014-04-25  Brent Fulgham  <[email protected]>
+
+        ScrollingCoordinator is unaware of topContentInset
+        https://bugs.webkit.org/show_bug.cgi?id=132158
+        <rdar://problem/16706152>
+
+        Reviewed by Darin Adler.
+
+        Test: platform/mac/fast/scrolling/scroll-select-bottom-test.html
+
+        The calculation of non-fast-scrollable regions does not currently take
+        the topContentOffset into account. Consequently, the logic that decides
+        whether to stay on the scrolling thread, or drop down to an individual
+        page element, can make the wrong choice. This is especially true for
+        small scrollable regions (such as <select> elements), where the
+        topContentInset may be quite close to the size of the scrollable
+         element itself.
+
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::computeNonFastScrollableRegion): Also
+        include the topContentInset value in our calculation.
+
 2014-04-25  Javier Fernandez  <[email protected]>
 
         REGRESSION(r167799): Breaks debug build

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (167806 => 167807)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2014-04-25 15:15:52 UTC (rev 167806)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2014-04-25 15:27:55 UTC (rev 167807)
@@ -124,6 +124,7 @@
 
     IntPoint offset = frameLocation;
     offset.moveBy(frameView->frameRect().location());
+    offset.move(0, frameView->topContentInset());
 
     if (const FrameView::ScrollableAreaSet* scrollableAreas = frameView->scrollableAreas()) {
         for (FrameView::ScrollableAreaSet::const_iterator it = scrollableAreas->begin(), end = scrollableAreas->end(); it != end; ++it) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to