mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Introduce CustomPropertiesBuilder.
I'm about to introduce more state here to implement optimizations for custom property cascading, so this abstraction is useful to encapsulate that state.
This commit is contained in:
parent
47efcd5e52
commit
d0f080d5dd
4 changed files with 73 additions and 63 deletions
|
@ -9,6 +9,7 @@
|
|||
use context::QuirksMode;
|
||||
use cssparser::{DeclarationListParser, parse_important, ParserInput, CowRcStr};
|
||||
use cssparser::{Parser, AtRuleParser, DeclarationParser, Delimiter, ParseError as CssParseError};
|
||||
use custom_properties::CustomPropertiesBuilder;
|
||||
use error_reporting::{ParseErrorReporter, ContextualParseError};
|
||||
use parser::{ParserContext, ParserErrorContext};
|
||||
use properties::animated_properties::AnimationValue;
|
||||
|
@ -691,24 +692,15 @@ impl PropertyDeclarationBlock {
|
|||
&self,
|
||||
inherited_custom_properties: Option<&Arc<::custom_properties::CustomPropertiesMap>>,
|
||||
) -> Option<Arc<::custom_properties::CustomPropertiesMap>> {
|
||||
let mut custom_properties = None;
|
||||
let mut seen_custom = PrecomputedHashSet::default();
|
||||
let mut builder = CustomPropertiesBuilder::new(inherited_custom_properties);
|
||||
|
||||
for declaration in self.normal_declaration_iter() {
|
||||
if let PropertyDeclaration::Custom(ref name, ref value) = *declaration {
|
||||
::custom_properties::cascade(
|
||||
&mut custom_properties,
|
||||
inherited_custom_properties,
|
||||
&mut seen_custom,
|
||||
name,
|
||||
value.borrow(),
|
||||
);
|
||||
builder.cascade(name, value.borrow());
|
||||
}
|
||||
}
|
||||
::custom_properties::finish_cascade(
|
||||
custom_properties,
|
||||
inherited_custom_properties,
|
||||
)
|
||||
|
||||
builder.build()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue