aboutsummaryrefslogtreecommitdiffstats
path: root/components/selectors/parser.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* style: Manually tweak inlining in stateless pseudo selector matching.Emilio Cobos Álvarez2020-06-041-1/+28
| | | | | | | | | 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
* style: Fix a no-longer valid assumption in pseudo-element matching / ↵Emilio Cobos Álvarez2020-06-041-0/+41
| | | | | | | | | | | 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
* style: Fix a case where we'd allow parsing functional :host incorrectly.Emilio Cobos Álvarez2020-06-041-1/+6
| | | | | | This is a missing check I should've introduced in bug 1632647. Differential Revision: https://phabricator.services.mozilla.com/D76161
* style: Fix parsing of :is() and :where() to account for constraints from ↵Emilio Cobos Álvarez2020-06-041-74/+99
| | | | | | parent selectors. Differential Revision: https://phabricator.services.mozilla.com/D75856
* style: Collect ancestor hashes from single-length :is and :where selector lists.Emilio Cobos Álvarez2020-06-041-56/+65
| | | | | | | We can only collect hashes from single-length selectors, as described in the comment. Differential Revision: https://phabricator.services.mozilla.com/D71458
* style: Implement parsing / selector-matching for :is() and :where().Emilio Cobos Álvarez2020-04-181-144/+219
| | | | | | | | | | | | | | 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
* style: Reformat recent changes.Emilio Cobos Álvarez2020-04-161-1/+4
|
* style: Don't append the default namespace for featureless host selectors.Emilio Cobos Álvarez2020-04-161-10/+28
| | | | | | | 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
* style: Correctly style dark scrollbars in tree components.Cameron McCormack2019-12-161-0/+8
| | | | | | | | | | | | | | | | 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
* style: Support multiple parts in ::part() selectors.Emilio Cobos Álvarez2019-11-041-12/+21
| | | | Differential Revision: https://phabricator.services.mozilla.com/D48753
* Rustfmt and fix tidy on recent changes.Emilio Cobos Álvarez2019-06-251-5/+6
|
* style: Collect ::part() rules during CascadeData rebuilds.Emilio Cobos Álvarez2019-06-251-0/+25
| | | | | | | 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
* style: Add an extra flag to flag ::part() to selectors.Emilio Cobos Álvarez2019-06-251-14/+56
| | | | | | | | 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
* style: Cleanup selector-matching for nested pseudo-elements, match ::slotted ↵Emilio Cobos Álvarez2019-05-291-7/+11
| | | | | | | | | | | 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
* style: Rustfmt recent changes.Emilio Cobos Álvarez2019-05-071-25/+38
|
* style: Add parsing support for ::part().Emilio Cobos Álvarez2019-05-071-16/+79
| | | | | | Disabled for now of course. This should be pretty uncontroversial I'd think. Differential Revision: https://phabricator.services.mozilla.com/D28060
* style: Check iterator length in SelectorIter::is_featureless_host_selector.Emilio Cobos Álvarez2019-05-071-1/+2
| | | | | | | | 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
* style: Don't allow to parse XUL tree pseudo-elements with a single colon.Emilio Cobos Álvarez2019-05-071-8/+2
| | | | | | Now that they're not exposed to the web we can remove this special case. Differential Revision: https://phabricator.services.mozilla.com/D28071
* style: Refactor the selector parser to make implementing ::part() easier.Emilio Cobos Álvarez2019-05-071-174/+175
| | | | | | | | | | | | | | | ::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
* style: Reformat recent changes.Emilio Cobos Álvarez2019-04-121-3/+10
|
* style: Add derived ToShmem implementations.Cameron McCormack2019-04-121-13/+20
| | | | Differential Revision: https://phabricator.services.mozilla.com/D17197
* ReformatSimon Sapin2019-02-261-2/+3
|
* Rustfmt has changed its default style :/Simon Sapin2018-12-281-13/+12
|
* style: Fix tidy issues.Emilio Cobos Álvarez2018-12-161-14/+9
|
* style: Fix serialization of explicitly case-sensitive attr selectors with a ↵Boris Zbarsky2018-12-161-1/+1
| | | | | | namespace. Differential Revision: https://phabricator.services.mozilla.com/D14493
* style: Add support for 's' flag on attribute selectors.Boris Zbarsky2018-12-161-23/+63
| | | | | | | | 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
* Update MPL license to https (part 4)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* `cargo fix --edition`Simon Sapin2018-11-101-11/+11
|
* Reorder importsPyfisch2018-11-061-2/+2
|
* Format remaining filesPyfisch2018-11-061-70/+75
|
* style: Support ::before / ::after on ::slotted pseudos.Emilio Cobos Álvarez2018-11-051-57/+103
| | | | | | | 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
* style: Implement @supports selector() syntax.Emilio Cobos Álvarez2018-10-191-8/+9
| | | | | | | | | | | | | This implements the selector(<complex-selector>) syntax for @supports. See https://github.com/w3c/csswg-drafts/issues/3207 for explainer and discussion. Probably would should wait for that to be sorted out to land this, or maybe we should put it behind a pref to get the code landed and change our implementation if the discussion there leads to a change. Differential Revision: https://phabricator.services.mozilla.com/D8864
* format components/selectorsAnshul Malik2018-09-121-383/+321
|
* style: Shrink selectors::Component to 24 bytes.Cameron McCormack2018-08-081-32/+44
| | | | | | | This saves about 37 KiB of memory across the UA style sheets. Bug: 1475197 Reviewed-by: emilio
* style: Simplify selector serialization.Emilio Cobos Álvarez2018-07-011-7/+7
| | | | | | Bug: 1471063 Reviewed-by: xidorn MozReview-Commit-ID: 959U7yd5W9j
* style: Deindent the serialization loop.Emilio Cobos Álvarez2018-07-011-61/+62
| | | | | | Bug: 1471063 Reviewed-by: xidorn MozReview-Commit-ID: GPlUAx7YXVb
* style: Add diagnostics.Emilio Cobos Álvarez2018-06-121-1/+1
| | | | | | Bug: 1416282 Reviewed-by: xidorn MozReview-Commit-ID: GTnFyZnXR84
* style: Make pseudo-elements work with :host.Emilio Cobos Álvarez2018-06-121-3/+19
| | | | | | | | Imported WebKit's test as a WPT. Bug: 1465291 Reviewed-by: xidorn MozReview-Commit-ID: 19ZThuoqKLW
* Run rustfmt on selectors, servo_arc, and style.Bobby Holley2018-04-101-570/+858
| | | | | | | | | | This was generated with: ./mach cargo fmt --package selectors && ./mach cargo fmt --package servo_arc && ./mach cargo fmt --package style Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
* Manual fixups so that the rustfmt output won't trigger tidy.Bobby Holley2018-04-101-34/+39
|
* style: Implement the functional :host(..) selector.Emilio Cobos Álvarez2018-04-101-12/+32
| | | | | | | | | 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
* style: Implement the non-functional :host selector.Emilio Cobos Álvarez2018-04-091-10/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* selectors: Don't serialize :nth-child(-n) as -1n.Emilio Cobos Álvarez2018-04-071-0/+1
|
* Remove useless AsciiExt imports.Emilio Cobos Álvarez2018-03-271-1/+0
| | | | These warn with the next Nightly.
* style: Add infrastructure to match :host.Emilio Cobos Álvarez2018-03-141-11/+27
|
* style: Tidy a couple things.Emilio Cobos Álvarez2018-03-141-1/+4
|
* selectors: Simplify SelectorIter::next.Emilio Cobos Álvarez2018-01-181-4/+3
|
* Move Visit trait bounds to where they’re neededSimon Sapin2018-01-121-3/+3
|
* Document selectors::VisitSimon Sapin2018-01-121-9/+1
|
* Rename SelectorMethods to Visit, after its one method.Simon Sapin2018-01-121-5/+5
|