mirror of
https://github.com/servo/servo.git
synced 2025-06-24 17:14:33 +01:00
Remove now-redundant Arc inside PropertyDeclarationBlock.
This commit is contained in:
parent
acc38aa8c2
commit
ad3437b98a
6 changed files with 23 additions and 26 deletions
|
@ -330,7 +330,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
|
|||
fn from_declaration(rule: PropertyDeclaration) -> DeclarationBlock {
|
||||
DeclarationBlock::from_declarations(
|
||||
Arc::new(PropertyDeclarationBlock {
|
||||
declarations: Arc::new(vec![(rule, Importance::Normal)]),
|
||||
declarations: vec![(rule, Importance::Normal)],
|
||||
important_count: 0,
|
||||
}),
|
||||
Importance::Normal)
|
||||
|
@ -778,7 +778,7 @@ impl Element {
|
|||
});
|
||||
if let Some(index) = index {
|
||||
let declarations = Arc::make_mut(declarations);
|
||||
Arc::make_mut(&mut declarations.declarations).remove(index);
|
||||
declarations.declarations.remove(index);
|
||||
if importance.unwrap().important() {
|
||||
declarations.important_count -= 1;
|
||||
}
|
||||
|
@ -801,7 +801,7 @@ impl Element {
|
|||
// Usually, the reference count will be 1 here. But transitions could make it greater
|
||||
// than that.
|
||||
let declaration_block = Arc::make_mut(declaration_block);
|
||||
let existing_declarations = Arc::make_mut(&mut declaration_block.declarations);
|
||||
let existing_declarations = &mut declaration_block.declarations;
|
||||
|
||||
'outer: for incoming_declaration in declarations {
|
||||
for existing_declaration in &mut *existing_declarations {
|
||||
|
@ -835,7 +835,7 @@ impl Element {
|
|||
};
|
||||
|
||||
*inline_declarations = Some(Arc::new(PropertyDeclarationBlock {
|
||||
declarations: Arc::new(declarations.into_iter().map(|d| (d, importance)).collect()),
|
||||
declarations: declarations.into_iter().map(|d| (d, importance)).collect(),
|
||||
important_count: important_count,
|
||||
}));
|
||||
}
|
||||
|
@ -853,7 +853,7 @@ impl Element {
|
|||
// Usually, the reference counts of `from` and `to` will be 1 here. But transitions
|
||||
// could make them greater than that.
|
||||
let block = Arc::make_mut(block);
|
||||
let declarations = Arc::make_mut(&mut block.declarations);
|
||||
let declarations = &mut block.declarations;
|
||||
for &mut (ref declaration, ref mut importance) in declarations {
|
||||
if properties.iter().any(|p| declaration.name() == **p) {
|
||||
match (*importance, new_importance) {
|
||||
|
|
|
@ -266,7 +266,7 @@ impl<'a> QualifiedRuleParser for KeyframeListParser<'a> {
|
|||
Ok(Arc::new(Keyframe {
|
||||
selector: prelude,
|
||||
block: Arc::new(PropertyDeclarationBlock {
|
||||
declarations: Arc::new(declarations),
|
||||
declarations: declarations,
|
||||
important_count: 0,
|
||||
}),
|
||||
}))
|
||||
|
|
|
@ -286,7 +286,7 @@ impl Importance {
|
|||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct PropertyDeclarationBlock {
|
||||
#[cfg_attr(feature = "servo", ignore_heap_size_of = "#7038")]
|
||||
pub declarations: Arc<Vec<(PropertyDeclaration, Importance)>>,
|
||||
pub declarations: Vec<(PropertyDeclaration, Importance)>,
|
||||
|
||||
/// The number of entries in `self.declaration` with `Importance::Important`
|
||||
pub important_count: u32,
|
||||
|
@ -567,7 +567,7 @@ pub fn parse_property_declaration_list(context: &ParserContext, input: &mut Pars
|
|||
}
|
||||
}
|
||||
let mut block = PropertyDeclarationBlock {
|
||||
declarations: Arc::new(declarations),
|
||||
declarations: declarations,
|
||||
important_count: important_count,
|
||||
};
|
||||
deduplicate_property_declarations(&mut block);
|
||||
|
@ -583,8 +583,7 @@ fn deduplicate_property_declarations(block: &mut PropertyDeclarationBlock) {
|
|||
let mut seen_custom_normal = Vec::new();
|
||||
let mut seen_custom_important = Vec::new();
|
||||
|
||||
let declarations = Arc::get_mut(&mut block.declarations).unwrap();
|
||||
for (declaration, importance) in declarations.drain(..).rev() {
|
||||
for (declaration, importance) in block.declarations.drain(..).rev() {
|
||||
match declaration {
|
||||
% for property in data.longhands:
|
||||
PropertyDeclaration::${property.camel_case}(..) => {
|
||||
|
@ -636,7 +635,7 @@ fn deduplicate_property_declarations(block: &mut PropertyDeclarationBlock) {
|
|||
deduplicated.push((declaration, importance))
|
||||
}
|
||||
deduplicated.reverse();
|
||||
*declarations = deduplicated;
|
||||
block.declarations = deduplicated;
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue