Title: [252689] trunk
Revision
252689
Author
[email protected]
Date
2019-11-20 09:12:08 -0800 (Wed, 20 Nov 2019)

Log Message

REGRESSION (r252161): box-shadow with inset and rounded borders is clipped
https://bugs.webkit.org/show_bug.cgi?id=204348

Reviewed by Zalan Bujtas.

Source/WebCore:

r252161 introduced a bug for inset shadows where we passed the wrong rect to areaCastingShadowInHole().
Clean the code up a little, and make the xOffset stuff more similar to the outset shadow path.
We could still do a better job of pixel snapping here.

Test: fast/box-shadow/inset-box-shadow.html

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintBoxShadow):

LayoutTests:

* fast/box-shadow/inset-box-shadow-expected.html: Added.
* fast/box-shadow/inset-box-shadow.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (252688 => 252689)


--- trunk/LayoutTests/ChangeLog	2019-11-20 16:53:58 UTC (rev 252688)
+++ trunk/LayoutTests/ChangeLog	2019-11-20 17:12:08 UTC (rev 252689)
@@ -1,3 +1,13 @@
+2019-11-20  Simon Fraser  <[email protected]>
+
+        REGRESSION (r252161): box-shadow with inset and rounded borders is clipped
+        https://bugs.webkit.org/show_bug.cgi?id=204348
+
+        Reviewed by Zalan Bujtas.
+
+        * fast/box-shadow/inset-box-shadow-expected.html: Added.
+        * fast/box-shadow/inset-box-shadow.html: Added.
+
 2019-11-20  Per Arne Vollan  <[email protected]>
 
         Layout Test fast/text/font-antialiasing-save-restore.html is failing

Added: trunk/LayoutTests/fast/box-shadow/inset-box-shadow-expected.html (0 => 252689)


--- trunk/LayoutTests/fast/box-shadow/inset-box-shadow-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/inset-box-shadow-expected.html	2019-11-20 17:12:08 UTC (rev 252689)
@@ -0,0 +1,14 @@
+<style>
+
+    div {
+        position: absolute;
+        top: 32px;
+        left: 32px;
+        border-radius: 50%;
+        box-shadow: black 0px 0px 0px 2px;
+        height: 36px;
+        width: 36px;
+    }
+</style>
+<p>You should see a black outlined square here</p>
+<div></div>
\ No newline at end of file

Added: trunk/LayoutTests/fast/box-shadow/inset-box-shadow.html (0 => 252689)


--- trunk/LayoutTests/fast/box-shadow/inset-box-shadow.html	                        (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/inset-box-shadow.html	2019-11-20 17:12:08 UTC (rev 252689)
@@ -0,0 +1,13 @@
+<style>
+    div {
+        position: absolute;
+        top: 30px;
+        left: 30px;
+        border-radius: 50%;
+        box-shadow: black 0px 0px 0px 2px inset;
+        height: 40px;
+        width: 40px;
+    }
+</style>
+<p>You should see a black outlined square here</p>
+<div></div>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (252688 => 252689)


--- trunk/Source/WebCore/ChangeLog	2019-11-20 16:53:58 UTC (rev 252688)
+++ trunk/Source/WebCore/ChangeLog	2019-11-20 17:12:08 UTC (rev 252689)
@@ -1,3 +1,19 @@
+2019-11-20  Simon Fraser  <[email protected]>
+
+        REGRESSION (r252161): box-shadow with inset and rounded borders is clipped
+        https://bugs.webkit.org/show_bug.cgi?id=204348
+
+        Reviewed by Zalan Bujtas.
+
+        r252161 introduced a bug for inset shadows where we passed the wrong rect to areaCastingShadowInHole().
+        Clean the code up a little, and make the xOffset stuff more similar to the outset shadow path.
+        We could still do a better job of pixel snapping here.
+
+        Test: fast/box-shadow/inset-box-shadow.html
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintBoxShadow):
+
 2019-11-20  Zalan Bujtas  <[email protected]>
 
         [LFC][IFC] TextUtil::width should use FontCascade::widthForSimpleText when applicable

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (252688 => 252689)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2019-11-20 16:53:58 UTC (rev 252688)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2019-11-20 17:12:08 UTC (rev 252689)
@@ -2474,8 +2474,10 @@
 
             Color fillColor(shadowColor.red(), shadowColor.green(), shadowColor.blue(), 255);
 
-            FloatRect pixelSnappedOuterRect = snapRectToDevicePixels(areaCastingShadowInHole(holeRect, shadowPaintingExtent, shadowSpread, shadowOffset), deviceScaleFactor);
+            LayoutRect shadowCastingRect = areaCastingShadowInHole(border.rect(), shadowPaintingExtent, shadowSpread, shadowOffset);
             RoundedRect roundedHoleRect(holeRect, border.radii());
+
+            FloatRect pixelSnappedOuterRect = snapRectToDevicePixels(shadowCastingRect, deviceScaleFactor);
             FloatRoundedRect pixelSnappedRoundedHole = roundedHoleRect.pixelSnappedRoundedRectForPainting(deviceScaleFactor);
 
             GraphicsContextStateSaver stateSaver(context);
@@ -2485,7 +2487,9 @@
             } else
                 context.clip(pixelSnappedBorderRect.rect());
 
-            IntSize extraOffset(2 * roundToInt(paintRect.width()) + std::max<LayoutUnit>(0, shadowOffset.width()) + shadowPaintingExtent - 2 * shadowSpread + 1, 0);
+            LayoutUnit xOffset = 2 * paintRect.width() + std::max<LayoutUnit>(0, shadowOffset.width()) + shadowPaintingExtent + 2 * shadowSpread + LayoutUnit(1);
+            LayoutSize extraOffset(xOffset.ceil(), 0);
+
             context.translate(extraOffset);
             shadowOffset -= extraOffset;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to