<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[167807] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/167807">167807</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2014-04-25 08:27:55 -0700 (Fri, 25 Apr 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>ScrollingCoordinator is unaware of topContentInset
https://bugs.webkit.org/show_bug.cgi?id=132158
&lt;rdar://problem/16706152&gt;

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 &lt;select&gt; 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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingCoordinatorcpp">trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformmacfastscrollingscrollselectbottomtestexpectedtxt">trunk/LayoutTests/platform/mac/fast/scrolling/scroll-select-bottom-test-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastscrollingscrollselectbottomtesthtml">trunk/LayoutTests/platform/mac/fast/scrolling/scroll-select-bottom-test.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (167806 => 167807)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-04-25 15:15:52 UTC (rev 167806)
+++ trunk/LayoutTests/ChangeLog        2014-04-25 15:27:55 UTC (rev 167807)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-04-25  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+        ScrollingCoordinator is unaware of topContentInset
+        https://bugs.webkit.org/show_bug.cgi?id=132158
+        &lt;rdar://problem/16706152&gt;
+
+        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.
+
</ins><span class="cx"> 2014-04-25  Miyoung Shin  &lt;myid.shin@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web process is crashed during dispatching touchEvent created by JS.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastscrollingscrollselectbottomtestexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/fast/scrolling/scroll-select-bottom-test-expected.txt (0 => 167807)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+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 &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+div display height = 111
+Mouse moved to (30, 378)
+PASS Page did not receive wheel events.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastscrollingscrollselectbottomtesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/fast/scrolling/scroll-select-bottom-test.html (0 => 167807)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,150 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.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;
+}
+
+&lt;/style&gt;
+&lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+function onLoad() {
+    setupTopLevel();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;onLoad();&quot;&gt;
+&lt;script&gt;
+
+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(&quot;Page before: &quot; + pageScrollPositionBefore + &quot;, select before: &quot; + selectScrollPositionBefore);
+    //debug(&quot;Page after:  &quot; + pageScrollPositionAfter + &quot;, select after: &quot; + selectScrollPositionAfter);
+
+    if (pageScrollPositionBefore != pageScrollPositionAfter)
+        testFailed(&quot;Page received wheel events.&quot;);
+    else
+        testPassed(&quot;Page did not receive wheel events.&quot;);
+
+    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(&quot;div display height = &quot; + selectTarget.clientHeight);
+    var startPosY = selectTarget.offsetTop + selectTarget.clientHeight + clientInset - 2; // Very near top (accounting for top content inset).
+    eventSender.mouseMoveTo(startPosX, startPosY);
+    debug(&quot;Mouse moved to (&quot; + startPosX + &quot;, &quot; + startPosY + &quot;)&quot;);
+    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 = &quot;&lt;p&gt;This test is better run under DumpRenderTree. To manually test it, place the mouse pointer&lt;br/&gt;&quot;
+            + &quot;inside the select box, and scroll near (but not AT) the bottom of the range. Use the mouse wheel or a two-finger&lt;br/&gt;&quot;
+            + &quot;swipe to scroll through the rest of the select options.&lt;br/&gt;&lt;br/&gt;&quot;
+            + &quot;You should not see the page position change if this test is successful.&lt;/p&gt;&quot;;
+        messageLocation.appendChild(message);
+    }
+
+    if (window.internals)
+        window.internals.setTopContentInset(clientInset);
+}
+
+&lt;/script&gt;
+&lt;div id=&quot;parent&quot; style=&quot;height: 2000px; width: 2000px;&quot;&gt;
+    &lt;div id=&quot;source&quot; style=&quot;height: 100px; width: 500px;&quot;&gt;
+        Put mouse here and flick downwards
+    &lt;/div&gt;
+        &lt;div class=&quot;scrollable_region&quot;&gt;
+            &lt;h3&gt;Scrollable Select&lt;/h3&gt;
+            &lt;select id=&quot;target&quot; class=&quot;scrollable_select&quot; size=&quot;8&quot;&gt;
+                &lt;option&gt;content1&lt;/option&gt;
+                &lt;option&gt;content2&lt;/option&gt;
+                &lt;option&gt;content3&lt;/option&gt;
+                &lt;option&gt;content4&lt;/option&gt;
+                &lt;option&gt;content5&lt;/option&gt;
+                &lt;option&gt;content6&lt;/option&gt;
+                &lt;option&gt;content7&lt;/option&gt;
+                &lt;option&gt;content8&lt;/option&gt;
+                &lt;option&gt;content9&lt;/option&gt;
+                &lt;option&gt;content10&lt;/option&gt;
+                &lt;option&gt;content11&lt;/option&gt;
+                &lt;option&gt;content12&lt;/option&gt;
+                &lt;option&gt;content13&lt;/option&gt;
+                &lt;option&gt;content14&lt;/option&gt;
+                &lt;option&gt;content15&lt;/option&gt;
+                &lt;option&gt;content16&lt;/option&gt;
+                &lt;option&gt;content17&lt;/option&gt;
+                &lt;option&gt;content18&lt;/option&gt;
+                &lt;option&gt;content19&lt;/option&gt;
+                &lt;option&gt;content20&lt;/option&gt;
+                &lt;option&gt;content21&lt;/option&gt;
+            &lt;/select&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+&lt;script&gt;
+description(&quot;Tests that a select doesn't pass wheel events to main frame when scrolling at bottom&quot;);
+&lt;/script&gt;
+&lt;script src=&quot;../../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (167806 => 167807)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2014-04-25  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+        ScrollingCoordinator is unaware of topContentInset
+        https://bugs.webkit.org/show_bug.cgi?id=132158
+        &lt;rdar://problem/16706152&gt;
+
+        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 &lt;select&gt; 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.
+
</ins><span class="cx"> 2014-04-25  Javier Fernandez  &lt;jfernandez@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r167799): Breaks debug build
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingCoordinatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (167806 => 167807)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -124,6 +124,7 @@
</span><span class="cx"> 
</span><span class="cx">     IntPoint offset = frameLocation;
</span><span class="cx">     offset.moveBy(frameView-&gt;frameRect().location());
</span><ins>+    offset.move(0, frameView-&gt;topContentInset());
</ins><span class="cx"> 
</span><span class="cx">     if (const FrameView::ScrollableAreaSet* scrollableAreas = frameView-&gt;scrollableAreas()) {
</span><span class="cx">         for (FrameView::ScrollableAreaSet::const_iterator it = scrollableAreas-&gt;begin(), end = scrollableAreas-&gt;end(); it != end; ++it) {
</span></span></pre>
</div>
</div>

</body>
</html>