Commit graph

47185 commits

Author SHA1 Message Date
Oriol Brufau
1a49d8c79f Further changes required by Servo 2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
9ac97dd8ad style: when iterating over a selector to find a bucket, choose the rightmost
This restores the pre-regression behavior by choosing the later class in
cases where folks use stuff like `.foo.bar`.

This matches other browsers too.

Differential Revision: https://phabricator.services.mozilla.com/D177398
2023-11-21 15:36:35 +01:00
Boris Chiou
303ea410e2 style: Support self keyword for scroll()
`self` keyword specifies to use the element’s own principal box as the
scroll container. If the principal box is not a scroll container, then the
scroll progress timeline is inactive.

Differential Revision: https://phabricator.services.mozilla.com/D175707
2023-11-21 15:36:35 +01:00
Boris Chiou
f96c75c8d0 style: Update the syntax of scroll() to accept <scroller> and <axis> in any order
The order of <scroller> and <axis> doesn't matter in the parser.
However, we serialize <scroller> first, if it is not the initial value.

Differential Revision: https://phabricator.services.mozilla.com/D173906
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
a27f477c7d style: Rework -x-text-zoom to allow disabling text zoom and min-font-size separately
And use it instead of explicit document checks. This centralizes where
we check for it.

IsChromeDoc is relatively cheap, but this bug wants to also check for
PDF.js which is a bit more expensive.

No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D176940
2023-11-21 15:36:35 +01:00
Tiaan Louw
a6b97563c3 style: Add negate node to use in place of mul_by in sum nodes
Sum nodes would use mul_by to negate nodes to do subtraction, but some
nodes are not distributive.  This patch adds a negate node, so that the
operations inside these negate nodes can be resolved first and then the
"subtraction" can be applied.

Differential Revision: https://phabricator.services.mozilla.com/D172941
2023-11-21 15:36:35 +01:00
Boris Chiou
9fd6f09a41 style: Add animation-timeline: view() in style system
Support view() notation for animation-timeline:
  `<view()> = view( [ <axis> || <'view-timeline-inset'> ]? )`

We move AnimationTimeline and its related types into the generics folder,
and define two new structs for scroll() and view().

Note:
1. The syntax of scroll() doesn't match the current version of the spec.
    I will update it in Bug 1814444.
2. We will handle the creation/usage of the Anonymous View Progress Timelines
    in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D173904
2023-11-21 15:36:35 +01:00
Oriol Brufau
115a45f8eb Further changes required by Servo 2023-11-21 15:36:35 +01:00
Boris Chiou
b1bcb22650 style: Move animation-related values from box.rs/ui.rs to animation.rs
Although we store animation and transition style values in StyleUIReset and
define their properties in longhands/ui.mako.rs, but we may move them in
the future if this style struct becomes too large. So let's move the
definition of their values to an independent module, animation, so we
don't have to worry about this again.

This patch doesn't change any other things. Only move code.

Differential Revision: https://phabricator.services.mozilla.com/D173903
2023-11-21 15:36:35 +01:00
Oriol Brufau
1816d7750f Further changes required by Servo 2023-11-21 15:36:35 +01:00
CanadaHonk
a5b85ec834 style: Refactor ImportLayer into enum
Refactored ImportLayer into an enum instead of a struct and using
Option everywhere.

Differential Revision: https://phabricator.services.mozilla.com/D176793
2023-11-21 15:36:35 +01:00
CanadaHonk
2e713d4366 style: Serialize NaN and infinity percentages correctly
NaN and infinity percentages are now serialized as expected.

Also added some new WPT tests as percentages were previously untested
and added some spec comments to previous NaN/inf serialization code.

Differential Revision: https://phabricator.services.mozilla.com/D176726
2023-11-21 15:36:35 +01:00
Oriol Brufau
d44f772dc3 Further changes required by Servo 2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
6f090b8a85 style: [css-nesting] Update cssparser to allow parsing qualified rules along with declaration
No implementation just yet (the default QualifiedRuleParser
implementation just rejects stuff), but this is plumbing that I'd rather
get reviewed separately.

Differential Revision: https://phabricator.services.mozilla.com/D176686
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
93e0711194 style: [css-nesting] Process nested rules at cascade data rebuild
More nesting plumbing. Still does nothing because we don't parse the
nested rules.

Should be trivial to prove this patch doesn't change any behavior so
far, but I want to land it on its own because it can have performance
implications.

This follows the pattern of what we do with other rules like layers and
container conditions, that is, keep the ancestor selectors in a stack,
and poke at the last one in order to replace the ancestor.

This changes the behavior of replace_parent_selector as with the newer
version of the spec, stuff like:

  div {
    .foo {
      stuff
    }
  }

Should work as `div .foo`. A test is added for this case.

Differential Revision: https://phabricator.services.mozilla.com/D176560
2023-11-21 15:36:35 +01:00
Oriol Brufau
f9a48e15aa Further changes required by Servo 2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
d4e12b9db6 style: [css-nesting] Add storage for nested rules
Allow to have a CssRules list inside a StyleRule.

This only introduces the storage and serialization code for them, but we
still don't parse it.

Differential Revision: https://phabricator.services.mozilla.com/D176550
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
1182296c4b style: Enable all math functions on chrome code
They should be stable.

Not sure this is worth writing a test for since the idea is that this
code goes away eventually.

Differential Revision: https://phabricator.services.mozilla.com/D176680
2023-11-21 15:36:35 +01:00
Oriol Brufau
a523fffc9e Further changes required by Servo 2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
e91a0d8b96 style: Share code to parse @import layer + supports()
The duplication was slightly annoying me :)

Differential Revision: https://phabricator.services.mozilla.com/D176564
2023-11-21 15:36:35 +01:00
CanadaHonk
5671b9f025 style: Fix @import supports() parsing position
Fixed @import supports() being parsed in the incorrect position as per spec.

Also added more WPT tests for layer and supports in one @import.

Differential Revision: https://phabricator.services.mozilla.com/D176193
2023-11-21 15:36:35 +01:00
CanadaHonk
0c246b0b7c style: Fix @import serialization order
Fixed @import serialization being out of (spec) order.

Also added some more WPT tests.

Differential Revision: https://phabricator.services.mozilla.com/D176182
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
5d59674c8a style: Use more non-native rendering of menus
This makes our menus closer to GTK4, and depends less on the native menu
rendering etc. Thunderbird already does this to some extent.

Leave the old code behind a pref for now (just in case). Also fix some
code in nsNativeTheme::GetContentState (fixes rendering of radio menu
items).

Differential Revision: https://phabricator.services.mozilla.com/D175664
2023-11-21 15:36:35 +01:00
Jonathan Kew
9dfa7fb136 style: Implement CSS and rendering (but not copy/paste) support for the (non-standard) -webkit-text-security property
Differential Revision: https://phabricator.services.mozilla.com/D174951
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
bedf574092 style: Avoid linear search to check for custom property presence
The test-case in the next patch from 10s to a couple hundred
milliseconds on my machine. No behavior change other than that.

Differential Revision: https://phabricator.services.mozilla.com/D175612
2023-11-21 15:36:35 +01:00
Mirko Brodesser
9a97080dbb style: Replace popover's ':open' and ':closed' pseudo-classes with ':popover-open'
See https://github.com/whatwg/html/pull/9077.

Differential Revision: https://phabricator.services.mozilla.com/D175223
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
bc82d005ae style: Remove cascade layers pref
These have been enabled by default for quite a while.

Differential Revision: https://phabricator.services.mozilla.com/D175513
2023-11-21 15:36:35 +01:00
Oriol Brufau
9ce567d7fe Further changes required by Servo 2023-11-21 15:36:35 +01:00
CanadaHonk
1ac62a4ce8 style: Implement supports() syntax for @import rules
Implemented supports conditions using supports() in @import rules as per
CSS Cascading and Inheritance Level 4.

Locked behind new pref, layout.css.import-supports.enabled,
only enabled in nightlies in this patch.

Also added new WPT tests for @import supports() generally.

Spec: https://drafts.csswg.org/css-cascade-4/#conditional-import
WPT tests: https://wpt.fyi/results/css/css-cascade/import-conditions.html

Differential Revision: https://phabricator.services.mozilla.com/D172622
2023-11-21 15:36:35 +01:00
Oriol Brufau
b844a4e992 Further changes required by Servo 2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
0709e13446 style: Allow to use ThinVec/nsTArray in the style crate
This allows to clean-up the previous patches by using a single ThinVec
(which stores length / capacity along with the allocation).

Differential Revision: https://phabricator.services.mozilla.com/D175029
2023-11-21 15:36:35 +01:00
Jonathan Kew
a2df8f7ea5 style: Accept a comma-separated list of language codes in the :lang() pseudo
This is the other extension to the :lang() pseudo-class in  Selectors-4.
(Also supported in Safari.)

Depends on D174999

Differential Revision: https://phabricator.services.mozilla.com/D175000
2023-11-21 15:36:35 +01:00
CanadaHonk
13e2d10474 style: Implement inverted-colors media feature
Implemented the inverted-colors media feature from Media Queries Level 5
for all platforms.
Spec: https://drafts.csswg.org/mediaqueries-5/#inverted

Platform specific implementations:
- Windows: Checks system color filter setting, and if it is inverted
  (note: Windows does not live update due to having to read a reg key)
- Mac: Checks dedicated inverted accessibility system setting
- Android: Checks dedicated inverted system setting
- Linux: No GTK API exposes anything like it so always none

Locked behind new pref `layout.css.inverted-colors.enabled`,
always off by default for now.

Also added new WPT tests (none previously).

Other browsers:
- WebKit: shipped since Safari 9.1 (Jan 2017)
- Blink: no signal

Test page: https://goose.icu/inverted-colors

Differential Revision: https://phabricator.services.mozilla.com/D173201
2023-11-21 15:36:35 +01:00
Zach Hoffman
dcfef6cdbb style: Remove MatchingContext mutability FIXME that no longer applies
Differential Revision: https://phabricator.services.mozilla.com/D175028
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
5dd35ac6cd style: Simplify NAC setup
Make all UA widgets also NAC.

Keep the UA widget flag but break at anonymous subtree boundaries, so
that only nodes inside the UA widget directly (and not NAC from those)
get the flag.

This is important because two callers depend on this difference:

  * The style system, since we still want to match content rules from
    stylesheets in the UA widget. We also match user rules, which is a
    bit sketchy, but that was the previous behavior, will file a
    follow-up for that.

  * The reflector code, since we want the scope for UA widgets to not
    include the NAC nodes inside that UA widget. nsINode::IsInUAWidget
    got it wrong.

After this patch, ChromeOnlyAccess is equivalent to
IsInNativeAnonymousSubtree, so we should probably unify the naming.
That's left for a follow-up patch because I don't have a strong
preference.

Differential Revision: https://phabricator.services.mozilla.com/D174310
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
0917ee3f9b style: Fix some spec links
Trivial, comment-only

Differential Revision: https://phabricator.services.mozilla.com/D174474
2023-11-21 15:36:35 +01:00
Mike Hommey
38faddd687 style: Update bindgen to 0.64
Differential Revision: https://phabricator.services.mozilla.com/D174054
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
0748fd9582 style: Remove a bunch of now completely dead XUL layout code
And some related tests.

A bunch of -moz-box* properties are web exposed, so I'll file a
follow-up for hiding them.

Differential Revision: https://phabricator.services.mozilla.com/D173819
2023-11-21 15:36:35 +01:00
CanadaHonk
46a569ef45 style: Implement scripting media feature
Implemented the scripting media feature.

Not locked behind a pref as it does not do anything new or particularly
give new data which could be used for fingerprinting (see <noscript>,
etc).

Also added new WPT tests (none previously). Not supported in any other
browsers yet.

Test page: https://goose.icu/media-scripting

Differential Revision: https://phabricator.services.mozilla.com/D172995
2023-11-21 15:36:35 +01:00
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
Oriol Brufau
4804e8dd94 Further changes required by Servo 2023-11-21 15:36:35 +01:00