mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
parent
3cdc412a4c
commit
94fa868d2b
4 changed files with 84 additions and 68 deletions
|
@ -627,13 +627,14 @@ impl<'a> ElementHelpers<'a> for JSRef<'a, Element> {
|
|||
}
|
||||
|
||||
fn remove_inline_style_property(self, property: DOMString) {
|
||||
#![allow(unsafe_code)] // #6376
|
||||
let mut inline_declarations = self.style_attribute.borrow_mut();
|
||||
if let &mut Some(ref mut declarations) = &mut *inline_declarations {
|
||||
let index = declarations.normal
|
||||
.iter()
|
||||
.position(|decl| decl.name() == property);
|
||||
if let Some(index) = index {
|
||||
declarations.normal.make_unique().remove(index);
|
||||
unsafe { declarations.normal.make_unique().remove(index); }
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -641,19 +642,20 @@ impl<'a> ElementHelpers<'a> for JSRef<'a, Element> {
|
|||
.iter()
|
||||
.position(|decl| decl.name() == property);
|
||||
if let Some(index) = index {
|
||||
declarations.important.make_unique().remove(index);
|
||||
unsafe { declarations.important.make_unique().remove(index); }
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn update_inline_style(self, property_decl: PropertyDeclaration, style_priority: StylePriority) {
|
||||
#![allow(unsafe_code)] // #6376
|
||||
let mut inline_declarations = self.style_attribute().borrow_mut();
|
||||
if let &mut Some(ref mut declarations) = &mut *inline_declarations {
|
||||
let existing_declarations = if style_priority == StylePriority::Important {
|
||||
declarations.important.make_unique()
|
||||
unsafe { declarations.important.make_unique() }
|
||||
} else {
|
||||
declarations.normal.make_unique()
|
||||
unsafe { declarations.normal.make_unique() }
|
||||
};
|
||||
|
||||
for declaration in existing_declarations.iter_mut() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue