Add unsafe blocks to make_unique

See #6376
This commit is contained in:
Manish Goregaokar 2015-06-14 20:52:27 +05:30
parent 3cdc412a4c
commit 94fa868d2b
4 changed files with 84 additions and 68 deletions

View file

@ -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() {