Commit graph

3458 commits

Author SHA1 Message Date
Oriol Brufau
d76fe81600 Further changes required by Servo 2023-11-06 09:35:57 +01:00
Fred Chasen
9d41dd1ad9 style: Add forced-color-adjust property
Adds the forced-color-adjust property and ForcedColorAdjust keywords.
Updates tweak_when_ignoring_colors to check for `none` value of that property when determining if a color adjustment in needed.
Adds a check for `none` when styling selections to make sure they can be styled in forced color modes.

Differential Revision: https://phabricator.services.mozilla.com/D169000
2023-11-06 09:35:57 +01:00
Oriol Brufau
53cddb1886 Further changes required by Servo 2023-11-06 09:35:57 +01:00
Emilio Cobos Álvarez
8997888c6f style: Expose line-height resolution to style, and use it from ToResolvedValue
For ToResolvedValue implementation purposes we wouldn't need to split
out the vertical / font / line-height arguments and we could just pass
around the ComputedStyle, but the lh unit would need that distinction,
(because computing lh on font properties should use the parent style).

Differential Revision: https://phabricator.services.mozilla.com/D168705
2023-11-06 09:35:57 +01:00
Jonathan Kew
816a0f960b style: Fixes for font-language-override parsing and tests
Differential Revision: https://phabricator.services.mozilla.com/D168555
2023-11-06 09:35:57 +01:00
Jonathan Kew
2d441672be style: Ensure font-variant-alternates values are serialized in canonical order
Differential Revision: https://phabricator.services.mozilla.com/D168281
2023-11-06 09:35:57 +01:00
Jonathan Kew
3de6f5a887 style: Avoid redundantly serializing the initial value of font-weight (400) as part of the font shorthand in computed style
Differential Revision: https://phabricator.services.mozilla.com/D168250
2023-11-06 09:35:57 +01:00
Jonathan Kew
8a2cfc0b24 style: Use write_char in place of write_str when serializing single-character literals
Generated by running

  find servo/components/style -name "*.rs" -exec perl -p -i -e "s/write_str\(\"(.)\"\)/write_char('\1')/g" {} \;

(and then added `use std::fmt::Write;` in a couple of places to fix build errors that arose).

Differential Revision: https://phabricator.services.mozilla.com/D168217
2023-11-06 09:35:57 +01:00
Jonathan Kew
05fb1b62b7 style: Implement the font-synthesis-{weight,style,small-caps} longhand properties, and make font-synthesis into a shorthand
Differential Revision: https://phabricator.services.mozilla.com/D167480
2023-11-06 09:35:57 +01:00
Boris Chiou
b024f5b2e7 style: Make scroll-timeline-{name|axis} be a coordinating list property group
Named scroll progress timelines are declared in the coordinated value list
constructed from the longhands of the scroll-timeline shorthand property,
which form a coordinating list property group with scroll-timeline-name as
the coordinating list base property.

In the meantime, we also update its shorthand to match the current spec.

Differential Revision: https://phabricator.services.mozilla.com/D166596
2023-11-06 09:35:57 +01:00
Boris Chiou
6542bb135e style: Update scroll-timeline shorthand syntax in WPT
The syntax of scroll-timeline shorthand is:
  `[ <'scroll-timeline-name'> <'scroll-timeline-axis'>? ]#`.

This patch just updates WPT to match the spec.
Our fix will be together with Bug 1809005.

Differential Revision: https://phabricator.services.mozilla.com/D166595
2023-11-06 09:35:57 +01:00
Boris Chiou
39f57649da style: Support view-timeline shorthand
view-timeline shorthand includes view-timeline-name and
view-timeline-axis, but excludes view-timeline-inset.

Note: We will fix the test of "view-timeline-name: auto" in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D166404
2023-11-06 09:35:57 +01:00
Boris Chiou
835268aec2 style: Support view-timeline-inset in style system
Support view-timeline-inset: `[ [ auto | <length-percentage> ]{1,2} ]#`.
And its initial value is 0.

Differential Revision: https://phabricator.services.mozilla.com/D166243
2023-11-06 09:35:57 +01:00
Boris Chiou
b5b64af3f1 style: Support view-timeline-name and view-timeline-axis in style system
view-timeline-name: `none | <custom-ident>#`
view-timeline-axis: `[ block | inline | vertical | horizontal ]#`

Note:
Both view-timeline-name and scroll-timeline-name should accept `auto`.
We will fix it in this patch series.

Differential Revision: https://phabricator.services.mozilla.com/D166242
2023-11-06 09:35:57 +01:00
Tiaan Louw
4559546fbb style: Add lab(), lch(), oklab(), oklch() to specified colors
Use new changes from cssparser and use the new lab/lch/oklab/oklch color
formats.

Introduced a new color type AbsoluteColor.  It represents any kind of
color that has absolute numerical values.  It is also tied to a color
space and therefore can be trivially converted to another color space.

Differential Revision: https://phabricator.services.mozilla.com/D163579
2023-11-06 09:35:57 +01:00
Emilio Cobos Álvarez
6ce64abe7e style: Clean up list interpolation code
Factor out duplicated / common code to its own module, add / fix spec
links, and clean-up callers.

Differential Revision: https://phabricator.services.mozilla.com/D167253
2023-11-06 09:35:57 +01:00
Emilio Cobos Álvarez
979637de7d style: Remove some duplicated code for coordinated properties
Differential Revision: https://phabricator.services.mozilla.com/D167130
2023-11-06 09:35:57 +01:00
Emilio Cobos Álvarez
fe8cdbe328 style: Use the same computed time representation between Servo and Gecko
Same as above.

Differential Revision: https://phabricator.services.mozilla.com/D167126
2023-11-06 09:35:57 +01:00
Emilio Cobos Álvarez
b96f8f748c style: Share computed animation-iteration-count representation between Servo and Gecko
This removes the special AnimationIterationCount -> f32 conversion from
gecko.mako.rs which will be useful to simplify coordinated properties.

Differential Revision: https://phabricator.services.mozilla.com/D167123
2023-11-06 09:35:57 +01:00
Jonathan Watt
dd372eb5c2 style: Style changes to support the 'page-orientation' property
Differential Revision: https://phabricator.services.mozilla.com/D161800
2023-11-04 08:17:09 +01:00
Ziran Sun
e38d2369c5 style: Serialization differences with "columns" with one or more auto value
Differential Revision: https://phabricator.services.mozilla.com/D166087
2023-11-04 08:17:09 +01:00
Ben Freist
2edc1139b6 style: [refactor] Migrate NS_STYLE_LIST_STYLE_POSITION_* defines
Differential Revision: https://phabricator.services.mozilla.com/D166140
2023-11-04 08:17:09 +01:00
Jonathan Kew
e51b9b8e1c style: Remove spurious mention of FontStyleAdjust from style/properties/data.py
There's no font-style-adjust property, and no FontStyleAdjust type anywhere I can see.
So the mention in data.py is redundant (and potentially confusing).

Differential Revision: https://phabricator.services.mozilla.com/D166127
2023-11-04 08:17:09 +01:00
Jonathan Kew
2f64ef0d81 style: Compute font-size-adjust early, so that we get the correct used font size for font-dependent units
Differential Revision: https://phabricator.services.mozilla.com/D165842
2023-11-04 08:17:09 +01:00
Boris Chiou
425a92143d style: Rename scroll-linked (animations) to scroll-driven (excluding WPT tests)
The spec is still using `Scroll-linked`, so we exclude the change of WPT tests.
I believe WPT will get updates once the spec doc is renamed.

Differential Revision: https://phabricator.services.mozilla.com/D165914
2023-11-04 08:17:09 +01:00
Oriol Brufau
65e8b71b0f style: Compute column-rule-width to 0 when column-rule-style is none
Depends on D164554

Differential Revision: https://phabricator.services.mozilla.com/D164549
2023-11-04 08:17:09 +01:00
Emilio Cobos Álvarez
18b9e1b615 style: Use used, rather than computed font-size for font-metric dependent units
Differential Revision: https://phabricator.services.mozilla.com/D165737
2023-11-04 08:17:09 +01:00
Oriol Brufau
2389650734 Further changes required by Servo 2023-11-04 08:17:09 +01:00
Emilio Cobos Álvarez
92742f7f90 style: Avoid generic soup and extra reference count bumps
This makes me a bit happier about the previous patch :)

Differential Revision: https://phabricator.services.mozilla.com/D165236
2023-11-04 08:17:09 +01:00
Oriol Brufau
40f5dbb1ab style: Fix container units on ::backdrop
Differential Revision: https://phabricator.services.mozilla.com/D165542
2023-11-04 08:17:09 +01:00
Oriol Brufau
65fbb16bb4 style: Partial fix for container units in pseudo-elements
When apply_declarations is used for a pseudo-element, make it pass the
parent_style as the originating_element_style for container queries.

This requires changing some parameters from Option<&Arc<ComputedValues>>
to Option<&ComputedValues>.

It's not a complete solution, since e.g. parent_style is not the style
of the originating element of a ::backdrop. But here it's not as simple
as in D164908, so leaving these details for later.

Differential Revision: https://phabricator.services.mozilla.com/D164977
2023-11-04 08:17:09 +01:00
Ben Freist
16207872f9 style: [refactor] Migrate NS_STYLE_TEXT_DECORATION_STYLE_* defines
Differential Revision: https://phabricator.services.mozilla.com/D163177
2023-11-04 08:17:09 +01:00
Oriol Brufau
661e7d5c48 style: Fix elements not being query containers for the pseudo-element they originate. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D164807
2023-11-04 08:17:09 +01:00
Emilio Cobos Álvarez
c511b9c3f9 style: Unconditionally enable container properties in UA sheets
If the UA sheet gets parsed with the pref off, and then the pref gets
flipped on, we don't re-parse the UA sheet (nor we want to).

Enable the property in UA sheets unconditionally so that the test passes
even when the browser was started-up with the container queries pref
off.

Differential Revision: https://phabricator.services.mozilla.com/D164823
2023-11-04 08:17:09 +01:00
Emilio Cobos Álvarez
cd50d30c31 style: Fix outline-style: inherit behavior if you don't specify outline-width
The fix is calling set_outline_style so that we also reset the actual
outline width. Also clean-up surrounding code a little bit to be
marginally more efficient, and do the same change for border-*-style
(which was doing the right thing, but it's better to make sure both stay
in sync).

Differential Revision: https://phabricator.services.mozilla.com/D164554
2023-11-04 08:17:09 +01:00
Jonathan Kew
6162f82c6b style: Remove 'font-palette' from the 'font' shorthand
Differential Revision: https://phabricator.services.mozilla.com/D164128
2023-11-04 08:17:09 +01:00
Oriol Brufau
7ec4c53266 style: Fix style containment not triggered by 'contain'
'container-type' and 'content-visibility' can trigger various kinds of
containment, but this was done via nsStyleDisplay::EffectiveContainment,
to avoid affecting the computed value of 'contain'.

This was fine except for style containment, which needs to set the flag
SELF_OR_ANCESTOR_HAS_CONTAIN_STYLE in order to really work, but this was
only done with 'contain: style'.

So this patch removes nsStyleDisplay::EffectiveContainment, and instead
uses two fields for containment: mContain and mEffectiveContainment.
This is somewhat analogous to mDisplay and mOriginalDisplay, though in
that case the computed value is the modified display.

Also fixes a typo in IsContainStyle() that made it return true for any
kind of containment, not just for style containment.

Differential Revision: https://phabricator.services.mozilla.com/D163779
2023-11-04 08:17:09 +01:00
Emilio Cobos Álvarez
11313368ac style: Remove non-standard and unused system font values
And hide internal but used values. System fonts are not exposed in the
computed style so this should be fine.

If we need the old values for some obscure reason, it's trivial to alias
them to e.g., menu or so.

Differential Revision: https://phabricator.services.mozilla.com/D163269
2023-11-04 08:17:09 +01:00
Thomas Wisniewski
62dddfb2a6 style: Alias -webkit-clip-path to clip-path for webcompat
Differential Revision: https://phabricator.services.mozilla.com/D162674
2023-11-04 08:17:09 +01:00
Ben Freist
4b9fc07522 style: [refactor] Migrate NS_STYLE_UNICODE_BIDI_* defines
Differential Revision: https://phabricator.services.mozilla.com/D162487
2023-11-04 08:17:09 +01:00
Oriol Brufau
f9c55a2971 style: Exclude 'size' from the 'all' shorthand
Differential Revision: https://phabricator.services.mozilla.com/D162568
2023-11-04 08:17:09 +01:00
Ben Freist
717e4acefb style: [refactor] Migrate NS_STYLE_TEXT_COMBINE_UPRIGHT_* defines
Differential Revision: https://phabricator.services.mozilla.com/D161965
2023-11-04 08:17:09 +01:00
Jonathan Kew
17d33183c2 style: Fix serialization of the font-variant shorthand when font-variant-emoji is preffed off
Depends on D160256

Differential Revision: https://phabricator.services.mozilla.com/D160257
2023-11-03 08:59:49 +01:00
Emilio Cobos Álvarez
b2ab136cd9 style: Simplify container-type implementation
It was made a bitfield so that we could include style. But then style
containment was removed and the bitfield keeps causing us to do wrong
check (since INLINE_SIZE intersects SIZE).

So just make it an enum. This causes a progression and a test that
failed now times out (which is a pre-existing issue, just like the
pseudo-elements test that times out).

Differential Revision: https://phabricator.services.mozilla.com/D160371
2023-11-03 08:59:49 +01:00
Oriol Brufau
8a5ba3fe16 Further changes required by Servo 2023-11-03 08:59:49 +01:00
Emilio Cobos Álvarez
efdf518acc style: Remove system font support for various font longhands
We don't use them[1], and these are generally not properties that
authors would be able to set via the font shorthand anyways.

Let's simplify the code. This fixes the font-variant bug and also
unblocks further clean-ups of these properties in the future.

[1]: https://searchfox.org/mozilla-central/rev/59f0bf3c13dd455d9f5415b89178de701ea6b850/widget/LookAndFeelTypes.ipdlh#12-18

Differential Revision: https://phabricator.services.mozilla.com/D160352
2023-11-03 08:59:49 +01:00
sskcvqikf
8dcf5cddca style: Change NS_STYLE_MATH_STYLE_* macros to enum StyleMathStyle
Differential Revision: https://phabricator.services.mozilla.com/D160016
2023-11-03 08:59:49 +01:00
Jonathan Kew
8149cd4a0c style: Add support for the CSS font-variant-emoji property to the style system
Differential Revision: https://phabricator.services.mozilla.com/D147494
2023-11-03 08:59:49 +01:00
Emilio Cobos Álvarez
5ded58a2b1 style: Allow propagating computed style bits from the selector-matching process
This allows us to propagate flags from the container query styles all the
way to the computed style of the element.

The flag for viewport units in container queries has to be different
because it requires rematching, see comments.

Depends on D159851

Differential Revision: https://phabricator.services.mozilla.com/D159852
2023-11-03 08:59:49 +01:00
David Shin
27958b191a style: Enable lookup and computation of container size queries
Differential Revision: https://phabricator.services.mozilla.com/D158057
2023-11-03 08:59:49 +01:00