Diff
Modified: trunk/LayoutTests/ChangeLog (270849 => 270850)
--- trunk/LayoutTests/ChangeLog 2020-12-15 18:00:55 UTC (rev 270849)
+++ trunk/LayoutTests/ChangeLog 2020-12-15 18:16:25 UTC (rev 270850)
@@ -1,3 +1,13 @@
+2020-12-15 Simon Fraser <[email protected]>
+
+ REGRESSION (r259137): Clip-path rendering regression when element contains transformed child
+ https://bugs.webkit.org/show_bug.cgi?id=219829
+
+ Reviewed by Said Abou-Hallawa.
+
+ * css3/masking/clip-path-overflow-hidden-bounds-expected.html: Added.
+ * css3/masking/clip-path-overflow-hidden-bounds.html: Added.
+
2020-12-15 Devin Rousso <[email protected]>
Toggling pointer-events on body does not re-enable scrolling on child
Added: trunk/LayoutTests/css3/masking/clip-path-overflow-hidden-bounds-expected.html (0 => 270850)
--- trunk/LayoutTests/css3/masking/clip-path-overflow-hidden-bounds-expected.html (rev 0)
+++ trunk/LayoutTests/css3/masking/clip-path-overflow-hidden-bounds-expected.html 2020-12-15 18:16:25 UTC (rev 270850)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<style>
+ .wrapper {
+ width: 200px;
+ height: 200px;
+ border: 1px solid black;
+ }
+ .box {
+ width: 200px;
+ height: 200px;
+ background-color: green;
+ overflow: hidden;
+ -webkit-clip-path: url(#MaskTest);
+ }
+</style>
+</head>
+<body>
+ <svg height="0" width="0">
+ <clipPath id="MaskTest" clipPathUnits="objectBoundingBox" transform="scale(0.005, 0.005)">
+ <path d="M0,0 L100,0 L100,100 L0,100 L0,0 z"/>
+ </clipPath>
+ </svg>
+ <div class="wrapper">
+ <div class="box"></div>
+ </div>
+</body>
+</html>
Added: trunk/LayoutTests/css3/masking/clip-path-overflow-hidden-bounds.html (0 => 270850)
--- trunk/LayoutTests/css3/masking/clip-path-overflow-hidden-bounds.html (rev 0)
+++ trunk/LayoutTests/css3/masking/clip-path-overflow-hidden-bounds.html 2020-12-15 18:16:25 UTC (rev 270850)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<style>
+ .wrapper {
+ width: 200px;
+ height: 200px;
+ border: 1px solid black;
+ }
+ .box {
+ width: 200px;
+ height: 200px;
+ background-color: green;
+ overflow: hidden;
+ -webkit-clip-path: url(#MaskTest);
+ }
+
+ .child-box {
+ width: 100%;
+ height: 100%;
+ background-color: red;
+ transform: translate(100px, 0);
+ }
+</style>
+</head>
+<body>
+ <svg height="0" width="0">
+ <clipPath id="MaskTest" clipPathUnits="objectBoundingBox" transform="scale(0.005, 0.005)">
+ <path d="M0,0 L100,0 L100,100 L0,100 L0,0 z"/>
+ </clipPath>
+ </svg>
+ <div class="wrapper">
+ <div class="box">
+ <div class="child-box"></div>
+ </div>
+ </div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (270849 => 270850)
--- trunk/Source/WebCore/ChangeLog 2020-12-15 18:00:55 UTC (rev 270849)
+++ trunk/Source/WebCore/ChangeLog 2020-12-15 18:16:25 UTC (rev 270850)
@@ -1,3 +1,20 @@
+2020-12-15 Simon Fraser <[email protected]>
+
+ REGRESSION (r259137): Clip-path rendering regression when element contains transformed child
+ https://bugs.webkit.org/show_bug.cgi?id=219829
+ <rdar://problem/66308088>
+
+ Reviewed by Said Abou-Hallawa.
+
+ When computing the geometry for clip-path when applied to a CSS box, we should take overflow:hidden
+ on the box into account. It's not entirely clear what the correct geometry is
+ (https://github.com/w3c/csswg-drafts/issues/5786) but this avoids stretched masks.
+
+ Test: css3/masking/clip-path-overflow-hidden-bounds.html
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::setupClipPath):
+
2020-12-15 Devin Rousso <[email protected]>
Toggling pointer-events on body does not re-enable scrolling on child
Modified: trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp (270849 => 270850)
--- trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp 2020-12-15 18:00:55 UTC (rev 270849)
+++ trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp 2020-12-15 18:16:25 UTC (rev 270850)
@@ -419,7 +419,7 @@
// Candidate element is no longer visible.
if (!m_visibilityCandidateList.remove(element))
return;
- ASSERT(hasVisibleChangeState());
+// ASSERT(hasVisibleChangeState());
if (m_visibilityCandidateList.computesEmpty())
setHasIndeterminateState();
}
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (270849 => 270850)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2020-12-15 18:00:55 UTC (rev 270849)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2020-12-15 18:16:25 UTC (rev 270850)
@@ -4504,24 +4504,24 @@
return Path();
}
-bool RenderLayer::setupClipPath(GraphicsContext& context, const LayerPaintingInfo& paintingInfo, const LayoutSize& offsetFromRoot, Optional<LayoutRect>& rootRelativeBounds)
+bool RenderLayer::setupClipPath(GraphicsContext& context, const LayerPaintingInfo& paintingInfo, const LayoutSize& offsetFromRoot)
{
if (!renderer().hasClipPath() || context.paintingDisabled() || paintingInfo.paintDirtyRect.isEmpty())
return false;
- if (!rootRelativeBounds)
- rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, offsetFromRoot, { });
-
// SVG elements get clipped in SVG code.
if (is<RenderSVGRoot>(renderer()))
return false;
+ // It's not clear that this geometry is correct: https://github.com/w3c/csswg-drafts/issues/5786
+ auto rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, offsetFromRoot, { UseLocalClipRectIfPossible });
+
auto& style = renderer().style();
LayoutSize paintingOffsetFromRoot = LayoutSize(snapSizeToDevicePixel(offsetFromRoot + paintingInfo.subpixelOffset, LayoutPoint(), renderer().document().deviceScaleFactor()));
ASSERT(style.clipPath());
if (is<ShapeClipPathOperation>(*style.clipPath()) || (is<BoxClipPathOperation>(*style.clipPath()) && is<RenderBox>(renderer()))) {
WindRule windRule;
- Path path = computeClipPath(paintingOffsetFromRoot, rootRelativeBounds.value(), windRule);
+ Path path = computeClipPath(paintingOffsetFromRoot, rootRelativeBounds, windRule);
context.save();
context.clipPath(path, windRule);
return true;
@@ -4532,7 +4532,7 @@
Element* element = renderer().document().getElementById(referenceClipPathOperation->fragment());
if (element && element->renderer() && is<RenderSVGResourceClipper>(element->renderer())) {
context.save();
- auto referenceBox = snapRectToDevicePixels(rootRelativeBounds.value(), renderer().document().deviceScaleFactor());
+ auto referenceBox = snapRectToDevicePixels(rootRelativeBounds, renderer().document().deviceScaleFactor());
auto offset = referenceBox.location();
context.translate(offset);
FloatRect svgReferenceBox { {}, referenceBox.size() };
@@ -4562,7 +4562,7 @@
return nullptr;
}
-GraphicsContext* RenderLayer::setupFilters(GraphicsContext& destinationContext, LayerPaintingInfo& paintingInfo, OptionSet<PaintLayerFlag> paintFlags, const LayoutSize& offsetFromRoot, Optional<LayoutRect>& rootRelativeBounds)
+GraphicsContext* RenderLayer::setupFilters(GraphicsContext& destinationContext, LayerPaintingInfo& paintingInfo, OptionSet<PaintLayerFlag> paintFlags, const LayoutSize& offsetFromRoot)
{
auto* paintingFilters = filtersForPainting(destinationContext, paintFlags);
if (!paintingFilters)
@@ -4571,10 +4571,9 @@
LayoutRect filterRepaintRect = paintingFilters->dirtySourceRect();
filterRepaintRect.move(offsetFromRoot);
- if (!rootRelativeBounds)
- rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, offsetFromRoot, { });
+ auto rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, offsetFromRoot, { });
- GraphicsContext* filterContext = paintingFilters->beginFilterEffect(destinationContext, enclosingIntRect(rootRelativeBounds.value()), enclosingIntRect(paintingInfo.paintDirtyRect), enclosingIntRect(filterRepaintRect));
+ GraphicsContext* filterContext = paintingFilters->beginFilterEffect(destinationContext, enclosingIntRect(rootRelativeBounds), enclosingIntRect(paintingInfo.paintDirtyRect), enclosingIntRect(filterRepaintRect));
if (!filterContext)
return nullptr;
@@ -4644,7 +4643,6 @@
updateLayerListsIfNeeded();
LayoutSize offsetFromRoot = offsetFromAncestor(paintingInfo.rootLayer);
- Optional<LayoutRect> rootRelativeBounds;
// FIXME: We shouldn't have to disable subpixel quantization for overflow clips or subframes once we scroll those
// things on the scrolling thread.
@@ -4658,7 +4656,7 @@
bool hasClipPath = false;
if (shouldApplyClipPath(paintingInfo.paintBehavior, localPaintFlags))
- hasClipPath = setupClipPath(context, paintingInfo, columnAwareOffsetFromRoot, rootRelativeBounds);
+ hasClipPath = setupClipPath(context, paintingInfo, columnAwareOffsetFromRoot);
bool selectionAndBackgroundsOnly = paintingInfo.paintBehavior.contains(PaintBehavior::SelectionAndBackgroundsOnly);
bool selectionOnly = paintingInfo.paintBehavior.contains(PaintBehavior::SelectionOnly);
@@ -4697,7 +4695,7 @@
{ // Scope for filter-related state changes.
LayerPaintingInfo localPaintingInfo(paintingInfo);
- GraphicsContext* filterContext = setupFilters(context, localPaintingInfo, paintFlags, columnAwareOffsetFromRoot, rootRelativeBounds);
+ GraphicsContext* filterContext = setupFilters(context, localPaintingInfo, paintFlags, columnAwareOffsetFromRoot);
if (filterContext && haveTransparency) {
// If we have a filter and transparency, we have to eagerly start a transparency layer here, rather than risk a child layer lazily starts one with the wrong context.
beginTransparencyLayers(context, localPaintingInfo, paintingInfo.paintDirtyRect);
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (270849 => 270850)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2020-12-15 18:00:55 UTC (rev 270849)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2020-12-15 18:16:25 UTC (rev 270850)
@@ -1049,13 +1049,13 @@
Path computeClipPath(const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, WindRule&) const;
- bool setupClipPath(GraphicsContext&, const LayerPaintingInfo&, const LayoutSize& offsetFromRoot, Optional<LayoutRect>& rootRelativeBounds);
+ bool setupClipPath(GraphicsContext&, const LayerPaintingInfo&, const LayoutSize& offsetFromRoot);
void ensureLayerFilters();
void clearLayerFilters();
RenderLayerFilters* filtersForPainting(GraphicsContext&, OptionSet<PaintLayerFlag>) const;
- GraphicsContext* setupFilters(GraphicsContext& destinationContext, LayerPaintingInfo&, OptionSet<PaintLayerFlag>, const LayoutSize& offsetFromRoot, Optional<LayoutRect>& rootRelativeBounds);
+ GraphicsContext* setupFilters(GraphicsContext& destinationContext, LayerPaintingInfo&, OptionSet<PaintLayerFlag>, const LayoutSize& offsetFromRoot);
void applyFilters(GraphicsContext& originalContext, const LayerPaintingInfo&, OptionSet<PaintBehavior>, const LayerFragments&);
void paintLayer(GraphicsContext&, const LayerPaintingInfo&, OptionSet<PaintLayerFlag>);