aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/stylesheets
Commit message (Collapse)AuthorAgeFilesLines
...
* style: Add a simple CSSLayerRule implementationEmilio Cobos Álvarez2023-05-301-2/+3
| | | | | | | | | | | The specifics of how this is going to work are still getting spec'd / discussed in https://github.com/w3c/csswg-drafts/issues/6576, but this allows DevTools to work fine and the feature to be complete enough for Nightly experimentation (with the other in-flight patches). Otherwise devtools crashes when trying to inspect pages that use them. Differential Revision: https://phabricator.services.mozilla.com/D124656
* style: Fix out of order child layer registration, and enable the testsEmilio Cobos Álvarez2023-05-301-0/+91
| | | | | | | | | | | | | | This makes layer order use a fixed set of bits per nesting level, to "reserve" bits for children before they are registered. See the comment in LayerOrder for the implementation limits it imposes, and potential alternatives if these limits are not enough (but I think they should be). Enable the tests, as they mostly pass now (commit incoming to fix the remaining ones). Differential Revision: https://phabricator.services.mozilla.com/D124620
* Further changes required by ServoOriol Brufau2023-05-301-1/+6
|
* style: Implement @import layer|layer(<name>)Emilio Cobos Álvarez2023-05-303-11/+76
| | | | | | | | | This works modulo the existing nested layer order bug. Will be covered by WPT /css/css-cascade/layer-import.html once the feature is enabled (I can probably enable it right away for those tests, but I'd rather fix the obvious bugs first). Differential Revision: https://phabricator.services.mozilla.com/D124538
* style: Compute layer order during CascadeData rebuildEmilio Cobos Álvarez2023-05-274-71/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | For that, deal with children in add_rule recursively, to keep the current layer name up-to-date in block layer rules. This is not the final version of this code, as right now something like this: @layer A { ... } @layer B { ... } @layer A.A { ... } Would give A.A more priority over B, which is not correct. There are tests for this incoming in wpt sync and such, but that can be tweaked later. Differential Revision: https://phabricator.services.mozilla.com/D124335
* style: Remove cascade layers prefEmilio Cobos Álvarez2023-05-261-1/+1
| | | | | | These have been enabled by default for quite a while. Differential Revision: https://phabricator.services.mozilla.com/D175513
* style: Hook up basic @layer rule parsingEmilio Cobos Álvarez2023-05-263-49/+68
| | | | | | | | | | Disabled, and of course doing nothing for now still, but this is another piece that is useful to get reviewed separately. Don't allow layers to be interleaved with @import / @namespace rules as per https://github.com/w3c/csswg-drafts/issues/6522. Differential Revision: https://phabricator.services.mozilla.com/D124229
* style: Tweak at-rule parsing APIs to support cascade layersEmilio Cobos Álvarez2023-05-262-29/+23
| | | | | | | This needs https://github.com/servo/rust-cssparser/pull/287 and a cssparser update. Differential Revision: https://phabricator.services.mozilla.com/D124216
* style: Restore an #[allow] that will otherwise cause warnings.Emilio Cobos Álvarez2023-05-261-0/+1
|
* style: Add some scaffolding for @layer rulesEmilio Cobos Álvarez2023-05-264-3/+205
| | | | | | | | | | | Not hooked anywhere yet, so this doesn't change behavior, but adds the basic data model etc. Adding parsing support requires some changes to cssparser to allow the same at rule to be block and statement-like at the same time, so better done separately. Differential Revision: https://phabricator.services.mozilla.com/D124079
* style: Don't EnsureUniqueInner from the cssRules getterEmilio Cobos Álvarez2023-05-241-1/+7
| | | | | | | Instead, fix up the various content data structures when the stylesheet is mutated. This makes reading a stylesheet not disable style sharing. Differential Revision: https://phabricator.services.mozilla.com/D115203
* style: Refactor the author sheet cache to keep alive the relevant ↵Emilio Cobos Álvarez2023-05-241-9/+16
| | | | | | | | | | | | | | | StylesheetContents This prevents incorrectly reusing cached results when the contents go away and new contents are allocated with the same address. Note that these keep alive transitively everything else under them, so all other medialist keys don't need this. By making this a proper hashmap it should also improve cache lookup times if the cache grows too big. Differential Revision: https://phabricator.services.mozilla.com/D115202
* style: Add a CSS error to the console when using non-featureless :host selectorsOriol Brufau2023-05-171-2/+38
| | | | | | (which would never match by definition). Differential Revision: https://phabricator.services.mozilla.com/D111610
* Further changes required by ServoOriol Brufau2023-05-161-3/+2
|
* style: Share CascadeData instances across ShadowRootsOriol Brufau2023-05-163-97/+41
| | | | | | | | | | | 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
* Simplify our setup for font metric queries from styleOriol Brufau2023-05-111-4/+0
| | | | | | | | This is a backport of https://phabricator.services.mozilla.com/D157589, by Emilio Cobos Álvarez, plus some additions so that Servo compiles, and some parts from https://phabricator.services.mozilla.com/D144455. Should have no change in behavior.
* Updated cssparser dependency to 0.29.Lewin Probst2021-11-184-55/+53
| | | | Signed-off-by: Lewin Probst <info@emirror.de>
* Fix compiler warningsBryce Wilson2021-08-141-1/+1
|
* Rustfmt.Emilio Cobos Álvarez2021-02-268-14/+41
|
* style: Add dark mode to plaintext.css, and a document rule to target ↵Emilio Cobos Álvarez2021-02-261-2/+27
| | | | | | | | | | | | | | | | | | | | | | | | plaintext documents. We add two @-moz-document functions: `plain-text-document()`, matching the obvious, and `unobservable-document()`, which matches a top-level document with no opener. This is the equivalent check we do for automatic darkening of `about:blank` here: https://searchfox.org/mozilla-central/rev/014fe72eaba26dcf6082fb9bbaf208f97a38594e/layout/base/PresShell.cpp#5282 The former we don't need to use, but it's nice to let user stylesheets target plaintext documents properly (rather than relying on extensions or what not). Note that these are not content-observable. Add two tests: One showing that we produce different rendering when on dark mode, and one showing that we produce the same one from an iframe, regardless of dark mode. Depends on D101517 Differential Revision: https://phabricator.services.mozilla.com/D101518
* style: Allow resource:// stylesheets to use chrome-only rules.Emilio Cobos Álvarez2021-02-261-3/+3
| | | | | | We'll use it to use @-moz-document from plaintext.css. Differential Revision: https://phabricator.services.mozilla.com/D101516
* style: Use a more precise rule start for sanitization.Emilio Cobos Álvarez2021-02-263-22/+21
| | | | Differential Revision: https://phabricator.services.mozilla.com/D98710
* style: Update cssparser to get ParserState in rule parser.Emilio Cobos Álvarez2021-02-263-25/+25
| | | | | | | | | | | | | | | The changes should be trivial. The third_party changes are up for review in https://github.com/servo/rust-cssparser/pull/277 (and of course I'll land with a bump to 0.28 rather than the override after that gets r+'d). The basic idea is that with this we have the actual start offset of the rule, so we wouldn't include html comments or other invalid stuff we discard during sanitization in bug 1680084. But that's a separate change. Differential Revision: https://phabricator.services.mozilla.com/D98677
* style: Separate out some of the declaration precedence components from ↵Emily McDonough2021-02-263-57/+73
| | | | | | @viewport rules Differential Revision: https://phabricator.services.mozilla.com/D97817
* style: Properly distinguish between empty children and no children in rule ↵Emilio Cobos Álvarez2021-02-261-12/+14
| | | | | | | | | iterator. So that skip_children(), which just pops the stack and is used by the dynamic media query evaluation code, works as it should. Differential Revision: https://phabricator.services.mozilla.com/D92717
* style: CSSOM should respect rule-level property restrictions.Emilio Cobos Álvarez2021-02-261-1/+1
| | | | Differential Revision: https://phabricator.services.mozilla.com/D90729
* style: Invalidate for CSSOM changes in a more fine-grained way.Emilio Cobos Álvarez2021-02-263-71/+120
| | | | | | | | | | | | | | | | | Also, for changes in CSS declarations, like changing cssRules[i].style.color or something, we end up avoiding a lot of the work we were doing. This page still trips us in the sense that they add a stylesheet, then call getBoundingClientRect(), then insert more rules in the stylesheet, which causes us to rebuild a lot of the cascade data. We could try to detect appends to the last stylesheet on the list or something I guess, and avoid rebuilding the cascade data in some cases. Depends on D85615 Differential Revision: https://phabricator.services.mozilla.com/D85616
* Fix warnings introduced in newer Rust NightlySimon Sapin2021-02-252-2/+2
| | | | | | | | | | | | This does not (yet) upgrade ./rust-toolchain The warnings: * dead_code "field is never read" * redundant_semicolons "unnecessary trailing semicolon" * non_fmt_panic "panic message is not a string literal, this is no longer accepted in Rust 2021" * unstable_name_collisions "a method with this name may be added to the standard library in the future" * legacy_derive_helpers "derive helper attribute is used before it is introduced" https://github.com/rust-lang/rust/issues/79202
* style: Switch all callsites of try() to try_parse() in the style crate.Emilio Cobos Álvarez2020-06-184-13/+13
| | | | | | | | | Fully automated via: $ rg -l '\.try\(' | xargs sed -i 's/\.try(/.try_parse(/g' $ cd servo/components/style && cargo +nightly fmt Differential Revision: https://phabricator.services.mozilla.com/D80099
* style: Remove the @-moz-document url-prefix() hack preference, enable it ↵Emilio Cobos Álvarez2020-06-041-4/+0
| | | | | | | | | everywhere. It doesn't seem like realistically we're going to be able to get rid of this any time soon. Differential Revision: https://phabricator.services.mozilla.com/D76809
* style: Gracefully handle errors creating shared memory UA style sheets.Cameron McCormack2020-06-042-13/+19
| | | | | | | | | | | | We still panic in a debug build, so that developers can notice when they need to add a new static atom after modifying UA sheets. We also add telemetry to note when this happens, add an app note to a crash report, in case any crash later on occurs, and re-up the existing, expired shared memory sheet telemetry probes so we can look at them again. Differential Revision: https://phabricator.services.mozilla.com/D73188
* style: Reformat recent changes.Emilio Cobos Álvarez2020-04-162-2/+2
|
* style: Add CSS Error for DisallowedImportRule.Erik Nordin2020-04-161-1/+1
| | | | | | | | - Add new CSS Error - Add new test case for error - Ensure that test cases use `replace()` and `replaceSync()` Differential Revision: https://phabricator.services.mozilla.com/D69423
* style: Disallow @import rules for all Constructable StyleSheets functions.Erik Nordin2020-04-164-3/+34
| | | | | | | | | | - Add enum AllowImportRules to CSS parsing. - `replaceSync()` will skip over @import rules and continue parsing. - `replace()` will skip over @import rules and continue parsing. - `insertRule()` will throw a syntax error on @import rules. - Modify WPT test cases to reflect these changes. Differential Revision: https://phabricator.services.mozilla.com/D61882
* style: Add a style flag for the root element style.Emilio Cobos Álvarez2020-02-121-1/+0
| | | | | | | This is needed to make the root element not a containing block in presence of filters or what not. Differential Revision: https://phabricator.services.mozilla.com/D61167
* Rustfmt recent changes.Emilio Cobos Álvarez2019-12-162-4/+2
|
* style: Preserve CSS input exactly during sanitization.Emilio Cobos Álvarez2019-12-162-4/+87
| | | | | | This avoids the mutation due to the different serialization in some cases. Differential Revision: https://phabricator.services.mozilla.com/D56732
* style: Fix serialization of @namespace rule.Emilio Cobos Álvarez2019-12-161-7/+7
| | | | | | | | | | This code comes from: https://hg.mozilla.org/mozilla-central/rev/2418cfba72c33c5623f6fb4c243c5203819c8240 I audited other callers of write_str, they seem ok. Differential Revision: https://phabricator.services.mozilla.com/D54601
* style: Simplify some code now that lifetimes are non-lexical.Emilio Cobos Álvarez2019-11-301-4/+4
| | | | Differential Revision: https://phabricator.services.mozilla.com/D54529
* style: Simplify code for keeping alive shared memory until all sheets go away.Emilio Cobos Álvarez2019-11-301-0/+4
| | | | | | | | | | | | | | | | | | The existing code wasn't sound, as CSSOM objects also needed to go away before the shared memory goes away (as they keep references to them). This is sound assuming no presence of reference cycles introduced by CSSOM. We may want to live with this and rely on chrome code not writing cycles like this with UA stylesheet DOM objects. We could explicitly drop all potentially-static objects... That seems pretty error prone though. Or we could also just leak the shared memory buffer, is there any reason why we may not want to do that? Differential Revision: https://phabricator.services.mozilla.com/D51870
* Update rand to 0.7 (fixes #24448)Anthony Ramine2019-10-233-9/+9
|
* Upgrade to rustc 1.39.0-nightly (f7af19c27 2019-08-15)Simon Sapin2019-08-231-7/+16
|
* style: Use `static_prefs::pref!`.Nicholas Nethercote2019-08-152-8/+4
| | | | | | | | | | It's much nicer. One nice thing about this is that the new code is subject to the existing threadedness checking, which identified that several of these should be atomic because they're accessed off the main thread. Differential Revision: https://phabricator.services.mozilla.com/D40792
* Update euclid.Emilio Cobos Álvarez2019-07-231-3/+11
| | | | | | | | There are a few canvas2d-related dependencies that haven't updated, but they only use euclid internally so that's not blocking landing the rest of the changes. Given the size of this patch, I think it's useful to get this landed as-is.
* style: Fix a warning in Servo builds by moving a macro to where it's used.Emilio Cobos Álvarez2019-07-231-15/+15
|
* style: Update to euclid 0.20.Nicolas Silva2019-07-231-2/+2
| | | | Differential Revision: https://phabricator.services.mozilla.com/D38530
* style: Modify URLExtraData rust debug to include referrerInfo.Thomas Nguyen2019-07-231-7/+14
| | | | Differential Revision: https://phabricator.services.mozilla.com/D36475
* style: Change `StaticPrefs` from a class to a namespace.Nicholas Nethercote2019-07-082-3/+3
| | | | | | | | | | This doesn't change the way C++ code uses static prefs. But it does slightly change how Rust code uses static prefs, specifically the name generated by bindgen is slightly different. The commit also improves some comments. Differential Revision: https://phabricator.services.mozilla.com/D35764
* Fix some new warningsSimon Sapin2019-06-224-12/+12
|
* Auto merge of #23532 - est31:unused_code_removal_4, r=emiliobors-servo2019-06-071-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove unused code (4/4) <!-- Please describe your changes on the following line: --> Fourth and final PR in a series of PRs to remove unused/dead code from servo, powered by an (upcoming) tool of mine. Please take a look and tell me if you want to keep something. * First PR: #23477 * Second PR: #23498 * Third PR: #23499 Shortstat of the combined PR series: ``` 47 files changed, 7 insertions(+), 805 deletions(-) ``` --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because they only remove dead code <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/23532) <!-- Reviewable:end -->