aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/traversal.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-08-04 21:33:59 -0500
committerGitHub <noreply@github.com>2017-08-04 21:33:59 -0500
commitac37f81c1f70f6994444ca0c40ad9d91a228ec87 (patch)
tree738bf433e7115f2320e4126d3602297e1268ec07 /components/style/traversal.rs
parent49615284d0f45646da917f7dda22a1103d12974d (diff)
parentbb44c0a6bcc5e2c4be26d8187769de875b4326da (diff)
downloadservo-ac37f81c1f70f6994444ca0c40ad9d91a228ec87.tar.gz
servo-ac37f81c1f70f6994444ca0c40ad9d91a228ec87.zip
Auto merge of #17972 - heycam:ignore-existing, r=bholley
style: Allow styles to be computed ignoring existing element data. From https://bugzilla.mozilla.org/show_bug.cgi?id=1384824. <!-- 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/17972) <!-- Reviewable:end -->
Diffstat (limited to 'components/style/traversal.rs')
-rw-r--r--components/style/traversal.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/components/style/traversal.rs b/components/style/traversal.rs
index 4640f7c9e0f..39206303ae3 100644
--- a/components/style/traversal.rs
+++ b/components/style/traversal.rs
@@ -391,6 +391,7 @@ pub fn resolve_style<E>(
context: &mut StyleContext<E>,
element: E,
rule_inclusion: RuleInclusion,
+ ignore_existing_style: bool,
) -> ElementStyles
where
E: TElement,
@@ -398,6 +399,7 @@ where
use style_resolver::StyleResolverForElement;
debug_assert!(rule_inclusion == RuleInclusion::DefaultOnly ||
+ ignore_existing_style ||
element.borrow_data().map_or(true, |d| !d.has_styles()),
"Why are we here?");
let mut ancestors_requiring_style_resolution = SmallVec::<[E; 16]>::new();
@@ -408,7 +410,7 @@ where
let mut style = None;
let mut ancestor = element.traversal_parent();
while let Some(current) = ancestor {
- if rule_inclusion == RuleInclusion::All {
+ if rule_inclusion == RuleInclusion::All && !ignore_existing_style {
if let Some(data) = current.borrow_data() {
if let Some(ancestor_style) = data.styles.get_primary() {
style = Some(ancestor_style.clone());