Title: [278443] trunk
Revision
278443
Author
[email protected]
Date
2021-06-03 19:03:04 -0700 (Thu, 03 Jun 2021)

Log Message

Crack in hero text on https://www.apple.com/mac-mini/
https://bugs.webkit.org/show_bug.cgi?id=226610
<rdar://71246655>

Reviewed by Simon Fraser.

Source/WebCore:

FillBox::Text's mask rect needs pixel snapping so that we can position/size it properly on non-1x screens.

Test: fast/clip/hidpi-background-clip-with-text-fill-color.html

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintMaskForTextFillBox):
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
* rendering/RenderBoxModelObject.h:

LayoutTests:

* fast/clip/hidpi-background-clip-with-text-fill-color-expected.html: Added.
* fast/clip/hidpi-background-clip-with-text-fill-color.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (278442 => 278443)


--- trunk/LayoutTests/ChangeLog	2021-06-04 01:53:30 UTC (rev 278442)
+++ trunk/LayoutTests/ChangeLog	2021-06-04 02:03:04 UTC (rev 278443)
@@ -1,3 +1,14 @@
+2021-06-03  Alan Bujtas  <[email protected]>
+
+        Crack in hero text on https://www.apple.com/mac-mini/
+        https://bugs.webkit.org/show_bug.cgi?id=226610
+        <rdar://71246655>
+
+        Reviewed by Simon Fraser.
+
+        * fast/clip/hidpi-background-clip-with-text-fill-color-expected.html: Added.
+        * fast/clip/hidpi-background-clip-with-text-fill-color.html: Added.
+
 2021-06-03  Chris Lord  <[email protected]>
 
         [WPE] position:sticky content is not correctly offset on async scrolled overflow layers with an RTL vertical scrollbar

Added: trunk/LayoutTests/fast/clip/hidpi-background-clip-with-text-fill-color-expected.html (0 => 278443)


--- trunk/LayoutTests/fast/clip/hidpi-background-clip-with-text-fill-color-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/clip/hidpi-background-clip-with-text-fill-color-expected.html	2021-06-04 02:03:04 UTC (rev 278443)
@@ -0,0 +1,16 @@
+<style>
+.container {
+  transform: translateZ(0);
+  padding-left: 340.25px;
+  font-size: 100px;
+  width: 2000px;
+}
+
+#content {
+  background: green;
+  -webkit-background-clip: text;
+  -webkit-text-fill-color: transparent;
+}
+</style>
+PASS if no vertical white line on the 2nd glyph below.
+<div class=container><div id=content>WW</div></div>
\ No newline at end of file

Added: trunk/LayoutTests/fast/clip/hidpi-background-clip-with-text-fill-color.html (0 => 278443)


--- trunk/LayoutTests/fast/clip/hidpi-background-clip-with-text-fill-color.html	                        (rev 0)
+++ trunk/LayoutTests/fast/clip/hidpi-background-clip-with-text-fill-color.html	2021-06-04 02:03:04 UTC (rev 278443)
@@ -0,0 +1,19 @@
+<style>
+.container {
+  transform: translateZ(0);
+  padding-left: 340.25px;
+  font-size: 100px;
+  width: 2000px;
+}
+
+#content {
+  background: green;
+  -webkit-background-clip: text;
+  -webkit-text-fill-color: transparent;
+}
+</style>
+PASS if no vertical white line on the 2nd glyph below.
+<div class=container><div id=content>WW</div></div>
+<script>
+content.style.transform = "translateY(0)";
+</script>

Modified: trunk/Source/WebCore/ChangeLog (278442 => 278443)


--- trunk/Source/WebCore/ChangeLog	2021-06-04 01:53:30 UTC (rev 278442)
+++ trunk/Source/WebCore/ChangeLog	2021-06-04 02:03:04 UTC (rev 278443)
@@ -1,3 +1,20 @@
+2021-06-03  Alan Bujtas  <[email protected]>
+
+        Crack in hero text on https://www.apple.com/mac-mini/
+        https://bugs.webkit.org/show_bug.cgi?id=226610
+        <rdar://71246655>
+
+        Reviewed by Simon Fraser.
+
+        FillBox::Text's mask rect needs pixel snapping so that we can position/size it properly on non-1x screens.
+
+        Test: fast/clip/hidpi-background-clip-with-text-fill-color.html
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintMaskForTextFillBox):
+        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+        * rendering/RenderBoxModelObject.h:
+
 2021-06-03  Jean-Yves Avenard  <[email protected]>
 
         REGRESSION(r278336): fast/dom/Window/property-access-on-cached-window-after-frame-removed.html (layout-test) is a constant crash

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (278442 => 278443)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2021-06-04 01:53:30 UTC (rev 278442)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2021-06-04 02:03:04 UTC (rev 278443)
@@ -698,7 +698,7 @@
     return view().imageQualityController().chooseInterpolationQuality(context, this, image, layer, size);
 }
 
-void RenderBoxModelObject::paintMaskForTextFillBox(ImageBuffer* maskImage, const IntRect& maskRect, LegacyInlineFlowBox* box, const LayoutRect& scrolledPaintRect)
+void RenderBoxModelObject::paintMaskForTextFillBox(ImageBuffer* maskImage, const FloatRect& maskRect, LegacyInlineFlowBox* box, const LayoutRect& scrolledPaintRect)
 {
     GraphicsContext& maskImageContext = maskImage->context();
     maskImageContext.translate(-maskRect.location());
@@ -705,7 +705,7 @@
 
     // Now add the text to the clip. We do this by painting using a special paint phase that signals to
     // InlineTextBoxes that they should just add their contents to the clip.
-    PaintInfo info(maskImageContext, maskRect, PaintPhase::TextClip, PaintBehavior::ForceBlackText);
+    PaintInfo info(maskImageContext, LayoutRect { maskRect }, PaintPhase::TextClip, PaintBehavior::ForceBlackText);
     if (box) {
         const LegacyRootInlineBox& rootBox = box->root();
         box->paint(info, LayoutPoint(scrolledPaintRect.x() - box->x(), scrolledPaintRect.y() - box->y()), rootBox.lineTop(), rootBox.lineBottom());
@@ -852,7 +852,7 @@
     
     GraphicsContextStateSaver backgroundClipStateSaver(context, false);
     RefPtr<ImageBuffer> maskImage;
-    IntRect maskRect;
+    FloatRect maskRect;
 
     if (bgLayer.clip() == FillBox::Padding || bgLayer.clip() == FillBox::Content) {
         // Clip to the padding or content boxes as necessary.
@@ -869,8 +869,8 @@
         // We have to draw our text into a mask that can then be used to clip background drawing.
         // First figure out how big the mask has to be.  It should be no bigger than what we need
         // to actually render, so we should intersect the dirty rect with the border box of the background.
-        maskRect = snappedIntRect(rect);
-        maskRect.intersect(snappedIntRect(paintInfo.rect));
+        maskRect = snapRectToDevicePixels(rect, deviceScaleFactor);
+        maskRect.intersect(snapRectToDevicePixels(paintInfo.rect, deviceScaleFactor));
 
         // Now create the mask.
         maskImage = ImageBuffer::createCompatibleBuffer(maskRect.size(), DestinationColorSpace::SRGB(), context);

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (278442 => 278443)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2021-06-04 01:53:30 UTC (rev 278442)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2021-06-04 02:03:04 UTC (rev 278443)
@@ -326,7 +326,7 @@
     void drawBoxSideFromPath(GraphicsContext&, const LayoutRect&, const Path&, const BorderEdges&,
         float thickness, float drawThickness, BoxSide, const RenderStyle&,
         Color, BorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
-    void paintMaskForTextFillBox(ImageBuffer*, const IntRect&, LegacyInlineFlowBox*, const LayoutRect&);
+    void paintMaskForTextFillBox(ImageBuffer*, const FloatRect&, LegacyInlineFlowBox*, const LayoutRect&);
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to