style: Update StyleSource to use ArcUnion.

Bug: 1455784
Reviewed-by: Manishearth
MozReview-Commit-ID: AT4sud9goGV
This commit is contained in:
Bobby Holley 2018-04-20 16:28:33 -07:00 committed by Emilio Cobos Álvarez
parent cbbefebdba
commit 48558e313a
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 99 additions and 109 deletions

View file

@ -137,7 +137,7 @@ use style::properties::{parse_one_declaration_into, parse_style_attribute};
use style::properties::animated_properties::AnimationValue;
use style::properties::animated_properties::compare_property_priority;
use style::rule_cache::RuleCacheConditions;
use style::rule_tree::{CascadeLevel, StrongRuleNode, StyleSource};
use style::rule_tree::{CascadeLevel, StrongRuleNode};
use style::selector_parser::{PseudoElementCascadeType, SelectorImpl};
use style::shared_lock::{SharedRwLockReadGuard, StylesheetGuards, ToCssWithGuard, Locked};
use style::string_cache::{Atom, WeakAtom};
@ -3123,8 +3123,8 @@ pub extern "C" fn Servo_ComputedValues_GetStyleRuleList(
let mut result = SmallVec::<[_; 10]>::new();
for node in rule_node.self_and_ancestors() {
let style_rule = match *node.style_source() {
StyleSource::Style(ref rule) => rule,
let style_rule = match node.style_source().and_then(|x| x.as_rule()) {
Some(rule) => rule,
_ => continue,
};
@ -3141,9 +3141,11 @@ pub extern "C" fn Servo_ComputedValues_GetStyleRuleList(
unsafe { rules.set_len(result.len() as u32) };
for (ref src, ref mut dest) in result.into_iter().zip(rules.iter_mut()) {
src.with_raw_offset_arc(|arc| {
**dest = *Locked::<StyleRule>::arc_as_borrowed(arc);
})
src.with_arc(|a| {
a.with_raw_offset_arc(|arc| {
**dest = *Locked::<StyleRule>::arc_as_borrowed(arc);
})
});
}
}

View file

@ -35,8 +35,8 @@ size_of_test!(test_size_of_element_data, ElementData, 24);
size_of_test!(test_size_of_property_declaration, style::properties::PropertyDeclaration, 32);
size_of_test!(test_size_of_application_declaration_block, ApplicableDeclarationBlock, 24);
size_of_test!(test_size_of_rule_node, RuleNode, 80);
size_of_test!(test_size_of_application_declaration_block, ApplicableDeclarationBlock, 16);
size_of_test!(test_size_of_rule_node, RuleNode, 72);
// This is huge, but we allocate it on the stack and then never move it,
// we only pass `&mut SourcePropertyDeclaration` references around.