Commit graph

9109 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
520f851d8c style: Simplify some appearance code
I was looking into simplifying our scrollbar styles:

  * StyleAppearance::Resizer is not used in content, and some of the
    values were only for <xul:window> which are not supported anymore.

  * Statusbarpanel and Resizerpanel aren't used. Statusbar is only used
    once on macOS so we only need to keep it there.

Differential Revision: https://phabricator.services.mozilla.com/D178374
2023-11-24 08:57:14 +01:00
Oriol Brufau
7d72d7c385 Further changes required by Servo 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
d49b014c78 style: Make style parallel traversal more tunable at runtime
This adds two prefs to configure the parallel traversal work item size
and kick-off threshold, but otherwise shouldn't change behavior.

I switched from iterator generics to just a slice while at it, mostly
for simplicity, but there is a trade-off:

  * When switching from sequential to parallel traversal, we potentially
    pay the price of memmoving the VecDeque around once to make them a
    contiguous slice.

  * However we win in the common case of the smaller-than-work-unit size
    in which case we no longer need to copy stuff to a WorkItem. So I
    think overall this should be an improvement.

Differential Revision: https://phabricator.services.mozilla.com/D178656
2023-11-24 08:57:14 +01:00
Oriol Brufau
ea3fcce25f Further changes required by Servo 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
10f8eb4239 style: Make stylo thread pool size configurable via pref rather than just env
Remove a variety of code which we don't use to change the pool size. We
can just use the pref as needed in the future.

Differential Revision: https://phabricator.services.mozilla.com/D178575
2023-11-24 08:57:14 +01:00
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
Oriol Brufau
8d2ae3f1c5 Further changes required by Servo 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
Zach Hoffman
87ce7045ef style: [css-properties-values-api] Parsing and serialization for @property syntax descriptor
Based off of @emilio's syntax parser at
<https://github.com/emilio/css-typed-om-syntax>.

Co-authored-by: Emilio Cobos Álvarez <emilio@crisal.io>

Differential Revision: https://phabricator.services.mozilla.com/D178268
2023-11-24 08:57:14 +01:00
Daniel Holbert
8823b63513 style: Remove code that's flagged as to-be-removed once layout.css.always-repaint-on-unvisited is true
If I'm reading the code comment correctly, this is now unreachable code,
and hence can & should be removed.

Differential Revision: https://phabricator.services.mozilla.com/D178570
2023-11-24 08:57:14 +01:00
Boris Chiou
b5deea8442 style: Reject empty svg path string for basic shape path function
Per CSS shape spec, the empty path string is invalid. However, for SVG
d property, the EBNF allows the path data string in the d property to be
empty. We just disable the rendering of the path.

Note: only offset-path and clip-path are affected.

Differential Revision: https://phabricator.services.mozilla.com/D178123
2023-11-24 08:57:14 +01:00
Oriol Brufau
d4aafad560 Further changes required by Servo 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
David Shin
7a2b444a60 style: Implement parsing for baseline-source
Differential Revision: https://phabricator.services.mozilla.com/D173884
2023-11-24 08:57:14 +01:00
Emily McDonough
571136562d style: Remove the layout.css.named-pages.enabled pref
Differential Revision: https://phabricator.services.mozilla.com/D175438
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
920a1c1f08 style: [css-nesting] Update cssparser again
This changes the cssparser setup to:

  * Avoid having to do copies of the ParsingContext all over the place,
    which is useful because I plan to stash more nesting state in there.

  * Use the new RuleBodyParser which allows parsing qualified rules,
    declarations, and so on. Though we still don't use this anywhere.

The next step is to join NestedRuleParser and PropertyDeclarationParser,
so that we can parse declarations in a lot of the nested rules as well.

Differential Revision: https://phabricator.services.mozilla.com/D178053
2023-11-24 08:57:14 +01:00
Oriol Brufau
32f1989a5c Further changes required by Servo 2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
ae993e485a style: Move a bit declaration_block and cascade modules
So that they aren't imported via #[path]. This allows cargo to see them
even before building.

Differential Revision: https://phabricator.services.mozilla.com/D178105
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
c2a2113136 style: Container units should prevent us from using the rule cache
Much like with font-relative units, when they're used for a
non-inherited property we need to avoid using the rule cache.

This is because two elements matching the same rules won't get
guaranteed-equal non-inherited style structs.

Depends on D177732

Differential Revision: https://phabricator.services.mozilla.com/D177733
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
af13e670d9 style: Clean up length handling
No behavior change, but using Self is shorter and while I'm touching
this code might as well clean it up a little bit.

Differential Revision: https://phabricator.services.mozilla.com/D177732
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
d9d865e8c9 style: Add an API to parse an absolute length without any other context
This should allow making these work on canvas.

Differential Revision: https://phabricator.services.mozilla.com/D177074
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
a69578993a style: display: inline list-item is also a line participant
So the line break suppression flags should be propagated through it.

Otherwise ruby invariants might break, leading to a nullptr crash in
this case.

On debug builds the assertion was this one:

  https://searchfox.org/mozilla-central/rev/e6cb503ac22402421186e7488d4250cc1c5fecab/layout/generic/nsRubyBaseContainerFrame.cpp#631

Differential Revision: https://phabricator.services.mozilla.com/D177093
2023-11-24 08:57:14 +01:00
Tiaan Louw
18c701e6b5 style: Hardening color checks
Avoid trying to resolve a currentcolor when a foreground color is not
available.

Differential Revision: https://phabricator.services.mozilla.com/D177368
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
42cbb9d3cf style: Remove HasSimpleFFI
It's completely unsused and we don't want to use it any time soon, see
bug 1831539 and related.

Differential Revision: https://phabricator.services.mozilla.com/D177497
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
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
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
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
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