Commit graph

1860 commits

Author SHA1 Message Date
CanadaHonk
3a51e530d2 style: Remove overflow-block optional-paged
Removed overflow-block optional-paged value and reftesting as it was
removed from the spec in 2020: https://github.com/w3c/csswg-drafts/issues/5287

1 WPT subtest now newly passes.

WPT tests: https://wpt.fyi/results/css/mediaqueries/test_media_queries.html

Differential Revision: https://phabricator.services.mozilla.com/D178710
2023-11-24 08:57:14 +01:00
Zach Hoffman
9c46eabe83 style: [css-properties-values-api] Implement parsing and serialization for @property at-rule
Implemented behind the new properties-and-values pref.

Support for the CSSPropertyRule WebIDL interface is also added in this
patch, because until it's added, any attempt to access the rule using
the CSSOM would crash the browser.

Depends on D178268

Differential Revision: https://phabricator.services.mozilla.com/D178270
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
7c4ec6e9cc style: [css-nesting] Do a first pass at parsing nested rules mixed with declarations
Plumb everything up. This factors out declaration and rule parsing so
we share the code with the regular declaration parser.

This could be made a bit nicer in the future. We need to decide what to
do for @page and @keyframe (it seems conditional rules inside ought to
work, but that's not so easy because per spec we create a nested style
rule).

But this is a first pass that passes a good chunk of the tests. There
are other fixups to cssom, and I think some of the tests we fail are
actually wrong...

Differential Revision: https://phabricator.services.mozilla.com/D178266
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
b92440ef7c style: Disable NSCAP_FEATURE_USE_BASE
This is a relatively small code size regression (130k on windows and
macOS, 180k on Linux), for a few high confidence improvements in
speedometer 3. See link in the bug.

If this sticks, we can actually clean up a bunch of code, and eventually
unify RefPtr and nsCOMPtr. But I want this to be on the tree for a while
before doing more aggressive refactorings / actually removing the code.

Differential Revision: https://phabricator.services.mozilla.com/D178267
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
d1046739fc style: Remove some magic from the bindings
This simplifies a tiny bit our bindings in some places, and complicates
it in others, but over all I think it's better.

It requires a bit more manual code in the rust side to drop and cast the
relevant pointers (which was done implicitly before), but it's a lot
less magic than it used to be, and that's all autogenerated so consumers
don't need to care about it.

The set up is still not ideal. I don't like that we rely on destructors
running in both sides of the FFI boundary, but that's for another day.

This is the last usage of RawOffsetArc, so remove that. We now support
proper Arc<> in structs (GridTemplateAreas uses it), so I don't think
we'll need it any time soon.

Differential Revision: https://phabricator.services.mozilla.com/D177905
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
e9bf977369 style: Finish removing HasArcFFI
Use the actual Locked<T> types around (via a typedef, just for
convenience).

Differential Revision: https://phabricator.services.mozilla.com/D177824
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
3f03650c88 style: Plumb android text scale via nsLookAndFeel
That's how we do it for all other platforms. Do this rather than via a
custom mostly-untested pref, which allows us to simplify text zoom
handling.

Differential Revision: https://phabricator.services.mozilla.com/D177062
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
4b7260d846 style: Remove dead GTK menu styling code
Differential Revision: https://phabricator.services.mozilla.com/D177369
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
9370172552 style: Remove HasArcFFI for AnimationValue
See previous patches for context.

Differential Revision: https://phabricator.services.mozilla.com/D177622
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
779aa9d30e style: Remove HasArcFFI for some types
See blocked bug.

For non-Locked types we can just use the same underlying type at the FFI
boundary. Port StylesheetContents and CssUrlData to this set-up.
CssUrlData is already generated by cbindgen anyways.

Differential Revision: https://phabricator.services.mozilla.com/D177559
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
e18675401e style: Remove HasFFI as well
After the previous patches we only have one trait which we should also
tweak / rework, so let's put it all on that single trait.

Differential Revision: https://phabricator.services.mozilla.com/D177515
2023-11-21 15:36:35 +01:00
Emilio Cobos Álvarez
19e037d921 style: Remove HasBoxFFI
HasBoxFFI and HasArcFFI aren't great, see bug 1831242 as for examples of
why.

HasArcFFI requires a bit more care, but HasBoxFFI doesn't give us much
benefit. Instead use the same type in the FFI boundary.

Differential Revision: https://phabricator.services.mozilla.com/D177252
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Emilio Cobos Álvarez
92742f7f90 style: Avoid generic soup and extra reference count bumps
This makes me a bit happier about the previous patch :)

Differential Revision: https://phabricator.services.mozilla.com/D165236
2023-11-04 08:17:09 +01:00
Zach Hoffman
a685297bf3 style: Implement the color-gamut media feature
Differential Revision: https://phabricator.services.mozilla.com/D165385
2023-11-04 08:17:09 +01:00
Oriol Brufau
661e7d5c48 style: Fix elements not being query containers for the pseudo-element they originate. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D164807
2023-11-04 08:17:09 +01:00
Oriol Brufau
c4b8e451ed style: Re-evaluate container queries when container gets display:contents
Differential Revision: https://phabricator.services.mozilla.com/D164234
2023-11-04 08:17:09 +01:00
Oriol Brufau
0c36795e20 style: Evaluate size feature to unknown if the container lacks size containment
For example, inline elements may have container-type:size but they don't
support size containment, so @container(width >= 0) shouldn't match.

Differential Revision: https://phabricator.services.mozilla.com/D163936
2023-11-04 08:17:09 +01:00
Oriol Brufau
647d813c6b style: @container(width:0) shouldn't match elements with no box
Depends on D163879

Differential Revision: https://phabricator.services.mozilla.com/D163844
2023-11-04 08:17:09 +01:00
Oriol Brufau
748dd1eae2 style: Make container queries check content-box size
They were checking the border-box size (with paddings and borders), but
https://drafts.csswg.org/css-contain-3/#size-container says it should
be the content-box size.

Differential Revision: https://phabricator.services.mozilla.com/D163784
2023-11-04 08:17:09 +01:00
Emilio Cobos Álvarez
e520c3796d style: Make panel animations a LookAndFeel int
This will allow us to enable panel animations in some Linux
configurations but not others. Also, it's cleaner.

Differential Revision: https://phabricator.services.mozilla.com/D161693
2023-11-03 08:59:49 +01:00
Emilio Cobos Álvarez
5ded58a2b1 style: Allow propagating computed style bits from the selector-matching process
This allows us to propagate flags from the container query styles all the
way to the computed style of the element.

The flag for viewport units in container queries has to be different
because it requires rematching, see comments.

Depends on D159851

Differential Revision: https://phabricator.services.mozilla.com/D159852
2023-11-03 08:59:49 +01:00
Emilio Cobos Álvarez
a62f6c78b2 style: Make a wrapper struct for extra matching data
No behavior change but we're about to add some extra field to it.

Differential Revision: https://phabricator.services.mozilla.com/D159850
2023-11-03 08:59:49 +01:00
Frederic Wang
d4742aefb9 style: disable lquote/rquote attributes on the <ms> element
This commit introduces a MathML preference for the legacy implementation
of the lquote/rquote attributes, and disable it by default. This feature
is not implemented in Chromium or WebKit, not part of MathML Core and
Firefox's implementation has issues (e.g. bugs 787215 and 1108608).

Differential Revision: https://phabricator.services.mozilla.com/D158479
2023-11-03 08:59:49 +01:00
Jonathan Kew
a4ad5e19b0 style: Implement CSS parsing for the @font-palette-values rule
Not yet hooked up to any rendering functionality.

The intention is for both the @font-palette-values at-rule and the font-palette property
to be behind the same pref being introduced here.

Differential Revision: https://phabricator.services.mozilla.com/D157953
2023-11-03 08:59:49 +01:00