Skip to content

Commit

Permalink
Update to smallbitvec 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrubeck committed Apr 18, 2018
1 parent 5081755 commit e3f79d9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/malloc_size_of/Cargo.toml
Expand Up @@ -34,7 +34,7 @@ selectors = { path = "../selectors" }
serde = { version = "1.0.27", optional = true }
serde_bytes = { version = "0.10", optional = true }
servo_arc = { path = "../servo_arc" }
smallbitvec = "1.0.3"
smallbitvec = "2.1.0"
smallvec = "0.6"
string_cache = { version = "0.7", optional = true }
time = { version = "0.1.17", optional = true }
Expand Down
17 changes: 8 additions & 9 deletions components/script/dom/cssstyledeclaration.rs
Expand Up @@ -426,15 +426,14 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
// https://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface
fn IndexedGetter(&self, index: u32) -> Option<DOMString> {
self.owner.with_block(|pdb| {
pdb.declarations().get(index as usize).map(|declaration| {
let important = pdb.declarations_importance().get(index);
let mut css = String::new();
declaration.to_css(&mut css).unwrap();
if important {
css += " !important";
}
DOMString::from(css)
})
let declaration = pdb.declarations().get(index as usize)?;
let important = pdb.declarations_importance().get(index as usize)?;
let mut css = String::new();
declaration.to_css(&mut css).unwrap();
if important {
css += " !important";
}
Some(DOMString::from(css))
})
}

Expand Down
2 changes: 1 addition & 1 deletion components/style/Cargo.toml
Expand Up @@ -60,7 +60,7 @@ serde = {version = "1.0", optional = true, features = ["derive"]}
servo_arc = { path = "../servo_arc" }
servo_atoms = {path = "../atoms", optional = true}
servo_config = {path = "../config", optional = true}
smallbitvec = "1.0.6"
smallbitvec = "2.1.0"
smallvec = "0.6"
string_cache = { version = "0.7", optional = true }
style_derive = {path = "../style_derive"}
Expand Down
12 changes: 6 additions & 6 deletions components/style/properties/declaration_block.rs
Expand Up @@ -313,7 +313,7 @@ impl PropertyDeclarationBlock {
}

self.declarations.iter().enumerate().find(|&(_, decl)| decl.id() == property).map(|(i, decl)| {
let importance = if self.declarations_importance.get(i as u32) {
let importance = if self.declarations_importance[i] {
Importance::Important
} else {
Importance::Normal
Expand Down Expand Up @@ -517,7 +517,7 @@ impl PropertyDeclarationBlock {
continue;
}

let important = self.declarations_importance.get(i as u32);
let important = self.declarations_importance[i];
// For declarations from parsing, non-important declarations
// shouldn't override existing important one.
if important && !importance.important() &&
Expand Down Expand Up @@ -549,7 +549,7 @@ impl PropertyDeclarationBlock {

if let Some(index) = index_to_remove {
self.declarations.remove(index);
self.declarations_importance.remove(index as u32);
self.declarations_importance.remove(index);
self.declarations.push(declaration);
self.declarations_importance.push(importance.important());
return true;
Expand All @@ -572,8 +572,8 @@ impl PropertyDeclarationBlock {
for (i, declaration) in self.declarations.iter().enumerate() {
if declaration.id().is_or_is_longhand_of(property) {
let is_important = new_importance.important();
if self.declarations_importance.get(i as u32) != is_important {
self.declarations_importance.set(i as u32, is_important);
if self.declarations_importance[i] != is_important {
self.declarations_importance.set(i, is_important);
updated_at_least_one = true;
}
}
Expand Down Expand Up @@ -686,7 +686,7 @@ impl PropertyDeclarationBlock {
PropertyDeclarationBlock {
declarations,
longhands,
declarations_importance: SmallBitVec::from_elem(len as u32, false),
declarations_importance: SmallBitVec::from_elem(len, false),
}
}

Expand Down

0 comments on commit e3f79d9

Please sign in to comment.