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 -->
This commit is contained in:
bors-servo 2017-08-04 21:33:59 -05:00 committed by GitHub
commit ac37f81c1f
8 changed files with 64 additions and 31 deletions

View file

@ -2831,7 +2831,8 @@ pub extern "C" fn Servo_ResolveStyleLazily(element: RawGeckoElementBorrowed,
pseudo_type: CSSPseudoElementType,
rule_inclusion: StyleRuleInclusion,
snapshots: *const ServoElementSnapshotTable,
raw_data: RawServoStyleSetBorrowed)
raw_data: RawServoStyleSetBorrowed,
ignore_existing_styles: bool)
-> ServoStyleContextStrong
{
debug_assert!(!snapshots.is_null());
@ -2862,8 +2863,9 @@ pub extern "C" fn Servo_ResolveStyleLazily(element: RawGeckoElementBorrowed,
// In the common case we already have the style. Check that before setting
// up all the computation machinery. (Don't use it when we're getting
// default styles, though.)
if rule_inclusion == RuleInclusion::All {
// default styles or in a bfcached document (as indicated by
// ignore_existing_styles), though.)
if rule_inclusion == RuleInclusion::All && !ignore_existing_styles {
let styles = element.mutate_data().and_then(|d| {
if d.has_styles() {
Some(finish(&d.styles))
@ -2888,7 +2890,7 @@ pub extern "C" fn Servo_ResolveStyleLazily(element: RawGeckoElementBorrowed,
thread_local: &mut tlc,
};
let styles = resolve_style(&mut context, element, rule_inclusion);
let styles = resolve_style(&mut context, element, rule_inclusion, ignore_existing_styles);
finish(&styles).into()
}