From e3f79d91306655f4cbe3eefe6106b9c10218f464 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Tue, 17 Apr 2018 17:24:54 -0700 Subject: [PATCH] Update to smallbitvec 2.1 --- Cargo.lock | 8 ++++---- components/malloc_size_of/Cargo.toml | 2 +- components/script/dom/cssstyledeclaration.rs | 17 ++++++++--------- components/style/Cargo.toml | 2 +- .../style/properties/declaration_block.rs | 12 ++++++------ 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0c73f24e5396..152176b1c3d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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" diff --git a/components/malloc_size_of/Cargo.toml b/components/malloc_size_of/Cargo.toml index 829f812df9ad..7db5fbc8f896 100644 --- a/components/malloc_size_of/Cargo.toml +++ b/components/malloc_size_of/Cargo.toml @@ -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 } diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index 37b1a0a4ae1b..1e95cd9d27d7 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -426,15 +426,14 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration { // https://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface fn IndexedGetter(&self, index: u32) -> Option { 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)) }) } diff --git a/components/style/Cargo.toml b/components/style/Cargo.toml index 504be54c390c..ce2326dac8e3 100644 --- a/components/style/Cargo.toml +++ b/components/style/Cargo.toml @@ -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"} diff --git a/components/style/properties/declaration_block.rs b/components/style/properties/declaration_block.rs index 58c4bd97ee4a..0263de83fef8 100644 --- a/components/style/properties/declaration_block.rs +++ b/components/style/properties/declaration_block.rs @@ -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), } }