Граф коммитов

10790 Коммитов

Автор SHA1 Сообщение Дата
Zach Hoffman ecc8e1fb48 Bug 1840477 - Validate initial value syntax r=emilio
With this patch, all the WPTs for initial value validation pass, except
for one whose syntax fails to parse (see bug 1843988).

Depends on D183806

Differential Revision: https://phabricator.services.mozilla.com/D183807
2023-07-20 07:48:13 +00:00
Mike Hommey 7c063cf058 Bug 1844000 - Update parking-lot to 0.12.1. r=emilio,supply-chain-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D183825
2023-07-19 20:16:02 +00:00
Boris Chiou eb906cfb64 Bug 1841313 - Handle addition and accumulation for grid-template-{rows|columns}. r=emilio
If we unconditionally return `Err(())`, the entire composition fails and
we use the keyframe values always.

Basically, we should just use the effect value "per item" when it falls back to
discrete (i.e. non-additive), for composition. So we have to implement
Procedure::Add and Procedure::Accumulate to avoid rejecting everything in
GridTemplateComponent.

Differential Revision: https://phabricator.services.mozilla.com/D183623
2023-07-19 19:33:44 +00:00
Natalia Csoregi 5c4ac58967 Backed out 2 changesets (bug 1842474, bug 1842475) for causing bustage on accent-color issues. CLOSED TREE
Backed out changeset 108eee70bf44 (bug 1842475)
Backed out changeset d381fa26e3b6 (bug 1842474)
2023-07-19 19:45:38 +03:00
Gregory Pappas daa38b4cfd Bug 1842475 - Remove layout.css.color-scheme.enabled pref r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D184013
2023-07-19 16:22:16 +00:00
Gregory Pappas dab8d2005c Bug 1842474 - Remove layout.css.accent-color.enabled pref r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D184009
2023-07-19 16:04:38 +00:00
Emilio Cobos Álvarez 9aa60b822a Bug 1844241 - Remove now-dead graphics glass code. r=tnikkel,devtools-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D183942
2023-07-19 12:44:34 +00:00
Zach Hoffman 51828d2415 Bug 1843982 - Add ParsingMode for rejecting font-relative units r=emilio
Font-relative units are not computationally independent, so they cannot
be in the initial value.

Drive-by, but this patch also switches to defining the fields of
ParsingMode using bit shifting to match Gecko's ParsingMode declaration.

Differential Revision: https://phabricator.services.mozilla.com/D183806
2023-07-19 10:43:44 +00:00
Emilio Cobos Álvarez 907db2c227 Bug 1838460 - Remove unused -moz-buttondefault color. r=stransky
Differential Revision: https://phabricator.services.mozilla.com/D183776
2023-07-18 17:21:40 +00:00
Emilio Cobos Álvarez 0481e91ad7 Bug 1838460 - Don't use titlebar colors when not drawing tabs to the titlebar. r=stransky
Introduce the concept of "header bar" colors, and use them when we don't draw
to the titlebar directly (in which case we use the titlebar / caption colors).

This maps to the KDE "header" colors, and allows us to:

 * Fix this bug, by not blindly using titlebar colors. This restores
   previous behavior for most themes, which used to use the menubar
   colors, and actually enhances it by allowing them to react to
   window-inactive states.

 * Preserve the nice behavior on places we know it's good (that is, keep
   bug 1704086 fixed, for example). This is done by special-casing
   Adwaita/Breeze/Yaru, which is kinda lame, but it doesn't seem too
   terrible.

 * More thoroughly respect KDE system settings.

Differential Revision: https://phabricator.services.mozilla.com/D182888
2023-07-18 16:44:42 +00:00
Tiaan Louw 13e6deeb9a Bug 1843519 - Reuse merge logic from try_product_in_place when parsing. r=emilio
The merge logic in try_product_in_place could not be used because it
expected the rhs node to be a leaf already.  Now it tries to resolve the
rhs to a number before checking validity.  This allows the use of the
logic during parsing as well.  When simplifying the rhs is already a
node as it used to be, so the resolve should hit the Leaf case anyway
and return early, so the overhead is negligible.

Differential Revision: https://phabricator.services.mozilla.com/D183573
2023-07-18 15:02:06 +00:00
Emilio Cobos Álvarez 7e60f84b6e Bug 1843663 - Remove pre windows-10-specific media queries and styles. r=dao,Gijs,handyman,settings-reviewers
Some basic clean-up. I want to do this before doing bigger changes in
bug 1843044.

There's tons more code that can get cleaned-up on the widget side, but
let's start with this.

Differential Revision: https://phabricator.services.mozilla.com/D183622
2023-07-18 14:11:33 +00:00
Tiaan Louw dbfa0366e2 Bug 1843528 - Move sign() function behind a pref r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D183575
2023-07-15 09:44:05 +00:00
Natalia Csoregi d413cf062d Backed out changeset 413d7af91dc0 (bug 1843519) for causing test_property_syntax_errors.html failures. CLOSED TREE 2023-07-15 11:13:23 +03:00
Tiaan Louw 6de9de5f42 Bug 1843519 - Reuse merge logic from try_product_in_place when parsing. r=emilio
The merge logic in try_product_in_place could not be used because it
expected the rhs node to be a leaf already.  Now it tries to resolve the
rhs to a number before checking validity.  This allows the use of the
logic during parsing as well.  When simplifying the rhs is already a
node as it used to be, so the resolve should hit the Leaf case anyway
and return early, so the overhead is negligible.

Differential Revision: https://phabricator.services.mozilla.com/D183573
2023-07-15 07:04:01 +00:00
Emilio Cobos Álvarez aadc4434c7 Bug 1843076 - Use data_mut in HeaderSlice::drop().
Tentative, but it is more correct and made miri happier.

Differential Revision: https://phabricator.services.mozilla.com/D183625
2023-07-14 22:51:06 +00:00
Frederic Wang 8343f88354 Bug 1821980: Align mathvariant implementation on MathML Core. r=emilio,jfkthame
In MathML Core, the recommendation is to directly use the proper
character from the Mathematical Alphanumeric Symbols instead of the
mathvariant attribute. The exception is for automatic italicization on
single-char `<mi>` element. This is implemented via a new text-transform
value "math-auto" [1] which is the default on the `<mi>` element. The
mathvariant attribute is now restricted to that element and to value
"normal" in order to force upright text instead [2]. This CL implements
this restriction together with that new text-transform value under the
mathml.legacy_mathvariant_attribute.disabled flag.

Some legacy MathML cases where math-auto alone does not work are
still handled via MathMLTextRunFactory.

[1] https://w3c.github.io/mathml-core/#new-text-transform-values
[2] https://w3c.github.io/mathml-core/#the-mathvariant-attribute

Differential Revision: https://phabricator.services.mozilla.com/D172395
2023-07-14 19:44:04 +00:00
Cristian Tuns 9f238811ed Backed out changeset db50582c2b9f (bug 1821980) for causing mochitest failures in browser_mathml.js CLOSED TREE 2023-07-14 13:49:13 -04:00
Frederic Wang 0a3179c31f Bug 1821980: Align mathvariant implementation on MathML Core. r=emilio,jfkthame
In MathML Core, the recommendation is to directly use the proper
character from the Mathematical Alphanumeric Symbols instead of the
mathvariant attribute. The exception is for automatic italicization on
single-char `<mi>` element. This is implemented via a new text-transform
value "math-auto" [1] which is the default on the `<mi>` element. The
mathvariant attribute is now restricted to that element and to value
"normal" in order to force upright text instead [2]. This CL implements
this restriction together with that new text-transform value under the
mathml.legacy_mathvariant_attribute.disabled flag.

Some legacy MathML cases where math-auto alone does not work are
still handled via MathMLTextRunFactory.

[1] https://w3c.github.io/mathml-core/#new-text-transform-values
[2] https://w3c.github.io/mathml-core/#the-mathvariant-attribute

Differential Revision: https://phabricator.services.mozilla.com/D172395
2023-07-14 15:53:34 +00:00
Iulian Moraru 68cbf5e276 Backed out changeset 6cceaca5e653 (bug 1821980) for causing multiple failures. CLOSED TREE 2023-07-14 15:41:31 +03:00
Tiaan Louw 86ae06a010 Bug 1843527 - Move abs() function behind a pref. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D183574
2023-07-14 11:29:55 +00:00
Frederic Wang 1e731ab03c Bug 1821980: Align mathvariant implementation on MathML Core. r=emilio,jfkthame
In MathML Core, the recommendation is to directly use the proper
character from the Mathematical Alphanumeric Symbols instead of the
mathvariant attribute. The exception is for automatic italicization on
single-char `<mi>` element. This is implemented via a new text-transform
value "math-auto" [1] which is the default on the `<mi>` element. The
mathvariant attribute is now restricted to that element and to value
"normal" in order to force upright text instead [2]. This CL implements
this restriction together with that new text-transform value under the
mathml.legacy_mathvariant_attribute.disabled flag.

Some legacy MathML cases where math-auto alone does not work are
still handled via MathMLTextRunFactory.

[1] https://w3c.github.io/mathml-core/#new-text-transform-values
[2] https://w3c.github.io/mathml-core/#the-mathvariant-attribute

Differential Revision: https://phabricator.services.mozilla.com/D172395
2023-07-14 10:52:59 +00:00
Tiaan Louw d77b08e5e5 Bug 1814588 - Implement sign() function r=emilio
This makes available the use of the sign() function.

https://drafts.csswg.org/css-values-4/#sign-funcs

Differential Revision: https://phabricator.services.mozilla.com/D182905
2023-07-13 21:47:55 +00:00
Tiaan Louw 6c901cb3db Bug 1815448 - Add product and invert nodes to allow calculation after parsing. r=emilio
Introduce a product and invert node so that calculations can be done
after parsing, mostly because we will introduce the sign() node which is
not distributive.

Differential Revision: https://phabricator.services.mozilla.com/D180681
2023-07-13 16:57:44 +00:00
Boris Chiou 3996efea15 Bug 1842277 - Compute <basic-shape-rect> to the equivalent inset() function. r=devtools-reviewers,emilio
Per spec
https://drafts.csswg.org/css-shapes-1/#basic-shape-computed-values, and
the spec issue, https://github.com/w3c/csswg-drafts/issues/9053,
all <basic-shape-rect> functions compute to the equivalent inset() function.
i.e.
`xywh(x y w h)` computes to
`inset(y calc(100% - x - w) calc(100% - y - h) x)`

The basic concept is to use `BasicShapeRect` as the specified value of
`<basic-shape-rect>`, i.e. inset()/xywh()/rect(), and its computed value is
the equivalent `InsetRect`, and so it becomes possible to interpolate among
these three functions.

Also, we can drop BuildXywhPath() and ComputeRect() because now there is
only inset() function when building gfx::Path.

Besides, tweak the test, offset-path-shape-xywh-003.html, because the original
test, `xywh(10% 10% 80% 80%)`, has to calculate `calc(100% - 10% - 80%)`.
Its result is `Percentage(0.099999964)` in Rust code, and then it makes us
compute an imprecision inset rect when building the gfx::path, which results in
a transform with the sub-pixel translation. So change it to
`xywh(10% 10% 90% 90%)` to avoid adding fuzzy tolerance.

Differential Revision: https://phabricator.services.mozilla.com/D183221
2023-07-12 20:16:47 +00:00
Emilio Cobos Álvarez 32ea1e021b Bug 1842221 - Simplify ThinArc and friends. r=boris
ThinArc is way more complex than it needs to be, and miri complains
about various things when using the selectors crate with it.

This doesn't fully fix miri, but it gets much closer. ThinArc becomes
just an alias for Arc<HeaderSlice<>>. This allows to simplify the
bindings to ArcSlice too, since now the existing Arc<> code can just be
used.

Differential Revision: https://phabricator.services.mozilla.com/D183011
2023-07-12 07:17:25 +00:00
Rob Buis 1a5792f5ac Bug 1835813 - support contain-intrinsic-size: auto none r=Oriol,emilio,devtools-reviewers,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D182462
2023-07-11 18:23:26 +00:00
Emilio Cobos Álvarez 61ac768304 Bug 1842404 - Don't duplicate calc() logic in rust and C++. r=tlouw
Now that we don't need the nscoord-resolving thing, we can actually just
call into rust to do this, and avoid the code duplication.

Differential Revision: https://phabricator.services.mozilla.com/D183078
2023-07-10 22:00:31 +00:00
Gregory Pappas 53f750f7c5 Bug 1842481 - Remove layout.css.step-position-jump.enabled pref r=boris,devtools-reviewers,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D183105
2023-07-10 20:07:00 +00:00
Markus Stange 24f1c30cdc Bug 1839082 - Add a fast path for non-compound attribute selectors. r=emilio
This improves the testcase in bug 1837673, because it means that we only
check attributes once. Before this patch, we would check them twice: First,
the SimpleFilter path would check for the presence of the attribute, and then
later we would enumerate attributes again to check the attribute value.
Now we don't use the SimpleFilter path anymore and go straight to attribute
enumeration.

Differential Revision: https://phabricator.services.mozilla.com/D181349
2023-07-09 19:09:27 +00:00
Markus Stange 0c2ed29fe3 Bug 1839082 - Move attribute checking around so that the attribute name can be checked without a function call. r=emilio
The goal here is to inline the loop and attribute name check into the caller.
Once an attribute with a matching name is found, we do the remainder of the
checks (namespace, attribute value) with a function call.

The `#[inline(always)]` annotation was needed in a local non-PGO --enable-release build.

Without #[inline(always)]: https://share.firefox.dev/46SQUMn
With #[inline(always)] (18% faster): https://share.firefox.dev/44CvC3g

Differential Revision: https://phabricator.services.mozilla.com/D181348
2023-07-09 19:09:27 +00:00
Markus Stange f1802f97b4 Bug 1839082 - Remove iter_attrs. This is no longer needed, now that attributes are always a single slice. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D183081
2023-07-09 19:09:27 +00:00
Boris Chiou 39d4bd0f10 Bug 1786160 - Support xywh() in style. r=emilio
Also, add layout.css.basic-shape-xywh.enabled and enable it on Nightly

Differential Revision: https://phabricator.services.mozilla.com/D182419
2023-07-07 18:12:40 +00:00
Emilio Cobos Álvarez 5eaca95860 Bug 1841128 - Tweak an assert that doesn't hold in presence of first-line reparenting but doesn't hurt correctness.
MANUAL PUSH: Debug-only change CLOSED TREE
2023-07-07 20:28:21 +02:00
Emilio Cobos Álvarez 0d753c2a94 Bug 1841128 - Simplify first-line reparenting a bit. r=TYLin
The TLDR is that our first-line implementation is complete madness, but
I'm not fixing bug 1465474 yet.

The guarantee that first-line style reparenting relies on is that
reparenting shouldn't change reset properties (that's why we had all
this "style to inherit ignoring first-line" to inherit reset
properties). Bug 1839223 broke this guarantee in the case the mapped
attribute declarations are reused / mutated (which is something we want
to do for performance).

What's going on in the test-case is that the old style's rule-node
declarations are mutated by the mapped attributes code. Re-cascading the
old styles yields a different `float` property value.

When a style change that causes a reframe like this one happens, we
don't update the frame tree styles with the new styles: it'd be wrong
and also useless work.

First-line reparenting happens after we've recomputed the styles, but
before we've reframed as needed. In this intermediate state, the frame
remains with the old (floated) style, but the ::first-line reparenting
code isn't aware that this frame is going away, so it happily
re-cascades and updates the style anyways, creating a floated
frame that has float: none in its computed style information.

This causes the frame destruction code to crash.

This patch restores that guarantee that ::first-line doesn't change
reset properties by re-using the "reset properties cache" code-path.
This is also simpler since it avoids us having to compute the "parent
ignoring ::first-line" style.

The code is also more explicit with the new enum rather than just an
Option.

Differential Revision: https://phabricator.services.mozilla.com/D182769
2023-07-07 16:46:52 +00:00
Emilio Cobos Álvarez 1b463368ae Bug 1838460 - Remove unused moz-menubartext color. r=geckoview-reviewers,devtools-reviewers,nchevobbe,amejiamarmol
-moz-menubarhovertext has one usage that can go away once we remove
windows 7 / 8 so not touching that yet.

Depends on D182896

Differential Revision: https://phabricator.services.mozilla.com/D182897
2023-07-07 15:23:10 +00:00
Noemi Erli 1b3921b744 Backed out 3 changesets (bug 1841128) for causing failures in 1385656.html
Backed out changeset 423c48eae15e (bug 1841128)
Backed out changeset 67e3d9e33912 (bug 1841128)
Backed out changeset cb94d6c0916d (bug 1841128)
2023-07-07 16:16:26 +03:00
Emilio Cobos Álvarez 51d0003074 Bug 1841128 - Simplify first-line reparenting a bit. r=TYLin
The TLDR is that our first-line implementation is complete madness, but
I'm not fixing bug 1465474 yet.

The guarantee that first-line style reparenting relies on is that
reparenting shouldn't change reset properties (that's why we had all
this "style to inherit ignoring first-line" to inherit reset
properties). Bug 1839223 broke this guarantee in the case the mapped
attribute declarations are reused / mutated (which is something we want
to do for performance).

What's going on in the test-case is that the old style's rule-node
declarations are mutated by the mapped attributes code. Re-cascading the
old styles yields a different `float` property value.

When a style change that causes a reframe like this one happens, we
don't update the frame tree styles with the new styles: it'd be wrong
and also useless work.

First-line reparenting happens after we've recomputed the styles, but
before we've reframed as needed. In this intermediate state, the frame
remains with the old (floated) style, but the ::first-line reparenting
code isn't aware that this frame is going away, so it happily
re-cascades and updates the style anyways, creating a floated
frame that has float: none in its computed style information.

This causes the frame destruction code to crash.

This patch restores that guarantee that ::first-line doesn't change
reset properties by re-using the "reset properties cache" code-path.
This is also simpler since it avoids us having to compute the "parent
ignoring ::first-line" style.

The code is also more explicit with the new enum rather than just an
Option.

Depends on D182768

Differential Revision: https://phabricator.services.mozilla.com/D182769
2023-07-07 12:01:30 +00:00
Emilio Cobos Álvarez 1705f02eea Bug 1735575 - Add aliases for webkit-slider pseudos. r=boris
See discussion in the bug.

Differential Revision: https://phabricator.services.mozilla.com/D128392
2023-07-06 21:43:09 +00:00
Iulian Moraru 33c0086ecb Backed out changeset e1b5dd2da037 (bug 1835813) for causing multiple failures. 2023-07-05 16:34:47 +03:00
Rob Buis 44206e341c Bug 1835813 - support contain-intrinsic-size: auto none r=Oriol,emilio
Differential Revision: https://phabricator.services.mozilla.com/D182462
2023-07-05 11:48:16 +00:00
CanadaHonk c2e3ecef93 Bug 1841638 - Fix scale() single NaN value serialization r=emilio
Added custom implementation of PartialEq for Numbers to also check if
they are both NaN values.

WPT tests not specifically for this but incorrect serialization of
expected results:
- https://wpt.fyi/results/css/css-values/round-mod-rem-serialize.html
- https://wpt.fyi/results/css/css-values/sin-cos-tan-serialize.html

15 WPT subtests now newly pass 🎉

Differential Revision: https://phabricator.services.mozilla.com/D182725
2023-07-05 09:39:49 +00:00
CanadaHonk c50b872101 Bug 1531213 - Round to nearest integer per spec for calc() r=dholbert
Rounding to the nearest integer rounds in the direction of +inf when the
fractional portion is 0.5. eg: -1.5 -> -1, 1.5 -> 2

Spec: https://www.w3.org/TR/css-values-4/#css-round-to-the-nearest-integer
WPT test: https://wpt.fyi/results/css/css-values/calc-z-index-fractions-001.html

1 WPT subtest newly passes.

Differential Revision: https://phabricator.services.mozilla.com/D182745
2023-07-04 22:13:29 +00:00
Emilio Cobos Álvarez 974d8c61ca Bug 1841496 - Copy container units bit when reusing reset properties. r=dshin
I don't think this changes behavior right now because container units
prevent rule cache sharing here:

  https://searchfox.org/mozilla-central/rev/7069822ab03c425676187eadca1d8e0d84ff3b5b/servo/components/style/values/specified/length.rs#789

But it is the right thing to do, and I'm considering adding another code
path to copy reset properties in bug 1841128 for first-line reparenting,
and not doing this would cause correctness issues.

Differential Revision: https://phabricator.services.mozilla.com/D182660
2023-07-04 14:34:21 +00:00
Emilio Cobos Álvarez 82bb61c0e4 Bug 1837700 - Fix ToShmem for empty ThinVec. r=jfkthame
Bug 1837700 comment 14 is right. I can reproduce it by toggling off
scroll-anchoring by pref, and accessing:

  data:text/html,<div contenteditable>

So that we load contenteditable.css which hits the issue.

Differential Revision: https://phabricator.services.mozilla.com/D182666
2023-07-04 12:17:29 +00:00
Mike Hommey 7db694cb35 Bug 1841205 - Update num-derive to 0.4. r=emilio,supply-chain-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D182539
2023-07-04 07:29:36 +00:00
Mike Hommey e46d768d3c Bug 1841160 - Update phf to 0.11.2. r=emilio,supply-chain-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D182514
2023-07-04 07:29:08 +00:00
Emilio Cobos Álvarez c512afdb58 Bug 1840587 - Improve custom property reference storage. r=zrhoffman
This effectively undoes bug 1506760, preventing the reallocation of the
reference set.

This was done for UA sheet sharing (bug 1474793), but we can handle this
fine now (UA sheets don't have variable references anyways).

Depends on D182170

Differential Revision: https://phabricator.services.mozilla.com/D182171
2023-06-27 20:26:20 +00:00
Emilio Cobos Álvarez 0b23ad0195 Bug 1840587 - [css-properties-values-api] Values with references shouldn't be valid initial values. r=zrhoffman
Same, we need this check regardless of the syntax.

Differential Revision: https://phabricator.services.mozilla.com/D182170
2023-06-27 20:26:20 +00:00
Emilio Cobos Álvarez 03cf8ae8be Bug 1840587 - [css-properties-values-api] Prevent CSS-wide keywords as initial values. r=zrhoffman
This is not the whole validation that needs to happen, but we need to do
this anyways for the universal-syntax.

Rename validate_syntax to validate_initial_value since that's what it
does.

Differential Revision: https://phabricator.services.mozilla.com/D182169
2023-06-27 20:25:52 +00:00
Emilio Cobos Álvarez 3d3511bf24 Bug 1840476 - [css-properties-values-api] Custom property registration plumbing. r=zrhoffman,firefox-style-system-reviewers,webidl,saschanaz
This implements script registration and some basic validity checks so
that we start keeping track of custom properties in the CascadeData and
in script.

Differential Revision: https://phabricator.services.mozilla.com/D182110
2023-06-27 09:48:51 +00:00
Emilio Cobos Álvarez 4c49fa341e Bug 1839182 - Use desugared selector list in css error reports. r=nchevobbe,firefox-style-system-reviewers,boris
Hopefully this isn't too slow, and we only do this when error reporting
is enabled...

Differential Revision: https://phabricator.services.mozilla.com/D182014
2023-06-27 08:28:53 +00:00
Emilio Cobos Álvarez f167060cb5 Bug 1839945 - Simplify NestedRuleParser. r=boris
Now that we just use a single mutable context we can simplify this by
using the same representation. The different type is still useful
because once we enter on a nested context there's some checks we can
omit.

This should make parsing slightly faster.

Differential Revision: https://phabricator.services.mozilla.com/D181802
2023-06-26 20:36:12 +00:00
Emilio Cobos Álvarez 19b74cd4e3 Bug 1839945 - [css-nesting] Properly restrict nested rules. r=zrhoffman
As per https://drafts.csswg.org/css-nesting/#conditionals only some
rules are allowed inside style rules.

Differential Revision: https://phabricator.services.mozilla.com/D181798
2023-06-26 20:36:12 +00:00
Tiaan Louw 4410cd25bc Bug 1838740 - linear-gradient() and friends can parse a color interpolation method r=emilio
Allow the following syntax for gradients:
`linear-gradient(in lab to right, red, blue)`

The patch will parse and make available the interpolation method, but no
rendering changes are made, so all gradients will still render in srgb.

Differential Revision: https://phabricator.services.mozilla.com/D181162
2023-06-26 13:46:38 +00:00
Cosmin Sabou 887e24051d Backed out changeset e7327bb0db03 (bug 1838740) for causing wpt failures on gradient-interpolation-method-computed.html. CLOSED TREE 2023-06-23 18:46:19 +03:00
Jan-Niklas Jaeschke 7518e2e9bc Bug 1811823, part 2: Add correct prioritization for custom highlights. r=emilio
Due to the prioritization rules for custom highlights, it is not feasible to rely on cascading.
Instead, highlights need to be stacked by their priority (and order of insertion).
Text and background color of the highest-prioritized highlight which defines that property should be used.

Since highlights are implemented as special `Selection`s, the algorithm that determines the prevailing selection for a text frame needed to be adapted to instead return a list of selections.

Differential Revision: https://phabricator.services.mozilla.com/D181143
2023-06-23 15:22:44 +00:00
Tiaan Louw 9f3b97d808 Bug 1838740 - linear-gradient() and friends can parse a color interpolation method r=emilio
Allow the following syntax for gradients:
`linear-gradient(in lab to right, red, blue)`

The patch will parse and make available the interpolation method, but no
rendering changes are made, so all gradients will still render in srgb.

Differential Revision: https://phabricator.services.mozilla.com/D181162
2023-06-23 11:39:19 +00:00
Sandor Molnar 14813b73cb Backed out changeset 49a74814e122 (bug 1838740) for causing wpt failures in gradient-interpolation-method-computed.html CLOSED TREE 2023-06-23 14:23:48 +03:00
Tiaan Louw e3ad93ef2a Bug 1838740 - linear-gradient() and friends can parse a color interpolation method r=emilio
Allow the following syntax for gradients:
`linear-gradient(in lab to right, red, blue)`

The patch will parse and make available the interpolation method, but no
rendering changes are made, so all gradients will still render in srgb.

Differential Revision: https://phabricator.services.mozilla.com/D181162
2023-06-23 08:12:22 +00:00
Emily McDonough bae44588ff Bug 1838078 - Ensure page-rules respect layer order for styling r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D180733
2023-06-22 20:16:26 +00:00
Emilio Cobos Álvarez 7bddcf9e5a Bug 1839223 - Remove nsMappedAttributes. r=smaug
Instead, lazily schedule evaluation of them before styling, much like we
were doing for SVG.

A subtle tweak is that we only remain scheduled while in the document.
This allows us to use the "in document" bit plus the "mapped attributes
dirty" bit to know our scheduled status. It also prevents doing silly
work for disconnected elements, and having to do hashmap lookups on
adoption and node destruction.

Differential Revision: https://phabricator.services.mozilla.com/D181549
2023-06-22 17:22:03 +00:00
Cristian Tuns 6957543e5e Backed out changeset a3e55d5f9f13 (bug 1839223) for causing multiple failures in Document.cpp CLOSED TREE 2023-06-22 11:34:15 -04:00
Emilio Cobos Álvarez 2c6de5f038 Bug 1839223 - Remove nsMappedAttributes. r=smaug
Instead, lazily schedule evaluation of them before styling, much like we
were doing for SVG.

A subtle tweak is that we only remain scheduled while in the document.
This allows us to use the "in document" bit plus the "mapped attributes
dirty" bit to know our scheduled status. It also prevents doing silly
work for disconnected elements, and having to do hashmap lookups on
adoption and node destruction.

Differential Revision: https://phabricator.services.mozilla.com/D181549
2023-06-22 14:31:16 +00:00
Emilio Cobos Álvarez 1ac45263e4 Bug 1839221 - Simplify rule to hide forms inside tables in html docs. r=jfkthame
While we're at it:

 * Hide :-moz-is-html from content. This is barely documented (a google
   search for that yields two pages mostly of our UA sheet) and unlikely
   to cause any compat impact (plus it's a one-liner to expose it if we
   needed to).

 * Make that only depend on the document state. It doesn't have any
   practical implications since we only use it on html.css which already
   has a default namespace.

 * Add some documentation on why are these pseudo-classes (rather than
   e.g., media queries).

Differential Revision: https://phabricator.services.mozilla.com/D181406
2023-06-22 11:31:44 +00:00
Tiaan Louw ce2ee22a42 Bug 1838600 - Implement the abs() function r=emilio
The abs() function resolves to the absolute value in calculations.

https://drafts.csswg.org/css-values-4/#sign-funcs

Differential Revision: https://phabricator.services.mozilla.com/D181060
2023-06-22 11:20:03 +00:00
Emilio Cobos Álvarez 4793228629 Bug 1839638 - Fix stylesheet invalidation on some kinds of rule insertions. r=zrhoffman
In particular, style rules weren't taking the children code-path.

Differential Revision: https://phabricator.services.mozilla.com/D181650
2023-06-22 09:14:08 +00:00
Emily McDonough 99e10c5f8a Bug 1833471 Part 1 - Implement @page pseudo-class parsing and rule handling r=emilio
This currently will not match page-rules based on any selectors with any
pseudo-classes present.

Differential Revision: https://phabricator.services.mozilla.com/D178252
2023-06-21 23:37:46 +00:00
Norisz Fay 9e2d68a917 Backed out 3 changesets (bug 1833471) for causing failures on cssom-ruleTypeAndOrder.html, page-rule-declarations-000.html
Backed out changeset 69c9504ac848 (bug 1833471)
Backed out changeset e76595d749fb (bug 1833471)
Backed out changeset fd4e99d77a6b (bug 1833471)
2023-06-22 01:01:20 +03:00
Emily McDonough a18b6d735d Bug 1833471 Part 1 - Implement @page pseudo-class parsing and rule handling r=emilio
This currently will not match page-rules based on any selectors with any
pseudo-classes present.

Differential Revision: https://phabricator.services.mozilla.com/D178252
2023-06-21 19:02:23 +00:00
Mike Hommey d8456fd716 Bug 1836230 - Update bindgen to 0.66.1. r=emilio,supply-chain-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D179656
2023-06-21 08:52:22 +00:00
Narcis Beleuzu 15227435c3 Backed out 3 changesets (bug 1833471) for wpt failure on page-rule-declarations-000.html . CLOSED TREE
Backed out changeset 547eef705668 (bug 1833471)
Backed out changeset e21e18f3f729 (bug 1833471)
Backed out changeset 16164bf63457 (bug 1833471)
2023-06-21 11:24:49 +03:00
Emily McDonough 7025ca8885 Bug 1833471 Part 1 - Implement @page pseudo-class parsing and rule handling r=emilio
This currently will not match page-rules based on any selectors with any
pseudo-classes present.

Differential Revision: https://phabricator.services.mozilla.com/D178252
2023-06-21 02:13:01 +00:00
Markus Stange d118d24b6b Bug 1839081 - Inline eq_atom. r=emilio
In a profile of querySelectorAll with a class selector, I noticed a
non-inlined call to `eq_atom` from `style::gecko::snapshot_helpers::has_class_or_part`.

This was in a local build on arm64 macOS with `--enable-release` but without PGO.

Before: https://share.firefox.dev/3pduJ2j
After: https://share.firefox.dev/3Nhv0JH

Differential Revision: https://phabricator.services.mozilla.com/D181345
2023-06-19 21:44:16 +00:00
Emilio Cobos Álvarez caae6da5e7 Bug 1837818 - Remove special selector-matching case in matches_simple_selector. r=boris
This doesn't regress stylebench.

Depends on D180592

Differential Revision: https://phabricator.services.mozilla.com/D180593
2023-06-19 09:51:38 +00:00
Emilio Cobos Álvarez e92382018b Bug 1837818 - Minor selector matching tweaks. r=boris
The idea is to make the function small enough that it's fast to inline and
optimize by the compiler. For that:

 * Move some complex bits of matches_simple_selector into functions so
   that the compiler can put them out of line if it wants.

 * Rename a function to be more descriptive and not force it to be
   inline (that wasn't measured afaict, comes from the :nth-child(of)
   implementation).

Depends on D180591

Differential Revision: https://phabricator.services.mozilla.com/D180592
2023-06-16 17:24:01 +00:00
Emilio Cobos Álvarez c27a7a2b3e Bug 1835068 - Parse relative selectors for nesting. r=dshin
Make parsing test not depend on under-specified serialization details,
see https://github.com/w3c/csswg-drafts/issues/8970.

Differential Revision: https://phabricator.services.mozilla.com/D181125
2023-06-16 15:29:59 +00:00
Emilio Cobos Álvarez 698a78bf91 Bug 1838670 - Match parent selector like :scope. r=zrhoffman
https://drafts.csswg.org/css-nesting-1/#nest-selector:

    When used in any other context, it represents the same elements as
    :scope in that context (unless otherwise defined).

Differential Revision: https://phabricator.services.mozilla.com/D181119
2023-06-16 15:22:31 +00:00
Zach Hoffman 630bf3eec6 Bug 1837351 - Skip positional pseudo-class matching during invalidation r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D180769
2023-06-16 03:33:18 +00:00
Boris Chiou 4b8c77479a Bug 1837305 - Part 6: Update AnimationValue for offset-path. r=emilio
We are using NonNegative now for offset-path, so just like clip-path, we
have to make sure we don't get the negative radius for circle and ellipse,
and don't get the negative border-radius for inset. Therefore, we have to
convert the computed value into animated value when doing interpolation,
and then clamp the value to make sure it is always >= 0 when converting
it back to computed value, just like what we do for clip-path in Bug 1512883.

Also drop the normalization of SVGPathData in AnimationInfo when
preparing offset-path for compositor animations. It's useless because we
"always" do normalization in SVGPathData::animate().

Differential Revision: https://phabricator.services.mozilla.com/D180284
2023-06-15 00:04:00 +00:00
Boris Chiou 0307742927 Bug 1837305 - Part 5: Add coord-box to offset-path property. r=devtools-reviewers,emilio
This patch makes sure the syntax of `offset-path` is:
  `offset-path: none | <offset-path> || <coord-box>`.

Differential Revision: https://phabricator.services.mozilla.com/D179628
2023-06-15 00:03:59 +00:00
Boris Chiou 38cbd14258 Bug 1837305 - Part 4: Update OffsetPath to use BasicShape in style system. r=devtools-reviewers,emilio
We rewrite the data structure of OffsetPath to support all basic shapes.
However, We don't build the gfx::Path for basic shapes other than path()
for now because the current caching mechanism (on the main thread) doesn't
work for basic shapes. It's layout dependent.

Note:
1. Update offset-path-interpolation-006.html to make sure the start value
   and the end value have `at <position>`. `offset-path` doesn't set center
   as default for `at <position>`, so if any of the values omits the
   `at <position>`, we expect they are not interpolated in Gecko.
   This is different from Blink, they still use center as the default value
   for interpolation.
2. We still have some failures in offset-path-interpolation-006.html
   beacuse we don't clamp the negative radius/radii and the negative
   border-radius. We will handle it in the following patches.
3. We will add `<coord-box>` in the later patch.
4. Adding Deserialize and Serialize is necessary for compositor
   animations.

Differential Revision: https://phabricator.services.mozilla.com/D179627
2023-06-15 00:03:59 +00:00
Boris Chiou 0620a0a751 Bug 1837305 - Part 3: Use PositionOrAuto for "at <position>" in circle and ellipse. r=emilio
The omitted postion has special meaning for offset-path. It defaults to using
offset-position as the circle/ellipse center if the explicit center is
not given. Just like what we do for ray(), here we also use
PositionOrAuto for it.

We omit this component if it is not given when serializing offet-path,
and preserve the value even if it specifies the default value, for the
same reason.

For shape-outside and clip-path, we don't change their behaviors for now.
This bug is for offset-path and we will use it in the following patches.
We should fix them in Bug 1837340.

Differential Revision: https://phabricator.services.mozilla.com/D179626
2023-06-15 00:03:59 +00:00
Boris Chiou b9b5dc541e Bug 1837305 - Part 2: Add ShapeType for BasicShape parser. r=emilio
For outline shapes, fill-rule should be ignored. We add the flag in
the parser of BasicShape, so offset-path can use this flag to ignore
fill-rule.

Note: "ShapeType" means this property uses filled shapes or outline
shapes. For outline shapes, we ignore fill-rule. This is from the
concept of `<outline-shape>` and `<filled-shape>` in
https://github.com/w3c/csswg-drafts/issues/3468#issue-393916361

No behavir change in this patch, just add the ability for offset-path to
ignore `<fill-rule>` when combining all basic shapes into offset-path.

Differential Revision: https://phabricator.services.mozilla.com/D179625
2023-06-15 00:03:59 +00:00
Boris Chiou 8e1a7c8124 Bug 1837305 - Part 1: Rework GenericBasicShape. r=devtools-reviewers,emilio
The definition of `<basic-shape>` includes other types of basic shapes,
e.g. path(), xywh(), rect(). So we put them together to match the spec.
However, some properties only use the subset of basic shapes, so we use
the bitflags to choose the supported basic shape at the parse time.

Also, remove StyleBasicShapeType because no one uses it.

Only refactoring in this patch.

Differential Revision: https://phabricator.services.mozilla.com/D179624
2023-06-15 00:03:59 +00:00
Emilio Cobos Álvarez 66b8b0e218 Bug 1837762 - Add a query-selector fast path for attribute selectors in the rightmost compound. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D180553
2023-06-14 21:43:29 +00:00
Emilio Cobos Álvarez 5113cc40e0 Bug 1837734 - Speed up / specialize attribute selector-matching. r=boris
Inline the attribute lookup code, and only branch on the attribute selector
type if we have found an attribute.

Differential Revision: https://phabricator.services.mozilla.com/D180531
2023-06-14 21:08:22 +00:00
Emilio Cobos Álvarez 8bf8754b43 Bug 1837734 - Remove unused TElement::has_attr. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D180530
2023-06-14 21:08:22 +00:00
Emilio Cobos Álvarez 2cb3884430 Bug 1837734 - Remove the never_matches field from attr selectors. r=boris
It's an extra branch which in practice we almost never take, plus extra
checks during parsing.

Differential Revision: https://phabricator.services.mozilla.com/D180529
2023-06-14 21:08:22 +00:00
Emilio Cobos Álvarez c1cb078eee Bug 1837734 - Add a way to optimize the "attribute in no namespace exists" check. r=boris
Go through the slow path by default. No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D180528
2023-06-14 21:08:21 +00:00
Emilio Cobos Álvarez f6d857bdb5 Bug 1837734 - Don't recompute quirks mode -> case sensitivity over and over. r=boris
The only reason we pass the quirks mode around is to compute the case
sensitivity, but we can just pass the later.

Differential Revision: https://phabricator.services.mozilla.com/D180527
2023-06-14 21:08:21 +00:00
Emilio Cobos Álvarez dbe7784f1b Bug 1838404 - Fix style invalidation on layer rule insertion. r=dholbert
Layer insertion may change the order of styles, so we may need to fully
invalidate.

Without this change, bug 1838045 makes
layer-statement-before-import.html fail.

Differential Revision: https://phabricator.services.mozilla.com/D180929
2023-06-14 20:50:16 +00:00
Emilio Cobos Álvarez 38cbc55c27 Bug 1835179 - Container units should prevent us from sharing style by rule node. r=dshin
At least when the containers are different.

For now check that by doing a somewhat simplified test (checking
sibling-ness).

The new flag can be useful to optimize container query restyles on
resizes too, in the future.

Differential Revision: https://phabricator.services.mozilla.com/D179268
2023-06-13 22:58:49 +00:00
Ting-Yu Lin beef887207 Bug 1577358 - Remove obsolete comment to add use counter for developing CSS properties. r=emilio DONTBUILD
The CSS properties in the list are all shipped. Since we still don't support use
counter for developing CSS properties since this bug opens, I assume this
feature is not critical. Hence the removal of the comment.

Differential Revision: https://phabricator.services.mozilla.com/D180771
2023-06-13 17:08:13 +00:00
David Shin 42c39f4b16 Bug 1835037: Move `ANCHORS_RELATIVE_SELECTOR` out of nsINode flags. r=emilio
Move the flag to ComputedValueFlags, like `CONSIDERED_RELATIVE_SELECTOR`.

Differential Revision: https://phabricator.services.mozilla.com/D180726
2023-06-13 13:21:42 +00:00
Emilio Cobos Álvarez 783ae49252 Bug 1837962 - Clean up Context::for_non_inherited_property. r=layout-reviewers,AlaskanEmily
We don't ever check the particular property, so it can just be a
boolean.

Differential Revision: https://phabricator.services.mozilla.com/D180680
2023-06-12 19:42:23 +00:00
Emilio Cobos Álvarez af7d5e8b3b Bug 1837692 - Fix rebase conflict with bug 1837664.
MANUAL PUSH: Trivial build fix CLOSED TREE.
2023-06-12 18:45:19 +02:00
Emilio Cobos Álvarez e12833a476 Bug 1837692 - Do not snap -webkit-text-stroke-width to dev pixels. r=jfkthame
Introduce LineWidth (which doesn't snap) and let BorderSideWidth
wrap it and actually do the snapping.

Differential Revision: https://phabricator.services.mozilla.com/D180688
2023-06-12 14:57:53 +00:00
Emilio Cobos Álvarez 1d2f69fc15 Bug 1837664 - Improve border-image shorthand serialization, and annotate more passes. CLOSED TREE 2023-06-12 12:09:58 -04:00
Emilio Cobos Álvarez 1806936bd6 Bug 1835407 - Don't allow to share style by rule node for links. r=dholbert
(Regardless of visitedness)

Differential Revision: https://phabricator.services.mozilla.com/D180353
2023-06-12 10:21:15 +00:00