tor-browser

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

commit 485407fee83fce092e011378c6a4af832ae887d1
parent 0288ba33eabcce03a244008fa33d4ae646beb7da
Author: Diego Escalante <descalante@mozilla.com>
Date:   Fri,  9 Jan 2026 15:44:47 +0000

Bug 2009026 - Generate attr substitutions from specified values instead of computed values. r=emilio,firefox-style-system-reviewers

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

Diffstat:
Mservo/components/style/custom_properties.rs | 1-
Mservo/components/style/properties_and_values/value.rs | 55+++++++++++++++++++++++++++++++------------------------
2 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/servo/components/style/custom_properties.rs b/servo/components/style/custom_properties.rs @@ -2182,7 +2182,6 @@ fn substitute_one_reference<'a>( AllowComputationallyDependent::Yes, ) .ok()?; - let value = value.to_computed_value(computed_context); Some(Substitution::from_value(value.to_variable_value())) }), }; diff --git a/servo/components/style/properties_and_values/value.rs b/servo/components/style/properties_and_values/value.rs @@ -240,6 +240,37 @@ impl<Component> Value<Component> { } } +impl<L, N, P, LP, C, Image, U, Integer, A, T, R, Transform> + Value<GenericValueComponent<L, N, P, LP, C, Image, U, Integer, A, T, R, Transform>> +where + Self: ToCss, +{ + fn serialization_types(&self) -> (TokenSerializationType, TokenSerializationType) { + match &self.v { + ValueInner::Component(component) => component.serialization_types(), + ValueInner::Universal(_) => unreachable!(), + ValueInner::List(list) => list + .components + .first() + .map_or(Default::default(), |f| f.serialization_types()), + } + } + + /// Convert to an untyped variable value. + pub fn to_variable_value(&self) -> ComputedPropertyValue { + if let ValueInner::Universal(ref value) = self.v { + return (**value).clone(); + } + let serialization_types = self.serialization_types(); + ComputedPropertyValue::new( + self.to_css_string(), + &self.url_data, + serialization_types.0, + serialization_types.1, + ) + } +} + /// A specified registered custom property value. #[derive( Animate, ToComputedValue, ToResolvedValue, ToCss, Clone, Debug, MallocSizeOf, PartialEq, ToShmem, @@ -322,17 +353,6 @@ impl SpecifiedValue { } impl ComputedValue { - fn serialization_types(&self) -> (TokenSerializationType, TokenSerializationType) { - match &self.v { - ValueInner::Component(component) => component.serialization_types(), - ValueInner::Universal(_) => unreachable!(), - ValueInner::List(list) => list - .components - .first() - .map_or(Default::default(), |f| f.serialization_types()), - } - } - fn to_declared_value(&self) -> properties::CustomDeclarationValue { if let ValueInner::Universal(ref var) = self.v { return properties::CustomDeclarationValue::Unparsed(Arc::clone(var)); @@ -351,19 +371,6 @@ impl ComputedValue { } } - /// Convert to an untyped variable value. - pub fn to_variable_value(&self) -> ComputedPropertyValue { - if let ValueInner::Universal(ref value) = self.v { - return (**value).clone(); - } - let serialization_types = self.serialization_types(); - ComputedPropertyValue::new( - self.to_css_string(), - &self.url_data, - serialization_types.0, - serialization_types.1, - ) - } } /// Whether the computed value parsing should allow computationaly dependent values like 3em or