<!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>[183597] 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/183597">183597</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2015-04-29 17:46:40 -0700 (Wed, 29 Apr 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Compute the non-fast-scrollable region in main-document coordinates
https://bugs.webkit.org/show_bug.cgi?id=144420

Reviewed by Tim Horton.

Source/WebCore:

Compute the non-fast-scrollable region in document coordinates, to make it easier
to reason about. Previously, it was document coordinates offset by top content inset.

* page/DebugPageOverlays.cpp:
(WebCore::MouseWheelRegionOverlay::updateRegion): Traverse all frames to compute the wheel
event handler region, mapping each to root view coords, and then mapping back into document
coords at the end.
(WebCore::NonFastScrollableRegionOverlay::updateRegion): No offset needed here; the
overlay and region are both document coordinates.
* page/FrameView.h: Make some mapping function overrides public, and expose widgetsInRenderTree().
* page/Page.cpp:
(WebCore::Page::nonFastScrollableRects): Remove frame argument.
* page/Page.h:
* page/PageOverlay.cpp:
(WebCore::PageOverlay::bounds):
(WebCore::PageOverlay::viewToOverlayOffset): Convenience function to map between
view and overlay coordinates.
* page/PageOverlay.h:
* page/scrolling/AsyncScrollingCoordinator.cpp: New computeNonFastScrollableRegion() signature.
(WebCore::AsyncScrollingCoordinator::updateNonFastScrollableRegion):
(WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
(WebCore::AsyncScrollingCoordinator::scrollingStateTreeAsText):
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::absoluteNonFastScrollableRegionForFrame): This function
recurses on frames, computing an absolute (document-relative) region per frame. This
removes the confusing offsetting through top content inset.
Change how we get to plugins that want wheel events; we can't get from PluginViewBase
to renderers, so use FrameView's list of Widgets, and their RenderWidgets. This fixes
regions for transformed plugin-ins.
For subframes, we get a region in the subframe's document coords. Map to that sub-frame,
then to our frame, then to our document.
(WebCore::ScrollingCoordinator::absoluteNonFastScrollableRegion): Wrapper that hides
the recursive function.
(WebCore::ScrollingCoordinator::computeNonFastScrollableRegion): Deleted.
* page/scrolling/ScrollingCoordinator.h:
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::shouldHandleWheelEventSynchronously): Map the event point
from view coordinates to document coordinates for testing against the non-fast region.
We previously assert that the root note is a FrameScrolling node.
* page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
(WebCore::ScrollingTreeFrameScrollingNode::viewToContentsOffset): Similar to ScrollView::viewToContents()
for the scrolling tree.
* page/scrolling/ScrollingTreeFrameScrollingNode.h:
* testing/Internals.cpp:
(WebCore::Internals::nonFastScrollableRects): No need for frame arg.

LayoutTests:

We now report the non-fast region in document coordinates, so these two results change.

* platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/top-content-inset-expected.txt:
* platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/top-content-inset-header-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2tileddrawingscrollingnonfastregiontopcontentinsetexpectedtxt">trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/top-content-inset-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2tileddrawingscrollingnonfastregiontopcontentinsetheaderexpectedtxt">trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/top-content-inset-header-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageDebugPageOverlayscpp">trunk/Source/WebCore/page/DebugPageOverlays.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewh">trunk/Source/WebCore/page/FrameView.h</a></li>
<li><a href="#trunkSourceWebCorepagePagecpp">trunk/Source/WebCore/page/Page.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageh">trunk/Source/WebCore/page/Page.h</a></li>
<li><a href="#trunkSourceWebCorepagePageOverlaycpp">trunk/Source/WebCore/page/PageOverlay.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageOverlayh">trunk/Source/WebCore/page/PageOverlay.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorcpp">trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingCoordinatorcpp">trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingCoordinatorh">trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreecpp">trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreeFrameScrollingNodecpp">trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreeFrameScrollingNodeh">trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (183596 => 183597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-04-30 00:40:36 UTC (rev 183596)
+++ trunk/LayoutTests/ChangeLog        2015-04-30 00:46:40 UTC (rev 183597)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-04-29  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Compute the non-fast-scrollable region in main-document coordinates
+        https://bugs.webkit.org/show_bug.cgi?id=144420
+
+        Reviewed by Tim Horton.
+
+        We now report the non-fast region in document coordinates, so these two results change.
+
+        * platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/top-content-inset-expected.txt:
+        * platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/top-content-inset-header-expected.txt:
+
</ins><span class="cx"> 2015-04-29  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         NodeList has issues with Symbol and empty string
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2tileddrawingscrollingnonfastregiontopcontentinsetexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/top-content-inset-expected.txt (183596 => 183597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/top-content-inset-expected.txt        2015-04-30 00:40:36 UTC (rev 183596)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/top-content-inset-expected.txt        2015-04-30 00:46:40 UTC (rev 183597)
</span><span class="lines">@@ -1,3 +1,3 @@
</span><span class="cx"> Wheel event rect:
</span><span class="cx"> 
</span><del>-28, 110 - 128, 210
</del><ins>+28, 50 - 128, 150
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2tileddrawingscrollingnonfastregiontopcontentinsetheaderexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/top-content-inset-header-expected.txt (183596 => 183597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/top-content-inset-header-expected.txt        2015-04-30 00:40:36 UTC (rev 183596)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/top-content-inset-header-expected.txt        2015-04-30 00:46:40 UTC (rev 183597)
</span><span class="lines">@@ -1,3 +1,3 @@
</span><span class="cx"> Wheel event rect:
</span><span class="cx"> 
</span><del>-28, 110 - 128, 210
</del><ins>+28, 50 - 128, 150
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (183596 => 183597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-04-30 00:40:36 UTC (rev 183596)
+++ trunk/Source/WebCore/ChangeLog        2015-04-30 00:46:40 UTC (rev 183597)
</span><span class="lines">@@ -1,3 +1,56 @@
</span><ins>+2015-04-29  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Compute the non-fast-scrollable region in main-document coordinates
+        https://bugs.webkit.org/show_bug.cgi?id=144420
+
+        Reviewed by Tim Horton.
+
+        Compute the non-fast-scrollable region in document coordinates, to make it easier
+        to reason about. Previously, it was document coordinates offset by top content inset.
+
+        * page/DebugPageOverlays.cpp:
+        (WebCore::MouseWheelRegionOverlay::updateRegion): Traverse all frames to compute the wheel
+        event handler region, mapping each to root view coords, and then mapping back into document
+        coords at the end.
+        (WebCore::NonFastScrollableRegionOverlay::updateRegion): No offset needed here; the
+        overlay and region are both document coordinates.
+        * page/FrameView.h: Make some mapping function overrides public, and expose widgetsInRenderTree().
+        * page/Page.cpp:
+        (WebCore::Page::nonFastScrollableRects): Remove frame argument.
+        * page/Page.h:
+        * page/PageOverlay.cpp:
+        (WebCore::PageOverlay::bounds):
+        (WebCore::PageOverlay::viewToOverlayOffset): Convenience function to map between
+        view and overlay coordinates.
+        * page/PageOverlay.h:
+        * page/scrolling/AsyncScrollingCoordinator.cpp: New computeNonFastScrollableRegion() signature.
+        (WebCore::AsyncScrollingCoordinator::updateNonFastScrollableRegion):
+        (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
+        (WebCore::AsyncScrollingCoordinator::scrollingStateTreeAsText):
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::absoluteNonFastScrollableRegionForFrame): This function
+        recurses on frames, computing an absolute (document-relative) region per frame. This
+        removes the confusing offsetting through top content inset.
+        Change how we get to plugins that want wheel events; we can't get from PluginViewBase
+        to renderers, so use FrameView's list of Widgets, and their RenderWidgets. This fixes
+        regions for transformed plugin-ins.
+        For subframes, we get a region in the subframe's document coords. Map to that sub-frame,
+        then to our frame, then to our document.
+        (WebCore::ScrollingCoordinator::absoluteNonFastScrollableRegion): Wrapper that hides
+        the recursive function.
+        (WebCore::ScrollingCoordinator::computeNonFastScrollableRegion): Deleted.
+        * page/scrolling/ScrollingCoordinator.h:
+        * page/scrolling/ScrollingTree.cpp:
+        (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously): Map the event point
+        from view coordinates to document coordinates for testing against the non-fast region.
+        We previously assert that the root note is a FrameScrolling node.
+        * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
+        (WebCore::ScrollingTreeFrameScrollingNode::viewToContentsOffset): Similar to ScrollView::viewToContents()
+        for the scrolling tree.
+        * page/scrolling/ScrollingTreeFrameScrollingNode.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::nonFastScrollableRects): No need for frame arg.
+
</ins><span class="cx"> 2015-04-29  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Expand test infrastructure to support scrolling tests
</span></span></pre></div>
<a id="trunkSourceWebCorepageDebugPageOverlayscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DebugPageOverlays.cpp (183596 => 183597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DebugPageOverlays.cpp        2015-04-30 00:40:36 UTC (rev 183596)
+++ trunk/Source/WebCore/page/DebugPageOverlays.cpp        2015-04-30 00:46:40 UTC (rev 183597)
</span><span class="lines">@@ -90,8 +90,22 @@
</span><span class="cx"> 
</span><span class="cx"> bool MouseWheelRegionOverlay::updateRegion()
</span><span class="cx"> {
</span><del>-    std::unique_ptr&lt;Region&gt; region = std::make_unique&lt;Region&gt;(m_frame.document()-&gt;absoluteRegionForEventTargets(m_frame.document()-&gt;wheelEventTargets()).first);
</del><ins>+    std::unique_ptr&lt;Region&gt; region = std::make_unique&lt;Region&gt;();
+    
+    for (const Frame* frame = &amp;m_frame; frame; frame = frame-&gt;tree().traverseNext()) {
+        if (!frame-&gt;view() || !frame-&gt;document())
+            continue;
</ins><span class="cx"> 
</span><ins>+        Document::RegionFixedPair frameRegion = frame-&gt;document()-&gt;absoluteRegionForEventTargets(frame-&gt;document()-&gt;wheelEventTargets());
+    
+        IntPoint frameOffset = frame-&gt;view()-&gt;contentsToRootView(IntPoint());
+        frameRegion.first.translate(toIntSize(frameOffset));
+        
+        region-&gt;unite(frameRegion.first);
+    }
+    
+    region-&gt;translate(m_overlay-&gt;viewToOverlayOffset());
+
</ins><span class="cx">     bool regionChanged = !m_region || !(*m_region == *region);
</span><span class="cx">     m_region = WTF::move(region);
</span><span class="cx">     return regionChanged;
</span><span class="lines">@@ -119,12 +133,9 @@
</span><span class="cx"> 
</span><span class="cx">     if (Page* page = m_frame.page()) {
</span><span class="cx">         if (ScrollingCoordinator* scrollingCoordinator = page-&gt;scrollingCoordinator())
</span><del>-            *region = scrollingCoordinator-&gt;computeNonFastScrollableRegion(m_frame, IntPoint());
</del><ins>+            *region = scrollingCoordinator-&gt;absoluteNonFastScrollableRegion();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // computeNonFastScrollableRegion() applies topContentInset.
-    region-&gt;translate(IntSize(0, -m_frame.view()-&gt;topContentInset()));
-
</del><span class="cx">     bool regionChanged = !m_region || !(*m_region == *region);
</span><span class="cx">     m_region = WTF::move(region);
</span><span class="cx">     return regionChanged;
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.h (183596 => 183597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.h        2015-04-30 00:40:36 UTC (rev 183596)
+++ trunk/Source/WebCore/page/FrameView.h        2015-04-30 00:46:40 UTC (rev 183597)
</span><span class="lines">@@ -402,6 +402,12 @@
</span><span class="cx">     WEBCORE_EXPORT IntPoint convertFromRendererToContainingView(const RenderElement*, const IntPoint&amp;) const;
</span><span class="cx">     WEBCORE_EXPORT IntPoint convertFromContainingViewToRenderer(const RenderElement*, const IntPoint&amp;) const;
</span><span class="cx"> 
</span><ins>+    // Override ScrollView methods to do point conversion via renderers, in order to take transforms into account.
+    virtual IntRect convertToContainingView(const IntRect&amp;) const override;
+    virtual IntRect convertFromContainingView(const IntRect&amp;) const override;
+    virtual IntPoint convertToContainingView(const IntPoint&amp;) const override;
+    virtual IntPoint convertFromContainingView(const IntPoint&amp;) const override;
+
</ins><span class="cx">     bool isFrameViewScrollCorner(RenderScrollbarPart* scrollCorner) const { return m_scrollCorner == scrollCorner; }
</span><span class="cx"> 
</span><span class="cx">     // isScrollable() takes an optional Scrollability parameter that allows the caller to define what they mean by 'scrollable.'
</span><span class="lines">@@ -508,6 +514,8 @@
</span><span class="cx">     void didAddWidgetToRenderTree(Widget&amp;);
</span><span class="cx">     void willRemoveWidgetFromRenderTree(Widget&amp;);
</span><span class="cx"> 
</span><ins>+    const HashSet&lt;Widget*&gt;&amp; widgetsInRenderTree() const { return m_widgetsInRenderTree; }
+
</ins><span class="cx">     void addTrackedRepaintRect(const FloatRect&amp;);
</span><span class="cx"> 
</span><span class="cx">     // exposedRect represents WebKit's understanding of what part
</span><span class="lines">@@ -588,13 +596,6 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void delegatesScrollingDidChange() override;
</span><span class="cx"> 
</span><del>-    // Override ScrollView methods to do point conversion via renderers, in order to
-    // take transforms into account.
-    virtual IntRect convertToContainingView(const IntRect&amp;) const override;
-    virtual IntRect convertFromContainingView(const IntRect&amp;) const override;
-    virtual IntPoint convertToContainingView(const IntPoint&amp;) const override;
-    virtual IntPoint convertFromContainingView(const IntPoint&amp;) const override;
-
</del><span class="cx">     // ScrollableArea interface
</span><span class="cx">     virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&amp;) override;
</span><span class="cx">     virtual void scrollTo(const IntSize&amp;) override;
</span></span></pre></div>
<a id="trunkSourceWebCorepagePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.cpp (183596 => 183597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.cpp        2015-04-30 00:40:36 UTC (rev 183596)
+++ trunk/Source/WebCore/page/Page.cpp        2015-04-30 00:46:40 UTC (rev 183597)
</span><span class="lines">@@ -369,18 +369,19 @@
</span><span class="cx">     return String();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref&lt;ClientRectList&gt; Page::nonFastScrollableRects(const Frame&amp; frame)
</del><ins>+Ref&lt;ClientRectList&gt; Page::nonFastScrollableRects()
</ins><span class="cx"> {
</span><span class="cx">     if (Document* document = m_mainFrame-&gt;document())
</span><span class="cx">         document-&gt;updateLayout();
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;IntRect&gt; rects;
</span><span class="cx">     if (ScrollingCoordinator* scrollingCoordinator = this-&gt;scrollingCoordinator())
</span><del>-        rects = scrollingCoordinator-&gt;computeNonFastScrollableRegion(frame, IntPoint()).rects();
</del><ins>+        rects = scrollingCoordinator-&gt;absoluteNonFastScrollableRegion().rects();
</ins><span class="cx"> 
</span><span class="cx">     Vector&lt;FloatQuad&gt; quads(rects.size());
</span><span class="cx">     for (size_t i = 0; i &lt; rects.size(); ++i)
</span><span class="cx">         quads[i] = FloatRect(rects[i]);
</span><ins>+
</ins><span class="cx">     return ClientRectList::create(quads);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.h (183596 => 183597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.h        2015-04-30 00:40:36 UTC (rev 183596)
+++ trunk/Source/WebCore/page/Page.h        2015-04-30 00:46:40 UTC (rev 183597)
</span><span class="lines">@@ -196,7 +196,7 @@
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT String scrollingStateTreeAsText();
</span><span class="cx">     WEBCORE_EXPORT String synchronousScrollingReasonsAsText();
</span><del>-    WEBCORE_EXPORT Ref&lt;ClientRectList&gt; nonFastScrollableRects(const Frame&amp;);
</del><ins>+    WEBCORE_EXPORT Ref&lt;ClientRectList&gt; nonFastScrollableRects();
</ins><span class="cx"> 
</span><span class="cx">     Settings&amp; settings() const { return *m_settings; }
</span><span class="cx">     ProgressTracker&amp; progress() const { return *m_progress; }
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageOverlaycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageOverlay.cpp (183596 => 183597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageOverlay.cpp        2015-04-30 00:40:36 UTC (rev 183596)
+++ trunk/Source/WebCore/page/PageOverlay.cpp        2015-04-30 00:46:40 UTC (rev 183597)
</span><span class="lines">@@ -101,7 +101,7 @@
</span><span class="cx">     }
</span><span class="cx">     case OverlayType::Document:
</span><span class="cx">         return IntRect(IntPoint(), frameView-&gt;contentsSize());
</span><del>-    };
</del><ins>+    }
</ins><span class="cx"> 
</span><span class="cx">     ASSERT_NOT_REACHED();
</span><span class="cx">     return IntRect(IntPoint(), frameView-&gt;contentsSize());
</span><span class="lines">@@ -126,6 +126,20 @@
</span><span class="cx">         pageOverlayController-&gt;didChangeOverlayFrame(*this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+IntSize PageOverlay::viewToOverlayOffset() const
+{
+    switch (m_overlayType) {
+    case OverlayType::View:
+        return IntSize();
+
+    case OverlayType::Document: {
+        FrameView* frameView = m_page-&gt;mainFrame().view();
+        return frameView ? toIntSize(frameView-&gt;viewToContents(IntPoint())) : IntSize();
+    }
+    }
+    return IntSize();
+}
+
</ins><span class="cx"> void PageOverlay::setBackgroundColor(RGBA32 backgroundColor)
</span><span class="cx"> {
</span><span class="cx">     if (m_backgroundColor == backgroundColor)
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageOverlayh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageOverlay.h (183596 => 183597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageOverlay.h        2015-04-30 00:40:36 UTC (rev 183596)
+++ trunk/Source/WebCore/page/PageOverlay.h        2015-04-30 00:46:40 UTC (rev 183597)
</span><span class="lines">@@ -105,6 +105,8 @@
</span><span class="cx">     WEBCORE_EXPORT IntRect frame() const;
</span><span class="cx">     WEBCORE_EXPORT void setFrame(IntRect);
</span><span class="cx"> 
</span><ins>+    WEBCORE_EXPORT IntSize viewToOverlayOffset() const;
+
</ins><span class="cx">     RGBA32 backgroundColor() const { return m_backgroundColor; }
</span><span class="cx">     void setBackgroundColor(RGBA32);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (183596 => 183597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp        2015-04-30 00:40:36 UTC (rev 183596)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp        2015-04-30 00:46:40 UTC (rev 183597)
</span><span class="lines">@@ -95,7 +95,7 @@
</span><span class="cx">     if (!m_scrollingStateTree-&gt;rootStateNode())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_scrollingStateTree-&gt;rootStateNode()-&gt;setNonFastScrollableRegion(computeNonFastScrollableRegion(m_page-&gt;mainFrame(), IntPoint()));
</del><ins>+    m_scrollingStateTree-&gt;rootStateNode()-&gt;setNonFastScrollableRegion(absoluteNonFastScrollableRegion());
</ins><span class="cx">     m_nonFastScrollableRegionDirty = false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -113,7 +113,7 @@
</span><span class="cx">     // frame view whose layout was updated is not the main frame.
</span><span class="cx">     // In the future, we may want to have the ability to set non-fast scrolling regions for more than
</span><span class="cx">     // just the root node. But right now, this concept only applies to the root.
</span><del>-    m_scrollingStateTree-&gt;rootStateNode()-&gt;setNonFastScrollableRegion(computeNonFastScrollableRegion(m_page-&gt;mainFrame(), IntPoint()));
</del><ins>+    m_scrollingStateTree-&gt;rootStateNode()-&gt;setNonFastScrollableRegion(absoluteNonFastScrollableRegion());
</ins><span class="cx">     m_nonFastScrollableRegionDirty = false;
</span><span class="cx"> 
</span><span class="cx">     if (!coordinatesScrollingForFrameView(frameView))
</span><span class="lines">@@ -544,7 +544,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (m_scrollingStateTree-&gt;rootStateNode()) {
</span><span class="cx">         if (m_nonFastScrollableRegionDirty)
</span><del>-            m_scrollingStateTree-&gt;rootStateNode()-&gt;setNonFastScrollableRegion(computeNonFastScrollableRegion(m_page-&gt;mainFrame(), IntPoint()));
</del><ins>+            m_scrollingStateTree-&gt;rootStateNode()-&gt;setNonFastScrollableRegion(absoluteNonFastScrollableRegion());
</ins><span class="cx">         return m_scrollingStateTree-&gt;rootStateNode()-&gt;scrollingStateTreeAsText();
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingCoordinatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (183596 => 183597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp        2015-04-30 00:40:36 UTC (rev 183596)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp        2015-04-30 00:46:40 UTC (rev 183597)
</span><span class="lines">@@ -95,7 +95,7 @@
</span><span class="cx">     return renderView-&gt;usesCompositing();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Region ScrollingCoordinator::computeNonFastScrollableRegion(const Frame&amp; frame, const IntPoint&amp; frameLocation) const
</del><ins>+Region ScrollingCoordinator::absoluteNonFastScrollableRegionForFrame(const Frame&amp; frame) const
</ins><span class="cx"> {
</span><span class="cx">     RenderView* renderView = frame.contentRenderer();
</span><span class="cx">     if (!renderView || renderView-&gt;documentBeingDestroyed())
</span><span class="lines">@@ -128,34 +128,44 @@
</span><span class="cx">     // FIXME: should ASSERT(!frameView-&gt;needsLayout()) here, but need to fix DebugPageOverlays
</span><span class="cx">     // to not ask for regions at bad times.
</span><span class="cx"> 
</span><del>-    IntPoint offset = frameLocation;
-    offset.moveBy(frameView-&gt;frameRect().location());
-    offset.move(0, frameView-&gt;topContentInset());
-
</del><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 class="cx">             ScrollableArea* scrollableArea = *it;
</span><span class="cx">             // Composited scrollable areas can be scrolled off the main thread.
</span><span class="cx">             if (scrollableArea-&gt;usesAsyncScrolling())
</span><span class="cx">                 continue;
</span><ins>+
</ins><span class="cx">             IntRect box = scrollableArea-&gt;scrollableAreaBoundingBox();
</span><del>-            box.moveBy(offset);
</del><span class="cx">             nonFastScrollableRegion.unite(box);
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    for (const auto&amp; child : frameView-&gt;children()) {
-        if (!is&lt;PluginViewBase&gt;(*child))
</del><ins>+    for (auto&amp; widget : frameView-&gt;widgetsInRenderTree()) {
+        RenderWidget* renderWidget = RenderWidget::find(widget);
+        if (!renderWidget || !is&lt;PluginViewBase&gt;(*widget))
</ins><span class="cx">             continue;
</span><del>-        PluginViewBase&amp; pluginViewBase = downcast&lt;PluginViewBase&gt;(*child);
-        if (pluginViewBase.wantsWheelEvents())
-            nonFastScrollableRegion.unite(pluginViewBase.frameRect());
</del><ins>+    
+        if (downcast&lt;PluginViewBase&gt;(*widget).wantsWheelEvents())
+            nonFastScrollableRegion.unite(renderWidget-&gt;absoluteBoundingBoxRect());
</ins><span class="cx">     }
</span><ins>+    
+    // FIXME: if we've already accounted for this subframe as a scrollable area, we can avoid recursing into it here.
+    for (Frame* subframe = frame.tree().firstChild(); subframe; subframe = subframe-&gt;tree().nextSibling()) {
+        FrameView* subframeView = subframe-&gt;view();
+        if (!subframeView)
+            continue;
</ins><span class="cx"> 
</span><del>-    for (Frame* subframe = frame.tree().firstChild(); subframe; subframe = subframe-&gt;tree().nextSibling())
-        nonFastScrollableRegion.unite(computeNonFastScrollableRegion(*subframe, offset));
</del><ins>+        Region subframeRegion = absoluteNonFastScrollableRegionForFrame(*subframe);
+        // Map from the frame document to our document.
+        IntPoint offset = subframeView-&gt;contentsToView(IntPoint());
+        offset = subframeView-&gt;convertToContainingView(offset);
+        offset = frameView-&gt;viewToContents(offset);
</ins><span class="cx"> 
</span><del>-    // Include wheel event handler region for the main frame.
</del><ins>+        // FIXME: this translation ignores non-trival transforms on the frame.
+        subframeRegion.translate(toIntSize(offset));
+        nonFastScrollableRegion.unite(subframeRegion);
+    }
+
</ins><span class="cx">     Document::RegionFixedPair wheelHandlerRegion = frame.document()-&gt;absoluteRegionForEventTargets(frame.document()-&gt;wheelEventTargets());
</span><span class="cx">     bool wheelHandlerInFixedContent = wheelHandlerRegion.second;
</span><span class="cx">     if (wheelHandlerInFixedContent) {
</span><span class="lines">@@ -165,13 +175,19 @@
</span><span class="cx">         bool inFixed;
</span><span class="cx">         wheelHandlerRegion.first.unite(enclosingIntRect(frame.document()-&gt;absoluteEventHandlerBounds(inFixed)));
</span><span class="cx">     }
</span><del>-    wheelHandlerRegion.first.translate(toIntSize(offset));
</del><ins>+    
</ins><span class="cx">     nonFastScrollableRegion.unite(wheelHandlerRegion.first);
</span><span class="cx"> 
</span><ins>+    // FIXME: If this is not the main frame, we could clip the region to the frame's bounds.
</ins><span class="cx">     return nonFastScrollableRegion;
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Region ScrollingCoordinator::absoluteNonFastScrollableRegion() const
+{
+    return absoluteNonFastScrollableRegionForFrame(m_page-&gt;mainFrame());
+}
+
</ins><span class="cx"> void ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange(FrameView&amp; frameView)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingCoordinatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (183596 => 183597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h        2015-04-30 00:40:36 UTC (rev 183596)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h        2015-04-30 00:46:40 UTC (rev 183597)
</span><span class="lines">@@ -199,7 +199,7 @@
</span><span class="cx">     static String synchronousScrollingReasonsAsText(SynchronousScrollingReasons);
</span><span class="cx">     String synchronousScrollingReasonsAsText() const;
</span><span class="cx"> 
</span><del>-    Region computeNonFastScrollableRegion(const Frame&amp;, const IntPoint&amp; frameLocation) const;
</del><ins>+    Region absoluteNonFastScrollableRegion() const;
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     explicit ScrollingCoordinator(Page*);
</span><span class="lines">@@ -223,6 +223,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool hasVisibleSlowRepaintViewportConstrainedObjects(const FrameView&amp;) const;
</span><span class="cx">     void updateSynchronousScrollingReasons(FrameView&amp;);
</span><ins>+
+    Region absoluteNonFastScrollableRegionForFrame(const Frame&amp;) const;
</ins><span class="cx">     
</span><span class="cx">     bool m_forceSynchronousScrollLayerPositionUpdates { false };
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (183596 => 183597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp        2015-04-30 00:40:36 UTC (rev 183596)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp        2015-04-30 00:46:40 UTC (rev 183597)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;PlatformWheelEvent.h&quot;
</span><span class="cx"> #include &quot;ScrollingStateTree.h&quot;
</span><ins>+#include &quot;ScrollingTreeFrameScrollingNode.h&quot;
</ins><span class="cx"> #include &quot;ScrollingTreeNode.h&quot;
</span><span class="cx"> #include &quot;ScrollingTreeOverflowScrollingNode.h&quot;
</span><span class="cx"> #include &quot;ScrollingTreeScrollingNode.h&quot;
</span><span class="lines">@@ -72,10 +73,11 @@
</span><span class="cx">     if (shouldSetLatch)
</span><span class="cx">         m_latchedNode = 0;
</span><span class="cx">     
</span><del>-    if (!m_nonFastScrollableRegion.isEmpty()) {
</del><ins>+    if (!m_nonFastScrollableRegion.isEmpty() &amp;&amp; m_rootNode) {
+        ScrollingTreeFrameScrollingNode&amp; frameScrollingNode = downcast&lt;ScrollingTreeFrameScrollingNode&gt;(*m_rootNode);
</ins><span class="cx">         // FIXME: This is not correct for non-default scroll origins.
</span><span class="cx">         FloatPoint position = wheelEvent.position();
</span><del>-        position.moveBy(m_mainFrameScrollPosition);
</del><ins>+        position.move(frameScrollingNode.viewToContentsOffset(m_mainFrameScrollPosition));
</ins><span class="cx">         if (m_nonFastScrollableRegion.contains(roundedIntPoint(position)))
</span><span class="cx">             return true;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreeFrameScrollingNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp (183596 => 183597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp        2015-04-30 00:40:36 UTC (rev 183596)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp        2015-04-30 00:46:40 UTC (rev 183597)
</span><span class="lines">@@ -92,6 +92,11 @@
</span><span class="cx">     setScrollPositionWithoutContentEdgeConstraints(newScrollPosition);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+FloatSize ScrollingTreeFrameScrollingNode::viewToContentsOffset(const FloatPoint&amp; scrollOffset) const
+{
+    return toFloatSize(scrollOffset) - FloatSize(0, headerHeight() + topContentInset());
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(ASYNC_SCROLLING)
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreeFrameScrollingNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h (183596 => 183597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h        2015-04-30 00:40:36 UTC (rev 183596)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h        2015-04-30 00:46:40 UTC (rev 183597)
</span><span class="lines">@@ -55,6 +55,8 @@
</span><span class="cx">     SynchronousScrollingReasons synchronousScrollingReasons() const { return m_synchronousScrollingReasons; }
</span><span class="cx">     bool shouldUpdateScrollLayerPositionSynchronously() const { return m_synchronousScrollingReasons; }
</span><span class="cx"> 
</span><ins>+    FloatSize viewToContentsOffset(const FloatPoint&amp; scrollOffset) const;
+
</ins><span class="cx"> protected:
</span><span class="cx">     ScrollingTreeFrameScrollingNode(ScrollingTree&amp;, ScrollingNodeID);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (183596 => 183597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2015-04-30 00:40:36 UTC (rev 183596)
+++ trunk/Source/WebCore/testing/Internals.cpp        2015-04-30 00:46:40 UTC (rev 183597)
</span><span class="lines">@@ -1797,7 +1797,7 @@
</span><span class="cx">     if (!page)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    return page-&gt;nonFastScrollableRects(*document-&gt;frame());
</del><ins>+    return page-&gt;nonFastScrollableRects();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Internals::garbageCollectDocumentResources(ExceptionCode&amp; ec) const
</span></span></pre>
</div>
</div>

</body>
</html>