mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Move (some) CSSStyleDeclaration.SetProperty logic to style
This commit is contained in:
parent
bd4a4c38c8
commit
c740a76410
4 changed files with 103 additions and 98 deletions
|
@ -130,6 +130,30 @@ impl PropertyDeclarationBlock {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_parsed_declaration(&mut self, declaration: PropertyDeclaration,
|
||||
importance: Importance) {
|
||||
for slot in &mut *self.declarations {
|
||||
if slot.0.name() == declaration.name() {
|
||||
match (slot.1, importance) {
|
||||
(Importance::Normal, Importance::Important) => {
|
||||
self.important_count += 1;
|
||||
}
|
||||
(Importance::Important, Importance::Normal) => {
|
||||
self.important_count -= 1;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
*slot = (declaration, importance);
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
self.declarations.push((declaration, importance));
|
||||
if importance.important() {
|
||||
self.important_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
/// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-removeproperty
|
||||
pub fn remove_property(&mut self, property_name: &str) {
|
||||
// Step 2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue