diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
commit | 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch) | |
tree | a4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /servo/components/style/custom_properties_map.rs | |
parent | Adding debian version 124.0.1-1. (diff) | |
download | firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'servo/components/style/custom_properties_map.rs')
-rw-r--r-- | servo/components/style/custom_properties_map.rs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/servo/components/style/custom_properties_map.rs b/servo/components/style/custom_properties_map.rs index 04ca8e1b3d..13c5374308 100644 --- a/servo/components/style/custom_properties_map.rs +++ b/servo/components/style/custom_properties_map.rs @@ -4,7 +4,8 @@ //! The structure that contains the custom properties of a given element. -use crate::custom_properties::{Name, VariableValue}; +use crate::custom_properties::Name; +use crate::properties_and_values::value::ComputedValue as ComputedRegisteredValue; use crate::selector_map::PrecomputedHasher; use indexmap::IndexMap; use servo_arc::Arc; @@ -22,7 +23,8 @@ impl Default for CustomPropertiesMap { } /// We use None in the value to represent a removed entry. -type OwnMap = IndexMap<Name, Option<Arc<VariableValue>>, BuildHasherDefault<PrecomputedHasher>>; +type OwnMap = + IndexMap<Name, Option<ComputedRegisteredValue>, BuildHasherDefault<PrecomputedHasher>>; // IndexMap equality doesn't consider ordering, which we want to account for. Also, for the same // reason, IndexMap equality comparisons are slower than needed. @@ -69,12 +71,12 @@ const ANCESTOR_COUNT_LIMIT: usize = 4; /// An iterator over the custom properties. pub struct Iter<'a> { current: &'a Inner, - current_iter: indexmap::map::Iter<'a, Name, Option<Arc<VariableValue>>>, + current_iter: indexmap::map::Iter<'a, Name, Option<ComputedRegisteredValue>>, descendants: smallvec::SmallVec<[&'a Inner; ANCESTOR_COUNT_LIMIT]>, } impl<'a> Iterator for Iter<'a> { - type Item = (&'a Name, &'a Option<Arc<VariableValue>>); + type Item = (&'a Name, &'a Option<ComputedRegisteredValue>); fn next(&mut self) -> Option<Self::Item> { loop { @@ -141,14 +143,14 @@ impl Inner { self.len } - fn get(&self, name: &Name) -> Option<&Arc<VariableValue>> { + fn get(&self, name: &Name) -> Option<&ComputedRegisteredValue> { if let Some(p) = self.own_properties.get(name) { return p.as_ref(); } self.parent.as_ref()?.get(name) } - fn insert(&mut self, name: &Name, value: Option<Arc<VariableValue>>) { + fn insert(&mut self, name: &Name, value: Option<ComputedRegisteredValue>) { let new = self.own_properties.insert(name.clone(), value).is_none(); if new && self.parent.as_ref().map_or(true, |p| p.get(name).is_none()) { self.len += 1; @@ -177,7 +179,7 @@ impl CustomPropertiesMap { } /// Returns the property name and value at a given index. - pub fn get_index(&self, index: usize) -> Option<(&Name, &Option<Arc<VariableValue>>)> { + pub fn get_index(&self, index: usize) -> Option<(&Name, &Option<ComputedRegisteredValue>)> { if index >= self.len() { return None; } @@ -186,11 +188,11 @@ impl CustomPropertiesMap { } /// Returns a given property value by name. - pub fn get(&self, name: &Name) -> Option<&Arc<VariableValue>> { + pub fn get(&self, name: &Name) -> Option<&ComputedRegisteredValue> { self.0.get(name) } - fn do_insert(&mut self, name: &Name, value: Option<Arc<VariableValue>>) { + fn do_insert(&mut self, name: &Name, value: Option<ComputedRegisteredValue>) { if let Some(inner) = Arc::get_mut(&mut self.0) { return inner.insert(name, value); } @@ -214,7 +216,7 @@ impl CustomPropertiesMap { } /// Inserts an element in the map. - pub fn insert(&mut self, name: &Name, value: Arc<VariableValue>) { + pub fn insert(&mut self, name: &Name, value: ComputedRegisteredValue) { self.do_insert(name, Some(value)) } |