Update to smallbitvec 2.1

This commit is contained in:
Matt Brubeck 2018-04-17 17:24:54 -07:00
parent 5081755418
commit e3f79d9130
5 changed files with 20 additions and 21 deletions

8
Cargo.lock generated
View file

@ -1643,7 +1643,7 @@ dependencies = [
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_bytes 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"servo_arc 0.1.1",
"smallbitvec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"smallbitvec 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2938,7 +2938,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "smallbitvec"
version = "1.0.6"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -3029,7 +3029,7 @@ dependencies = [
"servo_atoms 0.0.1",
"servo_config 0.0.1",
"servo_url 0.0.1",
"smallbitvec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"smallbitvec 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"style_derive 0.0.1",
@ -4008,7 +4008,7 @@ dependencies = [
"checksum simd 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a94d14a2ae1f1f110937de5fb69e494372560181c7e1739a097fcc2cee37ba0"
"checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537"
"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
"checksum smallbitvec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "79b776f00dfe01df905fa3b2eaa1659522e99e3fc4a7b1334171622205c4bdcf"
"checksum smallbitvec 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "665fbc8384f961eb55c548daa2a4b1efff1f9d03b7a10f162ac6ad6a781ca966"
"checksum smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44db0ecb22921ef790d17ae13a3f6d15784183ff5f2a01aa32098c7498d2b4b9"
"checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b"
"checksum string_cache 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39cb4173bcbd1319da31faa5468a7e3870683d7a237150b0b0aaafd546f6ad12"

View file

@ -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 }

View file

@ -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))
})
}

View file

@ -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"}

View file

@ -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
@ -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() &&
@ -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;
@ -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;
}
}
@ -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),
}
}