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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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