<!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>[208411] trunk/Source/WebCore</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/208411">208411</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2016-11-04 17:55:43 -0700 (Fri, 04 Nov 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Rename unscaledUnobscuredVisibleContentSize and unscaledVisibleContentSizeIncludingObscuredArea for attempted clarity
https://bugs.webkit.org/show_bug.cgi?id=164438

Reviewed by Tim Horton.

unscaledUnobscuredVisibleContentSize() and unscaledVisibleContentSizeIncludingObscuredArea() were an endless source
of confusion.

Functions with &quot;VisibleContent&quot; in the name are usually expected to return document coordinates (affected by zooming),
so unscaledUnobscuredVisibleContentSize caused cognitive dissonance because of &quot;unscaled&quot; vs &quot;visibleContent&quot;, and
&quot;unobscured&quot; vs &quot;visible&quot;.

So rename:
    unscaledUnobscuredVisibleContentSize -&gt; sizeForUnobscuredContent
    unscaledVisibleContentSizeIncludingObscuredArea -&gt; sizeForVisibleContent

sizeForUnobscuredContent() can also be private to ScrollView.

* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::update):
* platform/ScrollView.cpp:
(WebCore::ScrollView::unobscuredContentRectInternal):
(WebCore::ScrollView::sizeForVisibleContent):
(WebCore::ScrollView::sizeForUnobscuredContent): Don't compute unscaledVisibleContentSizeIncludingObscuredArea
before testing whether we have a platform widget.
(WebCore::ScrollView::layoutSize):
(WebCore::ScrollView::unscaledVisibleContentSizeIncludingObscuredArea): Deleted.
(WebCore::ScrollView::unscaledUnobscuredVisibleContentSize): Deleted.
* platform/ScrollView.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::flushPendingLayerChanges):
(WebCore::RenderLayerCompositor::frameViewDidChangeSize):
(WebCore::RenderLayerCompositor::updateRootLayerPosition):
(WebCore::RenderLayerCompositor::ensureRootLayer):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorOverlaycpp">trunk/Source/WebCore/inspector/InspectorOverlay.cpp</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="#trunkSourceWebCorerenderingRenderLayerCompositorcpp">trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (208410 => 208411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-11-05 00:48:01 UTC (rev 208410)
+++ trunk/Source/WebCore/ChangeLog        2016-11-05 00:55:43 UTC (rev 208411)
</span><span class="lines">@@ -1,5 +1,44 @@
</span><span class="cx"> 2016-11-04  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Rename unscaledUnobscuredVisibleContentSize and unscaledVisibleContentSizeIncludingObscuredArea for attempted clarity
+        https://bugs.webkit.org/show_bug.cgi?id=164438
+
+        Reviewed by Tim Horton.
+
+        unscaledUnobscuredVisibleContentSize() and unscaledVisibleContentSizeIncludingObscuredArea() were an endless source
+        of confusion.
+        
+        Functions with &quot;VisibleContent&quot; in the name are usually expected to return document coordinates (affected by zooming),
+        so unscaledUnobscuredVisibleContentSize caused cognitive dissonance because of &quot;unscaled&quot; vs &quot;visibleContent&quot;, and
+        &quot;unobscured&quot; vs &quot;visible&quot;.
+        
+        So rename:
+            unscaledUnobscuredVisibleContentSize -&gt; sizeForUnobscuredContent
+            unscaledVisibleContentSizeIncludingObscuredArea -&gt; sizeForVisibleContent
+        
+        sizeForUnobscuredContent() can also be private to ScrollView.
+
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::update):
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::unobscuredContentRectInternal):
+        (WebCore::ScrollView::sizeForVisibleContent):
+        (WebCore::ScrollView::sizeForUnobscuredContent): Don't compute unscaledVisibleContentSizeIncludingObscuredArea
+        before testing whether we have a platform widget.
+        (WebCore::ScrollView::layoutSize):
+        (WebCore::ScrollView::unscaledVisibleContentSizeIncludingObscuredArea): Deleted.
+        (WebCore::ScrollView::unscaledUnobscuredVisibleContentSize): Deleted.
+        * platform/ScrollView.h:
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
+        (WebCore::RenderLayerCompositor::frameViewDidChangeSize):
+        (WebCore::RenderLayerCompositor::updateRootLayerPosition):
+        (WebCore::RenderLayerCompositor::ensureRootLayer):
+
+2016-11-04  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
</ins><span class="cx">         Layout viewport wrong with RTL documents
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=164434
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorOverlaycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (208410 => 208411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp        2016-11-05 00:48:01 UTC (rev 208410)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp        2016-11-05 00:55:43 UTC (rev 208411)
</span><span class="lines">@@ -322,8 +322,8 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     FrameView* overlayView = overlayPage()-&gt;mainFrame().view();
</span><del>-    IntSize viewportSize = view-&gt;unscaledVisibleContentSizeIncludingObscuredArea();
-    IntSize frameViewFullSize = view-&gt;unscaledVisibleContentSizeIncludingObscuredArea(ScrollableArea::IncludeScrollbars);
</del><ins>+    IntSize viewportSize = view-&gt;sizeForVisibleContent();
+    IntSize frameViewFullSize = view-&gt;sizeForVisibleContent(ScrollableArea::IncludeScrollbars);
</ins><span class="cx">     overlayView-&gt;resize(frameViewFullSize);
</span><span class="cx"> 
</span><span class="cx">     // Clear canvas and paint things.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollView.cpp (208410 => 208411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollView.cpp        2016-11-05 00:48:01 UTC (rev 208410)
+++ trunk/Source/WebCore/platform/ScrollView.cpp        2016-11-05 00:55:43 UTC (rev 208411)
</span><span class="lines">@@ -247,12 +247,12 @@
</span><span class="cx"> 
</span><span class="cx"> IntRect ScrollView::unobscuredContentRectInternal(VisibleContentRectIncludesScrollbars scrollbarInclusion) const
</span><span class="cx"> {
</span><del>-    FloatSize visibleContentSize = unscaledUnobscuredVisibleContentSize(scrollbarInclusion);
</del><ins>+    FloatSize visibleContentSize = sizeForUnobscuredContent(scrollbarInclusion);
</ins><span class="cx">     visibleContentSize.scale(1 / visibleContentScaleFactor());
</span><span class="cx">     return IntRect(m_scrollPosition, expandedIntSize(visibleContentSize));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IntSize ScrollView::unscaledVisibleContentSizeIncludingObscuredArea(VisibleContentRectIncludesScrollbars scrollbarInclusion) const
</del><ins>+IntSize ScrollView::sizeForVisibleContent(VisibleContentRectIncludesScrollbars scrollbarInclusion) const
</ins><span class="cx"> {
</span><span class="cx">     if (platformWidget())
</span><span class="cx">         return platformVisibleContentSizeIncludingObscuredArea(scrollbarInclusion == IncludeScrollbars);
</span><span class="lines">@@ -269,13 +269,13 @@
</span><span class="cx">     return IntSize(width() - scrollbarSpace.width(), height() - scrollbarSpace.height()).expandedTo(IntSize());
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-IntSize ScrollView::unscaledUnobscuredVisibleContentSize(VisibleContentRectIncludesScrollbars scrollbarInclusion) const
</del><ins>+IntSize ScrollView::sizeForUnobscuredContent(VisibleContentRectIncludesScrollbars scrollbarInclusion) const
</ins><span class="cx"> {
</span><del>-    IntSize visibleContentSize = unscaledVisibleContentSizeIncludingObscuredArea(scrollbarInclusion);
-
</del><span class="cx">     if (platformWidget())
</span><span class="cx">         return platformVisibleContentSize(scrollbarInclusion == IncludeScrollbars);
</span><span class="cx"> 
</span><ins>+    IntSize visibleContentSize = sizeForVisibleContent(scrollbarInclusion);
+
</ins><span class="cx"> #if USE(COORDINATED_GRAPHICS)
</span><span class="cx">     if (m_useFixedLayout &amp;&amp; !m_fixedVisibleContentRect.isEmpty())
</span><span class="cx">         return visibleContentSize;
</span><span class="lines">@@ -312,7 +312,7 @@
</span><span class="cx"> 
</span><span class="cx"> IntSize ScrollView::layoutSize() const
</span><span class="cx"> {
</span><del>-    return m_fixedLayoutSize.isEmpty() || !m_useFixedLayout ? unscaledUnobscuredVisibleContentSize(ExcludeScrollbars) : m_fixedLayoutSize;
</del><ins>+    return m_fixedLayoutSize.isEmpty() || !m_useFixedLayout ? sizeForUnobscuredContent() : m_fixedLayoutSize;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> IntSize ScrollView::fixedLayoutSize() const
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollView.h (208410 => 208411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollView.h        2016-11-05 00:48:01 UTC (rev 208410)
+++ trunk/Source/WebCore/platform/ScrollView.h        2016-11-05 00:55:43 UTC (rev 208411)
</span><span class="lines">@@ -199,13 +199,9 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool inProgrammaticScroll() const { return false; }
</span><span class="cx"> 
</span><del>-    // visibleContentRect().size() is computed from unscaledUnobscuredVisibleContentSize() divided by the value of visibleContentScaleFactor.
-    // visibleContentScaleFactor is usually 1, except when the setting delegatesPageScaling is true and the
-    // ScrollView is the main frame; in that case, visibleContentScaleFactor is equal to the page's pageScaleFactor.
-    // Ports that don't use pageScaleFactor can treat unscaledUnobscuredVisibleContentSize and visibleContentRect().size() as equivalent.
-    // unscaledVisibleContentSizeIncludingObscuredArea() includes areas in the content that might be obscured by UI elements.
-    IntSize unscaledUnobscuredVisibleContentSize(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
-    IntSize unscaledVisibleContentSizeIncludingObscuredArea(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
</del><ins>+    // Size available for view contents, including content inset areas. Not affected by zooming.
+    IntSize sizeForVisibleContent(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
+    // FIXME: remove this. It's only used for the incorrectly behaving ScrollView::unobscuredContentRectInternal().
</ins><span class="cx">     virtual float visibleContentScaleFactor() const { return 1; }
</span><span class="cx"> 
</span><span class="cx">     // Functions for getting/setting the size webkit should use to layout the contents. By default this is the same as the visible
</span><span class="lines">@@ -213,6 +209,7 @@
</span><span class="cx">     WEBCORE_EXPORT IntSize layoutSize() const;
</span><span class="cx">     int layoutWidth() const { return layoutSize().width(); }
</span><span class="cx">     int layoutHeight() const { return layoutSize().height(); }
</span><ins>+
</ins><span class="cx">     WEBCORE_EXPORT IntSize fixedLayoutSize() const;
</span><span class="cx">     WEBCORE_EXPORT void setFixedLayoutSize(const IntSize&amp;);
</span><span class="cx">     WEBCORE_EXPORT bool useFixedLayout() const;
</span><span class="lines">@@ -425,6 +422,9 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+    // Size available for view contents, excluding content insets. Not affected by zooming.
+    IntSize sizeForUnobscuredContent(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
+
</ins><span class="cx">     IntRect visibleContentRectInternal(VisibleContentRectIncludesScrollbars, VisibleContentRectBehavior) const override;
</span><span class="cx">     WEBCORE_EXPORT IntRect unobscuredContentRectInternal(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxModelObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (208410 => 208411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2016-11-05 00:48:01 UTC (rev 208410)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2016-11-05 00:55:43 UTC (rev 208411)
</span><span class="lines">@@ -1120,7 +1120,7 @@
</span><span class="cx">                 // down the frameView to to fit in the current viewport.
</span><span class="cx">                 viewportRect.setSize(frameView.fixedLayoutSize());
</span><span class="cx">             } else
</span><del>-                viewportRect.setSize(frameView.unscaledVisibleContentSizeIncludingObscuredArea());
</del><ins>+                viewportRect.setSize(frameView.sizeForVisibleContent());
</ins><span class="cx"> 
</span><span class="cx">             if (fixedBackgroundPaintsInLocalCoordinates()) {
</span><span class="cx">                 if (!useFixedLayout) {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerCompositorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (208410 => 208411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2016-11-05 00:48:01 UTC (rev 208410)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2016-11-05 00:55:43 UTC (rev 208411)
</span><span class="lines">@@ -458,7 +458,7 @@
</span><span class="cx">         rootLayer-&gt;flushCompositingState(exposedRect, frameView.viewportIsStable());
</span><span class="cx"> #else
</span><span class="cx">         // Having a m_clipLayer indicates that we're doing scrolling via GraphicsLayers.
</span><del>-        FloatRect visibleRect = m_clipLayer ? FloatRect({ 0, 0 }, frameView.unscaledVisibleContentSizeIncludingObscuredArea()) : frameView.visibleContentRect();
</del><ins>+        FloatRect visibleRect = m_clipLayer ? FloatRect({ 0, 0 }, frameView.sizeForVisibleContent()) : frameView.visibleContentRect();
</ins><span class="cx"> 
</span><span class="cx">         if (frameView.viewExposedRect())
</span><span class="cx">             visibleRect.intersect(frameView.viewExposedRect().value());
</span><span class="lines">@@ -1717,7 +1717,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (m_clipLayer) {
</span><span class="cx">         const FrameView&amp; frameView = m_renderView.frameView();
</span><del>-        m_clipLayer-&gt;setSize(frameView.unscaledVisibleContentSizeIncludingObscuredArea());
</del><ins>+        m_clipLayer-&gt;setSize(frameView.sizeForVisibleContent());
</ins><span class="cx">         m_clipLayer-&gt;setPosition(positionForClipLayer());
</span><span class="cx"> 
</span><span class="cx">         frameViewDidScroll();
</span><span class="lines">@@ -2124,7 +2124,7 @@
</span><span class="cx">         m_rootContentLayer-&gt;setAnchorPoint(FloatPoint3D());
</span><span class="cx">     }
</span><span class="cx">     if (m_clipLayer) {
</span><del>-        m_clipLayer-&gt;setSize(m_renderView.frameView().unscaledVisibleContentSizeIncludingObscuredArea());
</del><ins>+        m_clipLayer-&gt;setSize(m_renderView.frameView().sizeForVisibleContent());
</ins><span class="cx">         m_clipLayer-&gt;setPosition(positionForClipLayer());
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -3443,7 +3443,7 @@
</span><span class="cx">             m_clipLayer-&gt;addChild(m_scrollLayer.get());
</span><span class="cx">             m_scrollLayer-&gt;addChild(m_rootContentLayer.get());
</span><span class="cx"> 
</span><del>-            m_clipLayer-&gt;setSize(m_renderView.frameView().unscaledVisibleContentSizeIncludingObscuredArea());
</del><ins>+            m_clipLayer-&gt;setSize(m_renderView.frameView().sizeForVisibleContent());
</ins><span class="cx">             m_clipLayer-&gt;setPosition(positionForClipLayer());
</span><span class="cx">             m_clipLayer-&gt;setAnchorPoint(FloatPoint3D());
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>