tor-browser

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

commit 20ec807eff8b036bcb955840170697b1bde96b02
parent 38026d3a97a4c7eb5df1b89287c174c8bfa59fb4
Author: Jonathan Kew <jkew@mozilla.com>
Date:   Thu, 30 Oct 2025 10:27:13 +0000

Bug 1997157 - Rename text-decoration-trim to -inset per CSSWG resolution. r=layout-jp-market-reviewers,layout-reviewers,AlaskanEmily,TYLin

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

Diffstat:
Mbrowser/base/content/test/static/browser_parsable_css.js | 6+++---
Mdevtools/server/actors/animation-type-longhand.js | 2+-
Mdom/base/use_counter_metrics.yaml | 288++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mlayout/generic/nsTextFrame.cpp | 76++++++++++++++++++++++++++++++++++++++--------------------------------------
Mlayout/painting/nsCSSRendering.cpp | 24++++++++++++------------
Mlayout/painting/nsCSSRendering.h | 14++++++++------
Mlayout/style/ServoBindings.toml | 4++--
Mlayout/style/nsStyleStruct.cpp | 6+++---
Mlayout/style/nsStyleStruct.h | 2+-
Mlayout/style/res/html.css | 3++-
Mlayout/style/res/ua.css | 3++-
Mlayout/style/test/property_database.js | 6+++---
Mmodules/libpref/init/StaticPrefList.yaml | 2+-
Mservo/components/style/properties/data.py | 2+-
Mservo/components/style/properties/longhands/text.mako.rs | 10+++++-----
Mservo/components/style/values/computed/mod.rs | 4++--
Mservo/components/style/values/computed/text.rs | 8++++----
Mservo/components/style/values/generics/text.rs | 16++++++++--------
Mservo/components/style/values/specified/mod.rs | 2+-
Mservo/components/style/values/specified/text.rs | 20++++++++++----------
Mservo/ports/geckolib/cbindgen.toml | 2+-
21 files changed, 252 insertions(+), 248 deletions(-)

diff --git a/browser/base/content/test/static/browser_parsable_css.js b/browser/base/content/test/static/browser_parsable_css.js @@ -71,15 +71,15 @@ if (!Services.prefs.getBoolPref("layout.css.scroll-anchoring.enabled")) { }); } -if (!Services.prefs.getBoolPref("layout.css.text-decoration-trim.enabled")) { +if (!Services.prefs.getBoolPref("layout.css.text-decoration-inset.enabled")) { ignoreList.push({ sourceName: /html\.css$/i, - errorMessage: /Unknown property .*text-decoration-trim/i, + errorMessage: /Unknown property .*text-decoration-inset/i, isFromDevTools: false, }); ignoreList.push({ sourceName: /ua\.css$/i, - errorMessage: /Unknown property .*text-decoration-trim/i, + errorMessage: /Unknown property .*text-decoration-inset/i, isFromDevTools: false, }); } diff --git a/devtools/server/actors/animation-type-longhand.js b/devtools/server/actors/animation-type-longhand.js @@ -337,7 +337,7 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [ "scale", "shape-outside", "stroke-dasharray", - "text-decoration-trim", + "text-decoration-inset", "transform", "transform-origin", "translate", diff --git a/dom/base/use_counter_metrics.yaml b/dom/base/use_counter_metrics.yaml @@ -16547,23 +16547,6 @@ use.counter.deprecated_ops.doc: # Total of 704 'CSS (page)' use counters. use.counter.css.page: - css_align_content: - type: counter - description: > - Whether a page used the CSS property align-content. - Compare against `use.counter.top_level_content_documents_destroyed` - to calculate the rate. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - notification_emails: - - dom-core@mozilla.com - - emilio@mozilla.com - expires: never - send_in_pings: - - use-counters - css_align_items: type: counter description: > @@ -16581,23 +16564,6 @@ use.counter.css.page: send_in_pings: - use-counters - css_align_self: - type: counter - description: > - Whether a page used the CSS property align-self. - Compare against `use.counter.top_level_content_documents_destroyed` - to calculate the rate. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - notification_emails: - - dom-core@mozilla.com - - emilio@mozilla.com - expires: never - send_in_pings: - - use-counters - css_aspect_ratio: type: counter description: > @@ -17414,23 +17380,6 @@ use.counter.css.page: send_in_pings: - use-counters - css_justify_content: - type: counter - description: > - Whether a page used the CSS property justify-content. - Compare against `use.counter.top_level_content_documents_destroyed` - to calculate the rate. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - notification_emails: - - dom-core@mozilla.com - - emilio@mozilla.com - expires: never - send_in_pings: - - use-counters - css_justify_items: type: counter description: > @@ -17448,23 +17397,6 @@ use.counter.css.page: send_in_pings: - use-counters - css_justify_self: - type: counter - description: > - Whether a page used the CSS property justify-self. - Compare against `use.counter.top_level_content_documents_destroyed` - to calculate the rate. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - notification_emails: - - dom-core@mozilla.com - - emilio@mozilla.com - expires: never - send_in_pings: - - use-counters - css_line_break: type: counter description: > @@ -18978,6 +18910,40 @@ use.counter.css.page: send_in_pings: - use-counters + css_align_content: + type: counter + description: > + Whether a page used the CSS property align-content. + Compare against `use.counter.top_level_content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + css_justify_content: + type: counter + description: > + Whether a page used the CSS property justify-content. + Compare against `use.counter.top_level_content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + css_clip_rule: type: counter description: > @@ -19046,6 +19012,40 @@ use.counter.css.page: send_in_pings: - use-counters + css_align_self: + type: counter + description: > + Whether a page used the CSS property align-self. + Compare against `use.counter.top_level_content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + css_justify_self: + type: counter + description: > + Whether a page used the CSS property justify-self. + Compare against `use.counter.top_level_content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + css_font_synthesis_position: type: counter description: > @@ -21035,10 +21035,10 @@ use.counter.css.page: send_in_pings: - use-counters - css_text_decoration_thickness: + css_text_decoration_inset: type: counter description: > - Whether a page used the CSS property text-decoration-thickness. + Whether a page used the CSS property text-decoration-inset. Compare against `use.counter.top_level_content_documents_destroyed` to calculate the rate. bugs: @@ -21052,10 +21052,10 @@ use.counter.css.page: send_in_pings: - use-counters - css_text_decoration_trim: + css_text_decoration_thickness: type: counter description: > - Whether a page used the CSS property text-decoration-trim. + Whether a page used the CSS property text-decoration-thickness. Compare against `use.counter.top_level_content_documents_destroyed` to calculate the rate. bugs: @@ -28517,23 +28517,6 @@ use.counter.css.page: # Total of 704 'CSS (document)' use counters. use.counter.css.doc: - css_align_content: - type: counter - description: > - Whether a document used the CSS property align-content. - Compare against `use.counter.content_documents_destroyed` - to calculate the rate. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - notification_emails: - - dom-core@mozilla.com - - emilio@mozilla.com - expires: never - send_in_pings: - - use-counters - css_align_items: type: counter description: > @@ -28551,23 +28534,6 @@ use.counter.css.doc: send_in_pings: - use-counters - css_align_self: - type: counter - description: > - Whether a document used the CSS property align-self. - Compare against `use.counter.content_documents_destroyed` - to calculate the rate. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - notification_emails: - - dom-core@mozilla.com - - emilio@mozilla.com - expires: never - send_in_pings: - - use-counters - css_aspect_ratio: type: counter description: > @@ -29384,23 +29350,6 @@ use.counter.css.doc: send_in_pings: - use-counters - css_justify_content: - type: counter - description: > - Whether a document used the CSS property justify-content. - Compare against `use.counter.content_documents_destroyed` - to calculate the rate. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - notification_emails: - - dom-core@mozilla.com - - emilio@mozilla.com - expires: never - send_in_pings: - - use-counters - css_justify_items: type: counter description: > @@ -29418,23 +29367,6 @@ use.counter.css.doc: send_in_pings: - use-counters - css_justify_self: - type: counter - description: > - Whether a document used the CSS property justify-self. - Compare against `use.counter.content_documents_destroyed` - to calculate the rate. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - notification_emails: - - dom-core@mozilla.com - - emilio@mozilla.com - expires: never - send_in_pings: - - use-counters - css_line_break: type: counter description: > @@ -30948,6 +30880,40 @@ use.counter.css.doc: send_in_pings: - use-counters + css_align_content: + type: counter + description: > + Whether a document used the CSS property align-content. + Compare against `use.counter.content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + css_justify_content: + type: counter + description: > + Whether a document used the CSS property justify-content. + Compare against `use.counter.content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + css_clip_rule: type: counter description: > @@ -31016,6 +30982,40 @@ use.counter.css.doc: send_in_pings: - use-counters + css_align_self: + type: counter + description: > + Whether a document used the CSS property align-self. + Compare against `use.counter.content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + css_justify_self: + type: counter + description: > + Whether a document used the CSS property justify-self. + Compare against `use.counter.content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + css_font_synthesis_position: type: counter description: > @@ -33005,10 +33005,10 @@ use.counter.css.doc: send_in_pings: - use-counters - css_text_decoration_thickness: + css_text_decoration_inset: type: counter description: > - Whether a document used the CSS property text-decoration-thickness. + Whether a document used the CSS property text-decoration-inset. Compare against `use.counter.content_documents_destroyed` to calculate the rate. bugs: @@ -33022,10 +33022,10 @@ use.counter.css.doc: send_in_pings: - use-counters - css_text_decoration_trim: + css_text_decoration_thickness: type: counter description: > - Whether a document used the CSS property text-decoration-trim. + Whether a document used the CSS property text-decoration-thickness. Compare against `use.counter.content_documents_destroyed` to calculate the rate. bugs: diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp @@ -5783,48 +5783,48 @@ 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( +// Helper to determine decoration inset. +// Returns false if the inset would cut off the decoration entirely. +static bool ComputeDecorationInset( nsTextFrame* aFrame, const nsPresContext* aPresCtx, const nsIFrame* aDecFrame, const gfxFont::Metrics& aMetrics, nsCSSRendering::DecorationRectParams& aParams) { const WritingMode wm = aDecFrame->GetWritingMode(); bool verticalDec = wm.IsVertical(); - aParams.trimLeft = 0.0; - aParams.trimRight = 0.0; + aParams.insetLeft = 0.0; + aParams.insetRight = 0.0; - // Find the trim values for this frame. - const StyleTextDecorationTrim& cssTrim = - aDecFrame->StyleTextReset()->mTextDecorationTrim; - nscoord trimLeft, trimRight; - if (cssTrim.IsAuto()) { - // Use a trim factor of 1/12.5, so we get 2px of trim (resulting in a 4px + // Find the decoration-line inset values for this frame. + const StyleTextDecorationInset& cssInset = + aDecFrame->StyleTextReset()->mTextDecorationInset; + nscoord insetLeft, insetRight; + if (cssInset.IsAuto()) { + // Use an inset factor of 1/12.5, so we get 2px of inset (resulting in 4px // gap between adjacent lines) at font-size 25px. - constexpr gfxFloat kAutoTrimFactor = 1.0 / 12.5; - // Use the EM size multiplied by kAutoTrimFactor, with a minimum of one + constexpr gfxFloat kAutoInsetFactor = 1.0 / 12.5; + // Use the EM size multiplied by kAutoInsetFactor, with a minimum of one // CSS pixel to ensure that at least some separation occurs. - const nscoord autoDecorationTrim = + const nscoord autoDecorationInset = std::max(aPresCtx->DevPixelsToAppUnits( - NS_round(aMetrics.emHeight * kAutoTrimFactor)), + NS_round(aMetrics.emHeight * kAutoInsetFactor)), nsPresContext::CSSPixelsToAppUnits(1)); - trimLeft = autoDecorationTrim; - trimRight = autoDecorationTrim; + insetLeft = autoDecorationInset; + insetRight = autoDecorationInset; } else { - MOZ_ASSERT(cssTrim.IsLength(), "Impossible text-decoration-trim"); - const auto& length = cssTrim.AsLength(); + MOZ_ASSERT(cssInset.IsLength(), "Impossible text-decoration-inset"); + const auto& length = cssInset.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 = length.start.ToAppUnits(); - trimRight = length.end.ToAppUnits(); + insetLeft = length.start.ToAppUnits(); + insetRight = length.end.ToAppUnits(); } if (wm.IsInlineReversed()) { - std::swap(trimLeft, trimRight); + std::swap(insetLeft, insetRight); } // These rects must be based on the same origin. @@ -5909,22 +5909,22 @@ static bool ComputeDecorationTrim( std::swap(applyLeft, applyRight); } if (applyLeft) { - trimLeft -= marginLeft; + insetLeft -= marginLeft; } else { - trimLeft = 0; + insetLeft = 0; } if (applyRight) { - trimRight -= marginRight; + insetRight -= marginRight; } else { - trimRight = 0; + insetRight = 0; } - if (trimLeft + trimRight >= frameSize) { + if (insetLeft + insetRight >= frameSize) { // 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 + // inset 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 @@ -5934,11 +5934,11 @@ static bool ComputeDecorationTrim( // 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 (trimLeft > 0 || marginLeft == 0) { - aParams.trimLeft = aPresCtx->AppUnitsToFloatDevPixels(trimLeft); + if (insetLeft > 0 || marginLeft == 0) { + aParams.insetLeft = aPresCtx->AppUnitsToFloatDevPixels(insetLeft); } - if (trimRight > 0 || marginRight == 0) { - aParams.trimRight = aPresCtx->AppUnitsToFloatDevPixels(trimRight); + if (insetRight > 0 || marginRight == 0) { + aParams.insetRight = aPresCtx->AppUnitsToFloatDevPixels(insetRight); } return true; } @@ -6084,8 +6084,8 @@ void nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext, metrics, appUnitsPerDevUnit, this, parentWM.IsCentralBaseline(), swapUnderline); - if (!ComputeDecorationTrim(this, aPresContext, dec.mFrame, metrics, - params)) { + if (!ComputeDecorationInset(this, aPresContext, dec.mFrame, metrics, + params)) { return; } @@ -7916,8 +7916,8 @@ 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)) { + if (!ComputeDecorationInset(this, aParams.textStyle->PresContext(), + dec.mFrame, metrics, params)) { return; } bCoord = (frameBStart - dec.mBaselineOffset) / app; @@ -7938,11 +7938,11 @@ void nsTextFrame::DrawTextRunAndDecorations( params.allowInkSkipping = dec.mAllowInkSkipping; params.skipInk = StyleText()->mTextDecorationSkipInk; gfxClipAutoSaveRestore clipRestore(params.context); - // If we have a negative trim value, then the decoration will extend + // If we have a negative inset value, then the decoration will extend // outside the edges of the text. // TODO alaskanemily: Ideally we would adjust the clipping rect, but as // an initial pass we just disable clipping in this case. - if (clipRect && !params.HasNegativeTrim()) { + if (clipRect && !params.HasNegativeInset()) { clipRestore.Clip(*clipRect); } PaintDecorationLine(params); diff --git a/layout/painting/nsCSSRendering.cpp b/layout/painting/nsCSSRendering.cpp @@ -3999,23 +3999,23 @@ static void SkipInk(nsIFrame* aFrame, DrawTarget& aDrawTarget, // the whole text run. const Float absoluteLineStart = relativeTextStart - aParams.icoordInFrame; - // Compute the min/max positions based on trim. - const Float trimLineDrawAreaStart = - relativeTextStart + (aParams.trimLeft - aPadding); - const Float trimLineDrawAreaEnd = - relativeTextEnd - (aParams.trimRight - aPadding); + // Compute the min/max positions based on inset. + const Float insetLineDrawAreaStart = + relativeTextStart + (aParams.insetLeft - aPadding); + const Float insetLineDrawAreaEnd = + relativeTextEnd - (aParams.insetRight - 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 + // While we use the inset start/end values, it is possible the inset cuts // of the first intercept and into the next, so we will need to clamp // the dimensions in the other case too. - SkScalar startIntercept = trimLineDrawAreaStart; + SkScalar startIntercept = insetLineDrawAreaStart; if (i > 0) { startIntercept = std::max(aIntercepts[i - 1] + absoluteLineStart, startIntercept); } - SkScalar endIntercept = trimLineDrawAreaEnd; + SkScalar endIntercept = insetLineDrawAreaEnd; if (i < length) { endIntercept = std::min(aIntercepts[i] + absoluteLineStart, endIntercept); } @@ -4029,7 +4029,7 @@ static void SkipInk(nsIFrame* aFrame, DrawTarget& aDrawTarget, // Don't draw decoration lines that have a smaller width than 1, or half // the line-end padding dimension. // This will catch the case of an intercept being fully removed by the - // trim values, in which case the width will be negative. + // inset values, in which case the width will be negative. if (clipParams.lineSize.width < std::max(aPadding * 0.5, 1.0)) { continue; } @@ -4665,9 +4665,9 @@ gfxRect nsCSSRendering::GetTextDecorationRectInternal( MOZ_ASSERT_UNREACHABLE("Invalid text decoration value"); } - // Take text decoration trim into account. - r.x += aParams.trimLeft; - r.width -= aParams.trimLeft + aParams.trimRight; + // Take text decoration inset into account. + r.x += aParams.insetLeft; + r.width -= aParams.insetLeft + aParams.insetRight; r.width = std::max(r.width, 0.0); // Convert line-relative coordinate system (x = line-right, y = line-up) diff --git a/layout/painting/nsCSSRendering.h b/layout/painting/nsCSSRendering.h @@ -554,13 +554,15 @@ 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, insetLeft, and insetRight in // the following structs are non-rounded device pixels, not app units. struct DecorationRectParams { - // Checks if either start or end trim value is negative. + // Checks if either start or end inset value is negative. // In that situation, text decoration will extend past the edges of the // text. - bool HasNegativeTrim() const { return trimLeft < 0.0 || trimRight < 0.0; } + bool HasNegativeInset() const { + return insetLeft < 0.0 || insetRight < 0.0; + } // The width [length] and the height [thickness] of the decoration // line. This is a "logical" size in textRun orientation, so that @@ -594,11 +596,11 @@ struct nsCSSRendering { // The style of the decoration line mozilla::StyleTextDecorationStyle style = mozilla::StyleTextDecorationStyle::None; - // Trim start/end values for this decoration. + // Decoration-line start/end inset values for this decoration. // The caller must ensure that the start/end values are translated to // left/right in the line-relative direction. - Float trimLeft = 0.0f; - Float trimRight = 0.0f; + Float insetLeft = 0.0f; + Float insetRight = 0.0f; bool vertical = false; bool sidewaysLeft = false; gfxTextRun::Range glyphRange; diff --git a/layout/style/ServoBindings.toml b/layout/style/ServoBindings.toml @@ -136,7 +136,7 @@ rusty-enums = [ "mozilla::StyleMathVariant", "mozilla::StyleTextDecorationSkipInk", "mozilla::StyleTextDecorationLength", - "mozilla::StyleTextDecorationTrim", + "mozilla::StyleTextDecorationInset", "mozilla::StyleMaskType", "mozilla::StyleShapeRendering", "mozilla::StyleTextAnchor", @@ -445,7 +445,7 @@ cbindgen-types = [ { gecko = "StyleOverflowAnchor", servo = "crate::values::computed::OverflowAnchor" }, { gecko = "StyleTextDecorationSkipInk", servo = "crate::values::computed::TextDecorationSkipInk" }, { gecko = "StyleTextDecorationLength", servo = "crate::values::computed::TextDecorationLength" }, - { gecko = "StyleTextDecorationTrim", servo = "crate::values::computed::TextDecorationTrim" }, + { gecko = "StyleTextDecorationInset", servo = "crate::values::computed::TextDecorationInset" }, { gecko = "StyleRubyPosition", servo = "crate::values::computed::RubyPosition" }, { gecko = "StyleLength", servo = "crate::values::computed::CSSPixelLength" }, { gecko = "StyleLengthPercentage", servo = "crate::values::computed::LengthPercentage" }, diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp @@ -2884,7 +2884,7 @@ nsStyleTextReset::nsStyleTextReset() mInitialLetter{0, 0}, mTextDecorationColor(StyleColor::CurrentColor()), mTextDecorationThickness(StyleTextDecorationLength::Auto()), - mTextDecorationTrim(StyleTextDecorationTrim::Length( + mTextDecorationInset(StyleTextDecorationInset::Length( StyleLength::Zero(), StyleLength::Zero())) { MOZ_COUNT_CTOR(nsStyleTextReset); } @@ -2897,7 +2897,7 @@ nsStyleTextReset::nsStyleTextReset(const nsStyleTextReset& aSource) mInitialLetter(aSource.mInitialLetter), mTextDecorationColor(aSource.mTextDecorationColor), mTextDecorationThickness(aSource.mTextDecorationThickness), - mTextDecorationTrim(aSource.mTextDecorationTrim) { + mTextDecorationInset(aSource.mTextDecorationInset) { MOZ_COUNT_CTOR(nsStyleTextReset); } @@ -2911,7 +2911,7 @@ nsChangeHint nsStyleTextReset::CalcDifference( if (mTextDecorationLine != aNewData.mTextDecorationLine || mTextDecorationStyle != aNewData.mTextDecorationStyle || mTextDecorationThickness != aNewData.mTextDecorationThickness || - mTextDecorationTrim != aNewData.mTextDecorationTrim) { + mTextDecorationInset != aNewData.mTextDecorationInset) { // Changes to our text-decoration line can impact our overflow area & // also our descendants' overflow areas (particularly for text-frame // descendants). So, we update those areas & trigger a repaint. diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h @@ -1196,7 +1196,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTextReset { mozilla::StyleInitialLetter mInitialLetter; mozilla::StyleColor mTextDecorationColor; mozilla::StyleTextDecorationLength mTextDecorationThickness; - mozilla::StyleTextDecorationTrim mTextDecorationTrim; + mozilla::StyleTextDecorationInset mTextDecorationInset; }; struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText { diff --git a/layout/style/res/html.css b/layout/style/res/html.css @@ -542,7 +542,8 @@ del:lang(zh), strike:lang(ja), strike:lang(ko), strike:lang(zh) { - text-decoration-trim: auto; + /* stylelint-disable-next-line */ + text-decoration-inset: auto; } big { diff --git a/layout/style/res/ua.css b/layout/style/res/ua.css @@ -161,7 +161,8 @@ :any-link:lang(ja), :any-link:lang(ko), :any-link:lang(zh) { - text-decoration-trim: auto; + /* stylelint-disable-next-line */ + text-decoration-inset: auto; } :link { diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js @@ -14440,10 +14440,10 @@ if (IsCSSPropertyPrefEnabled("dom.viewTransitions.enabled")) { }); } -if (IsCSSPropertyPrefEnabled("layout.css.text-decoration-trim.enabled")) { +if (IsCSSPropertyPrefEnabled("layout.css.text-decoration-inset.enabled")) { Object.assign(gCSSProperties, { - "text-decoration-trim": { - domProp: "textDecorationTrim", + "text-decoration-inset": { + domProp: "textDecorationInset", inherited: false, type: CSS_TYPE_LONGHAND, applies_to_first_letter: true, diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml @@ -10447,7 +10447,7 @@ value: true mirror: always -- name: layout.css.text-decoration-trim.enabled +- name: layout.css.text-decoration-inset.enabled type: RelaxedAtomicBool value: false mirror: always diff --git a/servo/components/style/properties/data.py b/servo/components/style/properties/data.py @@ -551,7 +551,7 @@ class Longhand(Property): "SVGStrokeDashArray", "SVGWidth", "TextDecorationLength", - "TextDecorationTrim", + "TextDecorationInset", "TextIndent", "WordSpacing", } diff --git a/servo/components/style/properties/longhands/text.mako.rs b/servo/components/style/properties/longhands/text.mako.rs @@ -51,13 +51,13 @@ ${helpers.single_keyword( )} ${helpers.predefined_type( - "text-decoration-trim", - "TextDecorationTrim", - "computed::text::TextDecorationTrim::get_initial_value()", + "text-decoration-inset", + "TextDecorationInset", + "computed::text::TextDecorationInset::get_initial_value()", engines="gecko", - initial_specified_value="specified::text::TextDecorationTrim::get_initial_value()", + initial_specified_value="specified::text::TextDecorationInset::get_initial_value()", boxed=True, - gecko_pref="layout.css.text-decoration-trim.enabled", + gecko_pref="layout.css.text-decoration-inset.enabled", spec="https://drafts.csswg.org/css-text-decor-4/#text-decoration-skip-inset-property", affects="overflow", )} diff --git a/servo/components/style/values/computed/mod.rs b/servo/components/style/values/computed/mod.rs @@ -37,7 +37,7 @@ use std::cmp; use std::f32; use std::ops::{Add, Sub}; -pub use self::align::{SelfAlignment, ContentDistribution, ItemPlacement, JustifyItems}; +pub use self::align::{ContentDistribution, ItemPlacement, JustifyItems, SelfAlignment}; pub use self::angle::Angle; pub use self::animation::{ AnimationComposition, AnimationDirection, AnimationDuration, AnimationFillMode, @@ -112,7 +112,7 @@ pub use self::text::{OverflowWrap, RubyPosition, TextOverflow, WordBreak, WordSp pub use self::text::{TextAlign, TextAlignLast, TextEmphasisPosition, TextEmphasisStyle}; pub use self::text::{TextAutospace, TextUnderlinePosition}; pub use self::text::{ - TextDecorationLength, TextDecorationSkipInk, TextDecorationTrim, TextJustify, + TextDecorationInset, TextDecorationLength, TextDecorationSkipInk, TextJustify, }; pub use self::time::Time; pub use self::transform::{Rotate, Scale, Transform, TransformBox, TransformOperation}; diff --git a/servo/components/style/values/computed/text.rs b/servo/components/style/values/computed/text.rs @@ -6,8 +6,8 @@ use crate::values::computed::length::{Length, LengthPercentage}; use crate::values::generics::text::{ - GenericHyphenateLimitChars, GenericInitialLetter, GenericTextDecorationLength, - GenericTextDecorationTrim, GenericTextIndent, + GenericHyphenateLimitChars, GenericInitialLetter, GenericTextDecorationInset, + GenericTextDecorationLength, GenericTextIndent, }; use crate::values::generics::NumberOrAuto; use crate::values::specified::text as specified; @@ -29,8 +29,8 @@ pub type InitialLetter = GenericInitialLetter<CSSFloat, CSSInteger>; /// Implements type for `text-decoration-thickness` property. pub type TextDecorationLength = GenericTextDecorationLength<LengthPercentage>; -/// Implements type for `text-decoration-trim` property. -pub type TextDecorationTrim = GenericTextDecorationTrim<Length>; +/// Implements type for `text-decoration-inset` property. +pub type TextDecorationInset = GenericTextDecorationInset<Length>; /// The computed value of `text-align`. pub type TextAlign = specified::TextAlignKeyword; diff --git a/servo/components/style/values/generics/text.rs b/servo/components/style/values/generics/text.rs @@ -164,9 +164,9 @@ pub enum GenericTextDecorationLength<L> { FromFont, } -/// Text decoration trim values. +/// Text decoration inset values. /// -/// https://drafts.csswg.org/css-text-decor-4/#propdef-text-decoration-trim +/// https://drafts.csswg.org/css-text-decor-4/#text-decoration-skip-inset-property #[repr(C, u8)] #[derive( Animate, @@ -184,7 +184,7 @@ pub enum GenericTextDecorationLength<L> { ToShmem, ToTyped, )] -pub enum GenericTextDecorationTrim<L> { +pub enum GenericTextDecorationInset<L> { /// `auto` value Auto, /// Start and end length values. @@ -192,25 +192,25 @@ pub enum GenericTextDecorationTrim<L> { Length { start: L, end: L }, } -impl<L: Zero> GenericTextDecorationTrim<L> { +impl<L: Zero> GenericTextDecorationInset<L> { /// Gets the initial value (zero) #[inline] pub fn get_initial_value() -> Self { - GenericTextDecorationTrim::Length { + GenericTextDecorationInset::Length { start: L::zero(), end: L::zero(), } } } -impl<L: ToCss + PartialEq> ToCss for GenericTextDecorationTrim<L> { +impl<L: ToCss + PartialEq> ToCss for GenericTextDecorationInset<L> { fn to_css<W>(&self, dst: &mut CssWriter<W>) -> fmt::Result where W: Write, { match self { - GenericTextDecorationTrim::Auto => dst.write_str("auto"), - GenericTextDecorationTrim::Length { start, end } => { + GenericTextDecorationInset::Auto => dst.write_str("auto"), + GenericTextDecorationInset::Length { start, end } => { start.to_css(dst)?; if start != end { dst.write_char(' ')?; diff --git a/servo/components/style/values/specified/mod.rs b/servo/components/style/values/specified/mod.rs @@ -108,7 +108,7 @@ pub use self::text::{OverflowWrap, TextEmphasisPosition, TextEmphasisStyle, Word pub use self::text::{TextAlignKeyword, TextDecorationLine, TextOverflow, WordSpacing}; pub use self::text::{TextAlignLast, TextAutospace, TextUnderlinePosition}; pub use self::text::{ - TextDecorationLength, TextDecorationSkipInk, TextDecorationTrim, TextJustify, TextTransform, + TextDecorationInset, TextDecorationLength, TextDecorationSkipInk, TextJustify, TextTransform, }; pub use self::time::Time; pub use self::transform::{Rotate, Scale, Transform}; diff --git a/servo/components/style/values/specified/text.rs b/servo/components/style/values/specified/text.rs @@ -10,8 +10,8 @@ use crate::values::computed; use crate::values::computed::text::TextEmphasisStyle as ComputedTextEmphasisStyle; use crate::values::computed::{Context, ToComputedValue}; use crate::values::generics::text::{ - GenericHyphenateLimitChars, GenericInitialLetter, GenericTextDecorationLength, - GenericTextDecorationTrim, GenericTextIndent, + GenericHyphenateLimitChars, GenericInitialLetter, GenericTextDecorationInset, + GenericTextDecorationLength, GenericTextIndent, }; use crate::values::generics::NumberOrAuto; use crate::values::specified::length::{Length, LengthPercentage}; @@ -1093,24 +1093,24 @@ impl TextDecorationLength { } } -/// Implements type for `text-decoration-trim` property -pub type TextDecorationTrim = GenericTextDecorationTrim<Length>; +/// Implements type for `text-decoration-inset` property +pub type TextDecorationInset = GenericTextDecorationInset<Length>; -impl TextDecorationTrim { +impl TextDecorationInset { /// `Auto` value. #[inline] pub fn auto() -> Self { - GenericTextDecorationTrim::Auto + GenericTextDecorationInset::Auto } /// Whether this is the `Auto` value. #[inline] pub fn is_auto(&self) -> bool { - matches!(*self, GenericTextDecorationTrim::Auto) + matches!(*self, GenericTextDecorationInset::Auto) } } -impl Parse for TextDecorationTrim { +impl Parse for TextDecorationInset { fn parse<'i, 't>( ctx: &ParserContext, input: &mut Parser<'i, 't>, @@ -1118,10 +1118,10 @@ impl Parse for TextDecorationTrim { if let Ok(start) = input.try_parse(|i| Length::parse(ctx, i)) { let end = input.try_parse(|i| Length::parse(ctx, i)); let end = end.unwrap_or_else(|_| start.clone()); - return Ok(TextDecorationTrim::Length { start, end }); + return Ok(TextDecorationInset::Length { start, end }); } input.expect_ident_matching("auto")?; - Ok(TextDecorationTrim::Auto) + Ok(TextDecorationInset::Auto) } } diff --git a/servo/ports/geckolib/cbindgen.toml b/servo/ports/geckolib/cbindgen.toml @@ -194,7 +194,7 @@ include = [ "NonNegativeLengthOrAuto", "TextDecorationSkipInk", "TextDecorationLength", - "TextDecorationTrim", + "TextDecorationInset", "Time", "Rect", "InitialLetter",