Commit graph

47133 commits

Author SHA1 Message Date
Christian Sonne
c4ae5c93a8 style: add subgrid to list of suggestions for grid-template-* properties
Differential Revision: https://phabricator.services.mozilla.com/D169862
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
Emilio Cobos Álvarez
aa810f77ec style: Use non-native menus in Windows for documents where we don't have a native theme
Untested, but it should work.

Differential Revision: https://phabricator.services.mozilla.com/D169836
2023-11-06 09:35:57 +01:00
Tiaan Louw
a9998e899b style: Move AbsoluteColor to common color module
Differential Revision: https://phabricator.services.mozilla.com/D169607
2023-11-06 09:35:57 +01:00
Tiaan Louw
169c2682d5 style: Add missing color conversions
The patch adds some of the color conversions away from sRGB.

Differential Revision: https://phabricator.services.mozilla.com/D168895
2023-11-06 09:35:57 +01:00
Emilio Cobos Álvarez
dc295dad31 style: Implement ipdl reads without needing default ctors
Differential Revision: https://phabricator.services.mozilla.com/D149743
2023-11-06 09:35:57 +01:00
Emilio Cobos Álvarez
a55ae0ee90 style: Hint directionality of label content for crop="start" labels
Differential Revision: https://phabricator.services.mozilla.com/D168788
2023-11-06 09:35:57 +01:00
Nicolas Chevobbe
647434532d style: [devtools] Add color to DevTools autocomplete
Differential Revision: https://phabricator.services.mozilla.com/D168520
2023-11-06 09:35:57 +01:00
Jonathan Kew
0bf39dc3d3 style: Resolve <number> to <length> in ToResolvedValue for line-height
This makes the serialization of the 'font' shorthand on computed style return the line-height
as an absolute length rather than a number (font-size multiplier), which is consistent with
what the line-height longhand already returns, and with other browsers.

(See also https://github.com/w3c/csswg-drafts/issues/8385.)

Differential Revision: https://phabricator.services.mozilla.com/D168542
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
Oriol Brufau
dbd3eab9cd Further changes required by Servo 2023-11-06 09:35:57 +01:00
Jonathan Kew
449fe2338e style: Create a pref to list icon font families that should be used even when use_document_fonts=0, overriding the browser's font prefs
Some widely-used icon fonts use ligature rules to replace icon names such as "volume_up"
or "down_arrow" with icon glyphs. If the site is designed to use such a font, but the user
disables document fonts and we use our default Latin font instead, the underlying text will
be rendered instead of the intended icon.

To enable such fonts to continue to work, we provide a list of known ligature-icon fonts
and allow them to be used even when the document-fonts setting is disabled.

Differential Revision: https://phabricator.services.mozilla.com/D167923
2023-11-06 09:35:57 +01:00
Tiaan Louw
922914aa38 style: Implement color() function from CSS specification
Colors can now be defined in different color spaces with the color()
function.

https://w3c.github.io/csswg-drafts/css-color-4/#predefined

Differential Revision: https://phabricator.services.mozilla.com/D164866
2023-11-06 09:35:57 +01:00
Jan-Niklas Jaeschke
896aac5e4a style: Basic implementation of Custom Highlight API
Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++.

Added `::highlight(foo)` pseudo element to CSS engine.

Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections.

Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`.

Differential Revision: https://phabricator.services.mozilla.com/D164203
2023-11-06 09:35:57 +01:00
Emilio Cobos Álvarez
29c6094c80 style: [css-nesting] Parse parent selector
This parses the ampersand as a parent selector behind an
(off-by-default) selectors feature.

The plan is to call replace_parent_selector while we're doing the
CascadeData rebuilds, which is where we can have all the ancestor
nesting information.

No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D167237
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
Oriol Brufau
47a54ced2b Further changes required by Servo 2023-11-06 09:35:57 +01:00
Nicolas Chevobbe
d9a9ae4d7b style: Add lab, lch, oklab and oklch to DevTools autocomplete
Differential Revision: https://phabricator.services.mozilla.com/D167803
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
1bb98a9e16 style: Accept auto for {scroll|view}-timeline-name
Per https://github.com/w3c/csswg-drafts/issues/7431, both timeline name
should accept `auto`.

Differential Revision: https://phabricator.services.mozilla.com/D166476
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
Emilio Cobos Álvarez
863716a0a1 style: Minor clean-up to transform interpolation code
Differential Revision: https://phabricator.services.mozilla.com/D167616
2023-11-06 09:35:57 +01:00
Boris Chiou
fffb3c0830 style: Avoid infinite output progress after applying the easing function
The output progress of easing functions could be inf or -inf, per spec,
https://drafts.csswg.org/css-easing-2/#output-progress-value.

But we should avoid using infinity to calculate interpolation or use
the infinite progress in Web Animations API, per the spec issue comments:
https://github.com/w3c/csswg-drafts/issues/8344#issuecomment-1399033481

Differential Revision: https://phabricator.services.mozilla.com/D167342
2023-11-06 09:35:57 +01:00
Oriol Brufau
bb55e923bb Further changes required by Servo 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
Jonathan Kew
d54d9ec25a style: De-dup items with the same tag in the computed value of font-feature-settings and font-variation-settings
Differential Revision: https://phabricator.services.mozilla.com/D167012
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
Zach Hoffman
fa297196ef style: Reuse list_matches_complex_selector() where possible
It can be reused for the Is, Where, and Negation components.

Differential Revision: https://phabricator.services.mozilla.com/D166267
2023-11-06 09:35:57 +01:00
Zach Hoffman
93de6edbc9 style: Apply slow selector flags before matching
This patch fixes a bug introduced by bug 1808228/D166266, where, if an
element does not initially match :nth-child(An+B of selector list) or
:nth-last-child(An+B of selector list), changing a sibling or ancestor
will not invalidate that element.

Differential Revision: https://phabricator.services.mozilla.com/D166982
2023-11-06 09:35:57 +01:00
dependabot[bot]
27f79b1d51
build(deps): bump webxr from 2735ed7 to 21d9e38 (#30691)
Bumps [webxr](https://github.com/servo/webxr) from `2735ed7` to `21d9e38`.
- [Commits](2735ed7483...21d9e38eab)

---
updated-dependencies:
- dependency-name: webxr
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-04 07:43:04 +00:00
Oriol Brufau
9b56e95912 Update test expectations 2023-11-04 08:17:09 +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
Oriol Brufau
9e36918bf0 Further changes required by Servo 2023-11-04 08:17:09 +01:00
Zach Hoffman
3076481c52 style: Implement selector matching for :nth-child(An+B of selector list) and :nth-last-child(An+B of selector list)
Since we have been using a single hash map to cache all :nth-child
indices (with no selector list), each different selector will need its
own cache.

As a side note, this patch does not address invalidation.

Differential Revision: https://phabricator.services.mozilla.com/D166266
2023-11-04 08:17:09 +01:00
Emilio Cobos Álvarez
a973371cf2 style: Remove non-standard values of caption-side for good
They have been disabled since bug 1688695. There's a variety of
table-caption bugs that would be easier to fix if we didn't have to
account for side-captions.

Differential Revision: https://phabricator.services.mozilla.com/D165690
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
Zach Hoffman
39b056cf70 style: Move nth-related logic to the NthSelectorData type for reuse
Drive-by, but selector_list_specificity() was also renamed to
max_selector_list_specificity().

Differential Revision: https://phabricator.services.mozilla.com/D166263
2023-11-04 08:17:09 +01:00
Zach Hoffman
1c8408e97e style: Implement parsing and serialization for nth-child(An+B of selector list) and :nth-last-child(An+B of selector list)
:nth-{,last-}child parsing is disabled by default for now by pref
layout.css.nth-child-of.enabled.

Differential Revision: https://phabricator.services.mozilla.com/D165895
2023-11-04 08:17:09 +01:00
Jonathan Kew
b7d64ee6a4 style: Animate the 'normal' value of font-style as 'oblique 0deg'
This matches what the spec[1] says for font-style:

> Animation type: by computed value type; normal animates as oblique 0deg

A bunch of WPT tests for font-style animation are landing in https://github.com/web-platform-tests/wpt/pull/37570.
Current Gecko passes 66/129 of the testcases there; with this patch applied it passes all the tests.

[1] https://drafts.csswg.org/css-fonts-4/#font-style-prop

Differential Revision: https://phabricator.services.mozilla.com/D166128
2023-11-04 08:17:09 +01:00