Title: [269242] trunk
Revision
269242
Author
[email protected]
Date
2020-11-01 19:50:42 -0800 (Sun, 01 Nov 2020)

Log Message

REGRESSION (r252689): box-shadow with inset and negative spread renders incorrectly
https://bugs.webkit.org/show_bug.cgi?id=209930

Patch by Mason Xiao <[email protected]> on 2020-11-01
Reviewed by Simon Fraser.

Source/WebCore:

r252689 introduced a typo when refactoring the calculation of xOffset.
Instead of subtracting the shadowSpread, it was added.
This caused issues when the shadowSpread was greater than approximately half of the enclosing element's width.

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

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintBoxShadow): Change sign of shadowSpread in xOffset calculation for inset

LayoutTests:

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (269241 => 269242)


--- trunk/LayoutTests/ChangeLog	2020-11-02 02:49:38 UTC (rev 269241)
+++ trunk/LayoutTests/ChangeLog	2020-11-02 03:50:42 UTC (rev 269242)
@@ -1,3 +1,13 @@
+2020-11-01  Mason Xiao  <[email protected]>
+
+        REGRESSION (r252689): box-shadow with inset and negative spread renders incorrectly
+        https://bugs.webkit.org/show_bug.cgi?id=209930
+
+        Reviewed by Simon Fraser.
+
+        * fast/box-shadow/negative-inset-box-shadow-expected.html: Added.
+        * fast/box-shadow/negative-inset-box-shadow.html: Added.
+
 2020-11-01  Diego Pino Garcia  <[email protected]>
 
         Emit baselines for WPT css-sizing/aspect-ratio/quirks-mode* tests after resync in r269187

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


--- trunk/LayoutTests/fast/box-shadow/negative-inset-box-shadow-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/negative-inset-box-shadow-expected.html	2020-11-02 03:50:42 UTC (rev 269242)
@@ -0,0 +1,10 @@
+<style>
+    div {
+        position: absolute;
+        top: 10px;
+        left: 10px;
+        height: 50px;
+        width: 50px;
+    }
+</style>
+<div></div>

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


--- trunk/LayoutTests/fast/box-shadow/negative-inset-box-shadow.html	                        (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/negative-inset-box-shadow.html	2020-11-02 03:50:42 UTC (rev 269242)
@@ -0,0 +1,11 @@
+<style>
+    div {
+        position: absolute;
+        top: 10px;
+        left: 10px;
+        box-shadow: rgba(0,0,0,0) 0px 0px 50px -25px inset;
+        height: 50px;
+        width: 50px;
+    }
+</style>
+<div></div>

Modified: trunk/Source/WebCore/ChangeLog (269241 => 269242)


--- trunk/Source/WebCore/ChangeLog	2020-11-02 02:49:38 UTC (rev 269241)
+++ trunk/Source/WebCore/ChangeLog	2020-11-02 03:50:42 UTC (rev 269242)
@@ -1,3 +1,19 @@
+2020-11-01  Mason Xiao  <[email protected]>
+
+        REGRESSION (r252689): box-shadow with inset and negative spread renders incorrectly
+        https://bugs.webkit.org/show_bug.cgi?id=209930
+
+        Reviewed by Simon Fraser.
+
+        r252689 introduced a typo when refactoring the calculation of xOffset.
+        Instead of subtracting the shadowSpread, it was added.
+        This caused issues when the shadowSpread was greater than approximately half of the enclosing element's width.
+
+        Test: fast/box-shadow/negative-inset-box-shadow.html
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintBoxShadow): Change sign of shadowSpread in xOffset calculation for inset
+
 2020-11-01  Simon Fraser  <[email protected]>
 
         [LFC Display] Pass deviceScaleFactor around with GraphicsContext at paint time

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (269241 => 269242)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2020-11-02 02:49:38 UTC (rev 269241)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2020-11-02 03:50:42 UTC (rev 269242)
@@ -2531,7 +2531,7 @@
             else
                 context.clip(pixelSnappedBorderRect.rect());
 
-            LayoutUnit xOffset = 2 * paintRect.width() + std::max<LayoutUnit>(0, shadowOffset.width()) + shadowPaintingExtent + 2 * shadowSpread + LayoutUnit(1);
+            LayoutUnit xOffset = 2 * paintRect.width() + std::max<LayoutUnit>(0, shadowOffset.width()) + shadowPaintingExtent - 2 * shadowSpread + LayoutUnit(1);
             LayoutSize extraOffset(xOffset.ceil(), 0);
 
             context.translate(extraOffset);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to