Commit graph

26409 commits

Author SHA1 Message Date
CanadaHonk
d2217be803 style: CSS comp funcs should handle NaN contagiously
If NaN is given as any input to CSS comp funcs (min/max/clamp), it
should return NaN. Does not cover simplification (see Bug 1820412).

Adjusted WPT test expectations, 18 newly pass. 🎉

Differential Revision: https://phabricator.services.mozilla.com/D171659
2023-11-21 15:36:35 +01:00
Boris Chiou
191c7cdb78 style: Remove layout.css.d-property.enabled
This feature was shipped in Fx97, and it seems we don't need this pref
anymore.

Differential Revision: https://phabricator.services.mozilla.com/D173591
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
78c1c53ccd style: Restyle pseudo-elements as well on part attribute changes
Refactor a bit the code to unify how we deal with this conditional
restyling (we had similar code for
MustCascadeChildrenIfInheritResetStyle).

Differential Revision: https://phabricator.services.mozilla.com/D172890
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
398df68d38 style: Minor clean ups on top of the previous patch
Remove now dead Mul implementations. Use Self rather than the whole type
to shrink a bit the code.

Differential Revision: https://phabricator.services.mozilla.com/D173143
2023-11-21 15:36:35 +01:00
Tiaan Louw
241e6e256f style: Refactor mul_by fn into map fn
Refactor the mul_by function on leafs into a more generic map function
that can be used for more operations like abs, signum and mul.

Differential Revision: https://phabricator.services.mozilla.com/D172936
2023-11-21 15:36:35 +01:00
Boris Chiou
a5f696b90d style: Use auto as the initial value for view-timeline-inset
Per the proposal in https://github.com/w3c/csswg-drafts/issues/7747,
we change view-timeline-inset to have an initial value of auto.

Differential Revision: https://phabricator.services.mozilla.com/D173487
2023-11-21 15:36:35 +01:00
Cathie Chen
6db3b1158c style: Update UA stylesheet for popover
Differential Revision: https://phabricator.services.mozilla.com/D172700
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
4d62fec376 style: Reuse declaration block with SVG presentation attributes
Ideally we'd only update the attributes that actually changed. That's a
bit more work I can try to look into, but this and bug 1823686 should
improve things here.

Differential Revision: https://phabricator.services.mozilla.com/D173162
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
7d12331626 style: Optimize [id=foo] as #foo in querySelector/All
This page seems to rely on this optimization being present. Optimizing
it is straight-forward. Why do they do that instead of using the #foo
syntax? Who knows.

Differential Revision: https://phabricator.services.mozilla.com/D173148
2023-11-21 15:36:35 +01:00
Zach Hoffman
536b3d603b style: Check that the lowercase attribute is different before trying to track it
Differential Revision: https://phabricator.services.mozilla.com/D173112
2023-11-21 15:36:35 +01:00
Tiaan Louw
f3402e6144 style: Color interpolation takes none keyword into account
Now that the none keyword is available, we can take it into account when
interpolating colors following the rules from the spec here:

https://drafts.csswg.org/css-color-4/#interpolation-missing

Differential Revision: https://phabricator.services.mozilla.com/D172666
2023-11-21 15:36:35 +01:00
Oriol Brufau
11414d0c94 Further changes required by Servo 2023-11-21 15:36:35 +01:00
Tiaan Louw
fb4501c5b4 style: Allow 'none' keyword in color components
Make use of the new changes in the cssparser that allows 'none' keywords
in color components where allowed.  We store the none values as 0.0 (as
per the spec) and mark the components with the flags. This way we don't
have to check anything on the components before doing calculations.

As this is the last part intended to be released for the new [color-4]
changes, I've also enabled the changes on nightly.

Differential Revision: https://phabricator.services.mozilla.com/D170208
2023-11-21 15:36:35 +01:00
David Shin
3756e3b027 style: :has relative selector matching, with no caching/filtering
Differential Revision: https://phabricator.services.mozilla.com/D172019
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
a68766197f style: Add (unused for now) parsing for support conditions in @import
You can use this as:

  input.try_parse(SupportsCondition::parse_for_import).ok()

Or so.

Differential Revision: https://phabricator.services.mozilla.com/D172668
2023-11-21 15:36:35 +01:00
Oriol Brufau
3914ff627e Further changes required by Servo 2023-11-21 15:36:35 +01:00
Zach Hoffman
356e886d26 style: Record attribute dependencies within the selector list of :nth-child(... of <selector list>)
There are separate filters for IDs, classes, attribute local names, and
element state.

Also, we invalidate siblings of elements matched against the selector
list of :nth-child(... of <selector list>) by marking matched elements
with NODE_HAS_SLOW_SELECTOR_NTH_OF.

The only remaining invalidation case invalidation case is
`:nth-child(An+B of :has())` (bug 1818155), which should not block
shipping `layout.css.nth-child-of.enabled`, because :has(...) is still
being implemented (bug 418039).

Depends on D172352

Differential Revision: https://phabricator.services.mozilla.com/D171936
2023-11-21 15:36:35 +01:00
Oriol Brufau
c7f8845665 Further changes required by Servo 2023-11-21 15:36:35 +01:00
Zach Hoffman
744b21e72a style: Apply selector flags to the shadow root
Because restyle events cannot be posted for non-element nodes like the
shadow root, a child's siblings are restyled directly if its parent has
NODE_HAS_SLOW_SELECTOR or NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS but that
parent is the shadow root.

Drive-by, but braces were also added to some single-line "if" statements
in RestyleManager.

Differential Revision: https://phabricator.services.mozilla.com/D172352
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
11a04d9d93 style: Support rendering content: <gradient> images
We implemented support for list-style-image anyways.

Differential Revision: https://phabricator.services.mozilla.com/D172343
2023-11-21 15:36:35 +01:00
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