Title: [283258] trunk
Revision
283258
Author
[email protected]
Date
2021-09-29 13:38:28 -0700 (Wed, 29 Sep 2021)

Log Message

Thin hairline gap displayed for subpixel sized inset box-shadows
https://bugs.webkit.org/show_bug.cgi?id=230814

Reviewed by Simon Fraser.

Source/WebCore:

Add missing device pixel snapping for inset offset.

Test: fast/box-shadow/hidpi-box-shadow-inset-on-subpixel-position.html

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

LayoutTests:

* fast/box-shadow/hidpi-box-shadow-inset-on-subpixel-position-expected.html: Added.
* fast/box-shadow/hidpi-box-shadow-inset-on-subpixel-position.html: Added.
* platform/win/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (283257 => 283258)


--- trunk/LayoutTests/ChangeLog	2021-09-29 20:35:07 UTC (rev 283257)
+++ trunk/LayoutTests/ChangeLog	2021-09-29 20:38:28 UTC (rev 283258)
@@ -1,3 +1,14 @@
+2021-09-29  Alan Bujtas  <[email protected]>
+
+        Thin hairline gap displayed for subpixel sized inset box-shadows
+        https://bugs.webkit.org/show_bug.cgi?id=230814
+
+        Reviewed by Simon Fraser.
+
+        * fast/box-shadow/hidpi-box-shadow-inset-on-subpixel-position-expected.html: Added.
+        * fast/box-shadow/hidpi-box-shadow-inset-on-subpixel-position.html: Added.
+        * platform/win/TestExpectations:
+
 2021-09-29  Eric Hutchison  <[email protected]>
 
         Fixed incorrect test expectations for imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-default-feature-policy.https.html.

Added: trunk/LayoutTests/fast/box-shadow/hidpi-box-shadow-inset-on-subpixel-position-expected.html (0 => 283258)


--- trunk/LayoutTests/fast/box-shadow/hidpi-box-shadow-inset-on-subpixel-position-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/hidpi-box-shadow-inset-on-subpixel-position-expected.html	2021-09-29 20:38:28 UTC (rev 283258)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<title>Test if subpixel inset shadows paint properly.</title>
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background-color: yellow;
+}
+</style>
+</body>
+<div style="box-shadow: 1px 2px inset"></div>
+<div style="box-shadow: 1px 2px inset"></div>
+<div style="box-shadow: 1px 2px inset"></div>
+<div style="box-shadow: 1.5px 1.5px inset"></div>
+<div style="box-shadow: 1.5px 1.5px inset"></div>
+<div style="box-shadow: 1.5px 1.5px inset"></div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/box-shadow/hidpi-box-shadow-inset-on-subpixel-position.html (0 => 283258)


--- trunk/LayoutTests/fast/box-shadow/hidpi-box-shadow-inset-on-subpixel-position.html	                        (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/hidpi-box-shadow-inset-on-subpixel-position.html	2021-09-29 20:38:28 UTC (rev 283258)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<title>Test if subpixel inset shadows paint properly.</title>
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background-color: yellow;
+}
+</style>
+</body>
+<div style="box-shadow: 1px 2px inset"></div>
+<div style="box-shadow: 1.1px 1.9px inset"></div>
+<div style="box-shadow: 1.2px 1.8px inset"></div>
+<div style="box-shadow: 1.3px 1.7px inset"></div>
+<div style="box-shadow: 1.4px 1.6px inset"></div>
+<div style="box-shadow: 1.5px 1.5px inset"></div>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/platform/win/TestExpectations (283257 => 283258)


--- trunk/LayoutTests/platform/win/TestExpectations	2021-09-29 20:35:07 UTC (rev 283257)
+++ trunk/LayoutTests/platform/win/TestExpectations	2021-09-29 20:38:28 UTC (rev 283258)
@@ -602,6 +602,7 @@
 webkit.org/b/87919 fast/repaint/hidpi-wrong-repaint-rect-when-parent-has-noncompositing-transform.html [ Failure ]
 
 webkit.org/b/151754 fast/borders/hidpi-border-clipping-right-after-move.html [ ImageOnlyFailure ]
+fast/box-shadow/hidpi-box-shadow-inset-on-subpixel-position.html [ ImageOnlyFailure ]
 
 # Skip because this platform does not support a paging mouse wheel event
 fast/events/wheel/platform-wheelevent-paging-x-in-non-scrolling-div.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (283257 => 283258)


--- trunk/Source/WebCore/ChangeLog	2021-09-29 20:35:07 UTC (rev 283257)
+++ trunk/Source/WebCore/ChangeLog	2021-09-29 20:38:28 UTC (rev 283258)
@@ -1,5 +1,19 @@
 2021-09-29  Alan Bujtas  <[email protected]>
 
+        Thin hairline gap displayed for subpixel sized inset box-shadows
+        https://bugs.webkit.org/show_bug.cgi?id=230814
+
+        Reviewed by Simon Fraser.
+
+        Add missing device pixel snapping for inset offset.
+
+        Test: fast/box-shadow/hidpi-box-shadow-inset-on-subpixel-position.html
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintBoxShadow):
+
+2021-09-29  Alan Bujtas  <[email protected]>
+
         [LFC][IFC] InlineDisplayContentBuilder should use the first-line style when applicable
         https://bugs.webkit.org/show_bug.cgi?id=230932
 

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (283257 => 283258)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2021-09-29 20:35:07 UTC (rev 283257)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2021-09-29 20:38:28 UTC (rev 283258)
@@ -2544,7 +2544,8 @@
             context.translate(extraOffset);
             shadowOffset -= extraOffset;
 
-            context.setShadow(shadowOffset, shadowRadius, shadowColor, shadow->isWebkitBoxShadow() ? ShadowRadiusMode::Legacy : ShadowRadiusMode::Default);
+            auto snappedShadowOffset = roundSizeToDevicePixels(shadowOffset, deviceScaleFactor);
+            context.setShadow(snappedShadowOffset, shadowRadius, shadowColor, shadow->isWebkitBoxShadow() ? ShadowRadiusMode::Legacy : ShadowRadiusMode::Default);
             context.fillRectWithRoundedHole(pixelSnappedOuterRect, pixelSnappedHoleRect, fillColor);
         }
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to