tor-browser

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

commit cd7748b0ac4dff025ad0e4a3936e8c2a6d0e8b76
parent 39869215be1cbecb1964724f675fae08942f555a
Author: Jan Varga <jvarga@igalia.com>
Date:   Thu, 11 Dec 2025 19:34:55 +0000

Bug 1990419 - Enable derive_fields for BorderSideWidth and LineWidth; r=emilio,firefox-style-system-reviewers

Enable derive_fields for BorderSideWidth and its dependency LineWidth,
allowing <length> values to reify into CSSNumericValue for the following
properties:
- border-top-width
- border-right-width
- border-bottom-width
- border-left-width
- border-block-start-width
- border-block-end-width
- border-inline-start-width
- border-inline-end-width
- outline-width

<length> related Typed OM WPT for these properties now pass.

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

Diffstat:
Mlayout/style/typedom/CSSUnitValue.cpp | 11++++++++++-
Mservo/components/style/values/computed/border.rs | 1+
Mservo/components/style/values/specified/border.rs | 2++
Mtesting/web-platform/meta/css/css-typed-om/the-stylepropertymap/properties/border-width.html.ini | 48------------------------------------------------
Mtesting/web-platform/meta/css/css-typed-om/the-stylepropertymap/properties/column-rule-width.html.ini | 15+++++++++++++++
Mtesting/web-platform/meta/css/css-typed-om/the-stylepropertymap/properties/logical.html.ini | 12------------
Mtesting/web-platform/meta/css/css-typed-om/the-stylepropertymap/properties/outline-width.html.ini | 12------------
7 files changed, 28 insertions(+), 73 deletions(-)

diff --git a/layout/style/typedom/CSSUnitValue.cpp b/layout/style/typedom/CSSUnitValue.cpp @@ -73,8 +73,17 @@ void CSSUnitValue::ToCssTextWithProperty(const CSSPropertyId& aPropertyId, // and fully spec-compliant manner. See bug 2005142 const bool isValueOutOfRange = [](NonCustomCSSPropertyId aId, double aValue) { switch (aId) { - case eCSSProperty_perspective: case eCSSProperty_column_width: + case eCSSProperty_perspective: + case eCSSProperty_border_block_end_width: + case eCSSProperty_border_block_start_width: + case eCSSProperty_border_bottom_width: + case eCSSProperty_border_inline_end_width: + case eCSSProperty_border_inline_start_width: + case eCSSProperty_border_left_width: + case eCSSProperty_border_right_width: + case eCSSProperty_border_top_width: + case eCSSProperty_outline_width: return aValue < 0; default: diff --git a/servo/components/style/values/computed/border.rs b/servo/components/style/values/computed/border.rs @@ -29,6 +29,7 @@ pub type LineWidth = Au; /// A computed value for border-width (and the like). #[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss, ToTyped, From)] #[repr(transparent)] +#[typed_value(derive_fields)] pub struct BorderSideWidth(pub Au); impl BorderSideWidth { diff --git a/servo/components/style/values/specified/border.rs b/servo/components/style/values/specified/border.rs @@ -100,6 +100,7 @@ impl BorderImageSlice { /// https://drafts.csswg.org/css-backgrounds-3/#typedef-line-width #[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem, ToTyped)] +#[typed_value(derive_fields)] pub enum LineWidth { /// `thin` Thin, @@ -168,6 +169,7 @@ impl ToComputedValue for LineWidth { /// A specified value for a single side of the `border-width` property. The difference between this /// and LineWidth is whether we snap to device pixels or not. #[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem, ToTyped)] +#[typed_value(derive_fields)] pub struct BorderSideWidth(LineWidth); impl BorderSideWidth { diff --git a/testing/web-platform/meta/css/css-typed-om/the-stylepropertymap/properties/border-width.html.ini b/testing/web-platform/meta/css/css-typed-om/the-stylepropertymap/properties/border-width.html.ini @@ -3,18 +3,6 @@ [Can set 'border-top-width' to var() references: ] expected: FAIL - [Can set 'border-top-width' to the 'thin' keyword: ] - expected: FAIL - - [Can set 'border-top-width' to the 'medium' keyword: ] - expected: FAIL - - [Can set 'border-top-width' to the 'thick' keyword: ] - expected: FAIL - - [Can set 'border-top-width' to a length: ] - expected: FAIL - [Setting 'border-top-width' to a percent: throws TypeError] expected: FAIL @@ -36,18 +24,6 @@ [Can set 'border-left-width' to var() references: ] expected: FAIL - [Can set 'border-left-width' to the 'thin' keyword: ] - expected: FAIL - - [Can set 'border-left-width' to the 'medium' keyword: ] - expected: FAIL - - [Can set 'border-left-width' to the 'thick' keyword: ] - expected: FAIL - - [Can set 'border-left-width' to a length: ] - expected: FAIL - [Setting 'border-left-width' to a percent: throws TypeError] expected: FAIL @@ -69,18 +45,6 @@ [Can set 'border-right-width' to var() references: ] expected: FAIL - [Can set 'border-right-width' to the 'thin' keyword: ] - expected: FAIL - - [Can set 'border-right-width' to the 'medium' keyword: ] - expected: FAIL - - [Can set 'border-right-width' to the 'thick' keyword: ] - expected: FAIL - - [Can set 'border-right-width' to a length: ] - expected: FAIL - [Setting 'border-right-width' to a percent: throws TypeError] expected: FAIL @@ -102,18 +66,6 @@ [Can set 'border-bottom-width' to var() references: ] expected: FAIL - [Can set 'border-bottom-width' to the 'thin' keyword: ] - expected: FAIL - - [Can set 'border-bottom-width' to the 'medium' keyword: ] - expected: FAIL - - [Can set 'border-bottom-width' to the 'thick' keyword: ] - expected: FAIL - - [Can set 'border-bottom-width' to a length: ] - expected: FAIL - [Setting 'border-bottom-width' to a percent: throws TypeError] expected: FAIL diff --git a/testing/web-platform/meta/css/css-typed-om/the-stylepropertymap/properties/column-rule-width.html.ini b/testing/web-platform/meta/css/css-typed-om/the-stylepropertymap/properties/column-rule-width.html.ini @@ -38,3 +38,18 @@ ['column-rule-width' does not support 'thin medium thick'] expected: FAIL + + ['column-rule-width' does not support 'thin'] + expected: FAIL + + ['column-rule-width' does not support 'medium'] + expected: FAIL + + ['column-rule-width' does not support 'thick'] + expected: FAIL + + ['column-rule-width' does not support '2px'] + expected: FAIL + + ['column-rule-width' does not support '3px'] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-typed-om/the-stylepropertymap/properties/logical.html.ini b/testing/web-platform/meta/css/css-typed-om/the-stylepropertymap/properties/logical.html.ini @@ -492,9 +492,6 @@ [Can set 'border-block-start-width' to the 'thick' keyword: ] expected: FAIL - [Can set 'border-block-start-width' to a length: ] - expected: FAIL - [Setting 'border-block-start-width' to a percent: throws TypeError] expected: FAIL @@ -606,9 +603,6 @@ [Can set 'border-block-end-width' to the 'thick' keyword: ] expected: FAIL - [Can set 'border-block-end-width' to a length: ] - expected: FAIL - [Setting 'border-block-end-width' to a percent: throws TypeError] expected: FAIL @@ -720,9 +714,6 @@ [Can set 'border-inline-start-width' to the 'thick' keyword: ] expected: FAIL - [Can set 'border-inline-start-width' to a length: ] - expected: FAIL - [Setting 'border-inline-start-width' to a percent: throws TypeError] expected: FAIL @@ -834,9 +825,6 @@ [Can set 'border-inline-end-width' to the 'thick' keyword: ] expected: FAIL - [Can set 'border-inline-end-width' to a length: ] - expected: FAIL - [Setting 'border-inline-end-width' to a percent: throws TypeError] expected: FAIL diff --git a/testing/web-platform/meta/css/css-typed-om/the-stylepropertymap/properties/outline-width.html.ini b/testing/web-platform/meta/css/css-typed-om/the-stylepropertymap/properties/outline-width.html.ini @@ -3,18 +3,6 @@ [Can set 'outline-width' to var() references: ] expected: FAIL - [Can set 'outline-width' to the 'thin' keyword: ] - expected: FAIL - - [Can set 'outline-width' to the 'medium' keyword: ] - expected: FAIL - - [Can set 'outline-width' to the 'thick' keyword: ] - expected: FAIL - - [Can set 'outline-width' to a length: ] - expected: FAIL - [Setting 'outline-width' to a percent: throws TypeError] expected: FAIL