aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/selector_parser.rs
Commit message (Collapse)AuthorAgeFilesLines
* Move Stylo to its own repo (#31350)Delan Azabani2024-02-271-240/+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
* style: Use write_char in place of write_str when serializing ↵Jonathan Kew2023-11-061-2/+2
| | | | | | | | | | | | 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
* style: Disallow forgiving selector-parsing in @supportsEmilio Cobos Álvarez2023-11-031-0/+3
| | | | | | As per spec, see https://github.com/w3c/csswg-drafts/issues/7280 Differential Revision: https://phabricator.services.mozilla.com/D156468
* Further changes required by ServoOriol Brufau2023-10-021-1/+1
|
* style: Unify Gecko and Servo EventState/ElementState bitsEmilio Cobos Álvarez2023-10-021-3/+3
| | | | | | | | | | | | | | | | 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
* style: Shrink maps if needed after stylist rebuildsEmilio Cobos Álvarez2023-06-091-1/+6
| | | | | | | | Hashbrown grows a lot sometimes making us waste a lot of memory. Shrink some of these maps after CascadeData rebuild / stylesheet collection invalidation. Differential Revision: https://phabricator.services.mozilla.com/D134716
* style: Run rustfmt on servo/components/style and servo/ports/geckolibTing-Yu Lin2023-06-091-2/+1
| | | | | | | | | | | | This patch is generated by running `cargo +nightly fmt` under `servo/components/style/` and `servo/ports/geckolib` against mozilla-central https://hg.mozilla.org/mozilla-central/rev/b193f2e7a6a5d1f042c957ea4acd5c89bf210512 My nightly version is: 1.58.0-nightly (c9c4b5d72 2021-11-17) Manually remove the redundant braces in author_styles.rs to fix a warning. Differential Revision: https://phabricator.services.mozilla.com/D131556
* style: Allow matches() / querySelector() / etc on chrome docs to access ↵Emilio Cobos Álvarez2023-06-091-6/+7
| | | | | | | | | | | | | | | | | | chrome-only selectors. r=boris Without this some tests fail with the previous patch because code like: https://searchfox.org/mozilla-central/rev/267682a8f45221bf0bfe999d4a0239706a43bc56/browser/base/content/browser-gestureSupport.js#651 starts throwing. Unfortunately I had missed that on my try run, because the error message didn't include that exception (it seemed like an intermittent browser-chrome failure instead). We could expose a ChromeOnly API for this, but this seems better. This fixes it trivially, and also removes the "no url data" situation from the selector parser, which is nice. Differential Revision: https://phabricator.services.mozilla.com/D130818
* style: Share CascadeData instances across ShadowRootsOriol Brufau2023-05-161-1/+1
| | | | | | | | | | | This should be both a memory and speed win for pages using a lot of Shadow DOM. In order to make the cache properly work we need to start keying media query results on the actual StyleSheetContents, as that's what we share on Gecko, but that should all be fine. Differential Revision: https://phabricator.services.mozilla.com/D107266
* Rustfmt.Emilio Cobos Álvarez2021-02-261-1/+2
|
* style: Allow resource:// stylesheets to use chrome-only rules.Emilio Cobos Álvarez2021-02-261-1/+1
| | | | | | We'll use it to use @-moz-document from plaintext.css. Differential Revision: https://phabricator.services.mozilla.com/D101516
* style: Add derived ToShmem implementations.Cameron McCormack2019-04-121-1/+1
| | | | Differential Revision: https://phabricator.services.mozilla.com/D17197
* Update MPL license to https (part 4)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* `cargo fix --edition --features gecko`Simon Sapin2018-11-101-3/+3
|
* `cargo fix --edition`Simon Sapin2018-11-101-7/+7
|
* Reorder importsPyfisch2018-11-061-1/+1
|
* style: Fix servo build.Emilio Cobos Álvarez2018-09-031-1/+1
|
* style: Use an Atom to represent Direction values in pseudo-classes.Cameron McCormack2018-09-031-19/+38
| | | | Differential Revision: https://phabricator.services.mozilla.com/D4730
* style: Measure heap allocations hanging off selector components.Cameron McCormack2018-07-161-1/+1
| | | | | | Bug: 1475191 Reviewed-by: emilio MozReview-Commit-ID: D7vZQ7v8owS
* Run rustfmt on selectors, servo_arc, and style.Bobby Holley2018-04-101-11/+10
| | | | | | | | | | 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)
* Change ToCss to take a CssWriter<W>Anthony Ramine2018-01-231-2/+2
| | | | | | This more concrete wrapper type can write a prefix the very first time something is written to it. This allows removing plenty of useless monomorphisations caused by the former W/SequenceWriter<W> pair of types.
* style: Move :-moz-locale-dir matching to rust.Emilio Cobos Álvarez2018-01-111-0/+14
|
* moving :dir() param serialization FIXMEMichael Wilson2017-11-211-0/+1
|
* Auto merge of #19315 - emilio:chrome-rules-user-sheets, r=heycambors-servo2017-11-211-2/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | style: Enable chrome-only CSS features in user stylesheets. MozReview-Commit-ID: FJ4vTiOrotH Bug: 1418963 Reviewed-by: heycam <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19315) <!-- Reviewable:end -->
| * style: Enable chrome-only CSS features in user stylesheets.Emilio Cobos Álvarez2017-11-211-2/+3
| | | | | | | | | | | | MozReview-Commit-ID: FJ4vTiOrotH Reviewed-by: heycam Bug: 1418963
* | style: :dir() pseudo class now represented by enumMichael Wilson2017-11-151-2/+24
|/ | | | Fixes #19195
* Revert "Diagnostic map semantics."Manish Goregaokar2017-10-231-9/+0
| | | | This reverts commit f5c5be00a7df984647364dfc84c0c9bc6d3e2f34.
* Add slots in PerPseudoElementMap for tree pseudos.Xidorn Quan2017-10-201-21/+9
|
* Replace all uses of the `heapsize` crate with `malloc_size_of`.Nicholas Nethercote2017-10-181-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`. `malloc_size_of` is better -- it handles various cases that `heapsize` does not -- so this patch changes Servo to use `malloc_size_of`. This patch makes the following changes to the `malloc_size_of` crate. - Adds `MallocSizeOf` trait implementations for numerous types, some built-in (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`). - Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't support that operation. - For `HashSet`/`HashMap`, falls back to a computed estimate when `enclosing_size_of_op` isn't available. - Adds an extern "C" `malloc_size_of` function that does the actual heap measurement; this is based on the same functions from the `heapsize` crate. This patch makes the following changes elsewhere. - Converts all the uses of `heapsize` to instead use `malloc_size_of`. - Disables the "heapsize"/"heap_size" feature for the external crates that provide it. - Removes the `HeapSizeOf` implementation from `hashglobe`. - Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of` doesn't derive those types, unlike `heapsize`.
* style: Remove the ElementExt trait.Emilio Cobos Álvarez2017-10-161-9/+0
| | | | It is likely it's the most useless trait ever existing.
* Diagnostic map semantics.Bobby Holley2017-10-071-0/+9
| | | | MozReview-Commit-ID: C0a5g6xMPY0
* Revert #18668 - Add mprotect diagnostics for HashMap crashBobby Holley2017-10-031-9/+0
|
* Semantics for ProtectedHashMap.Bobby Holley2017-09-281-0/+9
| | | | MozReview-Commit-ID: K0m65uZi7iw
* Measure the UA cache.Nicholas Nethercote2017-09-201-0/+1
| | | | | | | | | | | | | | | | ServoStyleSetSizes now has two uses, one for the Stylist, and one for the UA cache, and so the patch removes 'Stylist' from the field names. Example output from about:memory: > +----1,359,608 B (00.55%) -- layout > | +----756,488 B (00.31%) -- style-sheet-cache [2] > | +----393,968 B (00.16%) -- servo-ua-cache > | | +--234,496 B (00.10%) -- element-and-pseudos-maps > | | +---59,648 B (00.02%) -- revalidation-selectors > | | +---58,320 B (00.02%) -- invalidation-map > | | +---30,752 B (00.01%) -- other > | | +---10,752 B (00.00%) -- precomputed-pseudos
* Measure the stylist during memory reporting.Nicholas Nethercote2017-09-051-0/+5
|
* order derivable traits listsClément DAVID2017-08-231-1/+1
| | | | | | Ignoring : - **generated**.rs - python/tidy/servo_tidy_tests/rust_tidy.rs
* stylo: Remove a lot of the restyle damage related complexity.Emilio Cobos Álvarez2017-08-201-10/+0
| | | | | | | | | | The only reason why we had the `existing_style_for_style_damage` bit is to apply some optimizations that we don't have anymore. I still want to reintroduce a few of them, at least for the non-eager pseudo-element case... But I think I won't need this at all. This allows us to remove a fair amount of Gecko code too.
* style: Use an enumerated array for per-pseudo maps.Emilio Cobos Álvarez2017-08-081-14/+75
| | | | | | | This avoids random HashMaps. MozReview-Commit-ID: LQeZrLsoOnl Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
* style: Introduce Chrome UI privilege for parsersTing-Yu Lin2017-08-031-1/+11
| | | | | | | | | | | The motivation is that Chrome XBL stylesheets can be parsed under author level, but we allow some event-state pseudo classes like :-moz-handled-clicktoplay to be used. Also synchronize the privilege of pseudo classes in non_ts_pseudo_class_list.rs and nsCSSPseudoClassList.h (except :fullscreen). MozReview-Commit-ID: 8fUjjC8hbQO
* stylo: Introduce ComputedValuesInnerManish Goregaokar2017-07-171-1/+1
|
* Call non-functional pseudo-elements simple pseudo-element.Xidorn Quan2017-07-121-1/+1
|
* Thread ParseError return values through CSS parsing.Josh Matthews2017-06-091-3/+5
|
* Look for relevant links while matchingJ. Ryan Stinnett2017-05-241-3/+0
| | | | | | | | | | | | | | | | | 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
* style: Refactor the cascade function.Emilio Cobos Álvarez2017-05-171-1/+1
| | | | | The `cascade_primary_or_pseudo` function was nice when we shared more code, but right now I think it just makes it harder to understand what's going on.
* Use StyleArc in the style system.Bobby Holley2017-05-021-1/+1
| | | | MozReview-Commit-ID: flF0fv9E9M
* style: Stop special-casing a few attributes for style sharing, and use a ↵Emilio Cobos Álvarez2017-04-091-40/+1
| | | | | | | | | | 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>
* Use a more compact representation to store eager pseudo-elements.Bobby Holley2017-04-031-16/+0
| | | | | | This means that ElementStyles only need a single word to store eager pseudos. MozReview-Commit-ID: 5bDXlDweN46
* Improve some ergonomics around pseudo-elements.Bobby Holley2017-04-031-22/+2
| | | | | | I think a lot of the current indirection predates the crate merge. MozReview-Commit-ID: FM28dgZa5go
* style: Document the restyle hints code, and make it operate on `TElement`.Emilio Cobos Álvarez2017-01-021-24/+66
| | | | | This removes the annoying constraint of having to provide the current state from outside of the restyle hints code.
* Make Restyle tracking more granular.Bobby Holley2016-12-091-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | The primary idea of this patch is to ditch the rigid enum of Previous/Current styles, and replace it with a series of indicators for the various types of work that needs to be performed (expanding snapshots, rematching, recascading, and damage processing). This loses us a little bit of sanity checking (since the up-to-date-ness of our style is no longer baked into the type system), but gives us a lot more flexibility that we'll need going forward (especially when we separate matching from cascading). We also eliminate get_styling_mode in favor of a method on the traversal. This patch does a few other things as ridealongs: * Temporarily eliminates the handling for transfering ownership of styles to the frame. We'll need this again at some point, but for now it's causing too much complexity for a half-implemented feature. * Ditches TRestyleDamage, which is no longer necessary post-crate-merge, and is a constant source of compilation failures from either needing to be imported or being unnecessarily imported (which varies between gecko and servo). * Expands Snapshots for the traversal root, which was missing before. * Fixes up the skip_root stuff to avoid visiting the skipped root. * Unifies parallel traversal and avoids spawning for a single work item. * Adds an explicit pre_traverse step do any pre-processing and determine whether we need to traverse at all. MozReview-Commit-ID: IKhLAkAigXE