Commit graph

47279 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
c36a22a97f style: Don't recompute quirks mode -> case sensitivity over and over
The only reason we pass the quirks mode around is to compute the case
sensitivity, but we can just pass the later.

Differential Revision: https://phabricator.services.mozilla.com/D180527
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
5b184f448b style: Fix style invalidation on layer rule insertion
Layer insertion may change the order of styles, so we may need to fully
invalidate.

Without this change, bug 1838045 makes
layer-statement-before-import.html fail.

Differential Revision: https://phabricator.services.mozilla.com/D180929
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
50d7f882dd style: Container units should prevent us from sharing style by rule node
At least when the containers are different.

For now check that by doing a somewhat simplified test (checking
sibling-ness).

The new flag can be useful to optimize container query restyles on
resizes too, in the future.

Differential Revision: https://phabricator.services.mozilla.com/D179268
2023-11-24 08:57:14 +01:00
Ting-Yu Lin
07d6ec5d4b style: Remove obsolete comment to add use counter for developing CSS properties
The CSS properties in the list are all shipped. Since we still don't support use
counter for developing CSS properties since this bug opens, I assume this
feature is not critical. Hence the removal of the comment.

Differential Revision: https://phabricator.services.mozilla.com/D180771
2023-11-24 08:57:14 +01:00
Oriol Brufau
c1a622cf01 Further changes required by Servo 2023-11-24 08:57:14 +01:00
David Shin
ae5e0d49d8 style: Move ANCHORS_RELATIVE_SELECTOR out of nsINode flags
Move the flag to ComputedValueFlags, like `CONSIDERED_RELATIVE_SELECTOR`.

Differential Revision: https://phabricator.services.mozilla.com/D180726
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
9321265b38 style: Clean up Context::for_non_inherited_property
We don't ever check the particular property, so it can just be a
boolean.

Differential Revision: https://phabricator.services.mozilla.com/D180680
2023-11-24 08:57:14 +01:00
Oriol Brufau
1ad176f1bc Further changes required by Servo 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
3da0e44d98 style: Fix rebase conflict with bug 1837664 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
77c541b38a style: Do not snap -webkit-text-stroke-width to dev pixels
Introduce LineWidth (which doesn't snap) and let BorderSideWidth
wrap it and actually do the snapping.

Differential Revision: https://phabricator.services.mozilla.com/D180688
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
127e00e48a style: Improve border-image shorthand serialization, and annotate more passes 2023-11-24 08:57:14 +01:00
Oriol Brufau
733222fffe Further changes required by Servo 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
78f8d575b7 style: Don't allow to share style by rule node for links
(Regardless of visitedness)

Differential Revision: https://phabricator.services.mozilla.com/D180353
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
c8ccb52c9e style: Improve border shorthand serialization
Fix some bugs caught by css/cssom/shorthand-values. In particular:

  * Make the shorthand order match the spec.
  * Omit values when we can.

Fix a subtest that wasn't correct. Shorthands can be serialized as long
as !important matches in all components.

Differential Revision: https://phabricator.services.mozilla.com/D180466
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
cf3d31038c style: Minor clean-ups to border shorthand parsing
This doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D180465
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
7c8cf00033 style: Avoid selecting zero-resolution images in image-set
Fairly straight-forward. This fixes the two tests mentioned in comment 0
which aren't still in the repo.

Differential Revision: https://phabricator.services.mozilla.com/D180414
2023-11-24 08:57:14 +01:00
Oriol Brufau
5842cfc127 Further changes required by Servo 2023-11-24 08:57:14 +01:00
Andrew Osmond
42d9ec1106 style: Add method to parse CSS filters without context for workers
This patch adds the ability to parse most CSS filters without a context.
OffscreenCanvas can use this on worker threads to provide support for
filter operations.

Differential Revision: https://phabricator.services.mozilla.com/D179994
2023-11-24 08:57:14 +01:00
CanadaHonk
a10df24ffb style: Serialize NaN and infinity numbers
Added NaN/inf serialization of <number> and changed calc() code to not
remove NaN/infinity in code using it.

This change is unfortunately imperfect as some things using <number>
still refuse to serialize NaN/infinity for some reason (scale()?), but
this bug/patch is just for <number> so leaving that out of scope for
this.

Also added new WPT test file for number NaN/inf serialization based
on existing serialization tests (all pass already!).

5 other WPT subtests now newly pass.

Differential Revision: https://phabricator.services.mozilla.com/D178587
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
dcb61c095f style: Forbid negative CSS resolutions at parse time
Apply some clang-tidy suggestions while I was going through the
ServoStyleConstsInlines while at it.

Remove one 0x test because it's tested on the same test and causes a
harness error.

Differential Revision: https://phabricator.services.mozilla.com/D180331
2023-11-24 08:57:14 +01:00
Ting-Yu Lin
019c14cf0b style: Make flex-flow serialization interoperable
Differential Revision: https://phabricator.services.mozilla.com/D180270
2023-11-24 08:57:14 +01:00
Oriol Brufau
abc0c86fef Further changes required by Servo 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
d02c4e2fe9 style: Remove viewport rule code
Turns out Servo doesn't need this either, see
https://github.com/servo/servo/pull/29850.

Differential Revision: https://phabricator.services.mozilla.com/D180264
2023-11-24 08:57:14 +01:00
Oriol Brufau
0b75c1d9d1 Further changes required by Servo 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
23d60c2195 style: Unify parallel and sequential traversal scheduling
Use in_place_scope_fifo to spawn work into the thread pool while doing
work in the main thread.

Differential Revision: https://phabricator.services.mozilla.com/D179492
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
7771cf25a8 style: Remove :nth-child(... of) pref
We ship this, and the front-end uses it by default, so remove the pref.

Differential Revision: https://phabricator.services.mozilla.com/D180222
2023-11-24 08:57:14 +01:00
Boris Chiou
bcae33a43f style: Send offset-position to the compositor
We send offset-position to the compositor, just like other similar
properties, e.g. offset-rotate, offset-anchor. This includes extracting
this animation value, doing serialization and sending it via IPC.

So now we can run the animation of ray() on the compositor properly.

Differential Revision: https://phabricator.services.mozilla.com/D179862
2023-11-24 08:57:14 +01:00
Boris Chiou
2fef5d1a17 style: Add at <position> into ray() in style system
We reuse PositionOrAuto here, and let "auto" represent the situation when the
author omits "at <position>" because it has a special meaning.

https://drafts.fxtf.org/motion-1/#valdef-ray-at-position

Note: No need to update css/motion/parsing/offset-path-parsing-valid.html
because Blink added some to the upstream repo already.

Differential Revision: https://phabricator.services.mozilla.com/D179860
2023-11-24 08:57:14 +01:00
Boris Chiou
8b60424e29 style: Return Err() in to_animated_zero() for offset-path
It's unnecessary to implement ToAnimatedZero for this property and so we
return Err(()), just like other properties which also use basic shapes,
e.g. clip-path, shape-outside.

Differential Revision: https://phabricator.services.mozilla.com/D179859
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
52e2cc5ff0 style: Change some references to raw pointers in some FFI functions
Even tho https://github.com/rust-lang/rust/issues/112337 is IMO a rust
bug, it's easy to work around in our code and it doesn't really affect
expressiveness.

Differential Revision: https://phabricator.services.mozilla.com/D180065
2023-11-24 08:57:14 +01:00
Oriol Brufau
e792eba7c7 Further changes required by Servo 2023-11-24 08:57:14 +01:00
Jihye Hong
9e223342e7 style: Make content-visibility: auto forces contain-intrinsic-size to gain an auto value
When the content having `content-visibility: auto` and the specific value for `contain-intrinsic-size` is slightly out of the viewport,
its computed value keeps changing.
This patch makes `content-visibilty: auto` forces `contain-intrinsic-size` to gain an auto value to solve this issue.

Differential Revision: https://phabricator.services.mozilla.com/D174583
2023-11-24 08:57:14 +01:00
Oriol Brufau
dcbeb2f1ab Further changes required by Servo 2023-11-24 08:57:14 +01:00
Mike Hommey
39bc94a4f7 style: Update serde_with to 3.0.0
We upgrade enumset alongside so that we keep only one copy of darling.

Differential Revision: https://phabricator.services.mozilla.com/D179651
2023-11-24 08:57:14 +01:00
Boris Chiou
e1b6632313 style: Update the syntax of offset-position
Now it supports "normal" keyword. Also, offset-position doesn't create
stacking context and it doesn't have offset transform, so we can
simplify CompareMotionValues() a little bit.

Note: We don't have to add test in [1] because Blink added one to WPT
upstream repo already.

[1] css/motion/parsing/offset-position-parsing-valid.html

Note: the usage of offset-position is in other bugs.

Differential Revision: https://phabricator.services.mozilla.com/D179623
2023-11-24 08:57:14 +01:00
Oriol Brufau
0fd2f08da1 Further changes required by Servo 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
7b4fb5dc22 style: Simplify border snapping
Make the computed value of border-like properties app units (which is
effectively what happens in Gecko already), and clamp at computed value
time.

Differential Revision: https://phabricator.services.mozilla.com/D179481
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
ad72081ac8 style: Rustfmt servo/. r=zrhoffman
$ find servo -name '*.rs' | xargs rustup run nightly rustfmt

Depends on D179380

Differential Revision: https://phabricator.services.mozilla.com/D179381
2023-11-24 08:57:14 +01:00
Oriol Brufau
68cbe6833d Further changes required by Servo 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
6728158188 style: Use non-locked rules for all rule types that can
Anything that doesn't need interior mutability doesn't need Locked<>
around it.

Depends on D179059

Differential Revision: https://phabricator.services.mozilla.com/D179060
2023-11-24 08:57:14 +01:00
Zach Hoffman
0aed54f636 style: [css-properties-values-api] Remove Locked<> from CssRule::Property arc
Depends on D179038

Differential Revision: https://phabricator.services.mozilla.com/D179039
2023-11-24 08:57:14 +01:00
Oriol Brufau
cd67a09ac1 Further changes required by Servo 2023-11-24 08:57:14 +01:00
David Shin
ff8100d396 style: Correct style sharing handling for any element that considered :has() in selector matching
For any element that anchors a `:has()` selector (i.e. Matches a selector that
contains a `:has()` on its rightmost side), we prevent style sharing altogether,
as evaluation of the `:has()` selector is required in the first place to
determine style sharing.

On the other hand, any element matching a rule containing `:has()` without
anchoring it can do style sharing for siblings, but not cousins.

Differential Revision: https://phabricator.services.mozilla.com/D176836
2023-11-24 08:57:14 +01:00
Zach Hoffman
5c0897c8eb style: [css-properties-values-api] Share PropertyRule instance when cloning CssRule::Property
Differential Revision: https://phabricator.services.mozilla.com/D178892
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
48f2f475c6 style: Flush parent document layout if needed for viewport dependent media queries
This is necessary to properly report changes in our document.

The remaining failures are about change event scheduling, which is a
pre-existing issue. Will fix, but in a separate bug.

Differential Revision: https://phabricator.services.mozilla.com/D178917
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
ad81122fcf style: More gracefully deal with broken calls into selector matching
If this happens again, it might be worth not matching rather than
potentially crashing. Though I guess crashing is a very good way getting
it reported soon...

Differential Revision: https://phabricator.services.mozilla.com/D178921
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
b329d547be style: Properly increase the nesting level when matching :nth-child(of) selectors
Differential Revision: https://phabricator.services.mozilla.com/D178920
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
520f851d8c style: Simplify some appearance code
I was looking into simplifying our scrollbar styles:

  * StyleAppearance::Resizer is not used in content, and some of the
    values were only for <xul:window> which are not supported anymore.

  * Statusbarpanel and Resizerpanel aren't used. Statusbar is only used
    once on macOS so we only need to keep it there.

Differential Revision: https://phabricator.services.mozilla.com/D178374
2023-11-24 08:57:14 +01:00
Oriol Brufau
7d72d7c385 Further changes required by Servo 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
d49b014c78 style: Make style parallel traversal more tunable at runtime
This adds two prefs to configure the parallel traversal work item size
and kick-off threshold, but otherwise shouldn't change behavior.

I switched from iterator generics to just a slice while at it, mostly
for simplicity, but there is a trade-off:

  * When switching from sequential to parallel traversal, we potentially
    pay the price of memmoving the VecDeque around once to make them a
    contiguous slice.

  * However we win in the common case of the smaller-than-work-unit size
    in which case we no longer need to copy stuff to a WorkItem. So I
    think overall this should be an improvement.

Differential Revision: https://phabricator.services.mozilla.com/D178656
2023-11-24 08:57:14 +01:00