Title: [277462] trunk
Revision
277462
Author
[email protected]
Date
2021-05-13 16:19:48 -0700 (Thu, 13 May 2021)

Log Message

Ensure scrollable transformed elements that are themselves within scrollable elements don't ignore border-radius
https://bugs.webkit.org/show_bug.cgi?id=216978
<rdar://69660229>

Reviewed by Darin Adler.

Source/WebCore:

We use ShouldRespectOverflowClip to prevent clips from ancestors
from being used when we paint a scrollable layer (when
PaintLayerFlag::PaintingOverflowContents is set). We only look
at the ShouldRespectOverflowClip value when we're painting a layer
we're considering to be a clip rect root layer, and we unconditionally
apply ancestor clips for layers that aren't clip rect roots.

A non-root layer with a transform is handled by applying the transform
and painting the layer as a root layer (since we don't want to handle
computing the effect of ancestor clip rects past the transform). When
the transformed layer also has a border-radius, we incorrectly skip
marking its clip rect as being affected by radius, since we currently
do this at the same time as applying ancestor clip rects.

This patch splits out the setAffectedByRadius call so that it happens
even for transformed non-root layers.

Test: fast/layers/overflow-scroll-transform-border-radius.html

* rendering/RenderLayer.cpp:
(WebCore::ClipRects::setOverflowClipRectAffectedByRadius):
(WebCore::RenderLayer::calculateClipRects const):

LayoutTests:

* fast/layers/overflow-scroll-transform-border-radius-expected.html: Added.
* fast/layers/overflow-scroll-transform-border-radius.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (277461 => 277462)


--- trunk/LayoutTests/ChangeLog	2021-05-13 23:16:47 UTC (rev 277461)
+++ trunk/LayoutTests/ChangeLog	2021-05-13 23:19:48 UTC (rev 277462)
@@ -1,3 +1,14 @@
+2021-05-13  Cameron McCormack  <[email protected]>
+
+        Ensure scrollable transformed elements that are themselves within scrollable elements don't ignore border-radius
+        https://bugs.webkit.org/show_bug.cgi?id=216978
+        <rdar://69660229>
+
+        Reviewed by Darin Adler.
+
+        * fast/layers/overflow-scroll-transform-border-radius-expected.html: Added.
+        * fast/layers/overflow-scroll-transform-border-radius.html: Added.
+
 2021-05-13  Amir Mark Jr  <[email protected]>
 
         [BigSur] media/video-played-ranges-1.html is flaky failure

Added: trunk/LayoutTests/fast/layers/overflow-scroll-transform-border-radius-expected.html (0 => 277462)


--- trunk/LayoutTests/fast/layers/overflow-scroll-transform-border-radius-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layers/overflow-scroll-transform-border-radius-expected.html	2021-05-13 23:19:48 UTC (rev 277462)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<p>Test passes if the blue rectangle has a rounded top left corner.</p>
+<div style="width: 100px; height: 100px; overflow: scroll;">
+  <div style="transform: translate(10px, 10px);">
+    <div style="width: 50px; height: 50px; background-color: blue; border-radius: 25px 0 0 0;"></div>
+  </div>
+  <div style="width: 200px; height: 1px;"></div>
+</div>

Added: trunk/LayoutTests/fast/layers/overflow-scroll-transform-border-radius.html (0 => 277462)


--- trunk/LayoutTests/fast/layers/overflow-scroll-transform-border-radius.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layers/overflow-scroll-transform-border-radius.html	2021-05-13 23:19:48 UTC (rev 277462)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<p>Test passes if the blue rectangle has a rounded top left corner.</p>
+<div style="width: 100px; height: 100px; overflow: scroll;">
+  <div style="overflow: hidden; border-radius: 25px 0 0 0; transform: translate(10px, 10px);">
+    <div style="width: 50px; height: 50px; background-color: blue;"></div>
+  </div>
+  <div style="width: 200px; height: 1px;"></div>
+</div>

Modified: trunk/Source/WebCore/ChangeLog (277461 => 277462)


--- trunk/Source/WebCore/ChangeLog	2021-05-13 23:16:47 UTC (rev 277461)
+++ trunk/Source/WebCore/ChangeLog	2021-05-13 23:19:48 UTC (rev 277462)
@@ -1,3 +1,34 @@
+2021-05-13  Cameron McCormack  <[email protected]>
+
+        Ensure scrollable transformed elements that are themselves within scrollable elements don't ignore border-radius
+        https://bugs.webkit.org/show_bug.cgi?id=216978
+        <rdar://69660229>
+
+        Reviewed by Darin Adler.
+
+        We use ShouldRespectOverflowClip to prevent clips from ancestors
+        from being used when we paint a scrollable layer (when
+        PaintLayerFlag::PaintingOverflowContents is set). We only look
+        at the ShouldRespectOverflowClip value when we're painting a layer
+        we're considering to be a clip rect root layer, and we unconditionally
+        apply ancestor clips for layers that aren't clip rect roots.
+
+        A non-root layer with a transform is handled by applying the transform
+        and painting the layer as a root layer (since we don't want to handle
+        computing the effect of ancestor clip rects past the transform). When
+        the transformed layer also has a border-radius, we incorrectly skip
+        marking its clip rect as being affected by radius, since we currently
+        do this at the same time as applying ancestor clip rects.
+
+        This patch splits out the setAffectedByRadius call so that it happens
+        even for transformed non-root layers.
+
+        Test: fast/layers/overflow-scroll-transform-border-radius.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::ClipRects::setOverflowClipRectAffectedByRadius):
+        (WebCore::RenderLayer::calculateClipRects const):
+
 2021-05-13  Devin Rousso  <[email protected]>
 
         [macOS] experimental "Use theme color for scroll area background" isn't working

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (277461 => 277462)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2021-05-13 23:16:47 UTC (rev 277461)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2021-05-13 23:19:48 UTC (rev 277462)
@@ -177,6 +177,8 @@
     bool fixed() const { return m_fixed; }
     void setFixed(bool fixed) { m_fixed = fixed; }
 
+    void setOverflowClipRectAffectedByRadius() { m_overflowClipRect.setAffectedByRadius(true); }
+
     bool operator==(const ClipRects& other) const
     {
         return m_overflowClipRect == other.overflowClipRect()
@@ -4488,7 +4490,8 @@
             clipRects.setOverflowClipRect(intersection(newPosClip, clipRects.overflowClipRect()));
             clipRects.setFixedClipRect(intersection(newPosClip, clipRects.fixedClipRect()));
         }
-    }
+    } else if (renderer().hasOverflowClip() && transform() && renderer().style().hasBorderRadius())
+        clipRects.setOverflowClipRectAffectedByRadius();
 
     LOG_WITH_STREAM(ClipRects, stream << "RenderLayer " << this << " calculateClipRects " << clipRectsContext << " computed " << clipRects);
 }
@@ -4558,10 +4561,12 @@
     // Update the clip rects that will be passed to child layers.
     if (renderer().hasClipOrOverflowClip()) {
         // This layer establishes a clip of some kind.
-        if (renderer().hasOverflowClip() && (this != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)) {
-            foregroundRect.intersect(downcast<RenderBox>(renderer()).overflowClipRect(toLayoutPoint(offsetFromRootLocal), nullptr, clipRectsContext.overlayScrollbarSizeRelevancy));
-            if (renderer().style().hasBorderRadius())
+        if (renderer().hasOverflowClip()) {
+            if (this != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip) {
+                foregroundRect.intersect(downcast<RenderBox>(renderer()).overflowClipRect(toLayoutPoint(offsetFromRootLocal), nullptr, clipRectsContext.overlayScrollbarSizeRelevancy));
                 foregroundRect.setAffectedByRadius(true);
+            } else if (transform() && renderer().style().hasBorderRadius())
+                foregroundRect.setAffectedByRadius(true);
         }
 
         if (renderer().hasClip()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to