Skip to content

Commit

Permalink
Make PropertyDeclarationBlock have Arcs.
Browse files Browse the repository at this point in the history
  • Loading branch information
pradeep90 committed Nov 25, 2013
1 parent 318a1a3 commit e0c33fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/components/style/properties.rs.mako
Expand Up @@ -850,8 +850,8 @@ pub mod shorthands {


pub struct PropertyDeclarationBlock {
important: ~[PropertyDeclaration],
normal: ~[PropertyDeclaration],
important: Arc<~[PropertyDeclaration]>,
normal: Arc<~[PropertyDeclaration]>,
}


Expand Down Expand Up @@ -881,8 +881,8 @@ pub fn parse_property_declaration_list<I: Iterator<Node>>(input: I) -> PropertyD
}
}
PropertyDeclarationBlock {
important: important,
normal: normal,
important: Arc::new(important),
normal: Arc::new(normal),
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/components/style/selector_matching.rs
Expand Up @@ -254,13 +254,13 @@ impl Stylist {
// them into the SelectorMap of that priority.
macro_rules! append(
($priority: ident, $flag: ident) => {
if style_rule.declarations.$priority.len() > 0 {
if style_rule.declarations.$priority.get().len() > 0 {
$flag = true;
for selector in style_rule.selectors.iter() {
// TODO: avoid copying?
rule_map.$priority.insert(Rule {
selector: Arc::new(selector.clone()),
declarations: Arc::new(style_rule.declarations.$priority.clone()),
declarations: style_rule.declarations.$priority.clone(),
index: style_rule_index,
stylesheet_index: self.stylesheet_index,
});
Expand Down Expand Up @@ -307,9 +307,9 @@ impl Stylist {
applicable_declarations.push_all_move(declarations_list.slice(0, 3).concat_vec());
// Style attributes have author origin but higher specificity than style rules.
// TODO: avoid copying?
style_attribute.map(|sa| applicable_declarations.push(Arc::new(sa.normal.clone())));
style_attribute.map(|sa| applicable_declarations.push(sa.normal.clone()));
applicable_declarations.push_all_move(declarations_list.slice(3, 4).concat_vec());
style_attribute.map(|sa| applicable_declarations.push(Arc::new(sa.important.clone())));
style_attribute.map(|sa| applicable_declarations.push(sa.important.clone()));
applicable_declarations.push_all_move(declarations_list.slice(4, 6).concat_vec());

applicable_declarations
Expand Down Expand Up @@ -586,7 +586,7 @@ fn get_rules(css_string: &str) -> ~[~[Rule]] {
do iter_style_rules(sheet.rules.as_slice(), device) |style_rule| {
results.push(style_rule.selectors.iter().map(|s| Rule {
selector: Arc::new(s.clone()),
declarations: Arc::new(style_rule.declarations.normal.clone()),
declarations: style_rule.declarations.normal.clone(),
index: index,
stylesheet_index: 0u,
}).collect());
Expand Down

5 comments on commit e0c33fa

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pcwalton
at pradeep90@e0c33fa

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging pradeep90/servo/rule-hash-optimize = e0c33fa into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pradeep90/servo/rule-hash-optimize = e0c33fa merged ok, testing candidate = b564573

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = b564573

Please sign in to comment.