style: Fix slotted invalidation.

This is a partial revert of
ce1d8cd232

If you're in a shadow tree, you may not be slotted but you still need to look at
the slotted rules, since a <slot> could be a descendant of yours.

Just use the same invalidation map everywhere, and remove complexity.

This means that we can do some extra work while trying to gather invalidation
if there are slotted rules, but I don't think it's a problem.

The test is ported from https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/fast/css/invalidation/slotted.html?l=1&rcl=58d68fdf783d7edde1c82a642e037464861f2787

Curiously, Blink fails the test as written, presumably because they don't flush
styles from getComputedStyle correctly (in their test they do via
updateStyleAndReturnAffectedElementCount), due to <slot>s not being in the flat
tree in their implementation.

Bug: 1429846
Reviewed-by: heycam
MozReview-Commit-ID: 6b7BQ6bGMgd
This commit is contained in:
Emilio Cobos Álvarez 2018-01-11 17:39:47 +01:00
parent 4f09987611
commit 7bdeeaa702
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
4 changed files with 139 additions and 219 deletions

View file

@ -10,7 +10,7 @@ use invalidation::element::invalidator::{DescendantInvalidationLists, Invalidati
use invalidation::element::invalidator::{Invalidation, InvalidationProcessor};
use invalidation::element::state_and_attributes;
use selectors::matching::{MatchingContext, MatchingMode, QuirksMode, VisitedHandlingMode};
use stylist::StyleRuleCascadeData;
use stylist::CascadeData;
/// A struct holding the members necessary to invalidate document state
/// selectors.
@ -34,7 +34,7 @@ pub struct DocumentStateInvalidationProcessor<'a, E: TElement> {
// TODO(emilio): We might want to just run everything for every possible
// binding along with the document data, or just apply the XBL stuff to the
// bound subtrees.
rules: &'a StyleRuleCascadeData,
rules: &'a CascadeData,
matching_context: MatchingContext<'a, E::Impl>,
document_states_changed: DocumentState,
}
@ -43,7 +43,7 @@ impl<'a, E: TElement> DocumentStateInvalidationProcessor<'a, E> {
/// Creates a new DocumentStateInvalidationProcessor.
#[inline]
pub fn new(
rules: &'a StyleRuleCascadeData,
rules: &'a CascadeData,
document_states_changed: DocumentState,
quirks_mode: QuirksMode,
) -> Self {