Граф коммитов

14057 Коммитов

Автор SHA1 Сообщение Дата
Emilio Cobos Álvarez efb7960dba Bug 1768905 - Lint and 32-bit build fix.
MANUAL PUSH: Bustage fix CLOSED TREE
2022-05-11 21:43:39 +02:00
Emilio Cobos Álvarez 96360cdae3 Bug 1768905 - Move size of tests to compile-time tests in the style crate. r=dshin
Same reasoning as the previous commit.

Differential Revision: https://phabricator.services.mozilla.com/D146104
2022-05-11 19:02:58 +00:00
Emilio Cobos Álvarez 2cf5c869e6 Bug 1768905 - Convert specified value tests to compile-time tests. r=dshin
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
2022-05-11 19:02:57 +00:00
Emilio Cobos Álvarez 85f479d39b Bug 1767837 - Use debug_unreachable!() in matches_simple_selector. r=boris
This shrinks the function by avoiding generating rather noisy panic
code.

Depends on D145486

Differential Revision: https://phabricator.services.mozilla.com/D145487
2022-05-07 04:02:26 +00:00
Emilio Cobos Álvarez d8af45934c Bug 1767837 - Reorder some variants. r=boris
This doesn't make a difference, I was hoping it would allow us to remove the
special-casey code we have here:

  https://searchfox.org/mozilla-central/rev/997a56b018662e2940c99bbaf57a6ac9d1aa5422/servo/components/selectors/matching.rs#610-632

But it doesn't. Still I think it doesn't hurt tho, shouldn't change behavior.

Depends on D145485

Differential Revision: https://phabricator.services.mozilla.com/D145486
2022-05-07 04:02:25 +00:00
Emilio Cobos Álvarez 6ccaf80d38 Bug 1767837 - Simplify a bit hot selector-matching loop. r=boris
Note that element.clone() is just copying a couple pointers.

Have a single place where we compute the next element and check for linky-ness.
This saves a couple checks (very very minor win in the micro-benchmark I've
been looking at, but consistent).

Depends on D145484

Differential Revision: https://phabricator.services.mozilla.com/D145485
2022-05-06 23:52:23 +00:00
Emilio Cobos Álvarez 57b3d45319 Bug 1767837 - Compute hover / active quirk state lazily. r=boris
This makes the inner function much smaller which improves selector-matching
performance very mildly for the benchmarks I've been looking at. Also, this
should help selector matching on quirks mode by only doing this when we
actually find :hover / :active pseudo-classes.

Differential Revision: https://phabricator.services.mozilla.com/D145484
2022-05-06 23:52:23 +00:00
David Shin 23aa8d22fb Bug 1764126 - Part 1: Implement piecewise linear function. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D145256
2022-05-06 11:49:53 +00:00
Emilio Cobos Álvarez c71796d3cd Bug 1767307 - Fix layer statement rules with multiple layer names.
MANUAL PUSH: Trivial orange fix CLOSED TREE.
2022-05-06 13:57:08 +02:00
Emilio Cobos Álvarez d5100d0cd4 Bug 1767307 - Track @container condition id in style rules. r=boris
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
2022-05-06 10:30:01 +00:00
Emilio Cobos Álvarez b15e2bd5ee Bug 1767625 - Simplify selector flags setup even more. r=boris
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
2022-05-06 08:17:20 +00:00
Emilio Cobos Álvarez b73c08693f Bug 1768004 - Remove proton places tooltip code. r=dao
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
2022-05-05 16:18:17 +00:00
Emilio Cobos Álvarez 351616349b Bug 1469174 - Implement media feature expression multi-range syntax. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D145231
2022-05-03 15:50:13 +00:00
Emilio Cobos Álvarez 997a56b018 Bug 1759686 - Extend part 4 to resolve keyword sizes correctly, and reuse existing code to turning lengths into absolute pixels. r=jfkthame
I think it doesn't make sense to support em/percentages without
supporting smaller/bigger/other font-relative things.

I have many questions about how other units like viewport-units etc are
supposed to behave. Blink seems to resolve viewport units to zero:

  https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/css/resolver/font_style_resolver.cc;l=15-27;drc=5e62802ab420dc1743a1824ec4b537a730b2b24b

Which might be reasonable, but I think keeping a simple model consistent
with what other code like DOMMatrix does seems better for now.

Differential Revision: https://phabricator.services.mozilla.com/D144455
2022-05-03 12:39:10 +00:00
Jonathan Kew 746059b94b Bug 1759686 - patch 4 - Extend ServoCSSParser::ParseFontShorthandForMatching to (optionally) return font size in addition to family/style. r=emilio
When running in a Worker, the canvas2d SetFontInternal method can't call GetFontStyleForServo
because it doesn't have a canvasElement or presShell to pass. But we can use the method
ServoCSSParser::ParseFontShorthandForMatching to parse the canvas 'font' property, if we
extend it so as to also return the size from the font shorthand.

(This is incomplete by itself; Emilio's following patch fixes it up, so the intention is to land them together.)

Depends on D144186

Differential Revision: https://phabricator.services.mozilla.com/D144187
2022-05-03 12:39:09 +00:00
Emilio Cobos Álvarez 8417767d09 Bug 1469174 - Refactor media feature expression representation in preparation to support multi-range syntax. r=boris
No behavior change.

Depends on D145229

Differential Revision: https://phabricator.services.mozilla.com/D145230
2022-05-02 23:40:28 +00:00
Emilio Cobos Álvarez 46a3603363 Bug 1469174 - Factor out parsing the query feature name. r=boris
No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D145229
2022-05-02 20:27:55 +00:00
Emilio Cobos Álvarez 6a8d7ff269 Bug 1766889 - Fix insertRule with layer statements before imports. r=firefox-style-system-reviewers,layout-reviewers,boris
We need to do a bit more nuanced check because @layer statements might
go before imports.

Differential Revision: https://phabricator.services.mozilla.com/D144996
2022-04-29 11:29:37 +00:00
Emilio Cobos Álvarez 14f8cafbc3 Bug 1766655 - Introduce Optional<T> to represent optional values in the style system. r=dshin
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
2022-04-27 15:30:54 +00:00
Emilio Cobos Álvarez 0f45f078ef Bug 1766020 - Add support for parsing container-query-specific features. r=firefox-style-system-reviewers,layout-reviewers,boris
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
2022-04-27 10:52:32 +00:00
Narcis Beleuzu fc786a2667 Backed out 1 changesets (bug 1766020) for bc failures on browser_modal_print.js . CLOSED TREE
Backed out changeset 10118450bd7f (bug 1766020)
2022-04-27 12:34:31 +03:00
Emilio Cobos Álvarez 490d5e355e Bug 1766020 - Add support for parsing container-query-specific features. r=firefox-style-system-reviewers,layout-reviewers,boris
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
2022-04-27 07:32:07 +00:00
Emilio Cobos Álvarez 7d2ab62323 Bug 1766046 - cleanup animation-name. r=boris
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
2022-04-25 08:23:51 +00:00
Butkovits Atila 206c96bde0 Backed out changeset dfec425c53fe (bug 1766046) for causing wpt failures at animation-timeline-computed.html. CLOSED TREE 2022-04-25 11:06:51 +03:00
Emilio Cobos Álvarez e097b4be55 Bug 1765999 - Move some of the media query code to a more generic queries module. r=hiro
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
2022-04-24 21:48:02 +00:00
Emilio Cobos Álvarez 63420746b0 Bug 1766046 - cleanup animation-name. r=boris
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
2022-04-24 21:47:31 +00:00
Emilio Cobos Álvarez c42ed6e96e Bug 1765746 - Tweak contain bitflag definition order to avoid static constructors. r=dshin
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
2022-04-21 17:23:38 +00:00
Boris Chiou b34f4349a7 Bug 1737918 - Part 1: Add scroll() to animation-timeline for style system. r=emilio
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
2022-04-21 17:05:17 +00:00
Noemi Erli 560b5ccdb5 Backed out 4 changesets (bug 1737918) for causing bustages in ScrollTimeline.cpp CLOSED TREE
Backed out changeset cecdd071c1aa (bug 1737918)
Backed out changeset fcc5ecd364e4 (bug 1737918)
Backed out changeset f7bf3143e4a7 (bug 1737918)
Backed out changeset a143d2e54fb9 (bug 1737918)
2022-04-21 01:21:14 +03:00
Boris Chiou e8ad45ee42 Bug 1737918 - Part 1: Add scroll() to animation-timeline for style system. r=emilio
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
2022-04-20 20:28:52 +00:00
Noemi Erli 276b91ca80 Backed out changeset 7985a1fa0789 (bug 1764768) for causing multiple failures CLOSED TREE 2022-04-20 22:25:02 +03:00
Emilio Cobos Álvarez 485bae6d11 Bug 1764768 - Don't truncate viewport units at computed value time. r=dholbert
Instead, make the behavior consistent across all <length-percentage>
values (by truncating instead of rounding). This is the already-existing
behavior for calc() and percentages, but with this patch we also apply
it to plain length-flavored <length-percentage> values (this is needed
to avoid regressing things like bug 989802).

Regular <length>s keep rounding, to preserve existing behavior. We can
consider changing that in a follow-up if need be.

Differential Revision: https://phabricator.services.mozilla.com/D143857
2022-04-20 17:22:36 +00:00
Emilio Cobos Álvarez 25f4c3b0e6 Bug 1765489 - Make media feature evaluation take a computed::Context. r=dshin
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
2022-04-20 15:30:02 +00:00
Emilio Cobos Álvarez ee2dcf8fe6 Bug 1765550 - Move transitions and animations to nsStyleUIReset. r=dshin
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
2022-04-20 15:13:54 +00:00
Emilio Cobos Álvarez 086cb3d7f3 Bug 1765401 - Simplify media query evaluation code a bit. r=boris
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
2022-04-20 09:01:25 +00:00
Butkovits Atila df73a7b008 Backed out changeset 3d29e3e5525b (bug 1765401) for causing reftest failures at mediaqueries. CLOSED TREE 2022-04-20 09:53:50 +03:00
Emilio Cobos Álvarez ee81fcef78 Bug 1765401 - Simplify media query evaluation code a bit. r=firefox-style-system-reviewers,layout-reviewers,boris
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
2022-04-20 05:50:46 +00:00
David Shin ec93876623 Bug 1755565 - Implement `contain: inline-size`. r=emilio,dholbert
Differential Revision: https://phabricator.services.mozilla.com/D143501
2022-04-19 17:44:16 +00:00
Emilio Cobos Álvarez 5d9aa3dd08 Bug 1764768 - Don't go through app-units-ratio to convert absolute lengths. r=dholbert
This doesn't change behavior on its own, but the current code introduces
some minor floating point error which we can avoid, and which would
cause failures with the other patch on the bug.

Differential Revision: https://phabricator.services.mozilla.com/D143942
2022-04-19 08:39:29 +00:00
Emilio Cobos Álvarez 8db82eda4b Bug 1765006 - Clean-up viewport unit resolution a bit. r=hiro
I should've caught this when reviewing the new viewport units but alas :-)

Differential Revision: https://phabricator.services.mozilla.com/D143856
2022-04-18 00:58:19 +00:00
Emilio Cobos Álvarez 19938e39bf Bug 1764217 - Fix visited handling after bug 1763750. r=hiro
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
2022-04-13 23:11:44 +00:00
Nika Layzell 584d8e8388 Bug 1713773 - Part 2: Join servo style threads during shutdown, r=emilio
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
2022-04-12 20:22:24 +00:00
Emilio Cobos Álvarez 39d7652297 Bug 1656363 - Implement prefers-contrast: custom and let prefers-contrast ride the trains. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D143198
2022-04-12 09:07:18 +00:00
Hiroyuki Ikezoe 9fad1de770 Bug 1610815 - Implement new *vi and *vb units. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D143253
2022-04-12 04:06:38 +00:00
Hiroyuki Ikezoe 64b87a50a6 Bug 1610815 - Implement new {small,large,dynamic} viewport units. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D143252
2022-04-12 04:06:38 +00:00
Emilio Cobos Álvarez 46b85a0f91 Bug 1763750 - Tweak cascade priority to split writing-mode and font properties. r=hiro
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
2022-04-08 15:55:11 +00:00
Emilio Cobos Álvarez 37716ddbc3 Bug 1763644 - Add basic @container rule parsing and boilerplate. r=firefox-style-system-reviewers,layout-reviewers,boris
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
2022-04-08 04:15:40 +00:00
Butkovits Atila 3e31b63b4f Backed out 2 changesets (bug 1763644, bug 1762474)for causing failures at idlharness.html. CLOSED TREE
Backed out changeset 6c5ac0c99219 (bug 1762474)
Backed out changeset 8b625593255f (bug 1763644)
2022-04-08 07:01:01 +03:00
Emilio Cobos Álvarez 898b3335be Bug 1763644 - Add basic @container rule parsing and boilerplate. r=firefox-style-system-reviewers,layout-reviewers,boris
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
2022-04-08 00:01:26 +00:00
Butkovits Atila c1d171544c Backed out 2 changesets (bug 1763644, bug 1762474) for causing failures at test_interfaces.html. CLOSED TREE
Backed out changeset 6a588f6d08f7 (bug 1762474)
Backed out changeset ff486de30883 (bug 1763644)
2022-04-08 02:26:22 +03:00