diff --git a/gfx/tests/reftest/1853216-1-ref.html b/gfx/tests/reftest/1853216-1-ref.html
new file mode 100644
index 000000000000..5314b6e84abf
--- /dev/null
+++ b/gfx/tests/reftest/1853216-1-ref.html
@@ -0,0 +1,7 @@
+
+
+
+🕐
+🕐
+🕐
+
diff --git a/gfx/tests/reftest/1853216-1.html b/gfx/tests/reftest/1853216-1.html
new file mode 100644
index 000000000000..62f0922f3a3c
--- /dev/null
+++ b/gfx/tests/reftest/1853216-1.html
@@ -0,0 +1,9 @@
+
+
+
+
+🕐
+🕒
+🕘
+
diff --git a/gfx/tests/reftest/reftest.list b/gfx/tests/reftest/reftest.list
index f9a4f54e51b7..188c4c21c04e 100644
--- a/gfx/tests/reftest/reftest.list
+++ b/gfx/tests/reftest/reftest.list
@@ -43,3 +43,4 @@ pref(layout.css.backdrop-filter.enabled,true) == 1765862.html 1765862-ref.html
skip-if(!cocoaWidget) != 1806140.html 1806140-notref.html
fuzzy(0-1,0-240) == 1812341.html 1812341-ref.html
random-if(gtkWidget) fuzzy-if(Android,0-125,0-106) == 1845828-1.html 1845828-1-ref.html # Result on Linux depends on font configuration/hinting/etc, affecting whether subpixel positioning is used
+fuzzy(0-1,0-4) == 1853216-1.html 1853216-1-ref.html
diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp
index 14b317148b54..08e441f7875e 100644
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -2313,6 +2313,7 @@ void gfxFont::Draw(const gfxTextRun* aTextRun, uint32_t aStart, uint32_t aEnd,
fontParams.obliqueSkew = SkewForSyntheticOblique();
fontParams.haveSVGGlyphs = GetFontEntry()->TryGetSVGData(this);
fontParams.haveColorGlyphs = GetFontEntry()->TryGetColorGlyphs();
+ fontParams.hasTextShadow = aRunParams.hasTextShadow;
fontParams.contextPaint = aRunParams.runContextPaint;
if (fontParams.haveColorGlyphs && !UseNativeColrFontSupport()) {
@@ -2649,6 +2650,11 @@ bool gfxFont::RenderColorGlyph(DrawTarget* aDrawTarget, gfxContext* aContext,
layout::TextDrawTarget* aTextDrawer,
const FontDrawParams& aFontParams,
const Point& aPoint, uint32_t aGlyphId) {
+ if (aTextDrawer && aFontParams.hasTextShadow) {
+ aTextDrawer->FoundUnsupportedFeature();
+ return true;
+ }
+
if (const auto* paintGraph =
COLRFonts::GetGlyphPaintGraph(GetFontEntry()->GetCOLR(), aGlyphId)) {
const auto* hbShaper = GetHarfBuzzShaper();
diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h
index 34719c1cb397..1f7a9c413970 100644
--- a/gfx/thebes/gfxFont.h
+++ b/gfx/thebes/gfxFont.h
@@ -2320,6 +2320,7 @@ struct MOZ_STACK_CLASS TextRunDrawParams {
bool isRTL = false;
bool paintSVGGlyphs = true;
bool allowGDI = true;
+ bool hasTextShadow = false;
// MRU cache of color-font palettes being used by fonts in the run. We cache
// these in the TextRunDrawParams so that we can avoid re-creating a new
@@ -2364,6 +2365,7 @@ struct MOZ_STACK_CLASS FontDrawParams {
bool isVerticalFont;
bool haveSVGGlyphs;
bool haveColorGlyphs;
+ bool hasTextShadow; // whether we're rendering with a text-shadow
};
struct MOZ_STACK_CLASS EmphasisMarkDrawParams {
diff --git a/gfx/thebes/gfxTextRun.cpp b/gfx/thebes/gfxTextRun.cpp
index 7e4aada24923..70fea0a6e92c 100644
--- a/gfx/thebes/gfxTextRun.cpp
+++ b/gfx/thebes/gfxTextRun.cpp
@@ -624,6 +624,7 @@ void gfxTextRun::Draw(const Range aRange, const gfx::Point aPt,
params.textStrokePattern = aParams.textStrokePattern;
params.drawOpts = aParams.drawOpts;
params.drawMode = aParams.drawMode;
+ params.hasTextShadow = aParams.hasTextShadow;
params.callbacks = aParams.callbacks;
params.runContextPaint = aParams.contextPaint;
params.paintSVGGlyphs =
diff --git a/gfx/thebes/gfxTextRun.h b/gfx/thebes/gfxTextRun.h
index ddf5ea392277..0805816e3257 100644
--- a/gfx/thebes/gfxTextRun.h
+++ b/gfx/thebes/gfxTextRun.h
@@ -264,6 +264,7 @@ class gfxTextRun : public gfxShapedText {
mozilla::SVGContextPaint* contextPaint = nullptr;
gfxTextRunDrawCallbacks* callbacks = nullptr;
bool allowGDI = true;
+ bool hasTextShadow = false;
explicit DrawParams(gfxContext* aContext) : context(aContext) {}
};
diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp
index e000d43f3c8f..04337747b75c 100644
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -223,6 +223,7 @@ struct nsTextFrame::DrawTextRunParams {
gfx::FontPaletteValueSet* paletteValueSet = nullptr;
float textStrokeWidth = 0.0f;
bool drawSoftHyphen = false;
+ bool hasTextShadow = false;
explicit DrawTextRunParams(gfxContext* aContext) : context(aContext) {}
};
@@ -6070,6 +6071,7 @@ bool nsTextFrame::PaintTextWithSelectionColors(
params.glyphRange = aParams.glyphRange;
params.fontPalette = StyleFont()->GetFontPaletteAtom();
params.paletteValueSet = PresContext()->GetFontPaletteValueSet();
+ params.hasTextShadow = !StyleText()->mTextShadow.IsEmpty();
PaintShadowParams shadowParams(aParams);
shadowParams.provider = aParams.provider;
@@ -6656,6 +6658,7 @@ void nsTextFrame::PaintText(const PaintTextParams& aParams,
params.glyphRange = range;
params.fontPalette = StyleFont()->GetFontPaletteAtom();
params.paletteValueSet = PresContext()->GetFontPaletteValueSet();
+ params.hasTextShadow = !StyleText()->mTextShadow.IsEmpty();
DrawText(range, textBaselinePt, params);
}
@@ -6672,6 +6675,7 @@ static void DrawTextRun(const gfxTextRun* aTextRun,
params.fontPalette = aParams.fontPalette;
params.paletteValueSet = aParams.paletteValueSet;
params.callbacks = aParams.callbacks;
+ params.hasTextShadow = aParams.hasTextShadow;
if (aParams.callbacks) {
aParams.callbacks->NotifyBeforeText(aParams.textColor);
params.drawMode = DrawMode::GLYPH_PATH;