diff --git a/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp b/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp index f26ef2c6a4..09f8ce046c 100644 --- a/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp +++ b/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp @@ -555,6 +555,10 @@ void DisplayListPlayerSkia::play_command(PaintTextShadow const& command) auto blur_image_filter = SkImageFilters::Blur(command.blur_radius / 2, command.blur_radius / 2, nullptr); SkPaint blur_paint; blur_paint.setImageFilter(blur_image_filter); + // Skia paints color glyphs with their own colors, ignoring the paint color, so tint the shadow layer with a kSrcIn + // blend to force a flat silhouette in the shadow color. The glyphs are drawn opaquely below so the shadow color's + // alpha is applied exactly once. + blur_paint.setColorFilter(SkColorFilters::Blend(to_skia_color(command.color), SkBlendMode::kSrcIn)); canvas.saveLayer(SkCanvas::SaveLayerRec(nullptr, &blur_paint, nullptr, 0)); play_command(DrawGlyphRun { .font_id = command.font_id, .glyphs = command.glyphs, @@ -562,7 +566,7 @@ void DisplayListPlayerSkia::play_command(PaintTextShadow const& command) .glyph_bounding_rect = command.shadow_bounding_rect, .translation = command.draw_location + command.text_rect.location().to_type(), .scale = command.scale, - .color = command.color }); + .color = command.color.with_alpha(255) }); canvas.restore(); } diff --git a/Tests/LibWeb/Ref/data/fonts/COLR-palettes-test-font.ttf b/Tests/LibWeb/Ref/data/fonts/COLR-palettes-test-font.ttf new file mode 100644 index 0000000000..0f28caf21e Binary files /dev/null and b/Tests/LibWeb/Ref/data/fonts/COLR-palettes-test-font.ttf differ diff --git a/Tests/LibWeb/Ref/expected/text-shadow-color-on-color-font-glyph-ref.html b/Tests/LibWeb/Ref/expected/text-shadow-color-on-color-font-glyph-ref.html new file mode 100644 index 0000000000..11232e3f9c --- /dev/null +++ b/Tests/LibWeb/Ref/expected/text-shadow-color-on-color-font-glyph-ref.html @@ -0,0 +1,16 @@ + + +text-shadow uses the shadow color, not the glyph colors, for color-font glyphs + +
A
+
A
diff --git a/Tests/LibWeb/Ref/input/text-shadow-color-on-color-font-glyph.html b/Tests/LibWeb/Ref/input/text-shadow-color-on-color-font-glyph.html new file mode 100644 index 0000000000..5f9d580a43 --- /dev/null +++ b/Tests/LibWeb/Ref/input/text-shadow-color-on-color-font-glyph.html @@ -0,0 +1,17 @@ + + + + +
A