Commit graph

26168 commits

Author SHA1 Message Date
Oriol Brufau
3543a87592
Allow currentColor in canvas context's shadowColor (#30754)
This allows unifying the parse_color function and method, aligns Servo
with other browsers, and obeys the HTML spec:
 - https://html.spec.whatwg.org/multipage/canvas.html#shadows
 - https://html.spec.whatwg.org/multipage/infrastructure.html#parsed-as-a-css-color-value
2023-11-20 11:03:18 +00:00
Martin Robinson
e83e7ded6e
Remove use of proc_macro_diagnostics feature (#30745)
This is only used to emit a single error, which can be done using `syn`.
Removing the use of this feature brings us close to being to able to
compile with stable rust.
2023-11-17 10:36:09 +00:00
Martin Robinson
8de4629a3c
Remove usage of drain_filter (#30742)
This is a step on the way toward supporting stable rust.
2023-11-17 10:28:33 +00:00
Martin Robinson
50732b49c5
Remove Servo window.trap() extension (#30743)
This Servo-specific extension is unused by any code in the repository
and removing it allows us to remove use of nightly only reliance on
rust intrinsics. This is a step toward supporting stable rust.
2023-11-17 07:43:26 +00:00
atbrakhi
1e5db618d0
Fix Servo taking a long time to start on MacOS after a recompile (#30726)
* update init as we initialize media in the background now

With [#405](https://github.com/servo/media/pull/405) changes in
servo/media we move initialization of the media engine to a
background thread. This PR updates the init function in libservo
to adapt that behaviour.

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

* review fix: simplify code

* Update media

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-11-14 10:15:02 +00:00
Delan Azabani
098e6a1580
constellation: clean up logging of pipelines and browsing contexts (#30657)
* constellation: clean up logging of pipelines and browsing contexts

* bring back sentence case; remove commented code

* fix more typos and wordings
2023-11-14 04:53:31 +00:00
Martin Robinson
72cb34dc3d
Fix transform assertion failures in Layout 2013 and Layout 2020 (#30713)
Layout asserts that it never creates stacking contexts that have a zero
scale, yet it doesn't prevent the creation of those stacking contexts.
This change stops their creation at an earlier stage.

Fixes #30118.
2023-11-13 09:09:25 +00:00
Ngo Iok Ui (Wu Yu Wei)
44d79269f4
Fix servoshell can't respond when there's no minibrowser (#30598)
* Fix servoshell can't respond when there's no minibrowser

* Remove external_field and update documentation

* Update documentation

* Fix crash when handling ReadyToPresent if it's headless mode

* Fix some wpt tests got timedout
2023-11-11 06:45:27 +00:00
atbrakhi
3c57f2cb44
Use Au instead of Length in flexbox code (#30704)
* convert border and padding to app units in flexbox

* convert margin to app units in flexbox

* cleanup, fmt

* add todo comment

* fmt

* add comment

* use Length instead of CSSPixelLength: they are same
2023-11-08 14:23:43 +00:00
Oriol Brufau
ecc6ba79b0 Further changes required by Servo 2023-11-06 09:35:57 +01:00
CanadaHonk
a8fef9d4f2 style: Serialize NaN and infinity angles as per spec
`NaN`, `infinity`, and `-infinity` angles should be specially serialized.

Also fixed a few relevant WPT tests which did not follow spec.
(see https://github.com/web-platform-tests/wpt/pull/38825)

Adjusted WPT test expectations, 40 newly pass 🎉

Differential Revision: https://phabricator.services.mozilla.com/D171658
2023-11-06 09:35:57 +01:00
Oriol Brufau
7b28572309 Further changes required by Servo 2023-11-06 09:35:57 +01:00
Boris Chiou
a41194a318 style: Make <ray-size> optional and default to 'closest-side'
Per the spec update, the new syntax is:
  `ray() = ray( <angle> && <ray-size>? && contain? )`
And for `<ray-size>`:
  "If no <ray-size> is specified it defaults to closest-side."

So `<ray-size>` is optional and we omit it if it's default value, for
serialization.

By the way, offset=* properties are supported only in Gecko, so we don't
need a servo function to check the preference.

Differential Revision: https://phabricator.services.mozilla.com/D171625
2023-11-06 09:35:57 +01:00
Emilio Cobos Álvarez
860a6c2fe6 style: Move legacy -moz-box collapse to its own CSS property
Make display: -moz-box's visibility: collapse handling switchable by its
own CSS property.

Longer term maybe we should switch the front-end away from visibility:
collapse altogether (there are some alternatives), but for now this will
allow to move the front-end to switch to modern `display: flex` while
keeping `visibility: collapse` work as in -moz-box.

Differential Revision: https://phabricator.services.mozilla.com/D171472
2023-11-06 09:35:57 +01:00
Oriol Brufau
34eb94c71e Further changes required by Servo 2023-11-06 09:35:57 +01:00
Em Zhan
21d1bdeb9b style: Implement CSS exponential functions
Differential Revision: https://phabricator.services.mozilla.com/D170842
2023-11-06 09:35:57 +01:00
Boris Chiou
0b20b343e6 style: Support offset-position in the style system
Also, we make it animatable but don't apply it to the motion transform and
don't run it on the compositor for now (so it works for getComputedStyle but
doesn't have rendering result).

Per spec: https://w3c.github.io/csswg-drafts/css-values/#calc-serialize,
we tweak the WPT to let calc() serialize the percentage first, and maintain
zero-valued terms, i.e. 0%. (We are doing the same thing as
offset-anchor, so it should be fine with other browsers.)

Besides, I tweak the serialization of shorthand a little bit so we match
the implementation of WebKit.

Differential Revision: https://phabricator.services.mozilla.com/D170972
2023-11-06 09:35:57 +01:00
Emilio Cobos Álvarez
1b40d30f88 style: Fix appearance-cssom-001.html
* Remove some legacy appearance aliases that other engines don't
    implement.

  * Allow to pass with unimplemented <compat-auto> values, since per the
    spec the idea of these is to get them removed, see
    https://github.com/w3c/csswg-drafts/issues/8506 for the ones we don't
    implement.

  * Also allow the `-moz-` prefix to be implemented, because we can't
    quite get rid of it (people use it to remove the <input type=number>
    buttons with -moz-appearance: textfield and so on), and the
    alternative is to implement a bunch of non-standard ::-webkit-
    pseudo-elements.

Differential Revision: https://phabricator.services.mozilla.com/D171243
2023-11-06 09:35:57 +01:00
Emilio Cobos Álvarez
9a37424dca style: Make -moz-box-layout: flex default, and clean-up CSS
Now it's on by default everywhere, so all this is not needed. No behavior
change effectively since the xul.css bits being removed effectively achieve the
same.

Differential Revision: https://phabricator.services.mozilla.com/D170944
2023-11-06 09:35:57 +01:00
Oriol Brufau
4da83f238a Further changes required by Servo 2023-11-06 09:35:57 +01:00
Tiaan Louw
1c3aafd9d2 style: Use abstract color parser
In stead of having the css parser construct a color in it's own format
and then converting it to what Gecko needs to perform operations, we now
construct a Gecko friendly color type directly.

Differential Revision: https://phabricator.services.mozilla.com/D170187
2023-11-06 09:35:57 +01:00
Emilio Cobos Álvarez
6e128b6512 style: Don't reject negative resolutions either
This unveils an issue with image-set() tests, which expect 0x to not
parse (inconsistently with media queries).

Fix the test, since the spec doesn't restrict the range of <resolution>
values (and more importantly, it shouldn't allow open ranges).

Differential Revision: https://phabricator.services.mozilla.com/D170762
2023-11-06 09:35:57 +01:00
Emilio Cobos Álvarez
d68bd45cc3 style: Don't reject negative values at parse time in media features
Clean-up some other test expectations while at it.

Differential Revision: https://phabricator.services.mozilla.com/D170677
2023-11-06 09:35:57 +01:00
CanadaHonk
4ed0f518fb style: Fix parsing nested image-set funcs as valid
Nested image-set CSS functions should fail to parse as per spec.

WPT tests (2 newly pass):
a2154e3f97/css/css-images/image-set/image-set-parsing.html (L223-L239)

Differential Revision: https://phabricator.services.mozilla.com/D170829
2023-11-06 09:35:57 +01:00
Emilio Cobos Álvarez
75b3bf1842 style: Layer should be an invalid media type
Differential Revision: https://phabricator.services.mozilla.com/D170676
2023-11-06 09:35:57 +01:00
Emilio Cobos Álvarez
fa9fa00977 style: Remove -moz-image-region support from layout
There are no users of non-auto values, so we can just simplify some code and
remove the property.

Differential Revision: https://phabricator.services.mozilla.com/D170010
2023-11-06 09:35:57 +01:00
Oriol Brufau
e0e5a22614 Further changes required by Servo 2023-11-06 09:35:57 +01:00
Emilio Cobos Álvarez
1a3b32a248 style: Expose scrollbar-inline-size as a chrome-only environment variable
After the previous patches this is rather straight-forward.

Reviewed in: https://phabricator.services.mozilla.com/D168148
2023-11-06 09:35:57 +01:00
Emilio Cobos Álvarez
89e01f1df6 style: Expose chrome-only environment variables to all chrome:// documents, not just chrome-docshells
This will be necessary to make the new env var testable.

Reviewed in: https://phabricator.services.mozilla.com/D168148
2023-11-06 09:35:57 +01:00
David Shin
017ab0cb24 style: linear() easing function should not consider less than 2 linear stop arguments valid
Latest spec no longer handles `linear() == linear` and `linear(<single value>) == <single value>`.

Differential Revision: https://phabricator.services.mozilla.com/D169955
2023-11-06 09:35:57 +01:00
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
Tiaan Louw
93326b2d2b style: Part 3 - Color mixing is done with new color spaces
The color mixing is npw using AbsoluteColor and it's conversion
functions. The result is still being converted back to sRGB for now.

Differential Revision: https://phabricator.services.mozilla.com/D169930
2023-11-06 09:35:57 +01:00
Tiaan Louw
954c38cccb style: Part 2 - Use new color space for color mixing
Mixing is now using the new color space for specifying the interpolation
color space.  For that reason hsl and hwb is added to the color space
and also converting to/from them.

Differential Revision: https://phabricator.services.mozilla.com/D169929
2023-11-06 09:35:57 +01:00
Tiaan Louw
e963abe2e9 style: Part 1 - Move color mixing code to color module
No functional changes, just moving the code to the shared library in
preperation for replacing it with the new AbsoluteColor.

Differential Revision: https://phabricator.services.mozilla.com/D169928
2023-11-06 09:35:57 +01:00
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