mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #20662 - mbrubeck:smallbitvec, r=nox
Update to smallbitvec 2.1 --- - [x] `./mach build -d` does not report any errors - [x] `./mach build-geckolib` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests because covered by existing tests <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20662) <!-- Reviewable:end -->
This commit is contained in:
commit
3695fc4efc
5 changed files with 20 additions and 21 deletions
|
@ -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 }
|
||||
|
|
|
@ -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))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -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"}
|
||||
|
|
|
@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue