tor-browser

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

commit f2c2d7b9553a9311873aa8a9c476c2bdc870a0a8
parent 4e0ba320cb1e6a516ce257afa75cd71468ef14e5
Author: Emily McDonough <emcdonough@mozilla.com>
Date:   Fri, 24 Oct 2025 22:15:16 +0000

Bug 1993939 Part 1 - Fix text-decoration-trim direction for sideways-left text in a block frame r=layout-reviewers,layout-jp-market-reviewers,jfkthame

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

Diffstat:
Mlayout/generic/nsTextFrame.cpp | 9++++++---
Mlayout/painting/nsCSSRendering.cpp | 2+-
Dtesting/web-platform/meta/css/css-text-decor/text-decoration-trim-011.html.ini | 2--
3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp @@ -5823,7 +5823,7 @@ static bool ComputeDecorationTrim( trimRight = NSAppUnitsToDoublePixels(length.end.ToAppUnits(), app); } - if (wm.IsBidiRTL()) { + if (wm.IsInlineReversed()) { std::swap(trimLeft, trimRight); } const nsPoint offset = aFrame->GetOffsetTo(aDecFrame); @@ -5844,11 +5844,14 @@ static bool ComputeDecorationTrim( StyleBoxDecorationBreak::Clone; // TODO alaskanemily: This will not correctly account for the case that the // continuations are bidi continuations. - const bool applyLeft = cloneDecBreak || !aDecFrame->GetPrevContinuation(); + bool applyLeft = cloneDecBreak || !aDecFrame->GetPrevContinuation(); + bool applyRight = cloneDecBreak || !aDecFrame->GetNextContinuation(); + if (wm.IsInlineReversed()) { + std::swap(applyLeft, applyRight); + } if (applyLeft) { trimLeft -= NSAppUnitsToDoublePixels(start, app); } - const bool applyRight = cloneDecBreak || !aDecFrame->GetNextContinuation(); if (applyRight) { trimRight -= NSAppUnitsToDoublePixels(end, app); } diff --git a/layout/painting/nsCSSRendering.cpp b/layout/painting/nsCSSRendering.cpp @@ -4659,7 +4659,7 @@ gfxRect nsCSSRendering::GetTextDecorationRectInternal( } // Take text decoration trim into account. - r.x += aParams.sidewaysLeft ? aParams.trimRight : aParams.trimLeft; + r.x += aParams.trimLeft; r.width -= aParams.trimLeft + aParams.trimRight; r.width = std::max(r.width, 0.0); diff --git a/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-011.html.ini b/testing/web-platform/meta/css/css-text-decor/text-decoration-trim-011.html.ini @@ -1,2 +0,0 @@ -[text-decoration-trim-011.html] - expected: FAIL