<!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>[163018] 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/163018">163018</a></dd>
<dt>Author</dt> <dd>stavila@adobe.com</dd>
<dt>Date</dt> <dd>2014-01-29 07:20:56 -0800 (Wed, 29 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[CSSRegions] Unable to scroll a scrollable container for regions using mouse wheel
https://bugs.webkit.org/show_bug.cgi?id=123886

Source/WebCore:

When an element flowed into a scrollable region is scrolled using the mouse wheel, the event
needs to be propagated to the region containing that element, on top of which the cursor
is located.

Reviewed by Antti Koivisto.

Tests: fast/regions/wheel-scroll-abspos.html
       fast/regions/wheel-scroll.html

* page/EventHandler.cpp:
(WebCore::scrollNode):
(WebCore::EventHandler::defaultWheelEventHandler):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::scroll):
(WebCore::RenderBox::scrollWithWheelEventLocation):
* rendering/RenderBox.h:
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::regionFromAbsolutePointAndBox):
* rendering/RenderFlowThread.h:

LayoutTests:

Added tests for scrolling elements flowed into scrollable regions.

Reviewed by Antti Koivisto.

* fast/regions/wheel-scroll-abspos-expected.html: Added.
* fast/regions/wheel-scroll-abspos.html: Added.
* fast/regions/wheel-scroll-expected.html: Added.
* fast/regions/wheel-scroll.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="#trunkSourceWebCorepageEventHandlercpp">trunk/Source/WebCore/page/EventHandler.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxcpp">trunk/Source/WebCore/rendering/RenderBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxh">trunk/Source/WebCore/rendering/RenderBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderFlowThreadcpp">trunk/Source/WebCore/rendering/RenderFlowThread.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderFlowThreadh">trunk/Source/WebCore/rendering/RenderFlowThread.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastregionswheelscrollabsposexpectedhtml">trunk/LayoutTests/fast/regions/wheel-scroll-abspos-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastregionswheelscrollabsposhtml">trunk/LayoutTests/fast/regions/wheel-scroll-abspos.html</a></li>
<li><a href="#trunkLayoutTestsfastregionswheelscrollexpectedhtml">trunk/LayoutTests/fast/regions/wheel-scroll-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastregionswheelscrollhtml">trunk/LayoutTests/fast/regions/wheel-scroll.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (163017 => 163018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-01-29 14:52:22 UTC (rev 163017)
+++ trunk/LayoutTests/ChangeLog        2014-01-29 15:20:56 UTC (rev 163018)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-01-29  Radu Stavila  &lt;stavila@adobe.com&gt;
+
+        [CSSRegions] Unable to scroll a scrollable container for regions using mouse wheel
+        https://bugs.webkit.org/show_bug.cgi?id=123886
+
+        Added tests for scrolling elements flowed into scrollable regions.
+
+        Reviewed by Antti Koivisto.
+
+        * fast/regions/wheel-scroll-abspos-expected.html: Added.
+        * fast/regions/wheel-scroll-abspos.html: Added.
+        * fast/regions/wheel-scroll-expected.html: Added.
+        * fast/regions/wheel-scroll.html: Added.
+
</ins><span class="cx"> 2014-01-29  Krzysztof Czech  &lt;k.czech@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL][WK2] REGRESSION (r162586-r162589): accessibility/range-alter-by-percent.html failing
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionswheelscrollabsposexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/wheel-scroll-abspos-expected.html (0 => 163018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/wheel-scroll-abspos-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/wheel-scroll-abspos-expected.html        2014-01-29 15:20:56 UTC (rev 163018)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;style&gt;
+    body { font: 16px/16px monospace; }
+
+    .region {
+        border: 1px solid red;
+        padding: 2px;
+        width: 250px;
+        height: 55px;
+    }
+
+    #region4 {
+        height: 356px;
+        position: absolute;
+        left: 330px;
+        top: 120px;
+        border-width: thick;
+    }
+
+    p {
+        margin: 0px;
+    }
+
+    #container {
+        overflow: auto; 
+        border: 3px solid blue;
+        width: 270px;
+        height: 100px; 
+        padding: 10px;
+    }
+
+    .inner_scroll {
+        height: 75px;
+        border: 2px solid green;
+        margin: 5px;
+        overflow: scroll;
+        padding: 5px;
+    }
+&lt;/style&gt;
+
+&lt;script&gt;
+    onload = function() {
+        if (window.eventSender) {
+            eventSender.mouseMoveTo(150, 230);
+            eventSender.continuousMouseScrollBy(0, -10000);
+            eventSender.continuousMouseScrollBy(0, -10000);
+            eventSender.mouseMoveTo(0, 0);
+        }
+    }
+&lt;/script&gt;
+
+&lt;body&gt;
+    &lt;div&gt;
+        The text passes if everything can be scrolled normally using the mouse wheel: 
+        &lt;ul&gt;
+            &lt;li&gt;Scrolling inside the green div should work until it reaches the end and then the blue container should scroll.&lt;/li&gt;
+            &lt;li&gt;Scrolling inside the orange div should work until it reaches the end and then the blue container should NOT scroll because the region in which the orange div is flowed is absolutely positioned&lt;/li&gt;
+        &lt;/ul&gt;
+    &lt;/div&gt;
+
+    &lt;div id=&quot;container&quot;&gt;
+        &lt;div class=&quot;region&quot;&gt;
+            &lt;p&gt;Assume that there is enough content in the flow to fill the regions&lt;/p&gt;
+        &lt;/div&gt;
+        &lt;div class=&quot;region&quot;&gt;
+            &lt;div class=&quot;inner_scroll&quot; style=&quot;height: 30px; margin-top: 0px;&quot;&gt;
+                &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the container is less than the size of regions so that the container gets vertical scrollbar. Case1. If the mouse cursor is over the flow thread fragmented content inside a region, the user is unable to scroll the content inside the container. Case2. However, if the mouse is outside the flow thread content but still inside the container, then the user is able to scroll the container content. There *should be* a possibility to scroll the container content even when the mouse cursor is over the flow thread content in regions. (Case1)&lt;/p&gt;
+            &lt;/div&gt;
+        &lt;/div&gt;
+        &lt;div class=&quot;region&quot;&gt;
+            &lt;p style=&quot;margin-top: 1px&quot;&gt;is less than the size of regions so that the container gets vertical&lt;/p&gt;
+        &lt;/div&gt;
+        &lt;div class=&quot;region&quot; id=&quot;region4&quot;&gt;
+            &lt;p style=&quot;margin-top: 1px&quot;&gt;scrollbar. Case1. If the mouse cursor is over the flow thread fragmented content inside a region, the user is unable to scroll the content inside the container.&lt;/p&gt;
+            &lt;div class=&quot;inner_scroll&quot; style=&quot;border-color: orange;&quot;&gt;
+                &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the container is less than the size of regions so that the container gets vertical scrollbar. Case1. If the mouse cursor is over the flow thread fragmented content inside a region, the user is unable to scroll the content inside the container. Case2. However, if the mouse is outside the flow thread content but still inside the container, then the user is able to scroll the container content. There *should be* a possibility to scroll the container content even when the mouse cursor is over the flow thread content in regions. (Case1)&lt;/p&gt;
+                &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the container is less than the size of regions so that the container gets vertical scrollbar. Case1. If the mouse cursor is over the flow thread fragmented content inside a region, the user is unable to scroll the content inside the container. Case2. However, if the mouse is outside the flow thread content but still inside the container, then the user is able to scroll the container content. There *should be* a possibility to scroll the container content even when the mouse cursor is over the flow thread content in regions. (Case1)&lt;/p&gt;
+                &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the container is less than the size of regions so that the container gets vertical scrollbar. Case1. If the mouse cursor is over the flow thread fragmented content inside a region, the user is unable to scroll the content inside the container. Case2. However, if the mouse is outside the flow thread content but still inside the container, then the user is able to scroll the container content. There *should be* a possibility to scroll the container content even when the mouse cursor is over the flow thread content in regions. (Case1)&lt;/p&gt;
+            &lt;/div&gt;
+            &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the container is less than the size of regions so that the container gets vertical scrollbar. Case1.&lt;/p&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionswheelscrollabsposhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/wheel-scroll-abspos.html (0 => 163018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/wheel-scroll-abspos.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/wheel-scroll-abspos.html        2014-01-29 15:20:56 UTC (rev 163018)
</span><span class="lines">@@ -0,0 +1,88 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;style&gt;
+    body { font: 16px/16px monospace; }
+
+    .region {
+        -webkit-flow-from: flow;
+        width: 250px;
+        height: 55px;
+        border: 1px solid red;
+        padding: 2px;
+        overflow: visible;
+    }
+
+    #region4 {
+        height: auto;
+        position: absolute;
+        left: 330px;
+        top: 120px;
+        border-width: thick;
+    }
+
+    #container {
+        overflow: auto; 
+        border: 3px solid blue; 
+        height: 100px; 
+        padding: 10px;
+        width: 270px;
+    }
+
+    #article {
+        -webkit-flow-into: flow;
+    }
+
+    .inner_scroll {
+        height: 75px;
+        border: 2px solid green;
+        margin: 5px;
+        overflow: scroll;
+        padding: 5px;
+    }
+
+    p {
+        margin: 0px;
+    }
+&lt;/style&gt;
+
+&lt;script&gt;
+    onload = function() {
+        if (window.eventSender) {
+            eventSender.mouseMoveTo(150, 230);
+            eventSender.continuousMouseScrollBy(0, -10000);
+            eventSender.continuousMouseScrollBy(0, -10000);
+            eventSender.mouseMoveTo(0, 0);
+        }
+    }
+&lt;/script&gt;
+
+&lt;body&gt;
+    &lt;div&gt;
+        The text passes if everything can be scrolled normally using the mouse wheel: 
+        &lt;ul&gt;
+            &lt;li&gt;Scrolling inside the green div should work until it reaches the end and then the blue container should scroll.&lt;/li&gt;
+            &lt;li&gt;Scrolling inside the orange div should work until it reaches the end and then the blue container should NOT scroll because the region in which the orange div is flowed is absolutely positioned&lt;/li&gt;
+        &lt;/ul&gt;
+    &lt;/div&gt;
+
+    &lt;div id=&quot;container&quot;&gt;
+        &lt;!-- content to be flowed in regions --&gt;
+        &lt;div id=&quot;article&quot;&gt;
+            &lt;p&gt;Assume that there is enough content in the flow to fill the regions&lt;/p&gt;
+            &lt;div class=&quot;inner_scroll&quot; style=&quot;height: 30px&quot;&gt;
+                &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the container is less than the size of regions so that the container gets vertical scrollbar. Case1. If the mouse cursor is over the flow thread fragmented content inside a region, the user is unable to scroll the content inside the container. Case2. However, if the mouse is outside the flow thread content but still inside the container, then the user is able to scroll the container content. There *should be* a possibility to scroll the container content even when the mouse cursor is over the flow thread content in regions. (Case1)&lt;/p&gt;
+            &lt;/div&gt;
+            &lt;p&gt;is less than the size of regions so that the container gets vertical scrollbar. Case1. If the mouse cursor is over the flow thread fragmented content inside a region, the user is unable to scroll the content inside the container. &lt;/p&gt;
+            &lt;div class=&quot;inner_scroll&quot; style=&quot;border-color: orange;&quot;&gt;
+                &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the container is less than the size of regions so that the container gets vertical scrollbar. Case1. If the mouse cursor is over the flow thread fragmented content inside a region, the user is unable to scroll the content inside the container. Case2. However, if the mouse is outside the flow thread content but still inside the container, then the user is able to scroll the container content. There *should be* a possibility to scroll the container content even when the mouse cursor is over the flow thread content in regions. (Case1)&lt;/p&gt;
+            &lt;/div&gt;
+            &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the container is less than the size of regions so that the container gets vertical scrollbar. Case1.&lt;/p&gt;
+        &lt;/div&gt;
+
+        &lt;!-- regions that will fragment the content --&gt;
+        &lt;div class=&quot;region&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;region&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;region&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;region&quot; id=&quot;region4&quot;&gt;&lt;/div&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionswheelscrollexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/wheel-scroll-expected.html (0 => 163018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/wheel-scroll-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/wheel-scroll-expected.html        2014-01-29 15:20:56 UTC (rev 163018)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;style&gt;
+    body { font: 16px/16px monospace; }
+
+    .region {
+        border: 1px solid red;
+        padding: 2px;
+        width: 450px;
+        height: 40px;
+    }
+
+    #region4 {
+        height: 308px;
+    }
+
+    p {
+        margin: 0px;
+    }
+
+    #container {
+        overflow: auto; 
+        border: 3px solid blue;
+        width: 470px;
+        height: 250px; 
+        padding: 30px;
+    }
+
+    #inner_scroll {
+        height: 75px;
+        border: 2px solid green;
+        margin: 5px;
+        overflow: scroll;
+        padding: 5px;
+    }
+&lt;/style&gt;
+
+&lt;script&gt;
+    onload = function() {
+        if (window.eventSender) {
+            eventSender.mouseMoveTo(100, 300);
+            eventSender.continuousMouseScrollBy(0, -10000);
+            eventSender.mouseMoveTo(100, 100);
+            eventSender.continuousMouseScrollBy(0, -10000);
+            eventSender.mouseMoveTo(0, 0);
+        }
+    }
+&lt;/script&gt;
+
+&lt;body&gt;
+    &lt;p&gt;&lt;b&gt;The text passes if everything can be scrolled normally using the mouse wheel. Scrolling inside the green div should work until it reaches the end and then the blue container should scroll.&lt;/b&gt;&lt;/p&gt;&lt;/br&gt;
+
+    &lt;div id=&quot;container&quot;&gt;
+        &lt;div class=&quot;region&quot;&gt;
+            &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the &lt;/p&gt;
+        &lt;/div&gt;
+        &lt;div class=&quot;region&quot;&gt;
+            &lt;p style=&quot;margin-top: 1px&quot;&gt;container is less than the size of regions so that the container gets vertical scrollbar.&lt;/p&gt;
+        &lt;/div&gt;
+        &lt;div class=&quot;region&quot;&gt;
+            &lt;p style=&quot;margin-top: 1px&quot;&gt;Case1. If the mouse cursor is over the flow thread fragmented content inside a region,&lt;/p&gt;
+        &lt;/div&gt;
+        &lt;div class=&quot;region&quot; id=&quot;region4&quot;&gt;
+            &lt;p style=&quot;margin-top: 1px&quot;&gt;the user is unable to scroll the content inside the container. Case2. However, if the mouse is outside the flow thread content but still inside the container, then the user is able to scroll the container content.&lt;/p&gt;
+            &lt;div id=&quot;inner_scroll&quot;&gt;
+                &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the container is less than the size of regions so that the container gets vertical scrollbar. Case1. If the mouse cursor is over the flow thread fragmented content inside a region, the user is unable to scroll the content inside the container. Case2. However, if the mouse is outside the flow thread content but still inside the container, then the user is able to scroll the container content. There *should be* a possibility to scroll the container content even when the mouse cursor is over the flow thread content in regions. (Case1)&lt;/p&gt;
+                &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the container is less than the size of regions so that the container gets vertical scrollbar. Case1. If the mouse cursor is over the flow thread fragmented content inside a region, the user is unable to scroll the content inside the container. Case2. However, if the mouse is outside the flow thread content but still inside the container, then the user is able to scroll the container content. There *should be* a possibility to scroll the container content even when the mouse cursor is over the flow thread content in regions. (Case1)&lt;/p&gt;
+                &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the container is less than the size of regions so that the container gets vertical scrollbar. Case1. If the mouse cursor is over the flow thread fragmented content inside a region, the user is unable to scroll the content inside the container. Case2. However, if the mouse is outside the flow thread content but still inside the container, then the user is able to scroll the container content. There *should be* a possibility to scroll the container content even when the mouse cursor is over the flow thread content in regions. (Case1)&lt;/p&gt;
+            &lt;/div&gt;
+            &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the container is less than the size of regions so that the container gets vertical scrollbar. Case1. If the mouse cursor is over the flow thread fragmented content inside a region, the user is unable to scroll the content inside the container. Case2.&lt;/p&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionswheelscrollhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/wheel-scroll.html (0 => 163018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/wheel-scroll.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/wheel-scroll.html        2014-01-29 15:20:56 UTC (rev 163018)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;style&gt;
+    body { font: 16px/16px monospace; }
+
+    .region {
+        -webkit-flow-from: flow;
+        width: 450px;
+        height: 40px;
+        border: 1px solid red;
+        padding: 2px;
+    }
+
+    #region4 {
+        height: auto;
+    }
+
+    #container {
+        overflow: auto; 
+        border: 3px solid blue; 
+        height: 250px; 
+        padding: 30px;
+        width: 470px;
+    }
+
+    #article {
+        -webkit-flow-into: flow;
+    }
+
+    #inner_scroll {
+        height: 75px;
+        border: 2px solid green;
+        margin: 5px;
+        overflow: scroll;
+        padding: 5px;
+    }
+
+    p {
+        margin: 0px;
+    }
+&lt;/style&gt;
+
+&lt;script&gt;
+    onload = function() {
+        if (window.eventSender) {
+            eventSender.mouseMoveTo(100, 300);
+            eventSender.continuousMouseScrollBy(0, -10000);
+            eventSender.mouseMoveTo(100, 100);
+            eventSender.continuousMouseScrollBy(0, -10000);
+            eventSender.mouseMoveTo(0, 0);
+        }
+    }
+&lt;/script&gt;
+
+&lt;body&gt;
+    &lt;p&gt;&lt;b&gt;The text passes if everything can be scrolled normally using the mouse wheel. Scrolling inside the green div should work until it reaches the end and then the blue container should scroll.&lt;/b&gt;&lt;/p&gt;&lt;/br&gt;
+
+    &lt;div id=&quot;container&quot;&gt;
+        &lt;!-- content to be flowed in regions --&gt;
+        &lt;div id=&quot;article&quot;&gt;
+            &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the container is less than the size of regions so that the container gets vertical scrollbar. Case1. If the mouse cursor is over the flow thread fragmented content inside a region, the user is unable to scroll the content inside the container. Case2. However, if the mouse is outside the flow thread content but still inside the container, then the user is able to scroll the container content.&lt;/p&gt;
+            &lt;div id=&quot;inner_scroll&quot;&gt;
+                &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the container is less than the size of regions so that the container gets vertical scrollbar. Case1. If the mouse cursor is over the flow thread fragmented content inside a region, the user is unable to scroll the content inside the container. Case2. However, if the mouse is outside the flow thread content but still inside the container, then the user is able to scroll the container content. There *should be* a possibility to scroll the container content even when the mouse cursor is over the flow thread content in regions. (Case1)&lt;/p&gt;
+                &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the container is less than the size of regions so that the container gets vertical scrollbar. Case1. If the mouse cursor is over the flow thread fragmented content inside a region, the user is unable to scroll the content inside the container. Case2. However, if the mouse is outside the flow thread content but still inside the container, then the user is able to scroll the container content. There *should be* a possibility to scroll the container content even when the mouse cursor is over the flow thread content in regions. (Case1)&lt;/p&gt;
+                &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the container is less than the size of regions so that the container gets vertical scrollbar. Case1. If the mouse cursor is over the flow thread fragmented content inside a region, the user is unable to scroll the content inside the container. Case2. However, if the mouse is outside the flow thread content but still inside the container, then the user is able to scroll the container content. There *should be* a possibility to scroll the container content even when the mouse cursor is over the flow thread content in regions. (Case1)&lt;/p&gt;
+            &lt;/div&gt;
+            &lt;p&gt;Assume that there is enough content in the flow to fill the regions and the size of the container is less than the size of regions so that the container gets vertical scrollbar. Case1. If the mouse cursor is over the flow thread fragmented content inside a region, the user is unable to scroll the content inside the container. Case2.&lt;/p&gt;
+        &lt;/div&gt;
+
+        &lt;!-- regions that will fragment the content --&gt;
+        &lt;div class=&quot;region&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;region&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;region&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;region&quot; id=&quot;region4&quot;&gt;&lt;/div&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163017 => 163018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-29 14:52:22 UTC (rev 163017)
+++ trunk/Source/WebCore/ChangeLog        2014-01-29 15:20:56 UTC (rev 163018)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2014-01-29  Radu Stavila  &lt;stavila@adobe.com&gt;
+
+        [CSSRegions] Unable to scroll a scrollable container for regions using mouse wheel
+        https://bugs.webkit.org/show_bug.cgi?id=123886
+
+        When an element flowed into a scrollable region is scrolled using the mouse wheel, the event 
+        needs to be propagated to the region containing that element, on top of which the cursor
+        is located.
+
+        Reviewed by Antti Koivisto.
+
+        Tests: fast/regions/wheel-scroll-abspos.html
+               fast/regions/wheel-scroll.html
+
+        * page/EventHandler.cpp:
+        (WebCore::scrollNode):
+        (WebCore::EventHandler::defaultWheelEventHandler):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::scroll):
+        (WebCore::RenderBox::scrollWithWheelEventLocation):
+        * rendering/RenderBox.h:
+        * rendering/RenderFlowThread.cpp:
+        (WebCore::RenderFlowThread::regionFromAbsolutePointAndBox):
+        * rendering/RenderFlowThread.h:
+
</ins><span class="cx"> 2014-01-29  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r162922): [SOUP] Several tests are failing in EFL and GTK+ after r162922
</span></span></pre></div>
<a id="trunkSourceWebCorepageEventHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EventHandler.cpp (163017 => 163018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EventHandler.cpp        2014-01-29 14:52:22 UTC (rev 163017)
+++ trunk/Source/WebCore/page/EventHandler.cpp        2014-01-29 15:20:56 UTC (rev 163018)
</span><span class="lines">@@ -281,7 +281,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool scrollNode(float delta, ScrollGranularity granularity, ScrollDirection positiveDirection, ScrollDirection negativeDirection, Node* node, Element** stopElement)
</del><ins>+static inline bool scrollNode(float delta, ScrollGranularity granularity, ScrollDirection positiveDirection, ScrollDirection negativeDirection, Node* node, Element** stopElement, const IntPoint&amp; absolutePoint)
</ins><span class="cx"> {
</span><span class="cx">     if (!delta)
</span><span class="cx">         return false;
</span><span class="lines">@@ -289,7 +289,8 @@
</span><span class="cx">         return false;
</span><span class="cx">     RenderBox* enclosingBox = node-&gt;renderer()-&gt;enclosingBox();
</span><span class="cx">     float absDelta = delta &gt; 0 ? delta : -delta;
</span><del>-    return enclosingBox-&gt;scroll(delta &lt; 0 ? negativeDirection : positiveDirection, granularity, absDelta, stopElement);
</del><ins>+
+    return enclosingBox-&gt;scrollWithWheelEventLocation(delta &lt; 0 ? negativeDirection : positiveDirection, granularity, absDelta, enclosingBox, stopElement, absolutePoint);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if (ENABLE(TOUCH_EVENTS) &amp;&amp; !PLATFORM(IOS))
</span><span class="lines">@@ -2612,10 +2613,10 @@
</span><span class="cx">     
</span><span class="cx">     // Break up into two scrolls if we need to.  Diagonal movement on 
</span><span class="cx">     // a MacBook pro is an example of a 2-dimensional mouse wheel event (where both deltaX and deltaY can be set).
</span><del>-    if (dominantDirection != DominantScrollDirectionVertical &amp;&amp; scrollNode(wheelEvent-&gt;deltaX(), granularity, ScrollRight, ScrollLeft, startNode, &amp;stopElement))
</del><ins>+    if (dominantDirection != DominantScrollDirectionVertical &amp;&amp; scrollNode(wheelEvent-&gt;deltaX(), granularity, ScrollRight, ScrollLeft, startNode, &amp;stopElement, roundedIntPoint(wheelEvent-&gt;absoluteLocation())))
</ins><span class="cx">         wheelEvent-&gt;setDefaultHandled();
</span><span class="cx">     
</span><del>-    if (dominantDirection != DominantScrollDirectionHorizontal &amp;&amp; scrollNode(wheelEvent-&gt;deltaY(), granularity, ScrollDown, ScrollUp, startNode, &amp;stopElement))
</del><ins>+    if (dominantDirection != DominantScrollDirectionHorizontal &amp;&amp; scrollNode(wheelEvent-&gt;deltaY(), granularity, ScrollDown, ScrollUp, startNode, &amp;stopElement, roundedIntPoint(wheelEvent-&gt;absoluteLocation())))
</ins><span class="cx">         wheelEvent-&gt;setDefaultHandled();
</span><span class="cx">     
</span><span class="cx">     if (!m_latchedWheelEventElement)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (163017 => 163018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.cpp        2014-01-29 14:52:22 UTC (rev 163017)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp        2014-01-29 15:20:56 UTC (rev 163018)
</span><span class="lines">@@ -760,24 +760,54 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool RenderBox::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement)
</del><ins>+bool RenderBox::scrollLayer(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement)
</ins><span class="cx"> {
</span><del>-    RenderLayer* l = layer();
-    if (l &amp;&amp; l-&gt;scroll(direction, granularity, multiplier)) {
</del><ins>+    RenderLayer* boxLayer = layer();
+    if (boxLayer &amp;&amp; boxLayer-&gt;scroll(direction, granularity, multiplier)) {
</ins><span class="cx">         if (stopElement)
</span><span class="cx">             *stopElement = element();
</span><ins>+
</ins><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    return false;
+}
+
+bool RenderBox::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement)
+{
+    if (scrollLayer(direction, granularity, multiplier, stopElement))
+        return true;
+
</ins><span class="cx">     if (stopElement &amp;&amp; *stopElement &amp;&amp; *stopElement == element())
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     RenderBlock* b = containingBlock();
</span><span class="cx">     if (b &amp;&amp; !b-&gt;isRenderView())
</span><span class="cx">         return b-&gt;scroll(direction, granularity, multiplier, stopElement);
</span><ins>+
</ins><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool RenderBox::scrollWithWheelEventLocation(ScrollDirection direction, ScrollGranularity granularity, float multiplier, RenderBox* startBox, Element** stopElement, IntPoint absolutePoint)
+{
+    if (scrollLayer(direction, granularity, multiplier, stopElement))
+        return true;
+
+    if (stopElement &amp;&amp; *stopElement &amp;&amp; *stopElement == element())
+        return true;
+
+    RenderBlock* nextScrollBlock = containingBlock();
+    if (nextScrollBlock &amp;&amp; nextScrollBlock-&gt;isRenderNamedFlowThread()) {
+        ASSERT(startBox);
+        nextScrollBlock = toRenderFlowThread(nextScrollBlock)-&gt;regionFromAbsolutePointAndBox(absolutePoint, *startBox);
+    }
+
+    if (nextScrollBlock &amp;&amp; !nextScrollBlock-&gt;isRenderView())
+        return nextScrollBlock-&gt;scrollWithWheelEventLocation(direction, granularity, multiplier, startBox, stopElement, absolutePoint);
+
+    return false;
+}
+
</ins><span class="cx"> bool RenderBox::logicalScroll(ScrollLogicalDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement)
</span><span class="cx"> {
</span><span class="cx">     bool scrolled = false;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.h (163017 => 163018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.h        2014-01-29 14:52:22 UTC (rev 163017)
+++ trunk/Source/WebCore/rendering/RenderBox.h        2014-01-29 15:20:56 UTC (rev 163018)
</span><span class="lines">@@ -453,6 +453,7 @@
</span><span class="cx">     int instrinsicScrollbarLogicalWidth() const;
</span><span class="cx">     int scrollbarLogicalHeight() const { return style().isHorizontalWritingMode() ? horizontalScrollbarHeight() : verticalScrollbarWidth(); }
</span><span class="cx">     virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0);
</span><ins>+    virtual bool scrollWithWheelEventLocation(ScrollDirection, ScrollGranularity, float multiplier, RenderBox* startBox, Element** stopElement, IntPoint absolutePoint);
</ins><span class="cx">     virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0);
</span><span class="cx">     bool canBeScrolledAndHasScrollableArea() const;
</span><span class="cx">     virtual bool canBeProgramaticallyScrolled() const;
</span><span class="lines">@@ -657,6 +658,8 @@
</span><span class="cx">     void updateShapeOutsideInfoAfterStyleChange(const RenderStyle&amp;, const RenderStyle* oldStyle);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    bool scrollLayer(ScrollDirection, ScrollGranularity, float multiplier, Element** stopElement);
+
</ins><span class="cx">     bool fixedElementLaysOutRelativeToFrame(const FrameView&amp;) const;
</span><span class="cx"> 
</span><span class="cx">     bool includeVerticalScrollbarSize() const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderFlowThreadcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (163017 => 163018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp        2014-01-29 14:52:22 UTC (rev 163017)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp        2014-01-29 15:20:56 UTC (rev 163018)
</span><span class="lines">@@ -460,7 +460,29 @@
</span><span class="cx">         return region;
</span><span class="cx">     return region ? clampBox-&gt;clampToStartAndEndRegions(region) : 0;
</span><span class="cx"> }
</span><del>-    
</del><ins>+
+RenderRegion* RenderFlowThread::regionFromAbsolutePointAndBox(const IntPoint&amp; absolutePoint, const RenderBox&amp; flowedBox)
+{
+    RenderRegion* startRegion = nullptr;
+    RenderRegion* endRegion = nullptr;
+    getRegionRangeForBox(&amp;flowedBox, startRegion, endRegion);
+
+    if (!startRegion)
+        return nullptr;
+
+    for (auto iter = m_regionList.find(startRegion), end = m_regionList.end(); iter != end; ++iter) {
+        RenderRegion* region = *iter;
+        IntRect regionAbsoluteRect(roundedIntPoint(region-&gt;localToAbsolute()), roundedIntSize(region-&gt;frameRect().size()));
+        if (regionAbsoluteRect.contains(absolutePoint))
+            return region;
+
+        if (region == endRegion)
+            break;
+    }
+
+    return nullptr;
+}
+
</ins><span class="cx"> LayoutPoint RenderFlowThread::adjustedPositionRelativeToOffsetParent(const RenderBoxModelObject&amp; boxModelObject, const LayoutPoint&amp; startPoint)
</span><span class="cx"> {
</span><span class="cx">     LayoutPoint referencePoint = startPoint;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderFlowThreadh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderFlowThread.h (163017 => 163018)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderFlowThread.h        2014-01-29 14:52:22 UTC (rev 163017)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.h        2014-01-29 15:20:56 UTC (rev 163018)
</span><span class="lines">@@ -115,6 +115,8 @@
</span><span class="cx"> 
</span><span class="cx">     RenderRegion* regionAtBlockOffset(const RenderBox*, LayoutUnit, bool extendLastRegion = false, RegionAutoGenerationPolicy = AllowRegionAutoGeneration);
</span><span class="cx"> 
</span><ins>+    RenderRegion* regionFromAbsolutePointAndBox(const IntPoint&amp;, const RenderBox&amp; flowedBox);
+
</ins><span class="cx">     bool regionsHaveUniformLogicalWidth() const { return m_regionsHaveUniformLogicalWidth; }
</span><span class="cx">     bool regionsHaveUniformLogicalHeight() const { return m_regionsHaveUniformLogicalHeight; }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>