Commit graph

89 commits

Author SHA1 Message Date
Cameron McCormack
d0d43707fb style: Support a restyle hint that indicates all descendants must be recascaded.
This also moves the result of deciding whether to recascade from the
RestyleData into the RestyleHint.
2017-05-30 09:14:23 +08:00
Emilio Cobos Álvarez
f569274cca
Bug 1357583: Add a bunch of logging, shortcuts, and look also at the rightmost selector while invalidating sheets. r=heycam
MozReview-Commit-ID: 2XGcOCTa7MV
2017-05-29 20:27:38 +02:00
J. Ryan Stinnett
582ce1f6e4 Restyle hints for visited
Extend restyle hints to check additional cases for visited.

If we are sensitive to visitedness and the visited state changed, we force a
restyle here.  Matching doesn't depend on the actual visited state at all, so we
can't look at matching results to decide what to do for this case.

This also updates the snapshot version of `match_non_ts_pseudo_class` to check
the relevant link instead of the element state, just like we do when matching
with regular Gecko elements.

There's also a separate case of a visited-dependent selector when other state or
attributes change.  For this, we need to cover both types of matching we use
when cascading values.  If there is a relevant link, then we also matched in
visited mode.  Match again in this mode to ensure this also matches.  Note that
we never actually match directly against the element's true visited state at
all, since that would expose us to timing attacks.  The matching process only
considers the relevant link state and visited handling mode when deciding if
visited matches.

MozReview-Commit-ID: CVGquetQ2VW
2017-05-24 18:08:02 -05:00
J. Ryan Stinnett
e3a256803d Look for relevant links while matching
Adjust the matching process to look for a "relevant link" while matching.  A
"relevant link" is the element being matched if it is a link or the nearest
ancestor link.

Matching for links now depends on the `VisitedHandlingMode`, which determines
whether all links match as if they are unvisited (the default) or if the
relevant link matches as visited (and all others remain unvisited).

If a relevant link is ever found for any selector, track this as part of the
`MatchingContext` object.  This is used in the next patch to determine if an
additional match and cascade should be performed to compute the styles when
visited.

MozReview-Commit-ID: 3xUbRo7vpuD
2017-05-24 18:07:24 -05:00
Emilio Cobos Álvarez
e51ca0958e
style: Add a SelectorMapEntry trait. 2017-05-23 14:48:06 +02:00
Emilio Cobos Álvarez
a67e880256
style: Move SelectorMap to its own submodule. 2017-05-23 14:48:04 +02:00
Emilio Cobos Álvarez
5749886336
style: Remove dead code in restyle_hints module. 2017-05-23 14:47:16 +02:00
Emilio Cobos Álvarez
a12996f030
style: Make a bloom filter arrive to restyle hint computation. 2017-05-21 00:12:16 +02:00
Cameron McCormack
b46e196fa9
style: Generate RestyleHints to selector match at specific descendant depths. 2017-05-20 16:28:12 +02:00
Cameron McCormack
178939d8ce
style: Record in RestyleHints how far down the tree selector matching must be re-run. 2017-05-20 16:28:11 +02:00
Cameron McCormack
a397590838
style: Refactor RestyleHint to be a struct.
Later PRs will add additional data to it that is not so easy to
represent using bitflags.
2017-05-20 16:28:09 +02:00
Simon Sapin
c5e37f3d2c Remove unused selectors::Element::each_class 2017-05-18 17:13:14 +02:00
Simon Sapin
9376abdd2c Shrink selectors::Component, add case-insensitive for other attr selectors
* https://bugzilla.mozilla.org/show_bug.cgi?id=1364148
* https://bugzilla.mozilla.org/show_bug.cgi?id=1364162
2017-05-18 17:13:14 +02:00
Simon Sapin
83c7824fda Simplify rust-selectors API for attribute selectors 2017-05-18 17:13:13 +02:00
Emilio Cobos Álvarez
522f8489d6
Bug 1364850: Move PseudoElement to be just another combinator in selectors. r=bholley
MozReview-Commit-ID: 8OoOIodkKJ5
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-05-17 10:58:24 +02:00
J. Ryan Stinnett
e385b81fc3 Create a MatchingContext to group related matching args
MozReview-Commit-ID: 7XZTn7HDXrm
2017-05-16 09:19:28 -05:00
Emilio Cobos Álvarez
0bc185f1c2
Bug 1364412: Properly handle state restyle hints for pseudo-elements. r=bholley 2017-05-16 02:49:39 +02:00
Boris Zbarsky
cd29916c99 Fix dynamic updates when :dir matching changes in stylo.
This is the servo part of https://bugzilla.mozilla.org/show_bug.cgi?id=1364280
2017-05-15 12:31:49 -04:00
Boris Zbarsky
51cf50f20b Fix the situation when :any-link starts or stops matching to actually restyle correctly. 2017-05-12 13:22:41 -04:00
Emilio Cobos Álvarez
c732b0c600
Bug 1355343: Cache snapshot lookups. r=bholley
This is likely to be important at least for the initial element.

For the rest of them this is likely useless because we create them in a
throwaway fashion.

MozReview-Commit-ID: EFz9WUdB8S0
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-05-10 12:05:40 +02:00
Emilio Cobos Álvarez
46bf5d61f0
Bug 1355343: Take all the snapshots into account. r=bholley
I've chosen this approach mainly because there's no other good way to guarantee
the model is correct than holding the snapshots alive until a style refresh.

What I tried before this (storing them in a sort of "immutable element data") is
a pain, since we call into style from the frame constructor and other content
notifications, which makes keeping track of which snapshots should be cleared an
which shouldn't an insane task.

Ideally we'd have a single entry-point for style, but that's not the case right
now, and changing that requires pretty non-trivial changes to the frame
constructor.

MozReview-Commit-ID: FF1KWZv2iBM
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-05-10 12:05:39 +02:00
Bobby Holley
ac40cc629b Use a rulehash for DependencySet.
MozReview-Commit-ID: GXu6O4kiBE6
2017-05-05 13:50:40 -07:00
Josh Matthews
f3f9e28e88 Make unit tests pass on TravisCI. 2017-05-03 10:32:27 -04:00
Bobby Holley
a6ef89a7fe Make note_selector more efficient.
My measurements are inconclusive as to whether this really moves the
needle, but it seems like the right way to do it in any case.

MozReview-Commit-ID: 7OuCc2aQ7jH
2017-04-29 16:07:44 -07:00
Bobby Holley
b4a2e2f17c Clean up note_selector a bit and stop handling combinators in two places.
MozReview-Commit-ID: HhVi72K4yp0
2017-04-29 16:07:43 -07:00
Bobby Holley
2df9dc2b03 Use a different visitor pass for gathering revalidation selectors.
This allows us to ignore everything to the left of the rightmost simple selector.

MozReview-Commit-ID: 6I4VzKos22n
2017-04-27 11:12:39 -07:00
Bobby Holley
dd4575c23a Separate revalidation checking from attribute sensitivity checking.
The current code is busted because:
* It unconditionally flags for revalidation if the sensitivities are not yet
  sensitive to attributes.
* It uses is_attr_selector, despite the fact that ID and Class are both handled
  by the style sharing cache and should not trigger revalidation.

MozReview-Commit-ID: C7d8QrdKcFm
2017-04-27 11:12:32 -07:00
Emilio Cobos Álvarez
be0139ff3c
Bug 1331047: Implement the new traversal semantics for stylo. r=bholley,hiro
MozReview-Commit-ID: 4BXx9JpGZKX
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-04-27 14:26:48 +02:00
Brian Birtles
af9c7fc257 Add restyle hint for SMIL animations 2017-04-27 13:20:37 +09:00
Bobby Holley
cebacc7faa Rename SimpleSelector to Component.
MozReview-Commit-ID: JfaZpHSkG8h
2017-04-20 15:04:48 -07:00
Bobby Holley
6d66ec5e11 Store selectors and combinators inline in a single sequence.
This improves cache locality and reduces allocations during parsing.

Note that this reverses the iteration order within a sequence of simple selectors,
but that shouldn't matter.
2017-04-20 15:00:43 -07:00
Bobby Holley
9524c5cb57 Introduce SelectorInner and use it for top-level matching.
MozReview-Commit-ID: DxG6USsPIkh
2017-04-18 20:07:53 -07:00
Boris Chiou
1c1e487491 Bug 1341372 - Part 1: Let animation-only restyle include css-transition.
Animation-only restyle should include both Animation and Transition
cascade levels.

MozReview-Commit-ID: 5l6gaJKbixM
2017-04-17 17:06:12 +08:00
Emilio Cobos Álvarez
fcce61ee10
stylo: Fix restyle hints check.
It's clearly wrong to use intersects() there, since the coming check may be a
bigger hint.

MozReview-Commit-ID: 1YZ8OD0ajSz
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-04-13 09:37:02 +08:00
Emilio Cobos Álvarez
a0c2bdf775
style: Smoke-test the dependency tracking logic.
MozReview-Commit-ID: J5HWdS1H49s
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-04-13 09:37:01 +08:00
Emilio Cobos Álvarez
9e33cd5643
style: Simplify dependency visitor, avoid tracking dependencies of nested complex selectors separately. 2017-04-13 01:01:00 +08:00
Emilio Cobos Álvarez
568fa4cc0d
style: Fix dynamic changes of attributes when combined with :not. 2017-04-13 01:00:59 +08:00
Bobby Holley
d51d95d0c7 Merge style_affecting_attributes_selectors with selectors_for_cache_revalidation. 2017-04-12 09:32:14 +08:00
Bobby Holley
6515f78f6d Check for empty when determining what selectors to use for revalidation. 2017-04-12 09:32:06 +08:00
Emilio Cobos Álvarez
0ea58d1ffa
style: Stop special-casing a few attributes for style sharing, and use a visitor to track dependencies.
Also, simplify all the pre-snapshot attribute hacks in the script and style
code.

MozReview-Commit-ID: 6c9ipeb7Tnr
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-04-09 18:15:50 +08:00
Hiroyuki Ikezoe
7c4f4d5be9 Introduce eRestyle_CSSAnimations.
RESTYLE_CSS_ANIMATIONS will be individually processed prior to other restyle
hints in a traversal.
2017-03-27 06:19:51 +09:00
Boris Chiou
a03bde357c Bug 1349834 - Update RESTYLE_STYLE_ATTRIBUTE to sync Gecko change. 2017-03-24 22:36:09 +08:00
Emilio Cobos Álvarez
ab2956a815
Bug 1349553: Account for negations of state-dependent selectors.
MozReview-Commit-ID: VyHuxh9q5N
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-03-23 09:51:24 +01:00
Emilio Cobos Álvarez
a9b133bcbb
Bug 1345950: stylo: Fix slow selector flags. r=bholley
MozReview-Commit-ID: QwuSxulNG0
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-03-22 11:21:24 +01:00
Matt Brubeck
2872c8bfab Bug 1340683 - stylo: Implement the :-moz-any pseudo-class 2017-03-16 11:44:47 -07:00
Cameron McCormack
c0996c6536 stylo: Align eRestyle_Subtree value with RESTYLE_DESCENDANTS.
Handle the translation of eRestyle_Subtree into
(RESTYLE_SELF | RESTYLE_DESCENDANTS) in the From impl, too.
2017-03-11 09:33:55 +08:00
Bobby Holley
ae87b8a910 Switch from error! and println! to warn!, and set the default log level to warn on debug builds. 2017-02-14 17:19:01 -08:00
Cameron McCormack
229eb93fa3 Do RestyleHint assertions at runtime so they use build-time bindgen. 2017-02-14 10:38:59 +08:00
Cameron McCormack
bc1d7c2fdd Align RESTYLE_STYLE_ATTRIBUTE value with eRestyle_StyleAttribute. 2017-02-13 13:22:43 +08:00
Bobby Holley
9e860df9df Bug 1336646 - Apply selector flags during traversal. r=emilio 2017-02-08 19:21:05 -08:00