aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/sharing/mod.rs
Commit message (Collapse)AuthorAgeFilesLines
* style: Simplify selector flags setup even moreEmilio Cobos Álvarez2023-08-161-11/+8
| | | | | | | | | | | | | | | | In my investigation for bug 1766439, I am digging into why selector matching regressed. It doesn't help that the selector-matching code is instantiated a gazillion times (so there's a ton of copies of the relevant functions). This was needed in the past because we had different ways of setting the selector flags on elements, but I unified that recently and now we only need to either set them or not. That is the kind of thing that MatchingContext is really good for, so pass that instead on MatchingContext creation. Differential Revision: https://phabricator.services.mozilla.com/D145428
* style: Move transitions and animations to nsStyleUIResetEmilio Cobos Álvarez2023-08-161-3/+3
| | | | | | | | | | | | | | This mostly just moves code around, to minimize potential behavior changes. There are some cleanups that we should try to do long term (this "have an array with n different counts" is pretty weird). But for now this should unblock people. The destination struct (nsStyleUIReset) was chosen mainly because it's small and non-inherited, and it doesn't seem like a worse place than nsStyleDisplay. Differential Revision: https://phabricator.services.mozilla.com/D144183
* style: Simplify selector flag setting now that flag setting is atomicEmilio Cobos Álvarez2023-08-161-11/+2
| | | | | | | These bits are write-only, actually, and we don't even need to read them. Differential Revision: https://phabricator.services.mozilla.com/D141888
* Revert "Backport several style changes from Gecko (5) (#30099)" (#30104)Oriol Brufau2023-08-161-12/+24
| | | This reverts commit 8e15389caedd9b8e1b87cc9e4bfe8350a581546d.
* Backport several style changes from Gecko (5) (#30099)Oriol Brufau2023-08-151-24/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * style: Simplify selector flag setting now that flag setting is atomic These bits are write-only, actually, and we don't even need to read them. Differential Revision: https://phabricator.services.mozilla.com/D141888 * Further changes required by Servo * style: Support media queries for dynamic-range and video-dynamic-range This is a stub that only matches "standard" for all platforms. Differential Revision: https://phabricator.services.mozilla.com/D141053 * style: Remove :-moz-lwtheme-{brighttext,darktext} They are just convenience for :root[lwthemetextcolor="light"] (and dark, respectively), but they generally shouldn't be used for dark mode theming. In the past it was the only way to do it but now we have prefers-color-scheme. While at it, change lwthemetextcolor to be "lwtheme-brighttext" for consistency with similar code we have for popups etc, and move it to _setDarkModeAttributes. While at it, remove layout.css.moz-lwtheme.content.enabled (which is false always, we unshipped these from content successfully). Differential Revision: https://phabricator.services.mozilla.com/D141593 * style: layout.css.moz-locale-dir.content.enabled We successfully removed these from content in bug 1740230 (Firefox 96). Differential Revision: https://phabricator.services.mozilla.com/D141727 * style: Really honor background-color: transparent in HCM even for form controls I forgot we were doing this "revert-or-initial" shenanigans (which is needed for stuff like link colors to be honored), so we need to early-return. Use a more explicit test rather than a reftest for this. Differential Revision: https://phabricator.services.mozilla.com/D142063 * style: Ignore unchanged property for scroll-linked effect detector I think this is cleaner. Differential Revision: https://phabricator.services.mozilla.com/D141737 * style: Allow to derive Parse/ToCss/SpecifiedValueInfo on bitflags We keep getting this pattern of properties that have a set of joint and disjoint flags, and copy-pasting or writing the same parsing and serialization code in slightly different ways. container-type is one such type, and I think we should have a single way of dealing with this, thus implement deriving for various traits for bitflags, with an attribute that says which flags are single vs mixed. See docs and properties I ported. The remaining ones I left TODOs with, they are a bit trickier but can be ported with some care. Differential Revision: https://phabricator.services.mozilla.com/D142418 * Further changes required by Servo * style: Implement parsing / serialization for container{,-type,-name} CSS properties Two noteworthy details that may seem random otherwise: * Moving values around in nsStyleDisplay is needed so that the struct remains under the size limit that we have to avoid jumping allocator buckets. * All the test expectation churn is because tests depend on `container-type: size` parsing to run, and now they run. Tests for the relevant bits I implemented are passing, with the only exception of some `container-name-computed.html` failures which are https://github.com/w3c/csswg-drafts/issues/7181. Safari agrees with us there. Other notes when looking at the spec and seeing how it matches the implementation: * `container` syntax doesn't match spec, but matches tests and sanity: https://github.com/w3c/csswg-drafts/issues/7180 * `container-type` syntax doesn't _quite_ match spec, but matches tests and I think it's a spec bug since the definition for the missing keyword is gone: https://github.com/w3c/csswg-drafts/issues/7179 Differential Revision: https://phabricator.services.mozilla.com/D142419 * style: Remove assert that doesn't hold for text-decorations because of presentation hints MANUAL PUSH: Orange fix CLOSED TREE * style: Migrate `<th>` `text-align` behaviour from presentation hint to UA CSS Differential Revision: https://phabricator.services.mozilla.com/D142494 * style: Deduplicate TokenList values faster Remember whether we have already de-duplicated them once and avoid doing that again. This is an alternative approach that doesn't add overhead to attribute setting in the general case. Differential Revision: https://phabricator.services.mozilla.com/D142813 * style: Inherit used color-scheme from embedder <browser> elements This allows popups and sidebars to use the chrome preferred color-scheme. This moves the responsibility of setting the content-preferred color scheme to the appropriate browsers to the front-end (via tabs.css). We still return the PreferredColorSchemeForContent() when there's no pres context (e.g., for display:none in-process iframes). We could potentially move a bunch of the pres-context data to the document instead, but that should be acceptable IMO as for general web content there's no behavior change in any case. Differential Revision: https://phabricator.services.mozilla.com/D142578 * Further changes required by Servo * style: Add basic @container rule parsing and boilerplate For now parse a MediaFeatureCondition. That needs being made more specific, but that is probably worth its own patch. Differential Revision: https://phabricator.services.mozilla.com/D143192 * Further changes required by Servo * style: Tweak cascade priority to split writing-mode and font properties This makes the worst case for cascade performance slightly more expensive (4 rather than three declaration walks), but my hope is that it will make the average case faster, since the best case is now just two walks instead of three, and writing mode properties are somewhat rare. This needs a test, but needs to wait until the writing-mode dependent viewport units land (will wait to land with a test). Differential Revision: https://phabricator.services.mozilla.com/D143261 * style: Implement new {small,large,dynamic} viewport units Differential Revision: https://phabricator.services.mozilla.com/D143252 * Further changes required by Servo * style: Implement new *vi and *vb units Differential Revision: https://phabricator.services.mozilla.com/D143253 * style: Implement prefers-contrast: custom and let prefers-contrast ride the trains Differential Revision: https://phabricator.services.mozilla.com/D143198 * style: Join servo style threads during shutdown I was unable to change the BLOOM_KEY field to no longer be leaked, as the TLS is also accessed on the main thread, which is not exited before the leak checker shuts down. Differential Revision: https://phabricator.services.mozilla.com/D143529 * Further changes required by Servo * style: Fix visited handling after bug 1763750 Before bug 1763750, we unconditionally called compute_writing_mode, which got the writing mode from the cascade mode for visited styles. However after that bug we only do that if we apply any writing-mode-related property. We could just call compute_writing_mode unconditionally, but instead it seems better to skip all that work for visited cascade and reuse the mechanism introduced in that bug to only apply the visited-dependent longhands. We assert that all visited-dependent longhands are "late" longhands, so as to also avoid applying the font group and such. Differential Revision: https://phabricator.services.mozilla.com/D143490 * style: Clean-up viewport unit resolution a bit I should've caught this when reviewing the new viewport units but alas :-) Differential Revision: https://phabricator.services.mozilla.com/D143856 * style: Implement `contain: inline-size` Differential Revision: https://phabricator.services.mozilla.com/D143501 * style: Simplify media query evaluation code a bit This patch: * Removes generic <ident> support for media features. These were used for some privileged media features but are no longer used. * Simplifies media feature getters by shifting the responsibility of dealing with RangeOrOperator to the caller. This makes it easier to implement container-query / mediaqueries-4 syntax, and also cleans up the code a bunch. There should be no change in behavior. Differential Revision: https://phabricator.services.mozilla.com/D144051 * Further changes required by Servo * style: Move transitions and animations to nsStyleUIReset This mostly just moves code around, to minimize potential behavior changes. There are some cleanups that we should try to do long term (this "have an array with n different counts" is pretty weird). But for now this should unblock people. The destination struct (nsStyleUIReset) was chosen mainly because it's small and non-inherited, and it doesn't seem like a worse place than nsStyleDisplay. Differential Revision: https://phabricator.services.mozilla.com/D144183 * Further changes required by Servo * style: Make media feature evaluation take a computed::Context This has no behavior change right now, but will simplify sharing code with container queries. Container queries will have container information in the computed::Context (this is necessary anyways for container-based units), so this avoids having to have different code for media and container queries. Differential Revision: https://phabricator.services.mozilla.com/D144152 * Further changes required by Servo * style: Add scroll() to animation-timeline for style system scroll() is defined in the spec proposal, and there is a temporary spec: https://drafts.csswg.org/scroll-animations-1/rewrite#scroll-notation. The spec is still under development, so we don't drop the orignal scroll-timeline at rule. Instead, we add a new scroll() notation to animation-timeline, and support both syntax for now. Differential Revision: https://phabricator.services.mozilla.com/D143417 * style: Tweak contain bitflag definition order to avoid static constructors This has no behavior change otherwise. The STRICT definition depended on SIZE, which was defined later. That's fine in Rust, but in C++ it causes the initialization to be dynamic because it doesn't have the definition of SIZE yet (ugh). This is the fix for the regression, though the following patch turns on constexpr support in cbindgen, which would've caught this at build-time, and guarantees that we don't have extra static constructors. Differential Revision: https://phabricator.services.mozilla.com/D144316 * style: Move some of the media query code to a more generic queries module No behavior change, just moving and renaming files. The code in the "queries" module will be shared between @media and @container. @media has some other code that container queries doesn't need like MediaList / MediaType / etc. That remains in the media_queries module. Differential Revision: https://phabricator.services.mozilla.com/D144435 * Further changes required by Servo * style: cleanup animation-name Make the representation the same between Gecko and Servo code. This will enable further clean-ups in the future. Make serialization be correct, serializing as identifier unless it's an invalid one (in which case we serialize as a string). This changes our stringification behavior in the specified style, but now it will match the computed style and be more correct over-all. Differential Revision: https://phabricator.services.mozilla.com/D144473 * Further changes required by Servo * style: Add support for parsing container-query-specific features There are some mediaqueries-5 features that we still don't support and explain the remaining failures in at-container-{parsing,serialization}. Differential Revision: https://phabricator.services.mozilla.com/D144446 * Further changes required by Servo * style: Introduce Optional<T> to represent optional values in the style system cross-fade() was kinda doing this in its own way with PercentOrNone, but since now we have more use-cases for this we should probably make this a slightly more general solution. I added some convenience APIs, but they're unused as of this patch so let me know if you want them gone. Differential Revision: https://phabricator.services.mozilla.com/D144831 * style: Fix insertRule with layer statements before imports We need to do a bit more nuanced check because @layer statements might go before imports. Differential Revision: https://phabricator.services.mozilla.com/D144996 * style: Factor out parsing the query feature name No behavior change. Differential Revision: https://phabricator.services.mozilla.com/D145229 * style: Refactor media feature expression representation in preparation to support multi-range syntax No behavior change. Depends on D145229 Differential Revision: https://phabricator.services.mozilla.com/D145230 * style: Implement media feature expression multi-range syntax Differential Revision: https://phabricator.services.mozilla.com/D145231 * style: Remove proton places tooltip code There's nobody working on it, and tooltips should hopefully be nice enough after recent changes (bug 1765423). Having it enabled causes artifacts like bug 1767815 comment 3. We can always rescue this from hg history if needed. Differential Revision: https://phabricator.services.mozilla.com/D145621 * style: Simplify selector flags setup even more In my investigation for bug 1766439, I am digging into why selector matching regressed. It doesn't help that the selector-matching code is instantiated a gazillion times (so there's a ton of copies of the relevant functions). This was needed in the past because we had different ways of setting the selector flags on elements, but I unified that recently and now we only need to either set them or not. That is the kind of thing that MatchingContext is really good for, so pass that instead on MatchingContext creation. Differential Revision: https://phabricator.services.mozilla.com/D145428 * Further changes required by Servo * style: Track @container condition id in style rules Much like we track layer rules. Consolidate that "containing rule state we pass down while building the cascade data" in a single struct that we can easily restore. For now, do nothing with it. I want to land this patch separately because it touches the Rule struct and CascadeData rebuilds, which both are performance sensitive. Its layout shouldn't change because I also changed LayerId to be a u16 (this shouldn't matter in practice, since LayerOrder is already a u16). Differential Revision: https://phabricator.services.mozilla.com/D145243 * Further changes required by Servo * style: Fix layer statement rules with multiple layer names MANUAL PUSH: Trivial orange fix CLOSED TREE. * style: Implement piecewise linear function Differential Revision: https://phabricator.services.mozilla.com/D145256 * style: Convert specified value tests to compile-time tests These were written at a time where std::mem::size_of wasn't a `const fn` in Rust. Now that it is, we can make these tests live in the style crate, and the build not to compile if they fail. Differential Revision: https://phabricator.services.mozilla.com/D146103 * Further changes required by Servo * style: Move size of tests to compile-time tests in the style crate Same reasoning as the previous commit. Differential Revision: https://phabricator.services.mozilla.com/D146104 * Further changes required by Servo * style: Lint and 32-bit build fix. MANUAL PUSH: Bustage fix CLOSED TREE * style: Implement 'update' media feature Differential Revision: https://phabricator.services.mozilla.com/D146338 * style: Clean up unused -moz-window-shadow values After bug 1768278 and bug 1767815 there's no more uses of the cliprounded value in the tree (also it causes artifacts on HiDPI screens so we probably don't want new usages). The "sheet" value is unused, and the other values other than "default" and "none" are only derived from "default", so they don't need to be exposed in the style system. Differential Revision: https://phabricator.services.mozilla.com/D145821 * style: More container queries plumbing Provide container information in computed::Context and use it to resolve the container queries. This still fails a lot of tests because we are not ensuring that layout is up-to-date when we style the container descendants, but that's expected. Differential Revision: https://phabricator.services.mozilla.com/D146478 * Further changes required by Servo * style: Ensure options in listbox selects are not stacking contexts by default We could have a different property or something but this seems reasonable as well probably. Differential Revision: https://phabricator.services.mozilla.com/D146994 * style: Implement overflow-clip-margin: <length> Differential Revision: https://phabricator.services.mozilla.com/D146432 * style: Change order of container shorthand Since the initial value of container-type is an open issue [1], I'm leaving that as-is for now. [1] https://github.com/w3c/csswg-drafts/issues/7202 Differential Revision: https://phabricator.services.mozilla.com/D147338 * style: Make modal dialog code more generic, and make it apply to fullscreen too behind a pref For now, don't turn it on by default yet, because I want to wait for more discussion in https://github.com/w3c/csswg-drafts/issues/6965 and so on. But I think the code is simple enough to land this. Differential Revision: https://phabricator.services.mozilla.com/D147295 * style: Cache computed styles objects display: none subtrees This reuses our existing undisplayed style generation, but in a per-document rather than per-nsComputedDOMStyle object, which means that we can avoid re-resolving styles of elements in display: none subtrees much more often. This brings the test-case in the bug to par with other browsers or better, and is much simpler than the initial approach I tried back in the day. Differential Revision: https://phabricator.services.mozilla.com/D147547 * Further changes required by Servo * style: Parse scroll-snap-stop style and propagate it to APZ side Depends on D146147 Differential Revision: https://phabricator.services.mozilla.com/D145850 * style: Update color-mix() syntax to match the current spec Test expectation updates for this in the latest patch of the bug. Differential Revision: https://phabricator.services.mozilla.com/D147002 * Further changes required by Servo * style: Make the color interpolation code more generic It's really piece-wise premultiplied interpolation, with a special-case for hue, so centralize the implementation. Differential Revision: https://phabricator.services.mozilla.com/D147003 * style: Implement more color-mix() color-spaces We had code to convert between these and the latest draft supports them so... Differential Revision: https://phabricator.services.mozilla.com/D147004 * style: Fix color-mix() percentage normalization Differential Revision: https://phabricator.services.mozilla.com/D147005 * style: Fix hue adjustment to match the spec The value to sum is tau, not pi. This was caught by some tests, see https://drafts.csswg.org/css-color/#shorter Differential Revision: https://phabricator.services.mozilla.com/D147006 * style: Do hue interpolations in degrees rather than radians. r=barret This gives us a bit more precision. Differential Revision: https://phabricator.services.mozilla.com/D147007 * style: Improve Percentage -> LengthPercentage conversion This doesn't change behavior because we only use them for images that have no clamping. Depends on D147008 Differential Revision: https://phabricator.services.mozilla.com/D147511 * style: Remove some dead vibrancy code Drive-by cleanup. Differential Revision: https://phabricator.services.mozilla.com/D147698 * style: Fix warnings about whitelist/blocklist functions being deprecated in bindgen 0.59 Differential Revision: https://phabricator.services.mozilla.com/D147695 * style: Update style to arrayvec 0.7 Differential Revision: https://phabricator.services.mozilla.com/D147476 * style: Update style to uluru 3.0 Differential Revision: https://phabricator.services.mozilla.com/D147477 * style: Remove -moz-scrollbar-thumb-proportional It unconditionally matches on all platforms, so it's not returning any useful information. Depends on D147689 Differential Revision: https://phabricator.services.mozilla.com/D147690 * style: Use ColorMix for interpolated colors in the computed style rather than ComplexColorRatios This among other things preserves the right color-space when interpolating currentColor. Differential Revision: https://phabricator.services.mozilla.com/D147512 * Further changes required by Servo * style: Add an input-region-margin to widgets, and implement it on Linux Recompute the input region when resizing the widget and so on, and use it to check for rollups. Depends on D148211 Differential Revision: https://phabricator.services.mozilla.com/D148222 * Avoid complaints from ./mach test-tidy * Update test expectations --------- Co-authored-by: Emilio Cobos Álvarez <emilio@crisal.io> Co-authored-by: Brad Werth <bwerth@mozilla.com> Co-authored-by: David Shin <dshin@mozilla.com> Co-authored-by: Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com> Co-authored-by: Nika Layzell <nika@thelayzells.com> Co-authored-by: Boris Chiou <boris.chiou@gmail.com> Co-authored-by: Autumn on Tape <autumn@cyfox.net> Co-authored-by: Mike Hommey <mh+mozilla@glandium.org>
* style: Add attributes to the rule hashEmilio Cobos Álvarez2023-05-261-4/+1
| | | | | | | | | | | | | | | | | | | See the discussion here: https://twitter.com/Rich_Harris/status/1433153204678799365 This should make attribute selectors roughly as fast as class selectors. I think it's worth trying and see if perf bots complain on micro-benchmarks and stylebench and such. I made attributes more specific than local names, but less specific than classes, which I think makes sense. When doing something like foo[data-bar], filtering by data-bar seems likely to yield less elements than filtering by foo. While at it, remove the bloom filter pref since we shipped it in bug 1704551 for 87 and we haven't heard complaints. Differential Revision: https://phabricator.services.mozilla.com/D124383
* Upgrade to uluru 2Leonardo Razovic2021-07-151-4/+4
|
* style: Avoid some allocations in selector serialization.Emilio Cobos Álvarez2021-02-261-11/+11
| | | | | | | The allocations in display_to_css_identifier show up in the profiles of bug 1675628. Differential Revision: https://phabricator.services.mozilla.com/D97856
* Include animations and transitions in the cascadeMartin Robinson2020-06-091-2/+5
| | | | | | Instead of applying animations and transitions to styled elements, include them in the cascade. This allows them to interact properly with things like font-size and !important rules.
* style: Rustfmt recent changes.Emilio Cobos Álvarez2020-02-121-1/+1
|
* style: Do not incorrectly share style across elements with different part names.Emilio Cobos Álvarez2020-02-121-7/+46
| | | | | | | | | Do the same we do for classes for now. We could be more precise and achieve a bit more sharing with some more effort (left a comment there), but it seems unlikely to matter in practice (and if we did that, we'd probably want to do the same for classes). Differential Revision: https://phabricator.services.mozilla.com/D58453
* Remove obsolete logic for LRUCache sizeMatt Brubeck2019-10-011-6/+3
| | | The LRUCache implementation has been replaced, and no longer requires a backing store larger than its capacity.
* style: Shutdown Servo's thread-pool in leak-checking builds, leak the atom ↵Emilio Cobos Álvarez2019-09-121-6/+5
| | | | | | table elsewhere. Differential Revision: https://phabricator.services.mozilla.com/D44217
* Auto merge of #23532 - est31:unused_code_removal_4, r=emiliobors-servo2019-06-071-9/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 -->
| * Remove unused code from selector and style cratesest312019-06-071-9/+0
| |
* | style: Add refcount logging to servo_arc.Emilio Cobos Álvarez2019-06-041-2/+6
|/ | | | Differential Revision: https://phabricator.services.mozilla.com/D32173
* style: Remove support for XBL resources.Emilio Cobos Álvarez2019-05-071-21/+0
| | | | | | So much unsound code going away :-) Differential Revision: https://phabricator.services.mozilla.com/D28380
* style: Don't share styles when an element has animations applied to it.Brian Birtles2019-02-231-0/+5
| | | | | | | | | | | | | | | | | | | | We already avoid putting styles in the shared style cache for an element that has animations[1] but if we are doing the initial style of two siblings where the _second_ has animations applied, there is nothing to stop us from trying to share with the first (un-animated) element. This patch adds a check to prevent sharing in that case since sharing style between animated elements is unsound for the reasons described in [1]. A number of tests including: testing/web-platform/tests/web-animations/animation-model/animation-types/visibility.html will fail without this fix once we remove the style flush from KeyframeEffect::SetKeyframes later in this patch series. [1] https://searchfox.org/mozilla-central/rev/6e3cc153566f5f288ae768a2172385b8436d61dd/servo/components/style/sharing/mod.rs#597 Differential Revision: https://phabricator.services.mozilla.com/D18913
* 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
|
* `cargo fix --edition`Simon Sapin2018-11-101-10/+10
|
* Reorder importsPyfisch2018-11-061-2/+2
|
* Format remaining filesPyfisch2018-11-061-4/+4
|
* servo_arc cleanups for publishing.Manish Goregaokar2018-09-181-3/+10
| | | | Differential Revision: https://phabricator.services.mozilla.com/D6034
* Format style component.chansuke2018-09-091-2/+1
|
* style: Fix the broken invariants of the rule node cache.Emilio Cobos Álvarez2018-06-231-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | We were spuriously reframing the <shadow> because it initially shared style with the <br>, which ended up being display: none, while the <shadow> should've been display: contents from the beginning. lookup_by_rules seems pretty prone to obscure bugs, and also it's pretty complex... Probably we should try to get rid of it, I'm unconvinced that it's worth it. Even with that, in a normal restyle the <details> wouldn't have ended up with a style. It of course never had it before the reframe because the <shadow> was display: none, but that doesn't mean it shouldn't have gotten one, since we detected we needed to go through kids in: https://searchfox.org/mozilla-central/rev/6eea08365e7386a2b81c044e7cc8a3daa51d8754/servo/components/style/matching.rs#500 That code did happen, but since it's an animation-only restyle, we don't look at unstyled stuff. That looks somewhat fishy, but I guess for now it's fine as long as display isn't animatable. Bug: 1469076 Reviewed-by: heycam MozReview-Commit-ID: B6NMSTNOKgK
* style: Make element-backed pseudos inherit from NAC subtree roots and other ↵Emilio Cobos Álvarez2018-06-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NAC inherit from their parents. Currently, NAC always inherits from the closest non-NAC ancestor element, regardless of whether it is for an element-backed pseudo or not. This patch changes the inheritance so that for element-backed pseudos, we inherit from the closest native anonymous root's parent, and for other NAC we inherit from the parent. This prevents the following two issues and allows us to remove the NODE_IS_NATIVE_ANONYMOUS flag: * Avoiding inheriting from the non-NAC ancestor in XBL bindings bound to NAC. - This is no longer a problem since we apply the rule only if we're a pseudo-element, and all pseudo-elements are in native anonymous subtrees. - This also allows to remove the hack that propagates the NODE_IS_NATIVE_ANONYMOUS flag from the ::cue pseudo-element from BindToTree. * Inheriting from the wrong thing if we're a nested NAC subtree. - We no longer look past our NAC subtree, with the exception of ::-moz-number-text's pseudo-elements, for which we do want to propagate ::placeholder to. A few rules from forms.css have been modified because they're useless or needed to propagate stuff to the anonymous form control in input[type="number"] which previously inherited from the input itself. Bug: 1460382 Reviewed-by: heycam MozReview-Commit-ID: IDKYt3EJtSH
* Run rustfmt on selectors, servo_arc, and style.Bobby Holley2018-04-101-49/+84
| | | | | | | | | | 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-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* style: Rename StyleContext to ComputedStyle.Emilio Cobos Álvarez2018-03-221-2/+1
| | | | | | | Bug: 1447483 Reviewed-by: jwatt MozReview-Commit-ID: KATZ6DkmpVY Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
* style: Don't share style with an element that has a different proto binding ↵Emilio Cobos Álvarez2018-03-121-4/+18
| | | | | | | | than us. See the lengthy comment about why... XBL sucks. MozReview-Commit-ID: 8UgeJAVkj6a
* style: Allow to share style across elements with similar XBL bindings.Emilio Cobos Álvarez2018-03-121-7/+11
|
* style: Reorder style sharing checks so that cheaper and broader ones are ↵Emilio Cobos Álvarez2018-03-081-23/+23
| | | | earlier.
* style: Remove get_ prefix from get_state and get_id.Emilio Cobos Álvarez2018-02-241-1/+1
|
* style: Remove some useless explicit dereferencing.Emilio Cobos Álvarez2018-02-241-2/+2
|
* selectors: Remove the get_ prefix from get_local_name and get_namespace.Emilio Cobos Álvarez2018-02-241-2/+2
|
* style: Use Option::get_or_insert_with.Emilio Cobos Álvarez2018-01-101-27/+24
| | | | Less unwraps is better.
* style: Add a necessary check for style sharing between ::slotted() nodes.Emilio Cobos Álvarez2018-01-091-0/+11
| | | | | | | | If two elements are assigned to different slots, even within the same shadow root, they could match different rules, due to the slot being assigned to yet another slot in another shadow root. MozReview-Commit-ID: CfZJCVxIQzM
* Update to uluru 0.2 and arrayvec 0.4Matt Brubeck2017-12-071-1/+1
|
* style: Remove redundant style sharing check.Emilio Cobos Álvarez2017-11-301-7/+2
| | | | We check that a few lines before calling test_candidate.
* style: Move lru_cache to its own crate.Emilio Cobos Álvarez2017-11-151-1/+1
| | | | One less crate pointlessly in components/.
* style: Make style sharing look at XBL / Shadow DOM rules.Emilio Cobos Álvarez2017-10-281-16/+30
| | | | | | Bug: 1412251 Reviewed-by: bz MozReview-Commit-ID: II6lk6OmSZU
* Backed out changeset fc813bf68348 for failing reftest ↵Gecko Backout2017-10-281-30/+16
| | | | | | layout/reftests/bugs/272646-1.xul on OS X. r=backout Backs out https://github.com/servo/servo/pull/19045
* style: Make style sharing look at XBL / Shadow DOM rules.Emilio Cobos Álvarez2017-10-281-16/+30
| | | | | | Bug: 1412251 Reviewed-by: bz MozReview-Commit-ID: II6lk6OmSZU
* Implement an nth-index cache.Bobby Holley2017-09-211-1/+1
| | | | MozReview-Commit-ID: Ee0um3QXkxl
* Introduce an NthIndexCache type and pipe it from ThreadLocalStyleContext to ↵Bobby Holley2017-09-201-1/+13
| | | | | | MatchingContext. Some future refactoring here to pass fewer things as parameters would be nice.
* Hoist lookup() into lru_cache.Bobby Holley2017-09-201-25/+2
| | | | MozReview-Commit-ID: F5FbKFqpXEh
* LRUCache::new -> LRUCache::default.Bobby Holley2017-09-201-1/+1
| | | | MozReview-Commit-ID: KouOaYTluRx
* Hoist the LRU cache into its own crate to share it with selectors.Bobby Holley2017-09-201-1/+1
|
* Bug 1401317 - Make second pass sharing sensitive to ↵Bobby Holley2017-09-191-0/+5
| | | | | | DISABLE_STYLE_SHARING_CACHE. r=emilio MozReview-Commit-ID: 8U0xekMHGg8