mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Only cascade at a priority level rules that have declarations of that priority.
This commit is contained in:
parent
16bbc2f26e
commit
a175c9981e
6 changed files with 99 additions and 36 deletions
|
@ -767,6 +767,7 @@ impl Element {
|
|||
.position(|&(ref decl, _)| decl.matches(property));
|
||||
if let Some(index) = index {
|
||||
Arc::make_mut(&mut declarations.declarations).remove(index);
|
||||
declarations.recalc_any();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -781,26 +782,30 @@ impl Element {
|
|||
fn update(element: &Element, declarations: Vec<PropertyDeclaration>,
|
||||
importance: Importance) {
|
||||
let mut inline_declarations = element.style_attribute().borrow_mut();
|
||||
if let &mut Some(ref mut existing_declarations) = &mut *inline_declarations {
|
||||
// Usually, the reference count will be 1 here. But transitions could make it greater
|
||||
// than that.
|
||||
let existing_declarations = Arc::make_mut(&mut existing_declarations.declarations);
|
||||
if let &mut Some(ref mut declaration_block) = &mut *inline_declarations {
|
||||
{
|
||||
// Usually, the reference count will be 1 here. But transitions could make it greater
|
||||
// than that.
|
||||
let existing_declarations = Arc::make_mut(&mut declaration_block.declarations);
|
||||
|
||||
'outer: for incoming_declaration in declarations {
|
||||
for existing_declaration in &mut *existing_declarations {
|
||||
if existing_declaration.0.name() == incoming_declaration.name() {
|
||||
*existing_declaration = (incoming_declaration, importance);
|
||||
continue 'outer;
|
||||
'outer: for incoming_declaration in declarations {
|
||||
for existing_declaration in &mut *existing_declarations {
|
||||
if existing_declaration.0.name() == incoming_declaration.name() {
|
||||
*existing_declaration = (incoming_declaration, importance);
|
||||
continue 'outer;
|
||||
}
|
||||
}
|
||||
existing_declarations.push((incoming_declaration, importance));
|
||||
}
|
||||
existing_declarations.push((incoming_declaration, importance));
|
||||
}
|
||||
|
||||
declaration_block.recalc_any();
|
||||
return;
|
||||
}
|
||||
|
||||
*inline_declarations = Some(PropertyDeclarationBlock {
|
||||
declarations: Arc::new(declarations.into_iter().map(|d| (d, importance)).collect()),
|
||||
any_important: importance.important(),
|
||||
any_normal: !importance.important(),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue