aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/servo/selector_parser.rs
Commit message (Collapse)AuthorAgeFilesLines
* Move Stylo to its own repo (#31350)Delan Azabani2024-02-271-837/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove packages that were moved to external repo * Add workspace dependencies pointing to 2023-06-14 branch * Fix servo-tidy.toml errors * Update commit to include #31346 * Update commit to include servo/stylo#2 * Move css-properties.json lookup to target/doc/stylo * Remove dependency on vendored mako in favour of pypi dependency This also removes etc/ci/generate_workflow.py, which has been unused since at least 9e71bd6a7010d6e5723831696ae0ebe26b47682f. * Add temporary code to debug Windows test failures * Fix failures on Windows due to custom target dir * Update commit to include servo/stylo#3 * Fix license in tests/unit/style/build.rs * Document how to build with local Stylo in Cargo.toml
* Add support for table fixups (#30868)Martin Robinson2023-12-221-10/+10
| | | | | | | | | | | | | | | | This adds support for fixing up tables so that internal table elements that are not properly parented in the DOM have the correct box tree structure according to the CSS Table specification [1]. Note that this only comes into play when building the DOM via script, as HTML 5 has its own table fixups that mean that the box tree construction fixups here are not necessary. There are no tests for this change. In general, it's hard to write tests against the shape of the box tree, because it depends on the DOM. We plan to test this via WPT tests once layout is complete. 1. https://drafts.csswg.org/css-tables/#table-internal-element Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* style: Use write_char in place of write_str when serializing ↵Jonathan Kew2023-11-061-1/+1
| | | | | | | | | | | | single-character literals Generated by running find servo/components/style -name "*.rs" -exec perl -p -i -e "s/write_str\(\"(.)\"\)/write_char('\1')/g" {} \; (and then added `use std::fmt::Write;` in a couple of places to fix build errors that arose). Differential Revision: https://phabricator.services.mozilla.com/D168217
* Further changes required by ServoOriol Brufau2023-11-041-4/+3
|
* Further changes required by ServoOriol Brufau2023-11-041-0/+5
|
* Further changes required by ServoOriol Brufau2023-11-031-0/+5
|
* Further changes required by ServoOriol Brufau2023-11-031-1/+9
|
* Anonymous boxes that wrap inlines should not inherit overflow (#30579)Martin Robinson2023-10-191-51/+60
| | | | | | | | | | | | | | In legacy layout, anonymous text wrappers were inheriting the `overflow` and `text-overflow` properties. This results in the creation of extra clipping for these anonymous wrappers which could clip away floats. We will likely implement `text-overflow` differently in non-legacy layout. This change marks all legacy layout pseudo elements as "legacy" and also adds a new pseudo element for non-legacy layout that does not inherit `overflow`. Fixes #30562. Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Further changes required by ServoOriol Brufau2023-10-021-15/+15
|
* style: Unify Gecko and Servo EventState/ElementState bitsEmilio Cobos Álvarez2023-10-021-1/+1
| | | | | | | | | | | | | | | | Add a dom/base/rust crate called just "dom" where we can share these. Most of the changes are automatic: s/mozilla::EventStates/mozilla::dom::ElementState/ s/EventStates/ElementState/ s/NS_EVENT_STATE_/ElementState::/ s/NS_DOCUMENT_STATE_/DocumentState::/ And so on. This requires a new cbindgen version to avoid ugly casts for large shifts. Differential Revision: https://phabricator.services.mozilla.com/D148537
* Implement :valid :invalid pseudo classes (#26729)John Poge II2023-07-211-0/+8
| | | Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* style: Garbage-collect event state bitsOriol Brufau2023-05-191-1/+1
| | | | | | | We had about 9 gaps / unused bits. I moved the devtools ones at the end because I think we should be able to remove them (but separate bug). Differential Revision: https://phabricator.services.mozilla.com/D113365
* Miscellaneous build / tidy fixes.Emilio Cobos Álvarez2021-02-261-19/+16
|
* style: Replace :-moz-native-anonymous-no-specificity with ↵Masatoshi Kimura2021-02-261-5/+0
| | | | | | :where(:-moz-native-anonymous). Differential Revision: https://phabricator.services.mozilla.com/D88255
* style: implement -moz-inert CSS property.Alexander Surkov2021-02-261-0/+2
| | | | | | -moz-inert CSS property reflects inert subtrees concept and can be used to implement HTML:dialog element and HTML:inert attribute Differential Revision: https://phabricator.services.mozilla.com/D81701
* Reformat with rustfmt 1.4.36-nightly (7de6968 2021-02-07)Simon Sapin2021-02-251-1/+3
|
* Add animation and transition support for pseudo-elementsMartin Robinson2020-06-161-1/+1
| | | | | | | | | | This change extends the DocumentAnimationSet to hold animations for pseudo-elements. Since pseudo-elements in Servo are not in the DOM like in Gecko, they need to be handled a bit carefully in stylo. When a pseudo-element has an animation, recascade the style. Finally, this change passes the pseudo-element string properly to animation events. Fixes: #10316
* style: Miscellaneous servo build fixes.Emilio Cobos Álvarez2020-06-041-13/+16
|
* style: Finer grained invalidation for attribute changes.Emilio Cobos Álvarez2020-06-041-6/+0
| | | | | | | | | | | | | | | | | | | | | | | This should help out quite a bit with uBO, which has lots of very general attribute selectors. We invalidate per attribute name rather than using a SelectorMap, which prevents matching for attribute selectors that can't have changed. The idea is that this should be generally cheaper, though there are cases where this would be a slight pesimization. For example, if there's an attribute selector like: my-specific-element[my-attribute] { /* ... */ } And you change `my-attribute` in an element that isn't a `my-specific-element`, before that the SelectorMap would've prevented us from selector-matching completely. Now we'd still run selector-matching for that (though the matching would be pretty cheap). However I think this should speed up things generally, let's see what the perf tests think before landing this though. Differential Revision: https://phabricator.services.mozilla.com/D76825
* style: Run rustfmt.Emilio Cobos Álvarez2020-04-181-1/+0
|
* style: Implement parsing / selector-matching for :is() and :where().Emilio Cobos Álvarez2020-04-181-12/+9
| | | | | | | | | | | | | | 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: Allow to export a shadow part under multiple names.Emilio Cobos Álvarez2020-04-161-4/+0
| | | | | | | Other browsers allow this and the spec doesn't really disallow it, so fix it, add a test and carry on. Differential Revision: https://phabricator.services.mozilla.com/D65107
* :defined worksPatrick Shaughnessy2020-01-301-0/+4
|
* style: Correctly style dark scrollbars in tree components.Cameron McCormack2019-12-161-0/+5
| | | | | | | | | | | | | | | | 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: Fix servo build.Emilio Cobos Álvarez2019-11-301-0/+8
|
* style: Fix cascade order of shadow parts.Emilio Cobos Álvarez2019-11-301-0/+6
| | | | | | | This moves the shadow cascade order into the cascade level, and refactors the code a bit for that. Differential Revision: https://phabricator.services.mozilla.com/D49988
* Update rand to 0.7 (fixes #24448)Anthony Ramine2019-10-231-2/+2
|
* style: Invalidate style for ::selection.violet2019-06-251-0/+6
| | | | | | | | | | | | This patch invalidates the style for `::selection`, which will restore the behavior before the regression. However, it's still not quite correct, because repaint is not triggered. Given that `::selection` requires some major change to implement https://github.com/w3c/csswg-drafts/issues/2474, we can address this problem later. Differential Revision: https://phabricator.services.mozilla.com/D35305
* style: Fix servo build.Emilio Cobos Álvarez2019-05-071-4/+13
|
* Remove :-servo-case-sensitive-type-attr()Ian Moody2019-04-181-26/+6
| | | | | | | | No longer needed now that the case-sensitive flag for attributes selectors is supported. Update user-agent CSS sheet to use the standard flag. Fixes #23227
* Make use of RefCell::try_borrow_unguardedAnthony Ramine2019-04-121-1/+0
|
* style: Fix servo build, and appease tidy / fmt.Emilio Cobos Álvarez2019-04-121-4/+2
|
* style: Fix Gecko and Servo builds, and appease tidy.Emilio Cobos Álvarez2019-03-271-0/+6
|
* Rustfmt has changed its default style :/Simon Sapin2018-12-281-1/+1
|
* Update MPL license to https (part 4)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* style: Manually extinguish multi-line use statements.Emilio Cobos Álvarez2018-11-101-3/+2
|
* `cargo fix --edition`Simon Sapin2018-11-101-10/+12
|
* Reorder importsPyfisch2018-11-061-3/+3
|
* style: Remove PseudoElement::inherits_all.Emilio Cobos Álvarez2018-10-191-5/+0
| | | | | | | | | I plan to change servo to use all: inherit on its UA sheet. I hope the patch below should make it good enough performance-wise. And also, it's probably broken so I don't think it's worth supporting it specially. Differential Revision: https://phabricator.services.mozilla.com/D8686
* style: Stop using PseudoElement::inherits_all.Emilio Cobos Álvarez2018-10-151-35/+3
| | | | | | | | | This was done that way just because Servo didn't support the `all` property at the time. We should do it this way and optimize it if it's slow. Though I suspect that most of stuff doesn't actually need to be inherited, my patch at bug 1498943 should make it much faster than what it would otherwise be.
* Format style component.chansuke2018-09-091-2/+5
|
* style: Fix servo build.Emilio Cobos Álvarez2018-09-031-0/+4
|
* style: Simplify the Lang pseudo-class stuff a bit.Emilio Cobos Álvarez2018-09-031-3/+3
| | | | Differential Revision: https://phabricator.services.mozilla.com/D4754
* style: Convert FnvHash{Set,Map} instances to FxHash{Set,Map}.Nicholas Nethercote2018-08-081-4/+4
| | | | | Bug: 1477628 Reviewed-by: heycam
* style: Fix servo build.Emilio Cobos Álvarez2018-07-241-1/+1
|
* style: Push visited style computation a bit further down.Emilio Cobos Álvarez2018-07-241-4/+4
| | | | | | Bug: 1474959 Reviewed-by: xidorn MozReview-Commit-ID: 1DILenWIw4D
* Run rustfmt on selectors, servo_arc, and style.Bobby Holley2018-04-101-41/+63
| | | | | | | | | | 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)
* style: Implement the non-functional :host selector.Emilio Cobos Álvarez2018-04-091-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Stop using Gecko namespace ids in servo.Bobby Holley2018-04-061-2/+2
| | | | MozReview-Commit-ID: 2532dHCGPXW
* style: Add infrastructure to match :host.Emilio Cobos Álvarez2018-03-141-6/+14
|