tor-browser

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

commit 1c6a8b56e6f5f5393ea5ea745ab63ecb67613c93
parent e8e83d0d84fbc7c1c5e4e63a98e39912ecb1e0b8
Author: Cristian Tuns <ctuns@mozilla.com>
Date:   Tue,  7 Oct 2025 02:27:19 -0400

Revert "Bug 1979915 Part 2 - Update text expectations for implementing text-decoration-trim r=layout-jp-market-reviewers,jfkthame,TYLin" for causing Wr failures in text-decoration-trim-007.html

This reverts commit b52edf65bf2f037cac81f56bd949f10b7f2f5eaf.

Revert "Bug 1979915 Part 1 - Apply text-decoration-trim during decoration rect calculation and decoration painting. r=layout-reviewers,layout-jp-market-reviewers,jfkthame"

This reverts commit 05067d0cbe1e7e699d1b7df77a8755b7e412262a.

Diffstat:
Mlayout/generic/nsTextFrame.cpp | 101+------------------------------------------------------------------------------
Mlayout/painting/nsCSSRendering.h | 2+-
Atesting/web-platform/meta/css/css-text-decor/text-decoration-trim-001.html.ini | 2++
Atesting/web-platform/meta/css/css-text-decor/text-decoration-trim-002.html.ini | 2++
Atesting/web-platform/meta/css/css-text-decor/text-decoration-trim-003.html.ini | 2++
Atesting/web-platform/meta/css/css-text-decor/text-decoration-trim-004.html.ini | 2++
Atesting/web-platform/meta/css/css-text-decor/text-decoration-trim-005.html.ini | 2++
Atesting/web-platform/meta/css/css-text-decor/text-decoration-trim-006.html.ini | 2++
Atesting/web-platform/meta/css/css-text-decor/text-decoration-trim-007.html.ini | 2++
Atesting/web-platform/meta/css/css-text-decor/text-decoration-trim-008.html.ini | 2++
Atesting/web-platform/meta/css/css-text-decor/text-decoration-trim-009.html.ini | 2++
Atesting/web-platform/meta/css/css-text-decor/text-decoration-trim-010.html.ini | 2++
Atesting/web-platform/meta/css/css-text-decor/text-decoration-trim-012.html.ini | 2++
Atesting/web-platform/meta/css/css-text-decor/text-decoration-trim-013.html.ini | 2++
Atesting/web-platform/meta/css/css-text-decor/text-decoration-trim-014.html.ini | 2++
Atesting/web-platform/meta/css/css-text-decor/text-decoration-trim-015.html.ini | 2++
Atesting/web-platform/meta/css/css-text-decor/text-decoration-trim-016.html.ini | 2++
17 files changed, 32 insertions(+), 101 deletions(-)

diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp @@ -5772,97 +5772,6 @@ static gfxFloat ComputeDecorationLineOffset( return 0; } -// Helper to determine decoration trim offset. -// Returns false if the trim would cut off the decoration entirely. -static bool ComputeDecorationTrim( - const nsTextFrame* aFrame, const nsPresContext* aPresCtx, - const nsIFrame* aDecFrame, const gfxFont::Metrics& aMetrics, - nsCSSRendering::DecorationRectParams& aParams) { - const gfxFloat app = aPresCtx->AppUnitsPerDevPixel(); - const WritingMode wm = aDecFrame->GetWritingMode(); - bool verticalDec = wm.IsVertical(); - - aParams.trimLeft = 0.0; - aParams.trimRight = 0.0; - - // Find the trim values for this frame. - const StyleTextDecorationTrim& cssTrim = - aDecFrame->StyleTextReset()->mTextDecorationTrim; - gfxFloat trimLeft, trimRight; - if (cssTrim.IsAuto()) { - // Use the EM size divide by 8, or 1 dev pixel if this is too - // small to ensure that at least some separation occurs. - const gfxFloat scale = aPresCtx->CSSToDevPixelScale().scale; - const nscoord autoDecorationTrim = - std::max(aMetrics.emHeight * 0.125, scale); - trimLeft = autoDecorationTrim; - trimRight = autoDecorationTrim; - } else { - MOZ_ASSERT(cssTrim.IsLength(), "Impossible text-decoration-trim"); - const auto& length = cssTrim.AsLength(); - if (length.start.IsZero() && length.end.IsZero()) { - // We can avoid doing the geometric calculations below, potentially - // walking up and back down the frame tree, and walking continuations. - return true; - } - trimLeft = NSAppUnitsToDoublePixels(length.start.ToAppUnits(), app); - trimRight = NSAppUnitsToDoublePixels(length.end.ToAppUnits(), app); - } - - if (wm.IsBidiRTL()) { - std::swap(trimLeft, trimRight); - } - const nsPoint offset = aFrame->GetOffsetTo(aDecFrame); - const nsSize decSize = aDecFrame->GetSize(); - const nsSize size = aFrame->GetSize(); - nscoord start, end, max; - if (verticalDec) { - start = offset.y; - max = size.height; - end = decSize.height - (size.height + offset.y); - } else { - start = offset.x; - max = size.width; - end = decSize.width - (size.width + offset.x); - } - - const bool cloneDecBreak = aDecFrame->StyleBorder()->mBoxDecorationBreak == - StyleBoxDecorationBreak::Clone; - // TODO alaskanemily: This will not correctly account for the case that the - // continuations are bidi continuations. - const bool applyLeft = cloneDecBreak || !aDecFrame->GetPrevContinuation(); - if (applyLeft) { - trimLeft -= NSAppUnitsToDoublePixels(start, app); - } - const bool applyRight = cloneDecBreak || !aDecFrame->GetNextContinuation(); - if (applyRight) { - trimRight -= NSAppUnitsToDoublePixels(end, app); - } - - if (trimLeft >= NSAppUnitsToDoublePixels(max, app) - trimRight) { - // This frame does not contain the decoration at all. - return false; - } - // TODO alaskanemily: We currently determine if we should have a negative - // trim value by checking if we are at the edge of frame from which the - // decloration comes from. - // - // This is not absolutely correct, there could in theory be a zero-width - // frame before/after this frame, and we will draw the decoration extension - // twice (causing a visible inaccuracy for semi-transparent decorations). - // - // I am unsure if it's possible that the first/last frame might be inset - // for some reason, as well, in which case we will not draw the outset - // decorations. - if (applyLeft && (trimLeft > 0.0 || start == 0)) { - aParams.trimLeft = trimLeft; - } - if (applyRight && (trimRight > 0.0 || end == 0)) { - aParams.trimRight = trimRight; - } - return true; -} - void nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext, nsIFrame* aBlock, PropertyProvider& aProvider, @@ -6004,11 +5913,6 @@ void nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext, metrics, appUnitsPerDevUnit, this, parentWM.IsCentralBaseline(), swapUnderline); - if (!ComputeDecorationTrim(this, aPresContext, dec.mFrame, metrics, - params)) { - return; - } - nsRect decorationRect = nsCSSRendering::GetTextDecorationRect(aPresContext, params) + (verticalDec ? nsPoint(frameBStart - dec.mBaselineOffset, 0) @@ -7765,10 +7669,7 @@ void nsTextFrame::DrawTextRunAndDecorations( GetInflationForTextDecorations(dec.mFrame, inflationMinFontSize); const Metrics metrics = GetFirstFontMetrics( GetFontGroupForFrame(dec.mFrame, inflation), useVerticalMetrics); - if (!ComputeDecorationTrim(this, aParams.textStyle->PresContext(), - dec.mFrame, metrics, params)) { - return; - } + bCoord = (frameBStart - dec.mBaselineOffset) / app; params.color = dec.mColor; diff --git a/layout/painting/nsCSSRendering.h b/layout/painting/nsCSSRendering.h @@ -554,7 +554,7 @@ struct nsCSSRendering { mozilla::Side aStartBevelSide, nscoord aStartBevelOffset, mozilla::Side aEndBevelSide, nscoord aEndBevelOffset); - // NOTE: pt, dirtyRect, lineSize, ascent, offset, trimLeft, and trimRight in + // NOTE: pt, dirtyRect, lineSize, ascent, offset, trimStart and trimEnd in // the following structs are non-rounded device pixels, not app units. struct DecorationRectParams { // Checks if either start or end trim value is negative. diff --git a/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-001.html.ini b/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-001.html.ini @@ -0,0 +1,2 @@ +[text-decoration-trim-001.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-002.html.ini b/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-002.html.ini @@ -0,0 +1,2 @@ +[text-decoration-trim-002.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-003.html.ini b/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-003.html.ini @@ -0,0 +1,2 @@ +[text-decoration-trim-003.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-004.html.ini b/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-004.html.ini @@ -0,0 +1,2 @@ +[text-decoration-trim-004.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-005.html.ini b/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-005.html.ini @@ -0,0 +1,2 @@ +[text-decoration-trim-005.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-006.html.ini b/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-006.html.ini @@ -0,0 +1,2 @@ +[text-decoration-trim-006.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-007.html.ini b/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-007.html.ini @@ -0,0 +1,2 @@ +[text-decoration-trim-007.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-008.html.ini b/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-008.html.ini @@ -0,0 +1,2 @@ +[text-decoration-trim-008.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-009.html.ini b/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-009.html.ini @@ -0,0 +1,2 @@ +[text-decoration-trim-009.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-010.html.ini b/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-010.html.ini @@ -0,0 +1,2 @@ +[text-decoration-trim-010.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-012.html.ini b/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-012.html.ini @@ -0,0 +1,2 @@ +[text-decoration-trim-012.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-013.html.ini b/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-013.html.ini @@ -0,0 +1,2 @@ +[text-decoration-trim-013.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-014.html.ini b/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-014.html.ini @@ -0,0 +1,2 @@ +[text-decoration-trim-014.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-015.html.ini b/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-015.html.ini @@ -0,0 +1,2 @@ +[text-decoration-trim-015.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-016.html.ini b/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-016.html.ini @@ -0,0 +1,2 @@ +[text-decoration-trim-016.html] + expected: FAIL