<!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>[260482] 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/260482">260482</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2020-04-21 18:28:49 -0700 (Tue, 21 Apr 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>Composited layers are misplaced inside RTL overflow scroller with visible scrollbar
https://bugs.webkit.org/show_bug.cgi?id=210820

Reviewed by Zalan Bujtas.

Source/WebCore:

RenderLayerBacking::computeParentGraphicsLayerRect() used renderBox.paddingBoxRectIncludingScrollbar()
to position layers inside composited overflow scroll, but this is wrong if the RTL left-side
scrollbar takes space.

Fix by making some static functions that we can call from the various places that ask
about box geometry, and using them.

Test: compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::overflowClipRect const):
(WebCore::RenderBox::clipRect const):
(WebCore::RenderBox::overflowClipRect): Deleted.
(WebCore::RenderBox::clipRect): Deleted.
* rendering/RenderBox.h:
(WebCore::RenderBox::overflowClipRectForChildLayers const):
(WebCore::RenderBox::overflowClipRectForChildLayers): Deleted.
* rendering/RenderLayerBacking.cpp:
(WebCore::scrollContainerLayerBox):
(WebCore::clippingLayerBox):
(WebCore::overflowControlsHostLayerBox):
(WebCore::RenderLayerBacking::computeParentGraphicsLayerRect const):
(WebCore::RenderLayerBacking::updateGeometry):
(WebCore::clipBox): Deleted.
* rendering/RenderTable.cpp:
(WebCore::RenderTable::overflowClipRect const):
(WebCore::RenderTable::overflowClipRect): Deleted.
* rendering/RenderTable.h:

LayoutTests:

* compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow-expected.txt: Added.
* compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow.html: Added.
* platform/ios-wk2/compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow-expected.txt: 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="#trunkSourceWebCorerenderingRenderBoxcpp">trunk/Source/WebCore/rendering/RenderBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxh">trunk/Source/WebCore/rendering/RenderBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerBackingcpp">trunk/Source/WebCore/rendering/RenderLayerBacking.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTablecpp">trunk/Source/WebCore/rendering/RenderTable.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTableh">trunk/Source/WebCore/rendering/RenderTable.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscompositingscrollingasyncoverflowscrollingpositioninsidertloverflowexpectedtxt">trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow-expected.txt</a></li>
<li><a href="#trunkLayoutTestscompositingscrollingasyncoverflowscrollingpositioninsidertloverflowhtml">trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow.html</a></li>
<li><a href="#trunkLayoutTestsplatformioswk2compositingscrollingasyncoverflowscrollingpositioninsidertloverflowexpectedtxt">trunk/LayoutTests/platform/ios-wk2/compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (260481 => 260482)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2020-04-22 01:27:49 UTC (rev 260481)
+++ trunk/LayoutTests/ChangeLog 2020-04-22 01:28:49 UTC (rev 260482)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2020-04-21  Simon Fraser  <simon.fraser@apple.com>
+
+        Composited layers are misplaced inside RTL overflow scroller with visible scrollbar
+        https://bugs.webkit.org/show_bug.cgi?id=210820
+
+        Reviewed by Zalan Bujtas.
+
+        * compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow-expected.txt: Added.
+        * compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow.html: Added.
+        * platform/ios-wk2/compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow-expected.txt: Added.
+
</ins><span class="cx"> 2020-04-21  Darin Adler  <darin@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [Mac] Enable color well tests on modern WebKit
</span></span></pre></div>
<a id="trunkLayoutTestscompositingscrollingasyncoverflowscrollingpositioninsidertloverflowexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow-expected.txt (0 => 260482)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow-expected.txt                               (rev 0)
+++ trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow-expected.txt  2020-04-22 01:28:49 UTC (rev 260482)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 582.00 8.00)
+          (bounds 210.00 210.00)
+          (contentsOpaque 1)
+          (drawsContent 1)
+          (children 2
+            (GraphicsLayer
+              (offsetFromRenderer width=28 height=5)
+              (position 28.00 5.00)
+              (bounds 177.00 200.00)
+              (children 1
+                (GraphicsLayer
+                  (offsetFromRenderer width=28 height=5)
+                  (anchor 0.00 0.00)
+                  (bounds 177.00 400.00)
+                  (drawsContent 1)
+                  (children 1
+                    (GraphicsLayer
+                      (position 0.00 80.00)
+                      (bounds 100.00 100.00)
+                      (contentsOpaque 1)
+                    )
+                  )
+                )
+              )
+            )
+            (GraphicsLayer
+              (position 5.00 5.00)
+              (bounds 200.00 200.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 23.00 200.00)
+                  (drawsContent 1)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingscrollingasyncoverflowscrollingpositioninsidertloverflowhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow.html (0 => 260482)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow.html                               (rev 0)
+++ trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow.html  2020-04-22 01:28:49 UTC (rev 260482)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<html dir="rtl">
+<head>
+    <style>
+        .scroller {
+            position: relative;
+            z-index: 0;
+            width: 200px;
+            height: 200px;
+            background-color: #eee;
+            border: 5px solid gray;
+            overflow-y: scroll;
+        }
+        
+        .contents {
+            width: 100%;
+            height: 200%;
+        }
+        
+        .box {
+            position: absolute;
+            width: 100px;
+            height: 100px;
+            background-color: green;
+            top: 80px;
+            left: 0;
+        }
+        
+        .composited {
+            transform: translateZ(0);
+        }
+        
+        ::-webkit-scrollbar {
+            width: 23px;
+        }
+
+        ::-webkit-scrollbar-track {
+            background: silver;
+        }
+
+        ::-webkit-scrollbar-thumb {
+            background-color: gray;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        window.addEventListener('load', () => {
+            if (window.internals)
+                document.getElementById('layers').innerText = window.internals.layerTreeAsText(document);
+        }, false);
+    </script>
+</head>
+<body>
+    <div class="scroller">
+        <div class="contents">
+            <div class="composited box"></div>
+        </div>
+    </div>
+<pre id="layers"></pre>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformioswk2compositingscrollingasyncoverflowscrollingpositioninsidertloverflowexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/ios-wk2/compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow-expected.txt (0 => 260482)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-wk2/compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow-expected.txt                              (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow-expected.txt 2020-04-22 01:28:49 UTC (rev 260482)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 582.00 8.00)
+          (bounds 210.00 210.00)
+          (contentsOpaque 1)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (offsetFromRenderer width=5 height=5)
+              (position 5.00 5.00)
+              (bounds 200.00 200.00)
+              (children 1
+                (GraphicsLayer
+                  (offsetFromRenderer width=5 height=5)
+                  (anchor 0.00 0.00)
+                  (bounds 200.00 400.00)
+                  (drawsContent 1)
+                  (children 1
+                    (GraphicsLayer
+                      (position 0.00 80.00)
+                      (bounds 100.00 100.00)
+                      (contentsOpaque 1)
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (260481 => 260482)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2020-04-22 01:27:49 UTC (rev 260481)
+++ trunk/Source/WebCore/ChangeLog      2020-04-22 01:28:49 UTC (rev 260482)
</span><span class="lines">@@ -1,5 +1,41 @@
</span><span class="cx"> 2020-04-21  Simon Fraser  <simon.fraser@apple.com>
</span><span class="cx"> 
</span><ins>+        Composited layers are misplaced inside RTL overflow scroller with visible scrollbar
+        https://bugs.webkit.org/show_bug.cgi?id=210820
+
+        Reviewed by Zalan Bujtas.
+
+        RenderLayerBacking::computeParentGraphicsLayerRect() used renderBox.paddingBoxRectIncludingScrollbar()
+        to position layers inside composited overflow scroll, but this is wrong if the RTL left-side
+        scrollbar takes space.
+
+        Fix by making some static functions that we can call from the various places that ask
+        about box geometry, and using them.
+
+        Test: compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::overflowClipRect const):
+        (WebCore::RenderBox::clipRect const):
+        (WebCore::RenderBox::overflowClipRect): Deleted.
+        (WebCore::RenderBox::clipRect): Deleted.
+        * rendering/RenderBox.h:
+        (WebCore::RenderBox::overflowClipRectForChildLayers const):
+        (WebCore::RenderBox::overflowClipRectForChildLayers): Deleted.
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::scrollContainerLayerBox):
+        (WebCore::clippingLayerBox):
+        (WebCore::overflowControlsHostLayerBox):
+        (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect const):
+        (WebCore::RenderLayerBacking::updateGeometry):
+        (WebCore::clipBox): Deleted.
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::overflowClipRect const):
+        (WebCore::RenderTable::overflowClipRect): Deleted.
+        * rendering/RenderTable.h:
+
+2020-04-21  Simon Fraser  <simon.fraser@apple.com>
+
</ins><span class="cx">         [Async overflow scroll] Overflow that's hidden on one axis is scrollable on that axis
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=210771
</span><span class="cx">         <rdar://problem/62080331>
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (260481 => 260482)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.cpp     2020-04-22 01:27:49 UTC (rev 260481)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp        2020-04-22 01:28:49 UTC (rev 260482)
</span><span class="lines">@@ -1847,7 +1847,7 @@
</span><span class="cx">         paintInfo.phase = originalPhase;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location, RenderFragmentContainer* fragment, OverlayScrollbarSizeRelevancy relevancy, PaintPhase)
</del><ins>+LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location, RenderFragmentContainer* fragment, OverlayScrollbarSizeRelevancy relevancy, PaintPhase) const
</ins><span class="cx"> {
</span><span class="cx">     // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the property
</span><span class="cx">     // here.
</span><span class="lines">@@ -1865,7 +1865,7 @@
</span><span class="cx">     return clipRect;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutRect RenderBox::clipRect(const LayoutPoint& location, RenderFragmentContainer* fragment)
</del><ins>+LayoutRect RenderBox::clipRect(const LayoutPoint& location, RenderFragmentContainer* fragment) const
</ins><span class="cx"> {
</span><span class="cx">     LayoutRect borderBoxRect = borderBoxRectInFragment(fragment);
</span><span class="cx">     LayoutRect clipRect = LayoutRect(borderBoxRect.location() + location, borderBoxRect.size());
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.h (260481 => 260482)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.h       2020-04-22 01:27:49 UTC (rev 260481)
+++ trunk/Source/WebCore/rendering/RenderBox.h  2020-04-22 01:28:49 UTC (rev 260482)
</span><span class="lines">@@ -497,9 +497,9 @@
</span><span class="cx">     
</span><span class="cx">     LayoutRect localCaretRect(InlineBox*, unsigned caretOffset, LayoutUnit* extraWidthToEndOfLine = nullptr) override;
</span><span class="cx"> 
</span><del>-    virtual LayoutRect overflowClipRect(const LayoutPoint& location, RenderFragmentContainer* = nullptr, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, PaintPhase = PaintPhase::BlockBackground);
-    virtual LayoutRect overflowClipRectForChildLayers(const LayoutPoint& location, RenderFragmentContainer* fragment, OverlayScrollbarSizeRelevancy relevancy) { return overflowClipRect(location, fragment, relevancy); }
-    LayoutRect clipRect(const LayoutPoint& location, RenderFragmentContainer*);
</del><ins>+    virtual LayoutRect overflowClipRect(const LayoutPoint& location, RenderFragmentContainer* = nullptr, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, PaintPhase = PaintPhase::BlockBackground) const;
+    virtual LayoutRect overflowClipRectForChildLayers(const LayoutPoint& location, RenderFragmentContainer* fragment, OverlayScrollbarSizeRelevancy relevancy) const { return overflowClipRect(location, fragment, relevancy); }
+    LayoutRect clipRect(const LayoutPoint& location, RenderFragmentContainer*) const;
</ins><span class="cx">     virtual bool hasControlClip() const { return false; }
</span><span class="cx">     virtual LayoutRect controlClipRect(const LayoutPoint&) const { return LayoutRect(); }
</span><span class="cx">     bool pushContentsClip(PaintInfo&, const LayoutPoint& accumulatedOffset);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerBackingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (260481 => 260482)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp    2020-04-22 01:27:49 UTC (rev 260481)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp       2020-04-22 01:28:49 UTC (rev 260482)
</span><span class="lines">@@ -985,18 +985,6 @@
</span><span class="cx">     return layerConfigChanged;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static LayoutRect clipBox(RenderBox& renderer)
-{
-    LayoutRect result = LayoutRect::infiniteRect();
-    if (renderer.hasOverflowClip())
-        result = renderer.overflowClipRect(LayoutPoint(), 0); // FIXME: Incorrect for CSS regions.
-
-    if (renderer.hasClip())
-        result.intersect(renderer.clipRect(LayoutPoint(), 0)); // FIXME: Incorrect for CSS regions.
-
-    return result;
-}
-
</del><span class="cx"> static bool subpixelOffsetFromRendererChanged(const LayoutSize& oldSubpixelOffsetFromRenderer, const LayoutSize& newSubpixelOffsetFromRenderer, float deviceScaleFactor)
</span><span class="cx"> {
</span><span class="cx">     FloatSize previous = snapSizeToDevicePixel(oldSubpixelOffsetFromRenderer, LayoutPoint(), deviceScaleFactor);
</span><span class="lines">@@ -1111,6 +1099,28 @@
</span><span class="cx">         deviceScaleFactor()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static LayoutRect scrollContainerLayerBox(const RenderBox& renderBox)
+{
+    return renderBox.paddingBoxRect();
+}
+
+static LayoutRect clippingLayerBox(const RenderBox& renderBox)
+{
+    LayoutRect result = LayoutRect::infiniteRect();
+    if (renderBox.hasOverflowClip())
+        result = renderBox.overflowClipRect({ }, 0); // FIXME: Incorrect for CSS regions.
+
+    if (renderBox.hasClip())
+        result.intersect(renderBox.clipRect({ }, 0)); // FIXME: Incorrect for CSS regions.
+
+    return result;
+}
+
+static LayoutRect overflowControlsHostLayerBox(const RenderBox& renderBox)
+{
+    return renderBox.paddingBoxRectIncludingScrollbar();
+}
+
</ins><span class="cx"> // FIXME: See if we need this now that updateGeometry() is always called in post-order traversal.
</span><span class="cx"> LayoutRect RenderLayerBacking::computeParentGraphicsLayerRect(const RenderLayer* compositedAncestor) const
</span><span class="cx"> {
</span><span class="lines">@@ -1117,28 +1127,32 @@
</span><span class="cx">     if (!compositedAncestor || !compositedAncestor->backing())
</span><span class="cx">         return renderer().view().documentRect();
</span><span class="cx"> 
</span><del>-    auto* ancestorBackingLayer = compositedAncestor->backing();
</del><ins>+    auto* ancestorBacking = compositedAncestor->backing();
</ins><span class="cx">     LayoutRect parentGraphicsLayerRect;
</span><span class="cx">     if (m_owningLayer.isInsideFragmentedFlow()) {
</span><span class="cx">         // FIXME: flows/columns need work.
</span><del>-        LayoutRect ancestorCompositedBounds = ancestorBackingLayer->compositedBounds();
</del><ins>+        LayoutRect ancestorCompositedBounds = ancestorBacking->compositedBounds();
</ins><span class="cx">         ancestorCompositedBounds.setLocation(LayoutPoint());
</span><span class="cx">         parentGraphicsLayerRect = ancestorCompositedBounds;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (ancestorBackingLayer->hasClippingLayer()) {
</del><ins>+    if (!is<RenderBox>(compositedAncestor->renderer()))
+        return parentGraphicsLayerRect;
+
+    auto& ancestorRenderBox = downcast<RenderBox>(compositedAncestor->renderer());
+
+    if (ancestorBacking->hasClippingLayer()) {
</ins><span class="cx">         // If the compositing ancestor has a layer to clip children, we parent in that, and therefore position relative to it.
</span><del>-        LayoutRect clippingBox = clipBox(downcast<RenderBox>(compositedAncestor->renderer()));
</del><ins>+        LayoutRect clippingBox = clippingLayerBox(ancestorRenderBox);
</ins><span class="cx">         LayoutSize clippingBoxOffset = computeOffsetFromAncestorGraphicsLayer(compositedAncestor, clippingBox.location(), deviceScaleFactor());
</span><span class="cx">         parentGraphicsLayerRect = snappedGraphicsLayer(clippingBoxOffset, clippingBox.size(), deviceScaleFactor()).m_snappedRect;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (compositedAncestor->hasCompositedScrollableOverflow()) {
</span><del>-        LayoutRect ancestorCompositedBounds = ancestorBackingLayer->compositedBounds();
-        auto& renderBox = downcast<RenderBox>(compositedAncestor->renderer());
-        LayoutRect paddingBoxIncludingScrollbar = renderBox.paddingBoxRectIncludingScrollbar();
</del><ins>+        LayoutRect ancestorCompositedBounds = ancestorBacking->compositedBounds();
+        LayoutRect scrollContainerBox = scrollContainerLayerBox(ancestorRenderBox);
</ins><span class="cx">         ScrollOffset scrollOffset = compositedAncestor->scrollOffset();
</span><del>-        parentGraphicsLayerRect = LayoutRect((paddingBoxIncludingScrollbar.location() - toLayoutSize(ancestorCompositedBounds.location()) - toLayoutSize(scrollOffset)), paddingBoxIncludingScrollbar.size());
</del><ins>+        parentGraphicsLayerRect = LayoutRect((scrollContainerBox.location() - toLayoutSize(ancestorCompositedBounds.location()) - toLayoutSize(scrollOffset)), scrollContainerBox.size());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return parentGraphicsLayerRect;
</span><span class="lines">@@ -1246,8 +1260,9 @@
</span><span class="cx">     // If we have a layer that clips children, position it.
</span><span class="cx">     LayoutRect clippingBox;
</span><span class="cx">     if (auto* clipLayer = clippingLayer()) {
</span><ins>+        auto& renderBox = downcast<RenderBox>(renderer());
</ins><span class="cx">         // clipLayer is the m_childContainmentLayer.
</span><del>-        clippingBox = clipBox(downcast<RenderBox>(renderer()));
</del><ins>+        clippingBox = clippingLayerBox(renderBox);
</ins><span class="cx">         // Clipping layer is parented in the primary graphics layer.
</span><span class="cx">         LayoutSize clipBoxOffsetFromGraphicsLayer = toLayoutSize(clippingBox.location()) + rendererOffset.fromPrimaryGraphicsLayer();
</span><span class="cx">         SnappedRectInfo snappedClippingGraphicsLayer = snappedGraphicsLayer(clipBoxOffsetFromGraphicsLayer, clippingBox.size(), deviceScaleFactor());
</span><span class="lines">@@ -1256,7 +1271,7 @@
</span><span class="cx">         clipLayer->setOffsetFromRenderer(toLayoutSize(clippingBox.location() - snappedClippingGraphicsLayer.m_snapDelta));
</span><span class="cx"> 
</span><span class="cx">         if ((renderer().style().clipPath() || renderer().style().hasBorderRadius()) && !m_childClippingMaskLayer) {
</span><del>-            LayoutRect boxRect(LayoutPoint(), downcast<RenderBox>(renderer()).size());
</del><ins>+            LayoutRect boxRect({ }, renderBox.size());
</ins><span class="cx">             FloatRoundedRect contentsClippingRect = renderer().style().getRoundedInnerBorderFor(boxRect).pixelSnappedRoundedRectForPainting(deviceScaleFactor());
</span><span class="cx">             contentsClippingRect.move(LayoutSize(-clipLayer->offsetFromRenderer()));
</span><span class="cx">             clipLayer->setMasksToBoundsRect(contentsClippingRect);
</span><span class="lines">@@ -1264,7 +1279,7 @@
</span><span class="cx"> 
</span><span class="cx">         if (m_childClippingMaskLayer && !m_scrollContainerLayer) {
</span><span class="cx">             m_childClippingMaskLayer->setSize(clipLayer->size());
</span><del>-            m_childClippingMaskLayer->setPosition(FloatPoint());
</del><ins>+            m_childClippingMaskLayer->setPosition({ });
</ins><span class="cx">             m_childClippingMaskLayer->setOffsetFromRenderer(clipLayer->offsetFromRenderer());
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -1322,24 +1337,23 @@
</span><span class="cx"> 
</span><span class="cx">     if (m_scrollContainerLayer) {
</span><span class="cx">         ASSERT(m_scrolledContentsLayer);
</span><del>-        auto& renderBox = downcast<RenderBox>(renderer());
-        LayoutRect paddingBox = renderBox.paddingBoxRect();
-        LayoutRect parentLayerBounds = clippingLayer() ? clippingBox : compositedBounds();
</del><ins>+        LayoutRect scrollContainerBox = scrollContainerLayerBox(downcast<RenderBox>(renderer()));
+        LayoutRect parentLayerBounds = clippingLayer() ? scrollContainerBox : compositedBounds();
</ins><span class="cx"> 
</span><span class="cx">         // FIXME: need to do some pixel snapping here.
</span><del>-        m_scrollContainerLayer->setPosition(FloatPoint(paddingBox.location() - parentLayerBounds.location()));
-        m_scrollContainerLayer->setSize(roundedIntSize(LayoutSize(paddingBox.width(), paddingBox.height())));
</del><ins>+        m_scrollContainerLayer->setPosition(FloatPoint(scrollContainerBox.location() - parentLayerBounds.location()));
+        m_scrollContainerLayer->setSize(roundedIntSize(LayoutSize(scrollContainerBox.width(), scrollContainerBox.height())));
</ins><span class="cx"> 
</span><span class="cx">         ScrollOffset scrollOffset = m_owningLayer.scrollOffset();
</span><span class="cx">         updateScrollOffset(scrollOffset);
</span><span class="cx"> 
</span><span class="cx">         FloatSize oldScrollingLayerOffset = m_scrollContainerLayer->offsetFromRenderer();
</span><del>-        m_scrollContainerLayer->setOffsetFromRenderer(toFloatSize(paddingBox.location()));
</del><ins>+        m_scrollContainerLayer->setOffsetFromRenderer(toFloatSize(scrollContainerBox.location()));
</ins><span class="cx"> 
</span><span class="cx">         if (m_childClippingMaskLayer) {
</span><span class="cx">             m_childClippingMaskLayer->setPosition(m_scrollContainerLayer->position());
</span><span class="cx">             m_childClippingMaskLayer->setSize(m_scrollContainerLayer->size());
</span><del>-            m_childClippingMaskLayer->setOffsetFromRenderer(toFloatSize(paddingBox.location()));
</del><ins>+            m_childClippingMaskLayer->setOffsetFromRenderer(toFloatSize(scrollContainerBox.location()));
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         bool paddingBoxOffsetChanged = oldScrollingLayerOffset != m_scrollContainerLayer->offsetFromRenderer();
</span><span class="lines">@@ -1350,20 +1364,18 @@
</span><span class="cx"> 
</span><span class="cx">         m_scrolledContentsLayer->setSize(scrollSize);
</span><span class="cx">         m_scrolledContentsLayer->setScrollOffset(scrollOffset, GraphicsLayer::DontSetNeedsDisplay);
</span><del>-        m_scrolledContentsLayer->setOffsetFromRenderer(toLayoutSize(paddingBox.location()), GraphicsLayer::DontSetNeedsDisplay);
</del><ins>+        m_scrolledContentsLayer->setOffsetFromRenderer(toLayoutSize(scrollContainerBox.location()), GraphicsLayer::DontSetNeedsDisplay);
</ins><span class="cx">         
</span><span class="cx">         adjustTiledBackingCoverage();
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     if (m_overflowControlsContainer) {
</span><del>-        auto& renderBox = downcast<RenderBox>(renderer());
-        LayoutRect paddingBox = renderBox.paddingBoxRectIncludingScrollbar();
</del><ins>+        LayoutRect overflowControlsBox = overflowControlsHostLayerBox(downcast<RenderBox>(renderer()));
+        LayoutSize boxOffsetFromGraphicsLayer = toLayoutSize(overflowControlsBox.location()) + rendererOffset.fromPrimaryGraphicsLayer();
+        SnappedRectInfo snappedBoxInfo = snappedGraphicsLayer(boxOffsetFromGraphicsLayer, overflowControlsBox.size(), deviceScaleFactor());
</ins><span class="cx"> 
</span><del>-        LayoutSize paddingBoxOffsetFromGraphicsLayer = toLayoutSize(paddingBox.location()) + rendererOffset.fromPrimaryGraphicsLayer();
-        SnappedRectInfo snappedPaddingBoxInfo = snappedGraphicsLayer(paddingBoxOffsetFromGraphicsLayer, paddingBox.size(), deviceScaleFactor());
-
-        m_overflowControlsContainer->setPosition(snappedPaddingBoxInfo.m_snappedRect.location());
-        m_overflowControlsContainer->setSize(snappedPaddingBoxInfo.m_snappedRect.size());
</del><ins>+        m_overflowControlsContainer->setPosition(snappedBoxInfo.m_snappedRect.location());
+        m_overflowControlsContainer->setSize(snappedBoxInfo.m_snappedRect.size());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (m_foregroundLayer) {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (260481 => 260482)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTable.cpp   2020-04-22 01:27:49 UTC (rev 260481)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp      2020-04-22 01:28:49 UTC (rev 260482)
</span><span class="lines">@@ -1493,7 +1493,7 @@
</span><span class="cx">     return Optional<int>();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutRect RenderTable::overflowClipRect(const LayoutPoint& location, RenderFragmentContainer* fragment, OverlayScrollbarSizeRelevancy relevancy, PaintPhase phase)
</del><ins>+LayoutRect RenderTable::overflowClipRect(const LayoutPoint& location, RenderFragmentContainer* fragment, OverlayScrollbarSizeRelevancy relevancy, PaintPhase phase) const
</ins><span class="cx"> {
</span><span class="cx">     LayoutRect rect;
</span><span class="cx">     // Don't clip out the table's side of the collapsed borders if we're in the paint phase that will ask the sections to paint them.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTable.h (260481 => 260482)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTable.h     2020-04-22 01:27:49 UTC (rev 260481)
+++ trunk/Source/WebCore/rendering/RenderTable.h        2020-04-22 01:28:49 UTC (rev 260482)
</span><span class="lines">@@ -310,8 +310,8 @@
</span><span class="cx">     LayoutUnit convertStyleLogicalWidthToComputedWidth(const Length& styleLogicalWidth, LayoutUnit availableWidth);
</span><span class="cx">     LayoutUnit convertStyleLogicalHeightToComputedHeight(const Length& styleLogicalHeight);
</span><span class="cx"> 
</span><del>-    LayoutRect overflowClipRect(const LayoutPoint& location, RenderFragmentContainer*, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, PaintPhase = PaintPhase::BlockBackground) final;
-    LayoutRect overflowClipRectForChildLayers(const LayoutPoint& location, RenderFragmentContainer* fragment, OverlayScrollbarSizeRelevancy relevancy) override { return RenderBox::overflowClipRect(location, fragment, relevancy); }
</del><ins>+    LayoutRect overflowClipRect(const LayoutPoint& location, RenderFragmentContainer*, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, PaintPhase = PaintPhase::BlockBackground) const final;
+    LayoutRect overflowClipRectForChildLayers(const LayoutPoint& location, RenderFragmentContainer* fragment, OverlayScrollbarSizeRelevancy relevancy) const override { return RenderBox::overflowClipRect(location, fragment, relevancy); }
</ins><span class="cx"> 
</span><span class="cx">     void addOverflowFromChildren() final;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>