<!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>[194477] trunk/Source</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/194477">194477</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2015-12-31 19:17:31 -0800 (Thu, 31 Dec 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Rename documentScrollOffsetRelativeTo* functions
https://bugs.webkit.org/show_bug.cgi?id=152632

Reviewed by Zalan Bujtas.

ScrollView::documentScrollOffsetRelativeTo* functions return scroll positions,
not offsets, so rename them and fix their return types, and fix callers. Make
their code more similar.

Source/WebCore:

* platform/ScrollView.cpp:
(WebCore::ScrollView::documentScrollPositionRelativeToViewOrigin):
(WebCore::ScrollView::documentScrollPositionRelativeToScrollableAreaOrigin):
(WebCore::ScrollView::viewToContents):
(WebCore::ScrollView::contentsToView):
(WebCore::ScrollView::documentScrollOffsetRelativeToViewOrigin): Deleted.
(WebCore::ScrollView::documentScrollOffsetRelativeToScrollableAreaOrigin): Deleted.
* platform/ScrollView.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):

Source/WebKit2:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::determinePrimarySnapshottedPlugIn):
(WebKit::WebPage::plugInIntersectsSearchRect):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollViewcpp">trunk/Source/WebCore/platform/ScrollView.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollViewh">trunk/Source/WebCore/platform/ScrollView.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxModelObjectcpp">trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (194476 => 194477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-01-01 03:16:11 UTC (rev 194476)
+++ trunk/Source/WebCore/ChangeLog        2016-01-01 03:17:31 UTC (rev 194477)
</span><span class="lines">@@ -1,5 +1,29 @@
</span><span class="cx"> 2015-12-31  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Rename documentScrollOffsetRelativeTo* functions
+        https://bugs.webkit.org/show_bug.cgi?id=152632
+
+        Reviewed by Zalan Bujtas.
+
+        ScrollView::documentScrollOffsetRelativeTo* functions return scroll positions,
+        not offsets, so rename them and fix their return types, and fix callers. Make
+        their code more similar.
+
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::documentScrollPositionRelativeToViewOrigin):
+        (WebCore::ScrollView::documentScrollPositionRelativeToScrollableAreaOrigin):
+        (WebCore::ScrollView::viewToContents):
+        (WebCore::ScrollView::contentsToView):
+        (WebCore::ScrollView::documentScrollOffsetRelativeToViewOrigin): Deleted.
+        (WebCore::ScrollView::documentScrollOffsetRelativeToScrollableAreaOrigin): Deleted.
+        * platform/ScrollView.h:
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::scrollRectToVisible):
+
+2015-12-31  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
</ins><span class="cx">         [iOS WK2] Fix incorrect scrollPosition handling
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=152630
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollView.cpp (194476 => 194477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollView.cpp        2016-01-01 03:16:11 UTC (rev 194476)
+++ trunk/Source/WebCore/platform/ScrollView.cpp        2016-01-01 03:17:31 UTC (rev 194477)
</span><span class="lines">@@ -402,22 +402,16 @@
</span><span class="cx">     return scrollPoint.constrainedBetween(minimumScrollPosition(), maximumScrollPosition());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IntSize ScrollView::documentScrollOffsetRelativeToViewOrigin() const
</del><ins>+ScrollPosition ScrollView::documentScrollPositionRelativeToViewOrigin() const
</ins><span class="cx"> {
</span><del>-    return toIntSize(scrollPosition()) - IntSize(0, headerHeight() + topContentInset(TopContentInsetType::WebCoreOrPlatformContentInset));
</del><ins>+    return scrollPosition() - IntSize(0, headerHeight() + topContentInset(TopContentInsetType::WebCoreOrPlatformContentInset));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-IntPoint ScrollView::documentScrollPositionRelativeToViewOrigin() const
</del><ins>+ScrollPosition ScrollView::documentScrollPositionRelativeToScrollableAreaOrigin() const
</ins><span class="cx"> {
</span><del>-    IntPoint scrollPosition = this-&gt;scrollPosition();
-    return IntPoint(scrollPosition.x(), scrollPosition.y() - headerHeight() - topContentInset(TopContentInsetType::WebCoreOrPlatformContentInset));
</del><ins>+    return scrollPosition() - IntSize(0, headerHeight());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-IntSize ScrollView::documentScrollOffsetRelativeToScrollableAreaOrigin() const
-{
-    return toIntSize(scrollPosition()) - IntSize(0, headerHeight());
-}
-
</del><span class="cx"> int ScrollView::scrollSize(ScrollbarOrientation orientation) const
</span><span class="cx"> {
</span><span class="cx">     // If no scrollbars are present, it does not indicate content is not be scrollable.
</span><span class="lines">@@ -841,23 +835,23 @@
</span><span class="cx"> 
</span><span class="cx"> IntPoint ScrollView::viewToContents(const IntPoint&amp; point) const
</span><span class="cx"> {
</span><del>-    return point + documentScrollOffsetRelativeToViewOrigin();
</del><ins>+    return point + toIntSize(documentScrollPositionRelativeToViewOrigin());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> IntPoint ScrollView::contentsToView(const IntPoint&amp; point) const
</span><span class="cx"> {
</span><del>-    return point - documentScrollOffsetRelativeToViewOrigin();
</del><ins>+    return point - toIntSize(documentScrollPositionRelativeToViewOrigin());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> IntRect ScrollView::viewToContents(IntRect rect) const
</span><span class="cx"> {
</span><del>-    rect.move(documentScrollOffsetRelativeToViewOrigin());
</del><ins>+    rect.moveBy(documentScrollPositionRelativeToViewOrigin());
</ins><span class="cx">     return rect;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> IntRect ScrollView::contentsToView(IntRect rect) const
</span><span class="cx"> {
</span><del>-    rect.move(-documentScrollOffsetRelativeToViewOrigin());
</del><ins>+    rect.moveBy(-documentScrollPositionRelativeToViewOrigin());
</ins><span class="cx">     return rect;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollView.h (194476 => 194477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollView.h        2016-01-01 03:16:11 UTC (rev 194476)
+++ trunk/Source/WebCore/platform/ScrollView.h        2016-01-01 03:17:31 UTC (rev 194477)
</span><span class="lines">@@ -248,18 +248,17 @@
</span><span class="cx">     // scrollOffset() anchors its (0,0) point at the ScrollableArea's origin. When the Page has a
</span><span class="cx">     // header, the header is positioned at (0,0), ABOVE the start of the Document. So when a page with
</span><span class="cx">     // a header is pinned to the top, the scrollOffset() is (0,0), but the Document is actually at
</span><del>-    // (0, -headerHeight()). documentScrollOffsetRelativeToScrollableAreaOrigin() will return this
</del><ins>+    // (0, -headerHeight()). documentScrollPositionRelativeToScrollableAreaOrigin() will return this
</ins><span class="cx">     // version of the offset, which tracks the top of Document relative to where scrolling was achored.
</span><del>-    IntSize documentScrollOffsetRelativeToScrollableAreaOrigin() const;
</del><ins>+    ScrollPosition documentScrollPositionRelativeToScrollableAreaOrigin() const;
</ins><span class="cx"> 
</span><del>-    // scrollOffset() anchors its (0,0) point at the ScrollableArea's origin. The top of the scrolling
</del><ins>+    // scrollPostion() anchors its (0,0) point at the ScrollableArea's origin. The top of the scrolling
</ins><span class="cx">     // layer does not represent the top of the view when there is a topContentInset. Additionally, as
</span><span class="cx">     // detailed above, the origin of the scrolling layer also does not necessarily correspond with the
</span><del>-    // top of the document anyway, since there could also be header. documentScrollOffsetRelativeToViewOrigin()
</del><ins>+    // top of the document anyway, since there could also be header. documentScrollPositionRelativeToViewOrigin()
</ins><span class="cx">     // will return a version of the current scroll offset which tracks the top of the Document
</span><span class="cx">     // relative to the very top of the view.
</span><del>-    WEBCORE_EXPORT IntSize documentScrollOffsetRelativeToViewOrigin() const;
-    IntPoint documentScrollPositionRelativeToViewOrigin() const;
</del><ins>+    WEBCORE_EXPORT ScrollPosition documentScrollPositionRelativeToViewOrigin() const;
</ins><span class="cx"> 
</span><span class="cx">     virtual IntSize overhangAmount() const override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxModelObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (194476 => 194477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2016-01-01 03:16:11 UTC (rev 194476)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2016-01-01 03:17:31 UTC (rev 194477)
</span><span class="lines">@@ -1115,10 +1115,10 @@
</span><span class="cx">                 // topContentInset so do not add it to the calculation below.
</span><span class="cx">                 viewportRect.setLocation(frameView.scrollPositionForFixedPosition());
</span><span class="cx">             } else {
</span><del>-                // documentScrollOffsetRelativeToViewOrigin() includes -topContentInset in its height
</del><ins>+                // documentScrollPositionRelativeToViewOrigin() includes -topContentInset in its height
</ins><span class="cx">                 // so we need to account for that in calculating the phase size
</span><span class="cx">                 topContentInset = frameView.topContentInset(ScrollView::TopContentInsetType::WebCoreOrPlatformContentInset);
</span><del>-                viewportRect.setLocation(toLayoutPoint(frameView.documentScrollOffsetRelativeToViewOrigin()));
</del><ins>+                viewportRect.setLocation(frameView.documentScrollPositionRelativeToViewOrigin());
</ins><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             top += topContentInset;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (194476 => 194477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2016-01-01 03:16:11 UTC (rev 194476)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2016-01-01 03:17:31 UTC (rev 194477)
</span><span class="lines">@@ -2524,8 +2524,7 @@
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx">             LayoutRect viewRect = frameView.visibleContentRect();
</span><span class="cx">             LayoutRect visibleRectRelativeToDocument = viewRect;
</span><del>-            IntSize documentScrollOffsetRelativeToScrollableAreaOrigin = frameView.documentScrollOffsetRelativeToScrollableAreaOrigin();
-            visibleRectRelativeToDocument.setLocation(IntPoint(documentScrollOffsetRelativeToScrollableAreaOrigin.width(), documentScrollOffsetRelativeToScrollableAreaOrigin.height()));
</del><ins>+            visibleRectRelativeToDocument.setLocation(frameView.documentScrollPositionRelativeToScrollableAreaOrigin());
</ins><span class="cx"> #else
</span><span class="cx">             LayoutRect viewRect = frameView.unobscuredContentRect();
</span><span class="cx">             LayoutRect visibleRectRelativeToDocument = viewRect;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (194476 => 194477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-01-01 03:16:11 UTC (rev 194476)
+++ trunk/Source/WebKit2/ChangeLog        2016-01-01 03:17:31 UTC (rev 194477)
</span><span class="lines">@@ -1,5 +1,20 @@
</span><span class="cx"> 2015-12-31  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Rename documentScrollOffsetRelativeTo* functions
+        https://bugs.webkit.org/show_bug.cgi?id=152632
+
+        Reviewed by Zalan Bujtas.
+
+        ScrollView::documentScrollOffsetRelativeTo* functions return scroll positions,
+        not offsets, so rename them and fix their return types, and fix callers. Make
+        their code more similar.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
+        (WebKit::WebPage::plugInIntersectsSearchRect):
+
+2015-12-31  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
</ins><span class="cx">         [iOS WK2] Fix incorrect scrollPosition handling
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=152630
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (194476 => 194477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-01-01 03:16:11 UTC (rev 194476)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-01-01 03:17:31 UTC (rev 194477)
</span><span class="lines">@@ -4799,8 +4799,8 @@
</span><span class="cx">                 continue;
</span><span class="cx"> 
</span><span class="cx">             IntRect plugInRectRelativeToView = plugInImageElement.clientRect();
</span><del>-            IntSize scrollOffset = mainFrame.view()-&gt;documentScrollOffsetRelativeToViewOrigin();
-            IntRect plugInRectRelativeToTopDocument(plugInRectRelativeToView.location() + scrollOffset, plugInRectRelativeToView.size());
</del><ins>+            ScrollPosition scrollPosition = mainFrame.view()-&gt;documentScrollPositionRelativeToViewOrigin();
+            IntRect plugInRectRelativeToTopDocument(plugInRectRelativeToView.location() + scrollPosition, plugInRectRelativeToView.size());
</ins><span class="cx">             HitTestResult hitTestResult(plugInRectRelativeToTopDocument.center());
</span><span class="cx">             mainRenderView.hitTest(request, hitTestResult);
</span><span class="cx"> 
</span><span class="lines">@@ -4809,7 +4809,7 @@
</span><span class="cx">                 continue;
</span><span class="cx"> 
</span><span class="cx">             IntRect elementRectRelativeToView = element-&gt;clientRect();
</span><del>-            IntRect elementRectRelativeToTopDocument(elementRectRelativeToView.location() + scrollOffset, elementRectRelativeToView.size());
</del><ins>+            IntRect elementRectRelativeToTopDocument(elementRectRelativeToView.location() + scrollPosition, elementRectRelativeToView.size());
</ins><span class="cx">             LayoutRect inflatedPluginRect = plugInRectRelativeToTopDocument;
</span><span class="cx">             LayoutUnit xOffset = (inflatedPluginRect.width() * overlappingImageBoundsScale - inflatedPluginRect.width()) / 2;
</span><span class="cx">             LayoutUnit yOffset = (inflatedPluginRect.height() * overlappingImageBoundsScale - inflatedPluginRect.height()) / 2;
</span><span class="lines">@@ -4878,8 +4878,8 @@
</span><span class="cx">     IntRect plugInRectRelativeToView = plugInImageElement.clientRect();
</span><span class="cx">     if (plugInRectRelativeToView.isEmpty())
</span><span class="cx">         return false;
</span><del>-    IntSize scrollOffset = mainFrame.view()-&gt;documentScrollOffsetRelativeToViewOrigin();
-    IntRect plugInRectRelativeToTopDocument(plugInRectRelativeToView.location() + scrollOffset, plugInRectRelativeToView.size());
</del><ins>+    ScrollPosition scrollPosition = mainFrame.view()-&gt;documentScrollPositionRelativeToViewOrigin();
+    IntRect plugInRectRelativeToTopDocument(plugInRectRelativeToView.location() + toIntSize(scrollPosition), plugInRectRelativeToView.size());
</ins><span class="cx"> 
</span><span class="cx">     return plugInRectRelativeToTopDocument.intersects(searchRect);
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>