Commit graph

26389 commits

Author SHA1 Message Date
CanadaHonk
0e5eca1f00 style: Implement prefers-reduced-transparency media query
Implemented the prefers-reduced-transparency media query for all
platforms.

Windows and Mac have specific settings which are used, others (Android
and Linux/GTK) have it enabled if prefers-reduced-motion is also enabled
as there is no dedicated setting to check.

Locked behind new pref `layout.css.prefers-reduced-transparency.enabled`,
off by default always for now.

Also added new WPT tests (none previously).

Demo video: https://goose.icu/firefox_prt.mp4
Test page: https://goose.icu/prefers-reduced-transparency

Differential Revision: https://phabricator.services.mozilla.com/D172424
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
9509f84bc0 style: Simplify/remove a couple other length operations
Differential Revision: https://phabricator.services.mozilla.com/D172430
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
52f1a680d5 style: Fix a couple minor issues with the previous patch
Having unused imports and undocumented functions trigger warnings that
don't build in automation.

Differential Revision: https://phabricator.services.mozilla.com/D172429
2023-11-21 15:36:35 +01:00
CanadaHonk
571f8a8dd5 style: Serialize NaN and infinity lengths
Lengths using NaN and infinity are now serialized properly with some
improvements to computed values as well.

Also added a few minor new relevant WPT tests.
35 WPT tests newly pass 🎉

Differential Revision: https://phabricator.services.mozilla.com/D172183
2023-11-21 15:36:35 +01:00
CanadaHonk
2dad1f0fd7 style: Infinity angles should degenerate compute to 0
Also adjusted WPT tests to always expect deg like similar past changes.

WPT tests: https://github.com/web-platform-tests/wpt/blob/master/css/css-values/calc-infinity-nan-computed.html#L57-L71

Differential Revision: https://phabricator.services.mozilla.com/D172401
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
23d6ecfc57 style: Rustfmt recent changes to calc.rs
Differential Revision: https://phabricator.services.mozilla.com/D172339
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
2c986f0005 style: Add resolution support to calc()
Differential Revision: https://phabricator.services.mozilla.com/D172338
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
76e8eeda72 style: Make image-set without valid images render nothing
Differential Revision: https://phabricator.services.mozilla.com/D172341
2023-11-21 15:36:35 +01:00
Boris Chiou
29105eeb49 style: Re-define CoordPair struct
Redefine/Rename the fields in CoordPair to align the data members of gfx::Point.

Differential Revision: https://phabricator.services.mozilla.com/D5903
2023-11-21 15:36:35 +01:00
Ziran Sun
29a9f0da46 style: Add popover attribute and part of basic popover functionality
Starts to add part of the basic functionality for popover. Including
[1] :open & :closed CSS pseudo class
[2] showPopover(), hidePopover() and togglePopover() interfaces. Much of the
functionality is still to-do.
[3] PopoverData interface

Differential Revision: https://phabricator.services.mozilla.com/D171719
2023-11-21 15:36:35 +01:00
CanadaHonk
3ded7ff273 style: Parse and serialize NaN and infinity times correctly
Times like NaN and infinity are now parsed and serialized correctly.

Rewrote time to use `calc_clamping_mode` instead of `was_calc` to
stop some parse-time clamping which broke these values.

Adjusted WPT test expectations, 19 newly pass 🎉

Also added a new WPT test to cover a missing edge case:
`calc(1<unit> * NaN)` -> `calc(NaN * 1<canonical_unit>)`

The very similar angle tests do this already for angle's units.

Differential Revision: https://phabricator.services.mozilla.com/D171911
2023-11-21 15:36:35 +01:00
Oriol Brufau
9a6b46aebd Further changes required by Servo 2023-11-21 15:36:35 +01:00
Boris Chiou
3390b77281 style: Create timeline objects when mutating scroll-timeline property
And so we can lookup the timeline from TimelineCollection.

Differential Revision: https://phabricator.services.mozilla.com/D169273
2023-11-21 15:36:35 +01:00
Oriol Brufau
532d769e27 Further changes required by Servo 2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
cfb7a9a108 style: Be consistent for which URIs we expose chrome rules
Differential Revision: https://phabricator.services.mozilla.com/D171640
2023-11-21 15:36:35 +01:00
Oriol Brufau
664e44385e Further changes required by Servo 2023-11-21 15:36:35 +01:00
David Shin
f7b29ac432 style: Parsing for relative selectors in :has()
Differential Revision: https://phabricator.services.mozilla.com/D171358
2023-11-21 15:36:35 +01:00
Oriol Brufau
b6db94bdf5 Further changes required by Servo 2023-11-21 15:36:35 +01:00
Tiaan Louw
8c1c4073e2 style: Convert RGBA to AbsoluteColor for computed/animated/resolved CSS colors
Computed color values will not be in the correct format, closer to the
one specified by the author.  This also means that colors accross the
code are stored now as AbsoluteColor or StyleAbsoluteColor.  This allows
color space/gamut information to be available for use.

Some animation related test failures had to be changed, because colors
now has greater precision.  Animated a color now causes a lot more
animation updates, which was not initially expected.  See the bug for
discussion.

Differential Revision: https://phabricator.services.mozilla.com/D171021
2023-11-21 15:36:35 +01:00
Sylvestre Ledru
3763d9a6cc style: Fix clippy warnings
Depends on D96634

Differential Revision: https://phabricator.services.mozilla.com/D96636
2023-11-21 15:36:35 +01:00
Oriol Brufau
61af8fb56d
Enable new color functions from CSS Color 4 (#30752)
I will need to do most of the work anyways during the style updates,
so by enabling this it will be easier to detect mistakes.

Also, canvas colors are now parsed as <color>, precisely to support
these new features. This is according to the HTML spec:
https://html.spec.whatwg.org/multipage/infrastructure.html#parsed-as-a-css-color-value
2023-11-20 16:15:43 +00:00
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