This addresses a minor regression in bloom-matching.html. The common
case here is that there's no selector to the right of the
pseudo-element, so keep that path inline, while keeping all other checks
out of line.
Differential Revision: https://phabricator.services.mozilla.com/D76793
After bug 1632647, we can have pseudo-classes inside :not / :is /
:where, which the invalidation and matching code weren't handling.
Add a few tests for this stuff working as expected.
Differential Revision: https://phabricator.services.mozilla.com/D76160
This implements the easy / straight-forward parts of the :where / :is
selectors.
The biggest missing piece is to handle properly invalidation when there
are combinators present inside the :where. That's the hard part of this,
actually.
But this is probably worth landing in the interim. This fixes some of
the visitors that were easy to fix.
Differential Revision: https://phabricator.services.mozilla.com/D70788
Some of the stuff, in particular inside GeckoBindings stuff should be
refactored to be less ugly and duplicate a bit less code, but the rest of the
code should be landable as is.
Some invalidation changes are already needed because we weren't matching with
the right shadow host during invalidation (which made existing ::part() tests
fail).
Pending invalidation work:
* Making exportparts work right on the snapshots.
* Invalidating parts from descendant hosts.
They're not very hard but I need to think how to best implement it:
* Maybe get rid of ShadowRoot::mParts and just walk DOM descendants in the
Shadow DOM.
* Maybe implement a ElementHasExportPartsAttr much like HasPartAttr and use
that to keep the list of elements.
* Maybe invalidate :host and ::part() together in here[1]
* Maybe something else.
Opinions?
[1]: https://searchfox.org/mozilla-central/rev/131338e5017bc0283d86fb73844407b9a2155c98/servo/components/style/invalidation/element/invalidator.rs#561
Differential Revision: https://phabricator.services.mozilla.com/D53730
--HG--
extra : moz-landing-system : lando
D29542 fixed the bogus checks that was making nested pseudo-elements match
author rules. This adds tests and ends up being just a cleanup, though as it
turns out we it also fixes an issue with ::slotted() matched from
Element.matches.
Differential Revision: https://phabricator.services.mozilla.com/D27529
--HG--
extra : moz-landing-system : lando
Disabled for now of course. This should be pretty uncontroversial I'd think.
Differential Revision: https://phabricator.services.mozilla.com/D28060
--HG--
extra : moz-landing-system : lando
We always include the combinator for pseudo-elements now (not including it was
just an optimization) in order to not match when nested pseudo-elements are
involved.
We could add a more generic check in `matches_simple_selector` like:
```
if element.is_pseudo_element() {
match *selector {
Component::PseudoElement(..) |
Component::NonTSPseudoClass(..) => {},
_ => return false,
}
}
```
But even that wouldn't be enough to make selectors like `:hover::marker` not
match on the `::before::marker` pseudo-element, plus that code is really hot.
So for now do the check on the `next_element_for_combinator` function. It's a
bit hacky but it's the best I could came up with...
While at it, simplify some checks to use is_pseudo_element() instead of
implemented_pseudo_element() directly.
Only the Rust patch as-is would make markers for ::before and ::after on list
items not show up, so we also need to switch ::marker to use ProbeMarkerStyle()
rather than ProbePseudoElementStyle(), since the marker should exist even if it
matches no rules.
Differential Revision: https://phabricator.services.mozilla.com/D27529
--HG--
extra : moz-landing-system : lando
This saves about 37 KiB of memory across the UA style sheets.
MozReview-Commit-ID: EoZnlmyWwxX
--HG--
extra : rebase_source : cd8ef0ba838618f9a4583b7d9896caa3a0602199
This saves about 37 KiB of memory across the UA style sheets.
MozReview-Commit-ID: EoZnlmyWwxX
--HG--
extra : rebase_source : 471fc63e521a4332bb92b4a73cd31a4bbe0b2dfe
Summary:
This fixes a couple fuzz bugs and prevents special-casing <svg:use> even more in
bug 1431255.
Unfortunately not as many hacks went away as I'd have hoped, since we still need
to match document rules, see the linked SVGWG issues.
But blocks_ancestor_combinators goes away, which is nice since it's on a very
hot path.
Test Plan: WPT for style invalidation, covered by existing tests otherwise.
Reviewers: heycam
Tags: #secure-revision
Bug #: 1450250
Differential Revision: https://phabricator.services.mozilla.com/D2154
MozReview-Commit-ID: C4mthjoSNFh
Now that rustfmt is getting close to stable, and work on the style system has died down a bit, it seemed like an opportune time to auto-format the style crates.
The first commit disables import reordering, since tidy and rustfmt don't currently agree on the correct ordering. The second commit does a bunch of manual fixups such that the output of rustfmt passes tidy. The third commit runs rustfmt on the three aforementioned crate.
There are a few dozen warnings in the style crate about lines longer than 100 characters. It would be good to fix these, but I don't have time for that now.
Source-Repo: https://github.com/servo/servo
Source-Revision: 9a900ef019cd643bff961d7b20db6da69f3edb29
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 2b228d52a084bc832444ac686290840c4369f98d
We could invalidate in a slightly more fine-grained way, but I don't think it's
worth the churn vs. keeping the special-cases minimal.
Bug: 1452640
Reviewed-by: xidorn
MozReview-Commit-ID: 5DkQrgwg9GW
Source-Repo: https://github.com/servo/servo
Source-Revision: e11c2d97552d192b761b0684c8c6852b9dea0921
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 00941db97d18fcbea845f225d318eae4d47aab22
Kinda tricky because :host only matches rules on the shadow root where the rules
come from. So we need to be careful during invalidation and style sharing.
I didn't use the non_ts_pseudo_class_list bits because as soon as we implement
the :host(..) bits we're going to need to special-case it anyway.
The general schema is the following:
* Rightmost featureless :host selectors are handled inserting them in the
host_rules hashmap. Note that we only insert featureless stuff there. We
could insert all of them and just filter during matching, but that's slightly
annoying.
* The other selectors, like non-featureless :host or what not, are added to the
normal cascade data. This is harmless, since the shadow host rules are never
matched against the host, so we know they'll just never match, and avoids
adding more special-cases.
* Featureless :host selectors to the left of a combinator are handled during
matching, in the special-case of next_element_for_combinator in selectors.
This prevents this from being more invasive, and keeps the usual fast path
slim, but it's a bit hard to match the spec and the implementation.
We could keep a copy of the SelectorIter instead in the matching context to
make the handling of featureless-ness explicit in match_non_ts_pseudo_class,
but we'd still need the special-case anyway, so I'm not fond of it.
* We take advantage of one thing that makes this sound. As you may have
noticed, if you had `root` element which is a ShadowRoot, and you matched
something like `div:host` against it, using a MatchingContext with
current_host == root, we'd incorrectly report a match. But this is impossible
due to the following constraints:
* Shadow root rules aren't matched against the host during styling (except
these featureless selectors).
* DOM APIs' current_host needs to be the _containing_ host, not the element
itself if you're a Shadow host.
Bug: 992245
Reviewed-by: xidorn
MozReview-Commit-ID: KayYNfTXb5h
Source-Repo: https://github.com/servo/servo
Source-Revision: cb754b262747e7cab794411df55588f0f0b30b5e
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 2ebbb2578ff9dbadfe905ae501cd52bd61a9fe9a
This changes the order to match the normal selector-matching order, which is
usually faster.
That is, when matching div:nth-child(2), for example, before this patch we'd
first try to match :nth-child(2), and only then div.
This patch makes us walk until the end or the next combinator, and only then
match backwards, matching first div, then :nth-child.
Bug: 1443814
Reviewed-by: bholley
Source-Repo: https://github.com/servo/servo
Source-Revision: 8e52f8a523e2f12b2666536d0f8ff3fa40b83ef5
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 4b8b140e54485fb2762745f13af285c640d39254
This fixes the test from https://github.com/w3c/web-platform-tests/pull/9212 in
Gecko.
Source-Repo: https://github.com/servo/servo
Source-Revision: 82922c97dc0313736fedb8021b205d4f84088a15
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : ec1b0b5dcf36a50fe9b1cd5b087efb5f665cc79e
See each commit individually.
Source-Repo: https://github.com/servo/servo
Source-Revision: 6fc71a7644bd7afcccf83f67cfdaf01897e1a3bc
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 61fb59e354c7ad8307d6f76b93bd365abc575c85
This fixes bugs where we're not passing the value around correctly, like from
::-moz-any.
This is a fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1431539.
Source-Repo: https://github.com/servo/servo
Source-Revision: 0d7d02fca772a407d4ffa1ebd1e03d60f385eb74
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : c3d27604818f36b68c16d53ef143b4ef892c006e
This is the "better way" I mentioned in #19774, which seems to actually improve the score of dromaeo_css on talos.
Source-Repo: https://github.com/servo/servo
Source-Revision: 525758ea5ef67148c28acae9404916691e9a960c
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 0d5d151d5cadca6bf2feed3e0fe463a1b02e753d
Without turning it on yet, of course.
The reason why I didn't use the general PseudoElement mechanism is because this
pseudo is a bit of its own thing, and I found easier to make ::selectors know
about it (because you need to jump to the assigned slot) than the other way
around.
Also, we need to support ::slotted(..)::before and such, and supporting multiple
pseudo-elements like that breaks some other invariants around the SelectorMap,
and fixing those would require special-casing slotted a lot more in other parts
of the code.
Let me know if you think otherwise.
I also don't like much the boolean tuple return value, but I plan to do some
cleanup in the area in a bit, so it should go away soon, I'd hope.
Source-Repo: https://github.com/servo/servo
Source-Revision: f5129ef7b5efa59a176cac98dc68d910cb3279c9
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 5f956f568b12d8aa7611bc05ac7b1d1497689189
Right now we go through a lot of hoops to see if we ever see a relevant link.
However, that information is not needed: if the element is a link, we'll always
need to compute its visited style because its its own relevant link.
If the element inherits from a link, we need to also compute the visited style
anyway.
So the "has a relevant link been found" is pretty useless when we know what are
we inheriting from.
The branches at the beginning of matches_complex_selector_internal were
affecting performance, and there are no good reasons to keep them.
I've verified that this passes all the visited tests in mozilla central, and
that the test-cases too-flaky to be landed still pass.
Source-Repo: https://github.com/servo/servo
Source-Revision: 7a8733723551201d2c06acde9b0915b4c03938b4
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 00a655d0bcdf9cec70330c34eea0756b73c38cc3
These methods are instantiated by the Gecko library, and used during
querySelector, which means that they end up being super-hot in micro-benchmarks.
MozReview-Commit-ID: K1XJb0QyX5a
Source-Repo: https://github.com/servo/servo
Source-Revision: 85fa6409bb699647b4f5e22952538365e87418d7
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 156224040ad2191714b888e91c9b555e7efc9bb6
See #18809
Still haven't had time to test it but it should fix the tests failures that appeared in m-c
Source-Repo: https://github.com/servo/servo
Source-Revision: fe4139b779b3af749ec1426ddf4e1393c7b85442
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 9a0549d7dd8a99315ba3f8eec5d0f9fdf9eb4c0f