Commit graph

190 commits

Author SHA1 Message Date
Oriol Brufau
90a2687545 style: Add a CSS error to the console when using non-featureless :host selectors
(which would never match by definition).

Differential Revision: https://phabricator.services.mozilla.com/D111610
2023-05-17 02:12:40 +02:00
Oriol Brufau
b5dcb5c961 Further changes required by Servo 2023-05-17 02:12:21 +02:00
Oriol Brufau
e23a8bf0ad style: Add attribute names to the bloom filter
Safari does this. This reduces the runtime in the example linked from
comment 0 quite a lot (40ms on a local opt build, from ~130ms on a
release nightly build).

I added a pref because there's a slight chance of performance
regressions on pages that do not use attribute selectors, as we're now
doing more unconditional work per element (adding the attributes to the
bloom filter). But the trade-off should be worth it, I think.

Differential Revision: https://phabricator.services.mozilla.com/D111689
2023-05-16 23:40:23 +02:00
sagudev
9c2cc05a8e Upgrade remaining components to edition 2018 2023-02-18 09:42:37 +01:00
Federico Mena Quintero
c78af6a32f selectors/*.rs - Put all the to_shmem attributes behind a "shmem" feature 2023-02-14 13:05:59 -06:00
Michael Howell
c9fa1e9fc1
Add docs that say, somewhere, what non_ts means 2021-10-08 16:35:32 -07:00
Emilio Cobos Álvarez
aa4d2b0b0d selectors: Cherry-pick some fixes that got lost. 2021-02-27 05:58:37 +01:00
Emilio Cobos Álvarez
31e8e418ea Miscellaneous build / tidy fixes. 2021-02-26 17:53:55 +01:00
Emilio Cobos Álvarez
484cf5771b style: Avoid some allocations in selector serialization.
The allocations in display_to_css_identifier show up in the profiles of
bug 1675628.

Differential Revision: https://phabricator.services.mozilla.com/D97856
2021-02-26 16:44:05 +01:00
Sylvestre Ledru
a95ce79554 style: Fix clippy warnings
Depends on D96634

Differential Revision: https://phabricator.services.mozilla.com/D96636
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
191d5226a3 style: Implement complex :not().
This fixes the failures in bug 1671573 and just works thanks to the
invalidation improvements I did for :is / :where.

Added a couple tests for invalidation which is the tricky bit. 001 is a
very straight-forward test, 002 is the :is test but with :is() replaced
by double-:not().

This also fixes default namespaces inside :is() / :where(), which are
supposed to get ignored, but aren't. Added tests for that and for the
pre-existing :not() behavior which Chrome doesn't quite get right.

Differential Revision: https://phabricator.services.mozilla.com/D94142
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
7e6d70f314 style: Allow :is() and :where() to have better error recovery.
Adjust is-where-parsing.html to work with both the new and old behavior,
and add a test for the new behavior.

Depends on D90049

Differential Revision: https://phabricator.services.mozilla.com/D90050
2021-02-26 16:44:05 +01:00
Mihai Alexandru Michis
b1dbbb2969 Backed out 2 changesets (bug 1664718) for causing wpt and bc failures.
CLOSED TREE

Backed out changeset 62e71d3b6b32 (bug 1664718)
Backed out changeset c8a8791a26ed (bug 1664718)
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
6728aad0c6 style: Fix selectors unit tests.
MANUAL PUSH: Fix BR bustage. CLOSED TREE
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
5980525139 style: Allow :is() and :where() to have better error recovery.
Adjust is-where-parsing.html to work with both the new and old behavior,
and add a test for the new behavior.

Depends on D90049

Differential Revision: https://phabricator.services.mozilla.com/D90050
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
89c2e39dd9 style: Minor cleanup: Use shorthand initialization in selectors.
Differential Revision: https://phabricator.services.mozilla.com/D90049
2021-02-26 16:44:05 +01:00
Masatoshi Kimura
639bada63a style: Replace :-moz-native-anonymous-no-specificity with :where(:-moz-native-anonymous).
Differential Revision: https://phabricator.services.mozilla.com/D88255
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
9ce200a924 style: Implement :-moz-any() as an alias of :is().
This is strictly better and more flexible, but can change specificity so
have a pref in case it causes trouble. I doubt it will though, the
specificity rules of :is() make more sense, and my gut feeling is that
:-moz-any is not very used on the wild.

Make it early-beta-or-earlier for now to minimize risk, once this is on
nightly for a bit we can enable it everywhere.

Differential Revision: https://phabricator.services.mozilla.com/D86696
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
762abbaf9f
style: Rustfmt recent changes. 2020-06-04 02:02:50 +02:00
Emilio Cobos Álvarez
4cf9aeeaf7 style: Manually tweak inlining in stateless pseudo selector matching.
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
2020-06-04 01:50:36 +02:00
Emilio Cobos Álvarez
bd23e05c47 style: Fix a no-longer valid assumption in pseudo-element matching / invalidation code.
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
2020-06-04 01:50:36 +02:00
Emilio Cobos Álvarez
a40b2b610a style: Fix a case where we'd allow parsing functional :host incorrectly.
This is a missing check I should've introduced in bug 1632647.

Differential Revision: https://phabricator.services.mozilla.com/D76161
2020-06-04 01:50:36 +02:00
Emilio Cobos Álvarez
a457a2261b style: Fix parsing of :is() and :where() to account for constraints from parent selectors.
Differential Revision: https://phabricator.services.mozilla.com/D75856
2020-06-04 01:50:36 +02:00
Emilio Cobos Álvarez
21d48e00cc style: Collect ancestor hashes from single-length :is and :where selector lists.
We can only collect hashes from single-length selectors, as described in
the comment.

Differential Revision: https://phabricator.services.mozilla.com/D71458
2020-06-04 01:50:36 +02:00
Emilio Cobos Álvarez
83ea321096 style: Implement parsing / selector-matching for :is() and :where().
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
2020-04-18 03:48:15 +02:00
Emilio Cobos Álvarez
f76acc84c6 style: Reformat recent changes. 2020-04-16 17:50:17 +02:00
Emilio Cobos Álvarez
0514059618 style: Don't append the default namespace for featureless host selectors.
Per the spec it shouldn't match, and the front-end has been bitten by this
multiple times.

Differential Revision: https://phabricator.services.mozilla.com/D68213
2020-04-16 16:35:07 +02:00
Cameron McCormack
6973317a58 style: Correctly style dark scrollbars in tree components.
We need to ensure the rules that override all properties for scrollbar
part elements only apply to those that are NAC (and so will be eligible
for NAC style sharing).  We have some uses of non-NAC <scrollbar>
elements that should continue to inherit properties from their parents.

To avoid any changes in rule matching order that come with changing specificity,
we add a new :-moz-native-anonymous-no-specificity pseudo-class.

While we're here, we note :-moz-native-anonymous-no-specificity (and the
regular :-moz-native-anonymous pseudo-class) as not needing style
sharing cache revalidation, as we never share NAC styles.

Differential Revision: https://phabricator.services.mozilla.com/D56154
2019-12-16 14:23:56 +01:00
Emilio Cobos Álvarez
7965ddefa6 style: Support multiple parts in ::part() selectors.
Differential Revision: https://phabricator.services.mozilla.com/D48753
2019-11-04 13:36:32 +01:00
Emilio Cobos Álvarez
ed2e9ce482
Rustfmt and fix tidy on recent changes. 2019-06-25 13:11:31 +02:00
Emilio Cobos Álvarez
39de0a068e
style: Collect ::part() rules during CascadeData rebuilds.
Unlike for :host() or ::slotted(), or regular rules, we don't need a whole
SelectorMap<>, so gotta make the code a bit more generic.

Differential Revision: https://phabricator.services.mozilla.com/D32646
2019-06-25 13:11:28 +02:00
Emilio Cobos Álvarez
fac050325c
style: Add an extra flag to flag ::part() to selectors.
This grows the selector struct, but only in 32-bit, since in 64-bit we take
space from the alignment padding that we're paying due to having the size of the
slice as a word.

Differential Revision: https://phabricator.services.mozilla.com/D32645
2019-06-25 13:11:28 +02:00
Emilio Cobos Álvarez
43444db8a8 style: Cleanup selector-matching for nested pseudo-elements, match ::slotted correctly when there's no selector before it, and add tests.
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
2019-05-29 16:14:26 +02:00
Emilio Cobos Álvarez
57874ae90a style: Rustfmt recent changes. 2019-05-07 12:56:02 +02:00
Emilio Cobos Álvarez
a23ad3be50 style: Add parsing support for ::part().
Disabled for now of course. This should be pretty uncontroversial I'd think.

Differential Revision: https://phabricator.services.mozilla.com/D28060
2019-05-07 12:55:44 +02:00
Emilio Cobos Álvarez
9f73576f6a style: Check iterator length in SelectorIter::is_featureless_host_selector.
I'm going to unconditionally generate the PseudoElement combinator, and this
causes issues since we'll put the raw `::pseudo` selectors in the host bucket,
which is obviously wrong.

Differential Revision: https://phabricator.services.mozilla.com/D27528
2019-05-07 12:55:43 +02:00
Emilio Cobos Álvarez
52026f602b style: Don't allow to parse XUL tree pseudo-elements with a single colon.
Now that they're not exposed to the web we can remove this special case.

Differential Revision: https://phabricator.services.mozilla.com/D28071
2019-05-07 12:55:27 +02:00
Emilio Cobos Álvarez
09d497db3d style: Refactor the selector parser to make implementing ::part() easier.
::slotted() is already weird in the sense that it supports a pseudo-element
afterwards (so ::slotted(*)::before is valid for example).

::part() is weirder because you are supposed to allow stuff like
::part(foo):hover, ::part(foo):hover::before, etc.

In order to avoid making the already-complex parse_compound_selector more
complex, shuffle stuff so that we pass the progress of our current compound
selector around, and is the parsing code for each selector which decides whether
it's ok to parse at the given point.

Differential Revision: https://phabricator.services.mozilla.com/D27158
2019-05-07 12:55:23 +02:00
Emilio Cobos Álvarez
8c004c0858 style: Reformat recent changes. 2019-04-12 12:20:14 +02:00
Cameron McCormack
40248ae5fd style: Add derived ToShmem implementations.
Differential Revision: https://phabricator.services.mozilla.com/D17197
2019-04-12 12:19:52 +02:00
Simon Sapin
4464354e2e Reformat 2019-02-26 08:18:33 +01:00
Simon Sapin
be69f9c3e6 Rustfmt has changed its default style :/ 2018-12-28 13:17:47 +01:00
Emilio Cobos Álvarez
273705d7fb style: Fix tidy issues. 2018-12-16 13:35:09 +01:00
Boris Zbarsky
3d78025e10 style: Fix serialization of explicitly case-sensitive attr selectors with a namespace.
Differential Revision: https://phabricator.services.mozilla.com/D14493
2018-12-16 13:35:07 +01:00
Boris Zbarsky
a519d9ecc3 style: Add support for 's' flag on attribute selectors.
We could keep using ParsedCaseSensitivity::CaseSensitive as a temporary stand-in
for "case-sensitive or maybe not depending on what HTML says" until we check the
attribute list, but it seems better to make that explicit.

Differential Revision: https://phabricator.services.mozilla.com/D14093
2018-12-16 13:35:05 +01:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
Simon Sapin
a15d33a10e cargo fix --edition 2018-11-10 17:47:28 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Pyfisch
cb07debcb6 Format remaining files 2018-11-06 22:30:31 +01:00
Emilio Cobos Álvarez
badb8f398a
style: Support ::before / ::after on ::slotted pseudos.
See https://github.com/w3c/csswg-drafts/issues/3150 for the issue that would
expand this to all pseudos.

Differential Revision: https://phabricator.services.mozilla.com/D9994
2018-11-05 12:29:30 +01:00