tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit a723a587f01de205f977444433ac8bd0b51817f6
parent 8b8cd08d51ed623210d5ca422752a0d6573766f1
Author: Jan-Niklas Jaeschke <jjaschke@mozilla.com>
Date:   Tue, 28 Oct 2025 11:40:08 +0000

Bug 1845446 - CSS Highlight API: Implement support for `text-decoration`. r=jfkthame,emilio

This patch adds basic support for `text-decoration` in selection-based pseudo elements
(::selection, ::highlight(), ::target-text).
This is still missing support for text-decorations which are over- or underflowing.

Differential Revision: https://phabricator.services.mozilla.com/D264111

Diffstat:
Mlayout/generic/nsTextFrame.cpp | 159+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------
Mlayout/generic/nsTextFrame.h | 12+++++++-----
Mlayout/generic/nsTextPaintStyle.cpp | 40+++++++++++++++++++++++++++++++++++-----
Mlayout/generic/nsTextPaintStyle.h | 6++++++
Mlayout/painting/nsCSSRendering.cpp | 39++++++++++++++++++++++++---------------
Mlayout/painting/nsCSSRendering.h | 5++++-
Mtesting/web-platform/meta/css/css-highlight-api/highlight-text-decorations.html.ini | 3++-
Mtesting/web-platform/meta/css/css-highlight-api/painting/custom-highlight-container-metrics-003.html.ini | 2+-
Mtesting/web-platform/meta/css/css-highlight-api/painting/custom-highlight-container-metrics-004.html.ini | 2+-
Mtesting/web-platform/meta/css/css-highlight-api/painting/custom-highlight-container-metrics-005.html.ini | 2+-
Mtesting/web-platform/meta/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-003.html.ini | 2+-
Mtesting/web-platform/meta/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-004.html.ini | 2+-
Dtesting/web-platform/meta/css/css-highlight-api/painting/custom-highlight-painting-019.html.ini | 2--
Dtesting/web-platform/meta/css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001.html.ini | 2--
Dtesting/web-platform/meta/css/css-highlight-api/painting/custom-highlight-painting-text-decoration-001.html.ini | 2--
Atesting/web-platform/meta/css/css-highlight-api/target-text-text-decoration-001.html.ini | 3+++
Dtesting/web-platform/meta/css/css-pseudo/highlight-cascade/highlight-currentcolor-painting-properties-001.html.ini | 2--
Mtesting/web-platform/meta/css/css-pseudo/target-text-text-decoration-001.html.ini | 3++-
18 files changed, 211 insertions(+), 77 deletions(-)

diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp @@ -6163,6 +6163,9 @@ gfxFloat nsTextFrame::ComputeDescentLimitForSelectionUnderline( // Make sure this stays in sync with DrawSelectionDecorations below static constexpr SelectionTypeMask kSelectionTypesWithDecorations = + ToSelectionTypeMask(SelectionType::eNormal) | + ToSelectionTypeMask(SelectionType::eTargetText) | + ToSelectionTypeMask(SelectionType::eHighlight) | ToSelectionTypeMask(SelectionType::eSpellCheck) | ToSelectionTypeMask(SelectionType::eURLStrikeout) | ToSelectionTypeMask(SelectionType::eIMERawClause) | @@ -6175,6 +6178,9 @@ gfxFloat nsTextFrame::ComputeSelectionUnderlineHeight( nsPresContext* aPresContext, const gfxFont::Metrics& aFontMetrics, SelectionType aSelectionType) { switch (aSelectionType) { + case SelectionType::eNormal: + case SelectionType::eTargetText: + case SelectionType::eHighlight: case SelectionType::eIMERawClause: case SelectionType::eIMESelectedRawClause: case SelectionType::eIMEConvertedClause: @@ -6220,6 +6226,7 @@ struct nsTextFrame::PaintDecorationLineParams DrawPathCallbacks* callbacks = nullptr; bool paintingShadows = false; bool allowInkSkipping = true; + StyleTextDecorationSkipInk skipInk = StyleTextDecorationSkipInk::None; }; void nsTextFrame::PaintDecorationLine( @@ -6232,6 +6239,7 @@ void nsTextFrame::PaintDecorationLine( params.icoordInFrame = Float(aParams.icoordInFrame); params.baselineOffset = Float(aParams.baselineOffset); params.allowInkSkipping = aParams.allowInkSkipping; + params.skipInk = aParams.skipInk; if (aParams.callbacks) { Rect path = nsCSSRendering::DecorationLineToPath(params); if (aParams.decorationType == DecorationType::Normal) { @@ -6272,11 +6280,13 @@ static StyleTextDecorationStyle ToStyleLineStyle(const TextRangeStyle& aStyle) { */ void nsTextFrame::DrawSelectionDecorations( gfxContext* aContext, const LayoutDeviceRect& aDirtyRect, - SelectionType aSelectionType, nsTextPaintStyle& aTextPaintStyle, - const TextRangeStyle& aRangeStyle, const Point& aPt, - gfxFloat aICoordInFrame, gfxFloat aWidth, gfxFloat aAscent, - const gfxFont::Metrics& aFontMetrics, DrawPathCallbacks* aCallbacks, - bool aVertical, StyleTextDecorationLine aDecoration) { + SelectionType aSelectionType, nsAtom* aHighlightName, + nsTextPaintStyle& aTextPaintStyle, const TextRangeStyle& aRangeStyle, + const Point& aPt, gfxFloat aICoordInFrame, gfxFloat aWidth, + gfxFloat aAscent, const gfxFont::Metrics& aFontMetrics, + DrawPathCallbacks* aCallbacks, bool aVertical, + StyleTextDecorationLine aDecoration, const Range& aGlyphRange, + PropertyProvider* aProvider) { PaintDecorationLineParams params; params.context = aContext; params.dirtyRect = aDirtyRect; @@ -6290,20 +6300,74 @@ void nsTextFrame::DrawSelectionDecorations( params.sidewaysLeft = mTextRun->IsSidewaysLeft(); params.descentLimit = ComputeDescentLimitForSelectionUnderline( aTextPaintStyle.PresContext(), aFontMetrics); + params.glyphRange = aGlyphRange; + params.provider = aProvider; - float relativeSize; + float relativeSize = 1.f; const auto& decThickness = StyleTextReset()->mTextDecorationThickness; const gfxFloat appUnitsPerDevPixel = aTextPaintStyle.PresContext()->AppUnitsPerDevPixel(); const WritingMode wm = GetWritingMode(); switch (aSelectionType) { + case SelectionType::eNormal: + case SelectionType::eHighlight: + case SelectionType::eTargetText: { + RefPtr computedStyleFromPseudo = + aTextPaintStyle.GetComputedStyleForSelectionPseudo(aSelectionType, + aHighlightName); + const bool hasTextDecorations = + computedStyleFromPseudo + ? computedStyleFromPseudo->HasTextDecorationLines() + : false; + if (!hasTextDecorations) { + return; + } + params.style = + computedStyleFromPseudo->StyleTextReset()->mTextDecorationStyle; + params.color = computedStyleFromPseudo->StyleTextReset() + ->mTextDecorationColor.CalcColor(this); + params.decoration = + computedStyleFromPseudo->StyleTextReset()->mTextDecorationLine; + params.descentLimit = -1.f; + params.defaultLineThickness = ComputeSelectionUnderlineHeight( + aTextPaintStyle.PresContext(), aFontMetrics, aSelectionType); + params.lineSize.height = ComputeDecorationLineThickness( + computedStyleFromPseudo->StyleTextReset()->mTextDecorationThickness, + params.defaultLineThickness, aFontMetrics, appUnitsPerDevPixel, this); + + const bool swapUnderline = + wm.IsCentralBaseline() && IsUnderlineRight(*Style()); + params.icoordInFrame = aICoordInFrame; + auto paintForLine = [&](StyleTextDecorationLine decoration) { + if (!(computedStyleFromPseudo->StyleTextReset()->mTextDecorationLine & + decoration)) { + return; + } + + params.allowInkSkipping = true; + params.skipInk = + computedStyleFromPseudo->StyleText()->mTextDecorationSkipInk; + params.decoration = decoration; + params.offset = ComputeDecorationLineOffset( + params.decoration, + computedStyleFromPseudo->StyleText()->mTextUnderlinePosition, + computedStyleFromPseudo->StyleText()->mTextUnderlineOffset, + aFontMetrics, appUnitsPerDevPixel, this, wm.IsCentralBaseline(), + swapUnderline); + + PaintDecorationLine(params); + }; + paintForLine(StyleTextDecorationLine::UNDERLINE); + paintForLine(StyleTextDecorationLine::OVERLINE); + paintForLine(StyleTextDecorationLine::LINE_THROUGH); + return; + } case SelectionType::eIMERawClause: case SelectionType::eIMESelectedRawClause: case SelectionType::eIMEConvertedClause: case SelectionType::eIMESelectedClause: - case SelectionType::eSpellCheck: - case SelectionType::eHighlight: { + case SelectionType::eSpellCheck: { auto index = nsTextPaintStyle::GetUnderlineStyleIndexForSelectionType( aSelectionType); bool weDefineSelectionUnderline = @@ -6322,8 +6386,7 @@ void nsTextFrame::DrawSelectionDecorations( styleText->mTextUnderlineOffset, aFontMetrics, appUnitsPerDevPixel, this, wm.IsCentralBaseline(), swapUnderline); - bool isIMEType = aSelectionType != SelectionType::eSpellCheck && - aSelectionType != SelectionType::eHighlight; + bool isIMEType = aSelectionType != SelectionType::eSpellCheck; if (isIMEType) { // IME decoration lines should not be drawn on the both ends, i.e., we @@ -7163,11 +7226,12 @@ void nsTextFrame::PaintTextSelectionDecorations( } gfxFloat width = Abs(advance) / app; gfxFloat xInFrame = pt.x - (aParams.framePt.x / app); - DrawSelectionDecorations(aParams.context, aParams.dirtyRect, - aSelectionType, *aParams.textPaintStyle, - selectedStyles[index], pt, xInFrame, width, - mAscent / app, decorationMetrics, - aParams.callbacks, verticalRun, kDecoration); + DrawSelectionDecorations( + aParams.context, aParams.dirtyRect, aSelectionType, + highlightNames[index], *aParams.textPaintStyle, + selectedStyles[index], pt, xInFrame, width, mAscent / app, + decorationMetrics, aParams.callbacks, verticalRun, kDecoration, + aParams.glyphRange, aParams.provider); } } iterator.UpdateWithAdvance(advance); @@ -7196,8 +7260,7 @@ bool nsTextFrame::PaintTextWithSelection( MOZ_ASSERT(kPresentSelectionTypes[0] == SelectionType::eNormal, "The following for loop assumes that the first item of " "kPresentSelectionTypes is SelectionType::eNormal"); - for (size_t i = std::size(kPresentSelectionTypes) - 1; i >= 1; --i) { - SelectionType selectionType = kPresentSelectionTypes[i]; + for (SelectionType selectionType : Reversed(Span(kPresentSelectionTypes))) { if (ToSelectionTypeMask(selectionType) & allSelectionTypeMask) { // There is some selection of this selectionType. Try to paint its // decorations (there might not be any for this type but that's OK, @@ -7871,6 +7934,7 @@ void nsTextFrame::DrawTextRunAndDecorations( params.style = dec.mStyle; params.allowInkSkipping = dec.mAllowInkSkipping; + params.skipInk = StyleText()->mTextDecorationSkipInk; gfxClipAutoSaveRestore clipRestore(params.context); // If we have a negative trim value, then the decoration will extend // outside the edges of the text. @@ -8166,33 +8230,56 @@ bool nsTextFrame::CombineSelectionUnderlineRect(nsPresContext* aPresContext, sd->mSelectionType == SelectionType::eURLStrikeout) { continue; } + float relativeSize = 1.f; + RefPtr<ComputedStyle> style = Style(); - float relativeSize; - auto index = nsTextPaintStyle::GetUnderlineStyleIndexForSelectionType( - sd->mSelectionType); - if (sd->mSelectionType == SelectionType::eSpellCheck) { - if (!nsTextPaintStyle::GetSelectionUnderline( - this, index, nullptr, &relativeSize, &params.style)) { + if (sd->mSelectionType == SelectionType::eNormal || + sd->mSelectionType == SelectionType::eTargetText || + sd->mSelectionType == SelectionType::eHighlight) { + style = [&]() { + if (sd->mSelectionType == SelectionType::eHighlight) { + return ComputeHighlightSelectionStyle( + sd->mHighlightData.mHighlightName); + } + if (sd->mSelectionType == SelectionType::eTargetText) { + return ComputeTargetTextStyle(); + } + int16_t unusedFlags = 0; + const int16_t selectionStatus = GetSelectionStatus(&unusedFlags); + return ComputeSelectionStyle(selectionStatus); + }(); + if (!style || !style->HasTextDecorationLines()) { continue; } + params.style = style->StyleTextReset()->mTextDecorationStyle; } else { - // IME selections - TextRangeStyle& rangeStyle = sd->mTextRangeStyle; - if (rangeStyle.IsDefined()) { - if (!rangeStyle.IsLineStyleDefined() || - rangeStyle.mLineStyle == TextRangeStyle::LineStyle::None) { + auto index = nsTextPaintStyle::GetUnderlineStyleIndexForSelectionType( + sd->mSelectionType); + if (sd->mSelectionType == SelectionType::eSpellCheck) { + if (!nsTextPaintStyle::GetSelectionUnderline( + this, index, nullptr, &relativeSize, &params.style)) { + continue; + } + } else { + // IME selections + TextRangeStyle& rangeStyle = sd->mTextRangeStyle; + if (rangeStyle.IsDefined()) { + if (!rangeStyle.IsLineStyleDefined() || + rangeStyle.mLineStyle == TextRangeStyle::LineStyle::None) { + continue; + } + params.style = ToStyleLineStyle(rangeStyle); + relativeSize = rangeStyle.mIsBoldLine ? 2.0f : 1.0f; + } else if (!nsTextPaintStyle::GetSelectionUnderline( + this, index, nullptr, &relativeSize, &params.style)) { continue; } - params.style = ToStyleLineStyle(rangeStyle); - relativeSize = rangeStyle.mIsBoldLine ? 2.0f : 1.0f; - } else if (!nsTextPaintStyle::GetSelectionUnderline( - this, index, nullptr, &relativeSize, &params.style)) { - continue; } } nsRect decorationArea; - const auto& decThickness = StyleTextReset()->mTextDecorationThickness; + const auto& decThickness = + style->StyleTextReset()->mTextDecorationThickness; params.lineSize.width = aPresContext->AppUnitsToGfxUnits(aRect.width); params.defaultLineThickness = ComputeSelectionUnderlineHeight( aPresContext, metrics, sd->mSelectionType); @@ -8201,8 +8288,8 @@ bool nsTextFrame::CombineSelectionUnderlineRect(nsPresContext* aPresContext, decThickness, params.defaultLineThickness, metrics, aPresContext->AppUnitsPerDevPixel(), this); - bool swapUnderline = wm.IsCentralBaseline() && IsUnderlineRight(*Style()); - const auto* styleText = StyleText(); + bool swapUnderline = wm.IsCentralBaseline() && IsUnderlineRight(*style); + const auto* styleText = style->StyleText(); params.offset = ComputeDecorationLineOffset( textDecs.HasUnderline() ? StyleTextDecorationLine::UNDERLINE : StyleTextDecorationLine::OVERLINE, diff --git a/layout/generic/nsTextFrame.h b/layout/generic/nsTextFrame.h @@ -1050,11 +1050,13 @@ class nsTextFrame : public nsIFrame { */ void DrawSelectionDecorations( gfxContext* aContext, const LayoutDeviceRect& aDirtyRect, - mozilla::SelectionType aSelectionType, nsTextPaintStyle& aTextPaintStyle, - const TextRangeStyle& aRangeStyle, const Point& aPt, - gfxFloat aICoordInFrame, gfxFloat aWidth, gfxFloat aAscent, - const gfxFont::Metrics& aFontMetrics, DrawPathCallbacks* aCallbacks, - bool aVertical, mozilla::StyleTextDecorationLine aDecoration); + mozilla::SelectionType aSelectionType, nsAtom* aHighlightName, + nsTextPaintStyle& aTextPaintStyle, const TextRangeStyle& aRangeStyle, + const Point& aPt, gfxFloat aICoordInFrame, gfxFloat aWidth, + gfxFloat aAscent, const gfxFont::Metrics& aFontMetrics, + DrawPathCallbacks* aCallbacks, bool aVertical, + mozilla::StyleTextDecorationLine aDecoration, const Range& aGlyphRange, + PropertyProvider* aProvider); void PaintDecorationLine(const PaintDecorationLineParams& aParams); /** diff --git a/layout/generic/nsTextPaintStyle.cpp b/layout/generic/nsTextPaintStyle.cpp @@ -34,6 +34,7 @@ nsTextPaintStyle::nsTextPaintStyle(nsTextFrame* aFrame) mInitCommonColors(false), mInitSelectionColorsAndShadow(false), mResolveColors(true), + mInitTargetTextPseudoStyle(false), mSelectionTextColor(NS_RGBA(0, 0, 0, 0)), mSelectionBGColor(NS_RGBA(0, 0, 0, 0)), mSufficientContrast(0), @@ -219,12 +220,12 @@ void nsTextPaintStyle::GetTargetTextColors(nscolor* aForeColor, NS_ASSERTION(aForeColor, "aForeColor is null"); NS_ASSERTION(aBackColor, "aBackColor is null"); InitCommonColors(); - const RefPtr<const ComputedStyle> targetTextStyle = - mFrame->ComputeTargetTextStyle(); - if (targetTextStyle) { - *aForeColor = targetTextStyle->GetVisitedDependentColor( + InitTargetTextPseudoStyle(); + + if (mTargetTextPseudoStyle) { + *aForeColor = mTargetTextPseudoStyle->GetVisitedDependentColor( &nsStyleText::mWebkitTextFillColor); - *aBackColor = targetTextStyle->GetVisitedDependentColor( + *aBackColor = mTargetTextPseudoStyle->GetVisitedDependentColor( &nsStyleBackground::mBackgroundColor); return; } @@ -296,6 +297,27 @@ bool nsTextPaintStyle::GetCustomHighlightBackgroundColor(nsAtom* aHighlightName, return NS_GET_A(*aBackColor) != 0; } +RefPtr<ComputedStyle> nsTextPaintStyle::GetComputedStyleForSelectionPseudo( + SelectionType aSelectionType, nsAtom* aHighlightName) { + switch (aSelectionType) { + case SelectionType::eNormal: + InitSelectionColorsAndShadow(); + return mSelectionPseudoStyle; + case SelectionType::eTargetText: + InitTargetTextPseudoStyle(); + return mTargetTextPseudoStyle; + case SelectionType::eHighlight: { + return mCustomHighlightPseudoStyles.LookupOrInsertWith( + aHighlightName, [this, &aHighlightName] { + return mFrame->ComputeHighlightSelectionStyle(aHighlightName); + }); + } + default: + MOZ_ASSERT_UNREACHABLE("Wrong selection type"); + return nullptr; + } +} + void nsTextPaintStyle::GetURLSecondaryColor(nscolor* aForeColor) { NS_ASSERTION(aForeColor, "aForeColor is null"); @@ -443,6 +465,14 @@ bool nsTextPaintStyle::InitSelectionColorsAndShadow() { return true; } +void nsTextPaintStyle::InitTargetTextPseudoStyle() { + if (mInitTargetTextPseudoStyle) { + return; + } + mInitTargetTextPseudoStyle = true; + mTargetTextPseudoStyle = mFrame->ComputeTargetTextStyle(); +} + nsTextPaintStyle::nsSelectionStyle* nsTextPaintStyle::SelectionStyle( SelectionStyleIndex aIndex) { Maybe<nsSelectionStyle>& selectionStyle = mSelectionStyle[aIndex]; diff --git a/layout/generic/nsTextPaintStyle.h b/layout/generic/nsTextPaintStyle.h @@ -70,6 +70,9 @@ class MOZ_STACK_CLASS nsTextPaintStyle { bool GetCustomHighlightTextColor(nsAtom* aHighlightName, nscolor* aForeColor); bool GetCustomHighlightBackgroundColor(nsAtom* aHighlightName, nscolor* aBackColor); + RefPtr<ComputedStyle> GetComputedStyleForSelectionPseudo( + SelectionType aSelectionType, nsAtom* aHighlightName); + void GetURLSecondaryColor(nscolor* aForeColor); void GetIMESelectionColors(SelectionStyleIndex aIndex, nscolor* aForeColor, nscolor* aBackColor); @@ -117,12 +120,14 @@ class MOZ_STACK_CLASS nsTextPaintStyle { bool mInitCommonColors; bool mInitSelectionColorsAndShadow; bool mResolveColors; + bool mInitTargetTextPseudoStyle; // Selection data nscolor mSelectionTextColor; nscolor mSelectionBGColor; RefPtr<ComputedStyle> mSelectionPseudoStyle; + RefPtr<ComputedStyle> mTargetTextPseudoStyle; nsTHashMap<RefPtr<nsAtom>, RefPtr<ComputedStyle>> mCustomHighlightPseudoStyles; @@ -152,6 +157,7 @@ class MOZ_STACK_CLASS nsTextPaintStyle { // Color initializations void InitCommonColors(); bool InitSelectionColorsAndShadow(); + void InitTargetTextPseudoStyle(); nsSelectionStyle* SelectionStyle(SelectionStyleIndex aIndex); nsSelectionStyle InitSelectionStyle(SelectionStyleIndex aIndex); diff --git a/layout/painting/nsCSSRendering.cpp b/layout/painting/nsCSSRendering.cpp @@ -3990,25 +3990,35 @@ static void SkipInk(nsIFrame* aFrame, DrawTarget& aDrawTarget, nsCSSRendering::PaintDecorationLineParams clipParams = aParams; const unsigned length = aIntercepts.Length(); - Float lineStart = aParams.vertical ? aParams.pt.y : aParams.pt.x; - Float lineEnd = lineStart + aParams.lineSize.width; + // For selections, this points to the selection start, which may not be at the + // line start. + const Float relativeTextStart = + aParams.vertical ? aParams.pt.y : aParams.pt.x; + const Float relativeTextEnd = relativeTextStart + aParams.lineSize.width; + // The actual line start position needs to be adjusted by the offset of the + // start position in the frame, because the intercept positions are based off + // the whole text run. + const Float absoluteLineStart = relativeTextStart - aParams.icoordInFrame; // Compute the min/max positions based on trim. - const Float trimLineStart = lineStart + (aParams.trimLeft - aPadding); - const Float trimLineEnd = lineEnd - (aParams.trimRight - aPadding); + const Float trimLineDrawAreaStart = + relativeTextStart + (aParams.trimLeft - aPadding); + const Float trimLineDrawAreaEnd = + relativeTextEnd - (aParams.trimRight - aPadding); for (unsigned i = 0; i <= length; i += 2) { // Handle start/end edge cases and set up general case. // While we use the trim start/end values, it is possible the trim cuts // of the first intercept and into the next, so we will need to clamp // the dimensions in the other case too. - SkScalar startIntercept = trimLineStart; + SkScalar startIntercept = trimLineDrawAreaStart; if (i > 0) { - startIntercept = std::max(aIntercepts[i - 1] + lineStart, startIntercept); + startIntercept = + std::max(aIntercepts[i - 1] + absoluteLineStart, startIntercept); } - SkScalar endIntercept = trimLineEnd; + SkScalar endIntercept = trimLineDrawAreaEnd; if (i < length) { - endIntercept = std::min(aIntercepts[i] + lineStart, endIntercept); + endIntercept = std::min(aIntercepts[i] + absoluteLineStart, endIntercept); } // remove padding at both ends for width @@ -4029,9 +4039,10 @@ static void SkipInk(nsIFrame* aFrame, DrawTarget& aDrawTarget, // padding; snap the rect edges to device pixels for consistent rendering // of dots across separate fragments of a dotted line. if (aParams.vertical) { - clipParams.pt.y = aParams.sidewaysLeft - ? lineEnd - (endIntercept - lineStart) + aPadding - : startIntercept + aPadding; + clipParams.pt.y = + aParams.sidewaysLeft + ? relativeTextEnd - (endIntercept - relativeTextStart) + aPadding + : startIntercept + aPadding; aRect.y = std::floor(clipParams.pt.y + 0.5); aRect.SetBottomEdge( std::floor(clipParams.pt.y + clipParams.lineSize.width + 0.5)); @@ -4067,10 +4078,8 @@ void nsCSSRendering::PaintDecorationLine( // Check if decoration line will skip past ascenders/descenders // text-decoration-skip-ink only applies to overlines/underlines - mozilla::StyleTextDecorationSkipInk skipInk = - aFrame->StyleText()->mTextDecorationSkipInk; bool skipInkEnabled = - skipInk != mozilla::StyleTextDecorationSkipInk::None && + aParams.skipInk != mozilla::StyleTextDecorationSkipInk::None && aParams.decoration != StyleTextDecorationLine::LINE_THROUGH && aParams.allowInkSkipping && aFrame->IsTextFrame(); @@ -4130,7 +4139,7 @@ void nsCSSRendering::PaintDecorationLine( if (iter.GlyphRun()->mOrientation == mozilla::gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT || (iter.GlyphRun()->mIsCJK && - skipInk == mozilla::StyleTextDecorationSkipInk::Auto)) { + aParams.skipInk == mozilla::StyleTextDecorationSkipInk::Auto)) { // We don't support upright text in vertical modes currently // (see https://bugzilla.mozilla.org/show_bug.cgi?id=1572294), // but we do need to update textPos so that following runs will be diff --git a/layout/painting/nsCSSRendering.h b/layout/painting/nsCSSRendering.h @@ -602,7 +602,7 @@ struct nsCSSRendering { bool vertical = false; bool sidewaysLeft = false; gfxTextRun::Range glyphRange; - gfxTextRun::PropertyProvider* provider; + gfxTextRun::PropertyProvider* provider = nullptr; }; struct PaintDecorationLineParams : DecorationRectParams { @@ -620,6 +620,9 @@ struct nsCSSRendering { Float baselineOffset = 0.0f; // Whether text-decoration-skip-ink behavior is to be supported. bool allowInkSkipping = true; + + mozilla::StyleTextDecorationSkipInk skipInk = + mozilla::StyleTextDecorationSkipInk::None; }; /** diff --git a/testing/web-platform/meta/css/css-highlight-api/highlight-text-decorations.html.ini b/testing/web-platform/meta/css/css-highlight-api/highlight-text-decorations.html.ini @@ -1,2 +1,2 @@ [highlight-text-decorations.html] - expected: FAIL + fuzzy: maxDifference=0-238; totalPixels=0-76 +\ No newline at end of file diff --git a/testing/web-platform/meta/css/css-highlight-api/painting/custom-highlight-container-metrics-003.html.ini b/testing/web-platform/meta/css/css-highlight-api/painting/custom-highlight-container-metrics-003.html.ini @@ -1,2 +1,2 @@ [custom-highlight-container-metrics-003.html] - expected: FAIL + expected: [FAIL,PASS] diff --git a/testing/web-platform/meta/css/css-highlight-api/painting/custom-highlight-container-metrics-004.html.ini b/testing/web-platform/meta/css/css-highlight-api/painting/custom-highlight-container-metrics-004.html.ini @@ -1,2 +1,2 @@ [custom-highlight-container-metrics-004.html] - expected: FAIL + expected: [FAIL,PASS] diff --git a/testing/web-platform/meta/css/css-highlight-api/painting/custom-highlight-container-metrics-005.html.ini b/testing/web-platform/meta/css/css-highlight-api/painting/custom-highlight-container-metrics-005.html.ini @@ -1,2 +1,2 @@ [custom-highlight-container-metrics-005.html] - expected: FAIL + expected: [FAIL,PASS] diff --git a/testing/web-platform/meta/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-003.html.ini b/testing/web-platform/meta/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-003.html.ini @@ -1,2 +1,2 @@ [custom-highlight-dynamic-container-metrics-003.html] - expected: FAIL + expected: [FAIL,PASS] diff --git a/testing/web-platform/meta/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-004.html.ini b/testing/web-platform/meta/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-004.html.ini @@ -1,2 +1,2 @@ [custom-highlight-dynamic-container-metrics-004.html] - expected: FAIL + expected: [FAIL,PASS] diff --git a/testing/web-platform/meta/css/css-highlight-api/painting/custom-highlight-painting-019.html.ini b/testing/web-platform/meta/css/css-highlight-api/painting/custom-highlight-painting-019.html.ini @@ -1,2 +0,0 @@ -[custom-highlight-painting-019.html] - expected: FAIL diff --git a/testing/web-platform/meta/css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001.html.ini b/testing/web-platform/meta/css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001.html.ini @@ -1,2 +0,0 @@ -[custom-highlight-painting-priority-text-decoration-001.html] - expected: FAIL diff --git a/testing/web-platform/meta/css/css-highlight-api/painting/custom-highlight-painting-text-decoration-001.html.ini b/testing/web-platform/meta/css/css-highlight-api/painting/custom-highlight-painting-text-decoration-001.html.ini @@ -1,2 +0,0 @@ -[custom-highlight-painting-text-decoration-001.html] - expected: FAIL diff --git a/testing/web-platform/meta/css/css-highlight-api/target-text-text-decoration-001.html.ini b/testing/web-platform/meta/css/css-highlight-api/target-text-text-decoration-001.html.ini @@ -0,0 +1,2 @@ +[target-text-text-decoration-001.html] + fuzzy: maxDifference=0-92;totalPixels=0-1 +\ No newline at end of file diff --git a/testing/web-platform/meta/css/css-pseudo/highlight-cascade/highlight-currentcolor-painting-properties-001.html.ini b/testing/web-platform/meta/css/css-pseudo/highlight-cascade/highlight-currentcolor-painting-properties-001.html.ini @@ -1,2 +0,0 @@ -[highlight-currentcolor-painting-properties-001.html] - expected: FAIL diff --git a/testing/web-platform/meta/css/css-pseudo/target-text-text-decoration-001.html.ini b/testing/web-platform/meta/css/css-pseudo/target-text-text-decoration-001.html.ini @@ -1,2 +1,2 @@ [target-text-text-decoration-001.html] - expected: FAIL + fuzzy: maxDifference=0-92; totalPixels=0-1 +\ No newline at end of file