1921 Commits

Author SHA1 Message Date
Cristian Tuns
f0be219b00 Backed out 4 changesets (bug 1758391, bug 1852478) for causing build bustages in UseCounterMetrics.cpp CLOSED TREE
Backed out changeset fe673f87d86a (bug 1852478)
Backed out changeset d466ccbd1aad (bug 1852478)
Backed out changeset c0fa98fec39a (bug 1758391)
Backed out changeset 04d322f23fd0 (bug 1852478)
2024-01-25 18:29:39 -05:00
Jonathan Kew
2cd3b24544 Bug 1852478 - Convert CSS white-space into a shorthand that expands to white-space-collapse and text-wrap-mode longhands. r=firefox-style-system-reviewers,emilio
Note that although this builds, it would (by itself) result in some test breakage;
this is resolved in the following patches that build on this.

Differential Revision: https://phabricator.services.mozilla.com/D198790
2024-01-25 22:20:05 +00:00
Emilio Cobos Álvarez
dcf8ed8dd6 Bug 1876266 - Do less work on the ConsiderInitiatingTransition loop. r=firefox-style-system-reviewers,zrhoffman
Differential Revision: https://phabricator.services.mozilla.com/D199483
2024-01-24 23:08:51 +00:00
Narcis Beleuzu
3b47d28f1e Backed out 4 changesets (bug 1758391, bug 1852478) for failures on test_animation-type-longhand.html . CLOSED TREE
Backed out changeset d6a8b0b97282 (bug 1852478)
Backed out changeset fef9fcec3afc (bug 1852478)
Backed out changeset 01711557e2bf (bug 1758391)
Backed out changeset 8c8a01dbca12 (bug 1852478)
2024-01-22 16:37:15 +02:00
Jonathan Kew
5f45c5f18d Bug 1852478 - Convert CSS white-space into a shorthand that expands to white-space-collapse and text-wrap-mode longhands. r=firefox-style-system-reviewers,emilio
Note that although this builds, it would (by itself) result in some test breakage;
this is resolved in the following patches that build on this.

Differential Revision: https://phabricator.services.mozilla.com/D198790
2024-01-22 12:57:54 +00:00
David Shin
db2606acee Bug 1855110: Part 3 - Properly resolve registered custom properties using font-relative units. r=firefox-style-system-reviewers,emilio
Resolution of such custom properties (And other properties depending on them)
must take place after font-related properties (Which are prioritary) are
resolved. Resolution of custom properties is therefore split into two phases,
before and after prioritary properties are resolved.

Differential Revision: https://phabricator.services.mozilla.com/D196195
2024-01-16 21:03:03 +00:00
David Shin
6ec16498e0 Bug 1855110: Part 2 - Track and mark dependency cycles between custom properties and font-related properties. r=firefox-style-system-reviewers,emilio
Registered custom properties may utilize font-relative units such as `em`,
`ex`, etc. Font-related properties (More with `calc()` unit algebra), in
turn, may refer to such registered custom properties, leading to a cycle
(Note, unregistered properties are effectively copy-pastes, so it does not
suffer from this issue).

This patch:
1. Defers computation of registstered custom properties using font-relative
   units
2. Keeps track of custom properties utilizing font-relative units
3. Keeps track of non-custom, font-related properties making variable
   references
4. Expands the cycle detection to non-custom properties

Because of 1, this patch causes registered custom property using
font-relative units to resolve as if they're unregistered - this will be
addressed in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D196194
2024-01-16 21:03:02 +00:00
David Shin
fd910dd4ce Bug 1874705: Run invalidation on appended elements even if the first node is not an element. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D198604
2024-01-16 18:08:55 +00:00
David Shin
7cec63c2bc Bug 1874066: Distinguish edge selectors vs. other nth selectors. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D198464
2024-01-15 16:09:17 +00:00
Emilio Cobos Álvarez
7934c6a667 Bug 1874050 - Share more memory in custom property storage. r=dshin
This implements a similar optimization as WebKit's, see the bug comment.
This should be specially useful for sites with lots of custom
properties.

This is a high-confidence win on this speedometer subtest:

 * 1.9x faster in style updates.
 * 4.2x faster in layout object destruction (we no longer free the huge
   custom properties map).
 * Also speeds up paint and layout a bit, probably from less memory
   churn.

Differential Revision: https://phabricator.services.mozilla.com/D198308
2024-01-12 18:01:17 +00:00
David Shin
966bb4e7dd Bug 1873649: Do not eagerly seek prev and next siblings DOM mutation invalidation. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D198052
2024-01-11 18:21:46 +00:00
Emilio Cobos Álvarez
8af4c57baf Bug 1871540 - Use VariableValue to track references in unparsed values. r=dshin
Differential Revision: https://phabricator.services.mozilla.com/D197147
2023-12-22 20:52:26 +00:00
Cosmin Sabou
b43f82a95b Backed out 2 changesets (bug 1871540) for causing webvtt related failures. CLOSED TREE
Backed out changeset 6d2274dc2f41 (bug 1871540)
Backed out changeset a066a966cd03 (bug 1871540)
2023-12-22 21:11:11 +02:00
Emilio Cobos Álvarez
2d4c0d3cdc Bug 1871540 - Use VariableValue to track references in unparsed values. r=dshin
Depends on D197146

Differential Revision: https://phabricator.services.mozilla.com/D197147
2023-12-22 15:09:44 +00:00
Emilio Cobos Álvarez
fb4b456d4f Bug 1870832 - Use cbindgen for animation-{name,composition,fill-mode,direction}. r=firefox-style-system-reviewers,zrhoffman
Same amount of code, but more boring code (and I've probably missed
removing some), which is better.

Differential Revision: https://phabricator.services.mozilla.com/D196843
2023-12-20 10:52:25 +00:00
Emilio Cobos Álvarez
bab145128a Bug 1870832 - Auto-generate transition-property. r=firefox-style-system-reviewers,zrhoffman
Now that NonCustomPropertyId is not in mako, it can be auto-generated by
cbindgen. This allows simplifying some code.

Differential Revision: https://phabricator.services.mozilla.com/D196842
2023-12-20 10:52:24 +00:00
Emilio Cobos Álvarez
f09f699de7 Bug 1846516 - Fix some atom leaks caught by ASAN.
MANUAL PUSH: Trivial orange fix CLOSED TREE
2023-12-18 13:04:28 +01:00
Emilio Cobos Álvarez
815dc5495a Bug 1846516 - More fixes on top of bug 1870009. r=zrhoffman
This fixes some leaks, and fixes IsAnimatable/IsTransitionable to look
at PropertyId.

Differential Revision: https://phabricator.services.mozilla.com/D196419
2023-12-18 09:24:10 +00:00
Zach Hoffman
0060ff08b2 Bug 1846516 - [css-properties-values-api] Animate custom properties in a discrete way. r=firefox-style-system-reviewers,emilio
This patch also updates the bug ID for a FIXME leftover from bug 1840478
to bug 1869476, since the same FIXME is added in D190758.

Co-authored-by: Frederic Wang <fred.wang@free.fr>

Depends on D191322

Differential Revision: https://phabricator.services.mozilla.com/D190758
2023-12-18 09:24:08 +00:00
Zach Hoffman
7653a4f1c2 Bug 1846516 - [css-properties-values-api] Use AnimatedPropertyID to communicate between Gecko and Servo. r=emilio,layout-reviewers,firefox-style-system-reviewers
Co-authored-by: Frederic Wang <fred.wang@free.fr>
Co-authored-by: Emilio Cobos Álvarez <emilio@crisal.io>

Depends on D191059

Differential Revision: https://phabricator.services.mozilla.com/D191322
2023-12-18 09:24:08 +00:00
Zach Hoffman
0ec875a048 Bug 1846516 - [css-properties-values-api] Use PropertyDeclarationId/PropertyDeclarationIdSet for animated properties. r=firefox-style-system-reviewers,emilio
This will make possible to animate custom properties. For now, the
animation code keeps only dealing with PropertyDeclarationId::Longhand,
so behavior is unchanged.

Co-authored-by: Frederic Wang <fred.wang@free.fr>

Depends on D195972

Differential Revision: https://phabricator.services.mozilla.com/D190816
2023-12-18 09:24:07 +00:00
Emilio Cobos Álvarez
0aca60d53f Bug 1870009 - Clean up PropertyId to reuse NonCustomPropertyId. r=zrhoffman,firefox-style-system-reviewers
PropertyId predates NonCustomPropertyId. Now that we have it, we can
clean up a bit the code.

The idea is to make PropertyId and AnimatedPropertyId basically the
same, so that conversions can be improved in bug 1846516.

While at it make NonCustomPropertyId a u32.

Differential Revision: https://phabricator.services.mozilla.com/D196415
2023-12-14 15:29:27 +00:00
Emilio Cobos Álvarez
de8a41c001 Bug 1869299 - Expose a media query for known gtk theme families. r=rmader
This will allow to easily tweak the front-end for selected / known-good
themes.

Differential Revision: https://phabricator.services.mozilla.com/D196151
2023-12-13 12:41:18 +00:00
Nicolas Chevobbe
a41df8b4ed Bug 1866707 - Make InspectorUtils.isInheritedProperty check property definition in custom properties registry. r=zrhoffman.
Since registered custom properties can be specified to not inherit,
DevTools need to retrieve this information in order to display accurate
data in the rules view.
The method signature is changed and now take a Document so we can lookup
the registry.
The existing test is updated with registered and unregistered custom properties.

Next patch in queue handles the impact in DevTools code.

Differential Revision: https://phabricator.services.mozilla.com/D194629
2023-11-27 18:39:10 +00:00
Zach Hoffman
a55f8a22aa Bug 1865810 - [css-properties-values-api] Recompute initial values when viewport changes r=firefox-style-system-reviewers,emilio
If the initial values of custom property registrations contain viewport
units, changing the viewport will result in recomputing the initial
values.

Differential Revision: https://phabricator.services.mozilla.com/D194668
2023-11-26 15:54:42 +00:00
Zach Hoffman
2d02e6d74f Bug 1865563 - Rustfmt servo/. r=firefox-style-system-reviewers,emilio
$ git ls-files servo/*.rs | xargs rustup run nightly rustfmt

Differential Revision: https://phabricator.services.mozilla.com/D194020
2023-11-20 15:17:57 +00:00
Emilio Cobos Álvarez
3711a00967 Bug 1863620 - Make variable values track the url data they came from. r=zrhoffman
This is needed to be able to use chrome environment variables in
chrome stylesheets and have them work in non-chrome documents.

This will be used to communicate the right transition duration in
scrollbars.css, but should also be useful to have the right base URI for
<url>-typed custom properties.

Differential Revision: https://phabricator.services.mozilla.com/D193048
2023-11-08 18:30:48 +00:00
Emilio Cobos Álvarez
9a23481b1c Bug 1861726 - Make StyleImage::GetResolution account for CSS zoom. r=layout-reviewers,jfkthame
This fixes rendering of background-image when CSS zoom is in effect.

Note that we want to scale the resolution by the _inverse_ of the
zoom, since having a higher image resolution means that the CSS
size gets shrunk and viceversa.

Differential Revision: https://phabricator.services.mozilla.com/D192130
2023-11-06 10:24:53 +00:00
David Shin
77c37e8065 Bug 1833679 - DevTools warnings infrastructure. r=nchevobbe,emilio
Differential Revision: https://phabricator.services.mozilla.com/D191333
2023-11-02 15:29:12 +00:00
Emilio Cobos Álvarez
77a79110dc Bug 1861726 - Remove unused StyleImage::GetIntrinsicSize. r=boris
It doesn't account for various subtleties like aspect ratios etc, so
let's remove it.

Depends on D192131

Differential Revision: https://phabricator.services.mozilla.com/D192132
2023-11-01 17:17:13 +00:00
Emilio Cobos Álvarez
e3d3714eba Bug 1861726 - Expose some CSS zoom boilerplate to C++. r=boris
Not making use of Zoom() / Unzoom() on this patch, but will need it, so
doesn't hurt...

Differential Revision: https://phabricator.services.mozilla.com/D192131
2023-11-01 17:17:12 +00:00
Norisz Fay
458130d63a Backed out changeset 09a6e2a57a02 (bug 1847503) for causing canvas failures on canvas-display-p3-drawImage.https.html 2023-11-01 17:58:20 +02:00
Tiaan Louw
1568f5568f Bug 1847503 - Map colors into gamut limits before rendering. r=layout-reviewers,emilio
When colors are converted to sRGB to render onto the display, make sure
that they are within sRGB gamut limits.

Gamut mapping is implemented according to:
https://drafts.csswg.org/css-color-4/#gamut-mapping

The color-mix-non-srgb-001 test is checking the expected result in
sRGB, which happens to be out of gamut limits, but because the test
is for color-mix and not gamut mapping, I changed the expected
results to the color space of the mix.

The svg reftest now has an increased fuzzy to allow for the final colors
to be gamut mapped. Gamut mapping is dependent of available hardware, so
we can't pin down exact colors for the result.

Differential Revision: https://phabricator.services.mozilla.com/D191083
2023-11-01 08:28:33 +00:00
Narcis Beleuzu
21af958c87 Backed out changeset e5e1bc9736a5 (bug 1847503) for reftest failures on anim-css-floodcolor-overflow-1-from-by.svg . CLOSED TREE 2023-11-01 03:22:46 +02:00
Tiaan Louw
ef59084b47 Bug 1847503 - Map colors into gamut limits before rendering. r=layout-reviewers,emilio
When colors are converted to sRGB to render onto the display, make sure
that they are within sRGB gamut limits.

Gamut mapping is implemented according to:
https://drafts.csswg.org/css-color-4/#gamut-mapping

The color-mix-non-srgb-001 test is checking the expected result in
sRGB, which happens to be out of gamut limits, but because the test
is for color-mix and not gamut mapping, I changed the expected
results to the color space of the mix.

The svg reftest now has an increased fuzzy to allow for the final colors
to be gamut mapped. Gamut mapping is dependent of available hardware, so
we can't pin down exact colors for the result.

Differential Revision: https://phabricator.services.mozilla.com/D191083
2023-11-01 00:06:11 +00:00
Emilio Cobos Álvarez
9682848076 Bug 1861917 - Avoid passing originating_element_style around unnecessarily. r=Oriol
Differential Revision: https://phabricator.services.mozilla.com/D192219
2023-10-30 13:40:26 +00:00
Tiaan Louw
1b8d896689 Bug 1861739 - Add getter for the color interpolation method of a gradient r=layout-reviewers,emilio
Add a simple getter for the color interpolation method with is stored on
each of the structs in the union. This just makes it easier to get.

Differential Revision: https://phabricator.services.mozilla.com/D192105
2023-10-28 06:59:41 +00:00
David Shin
bbff1a3b96 Bug 1853258: Part 3 - Optimize invalidating relative selectors on DOM mutation. r=emilio
There are cases where we can run a selector match to realize that some DOM mutations
will not make a difference in the relative selector match state, which avoids
O(n^2) behaviour under some circumstances.

Differential Revision: https://phabricator.services.mozilla.com/D191307
2023-10-24 15:11:54 +00:00
David Shin
0e5202e0b3 Bug 1853258: Part 2 - Provide which DOM mutation is happening for relative selector invalidation. r=emilio
Required for upcoming optimization.
Also use the added information to move invalidation acceptance logic.

Differential Revision: https://phabricator.services.mozilla.com/D191306
2023-10-24 15:11:53 +00:00
Zach Hoffman
dafe900559 Bug 1857674 - Add computed context to custom properties builder r=firefox-style-system-reviewers,emilio
The stylist is kept in order to avoid needing to unwrap it each time a
stylist is used.

Because a computed context is always required to make a custom
properties builder, cascade_custom_properties_with_context is renamed to
cascade_custom_properties (and the previous cascade_custom_properties,
which did not require a computed context, is removed).

Differential Revision: https://phabricator.services.mozilla.com/D191613
2023-10-23 17:07:44 +00:00
Jonathan Kew
71e6f71f87 Bug 784648 - Implement the 'hanging' and 'each-line' options for CSS text-indent. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D191522
2023-10-23 15:12:23 +00:00
Emilio Cobos Álvarez
f5eb13c2da Bug 1859917 - Make SelectorList cheaply cloneable and more compact. r=dshin
We have ArcSelectorList for selector-lists that are cheap to copy.

For bug 1859915 and related, what we're going to end up doing is probably
expanding into the SelectorList of the parent rule unconditionally, at least
for the "single bare &" case.

It'd be nice to unify SelectorList implementations as preparation for that, and
make them cheaper to clone in general.

My proposal is making SelectorList a tagged pointer to either a single
selector, or to a ThinArc, effectively preserving the SmallVec<> optimization
we have now. This patch implements that proposal.

Depends on D191361

Differential Revision: https://phabricator.services.mozilla.com/D191362
2023-10-19 15:35:54 +00:00
Emilio Cobos Álvarez
e80493f437 Bug 1858160 - Simplify storage of property rules. r=zrhoffman
Now that invalid rules are dropped, we can use the same representation
for script and style registrations.

Differential Revision: https://phabricator.services.mozilla.com/D191293
2023-10-18 23:50:52 +00:00
Iulian Moraru
3772854173 Backed out changeset 667d97f09248 (bug 1847503) for causing reftest failures on anim-css-fill-overflow-1-by.svg. CLOSED TREE 2023-10-18 19:04:41 +03:00
Tiaan Louw
426a8dd5e2 Bug 1847503 - Map colors into gamut limits before rendering. r=layout-reviewers,emilio
When colors are converted to sRGB to render onto the display, make sure
that they are within sRGB gamut limits.

Gamut mapping is implemented according to:
https://drafts.csswg.org/css-color-4/#gamut-mapping

The color-mix-non-srgb-001 test is checking the expected result in
sRGB, which happens to be out of gamut limits, but because the test
is for color-mix and not gamut mapping, I changed the expected
results to the color space of the mix.

Differential Revision: https://phabricator.services.mozilla.com/D191083
2023-10-18 14:16:40 +00:00
Emilio Cobos Álvarez
ac497ae160 Bug 1858485 - Avoid AnimationValue allocation churn during transition handling. r=hiro
Differential Revision: https://phabricator.services.mozilla.com/D191080
2023-10-17 11:43:26 +00:00
Frederic Wang
b89f794f6b Bug 1857724 - [css-properties-values-api] Invalid @property declarations should be dropped. r=emilio
Currently Firefox properly performs validation of an @property rule, as
defined in [1]. However when such a rule is invalid, it only does not
register the custom property instead of dropping the whole rule. Other
implementations also follow that aproach and existing web platform tests
disagree with the specification [2].

This patch aligns Firefox's behavior with the specification, by moving
@property validation during parsing and dropping invalid rules. Tests
are updated as follows:

1. /css/css-properties-values-api/at-property-cssom.html

  Existing tests that don't have the three descriptors (syntax,
  inherit, initial-value) are invalid and now the test verifies
  no corresponding rules are exposed via CSSOM. `--no-initial-value`
  is renamed `--no-initial-color-value` and its legacy tests are
  kept for a new @property `--no-initial-universal-value` which uses
  the universal syntax (so initial value is optional). Some dummy
  descriptors are added for --tab\ttab so that it remains valid.
  Similarly, we ensure --valid-whitespace's syntax (space-separated)
  and initial-value (comma-separated) agree.

2. /css/css-properties-values-api/at-property.html

  Existing `test_descriptor()` tests are trying an @property with
  a single specified descriptor and so are always invalid. To work
  around that, we tweak `test_descriptor()` so that it can build a
  valid descriptor instead. The `syntax` and `inherits` fallback
  to universal and true respectively while the `initial-value`
  descriptor is built from the `syntax`. An extra parameters is
  introduced in case the caller wants to provide these values
  directly. Finally, when the expected value is null the function
  instead verifies that the rule is really dropped.

  2.1. Some existing syntax tests are registering rules with unquoted
  syntax value 'red', 'rgb(255, 0, 0)', 'color', 'foo | bar' and
  expect to obtain a rule with an empty syntax string, suggesting some
  kind of invalidity handling (cf similar tests). We interpret the
  first two as "specifying a color value", quotes are added and the
  first one actually becomes a valid custom-ident. The last two already
  have a similar quoted version, so we just interpret them as
  "missing quotes".

  2.2. Given the previous 'red' custom-ident, we add tests for invalid
  custom-ident as defined in [3].

  2.3. Some existing `syntax` tests are checking that we must have
  "pipe between components" and no "leading bar" and are again expecting
  a rule with an empty syntax string. We fix the apparent mistake of
  missing quotes and provide initial values that could potentially be
  interpreted as correct by implementations accepting these invalid
  syntaxes.

  2.4. One `initial-value` test is checking "var(--x)" but that is
  not computationally independent so tweak the test to check that
  makes the @property rule invalid. Also add a similar '3em' test
  mentioned in the spec.

  2.5. Some `inherits` tests verify that invalid rules are interpreted
  as false. It seems they should instead be treated as if it does not
  exist and so should make the @property rule invalid.

[1] https://drafts.css-houdini.org/css-properties-values-api-1/#at-property-rule
[2] https://github.com/w3c/css-houdini-drafts/issues/1098
[3] https://drafts.csswg.org/css-values-4/#custom-idents

Differential Revision: https://phabricator.services.mozilla.com/D190444
2023-10-12 05:18:00 +00:00
Frederic Wang
138e00de8e Bug 1855629 - Handling of custom properties when enumerating getComputedStyle(). r=emilio
After bug 1840478, non-inherited custom properties using their initial
values are represented as absent from `ComputedCustomProperties` in
order to save memory. Wherever the values of such properties are
requested, it is necessary to fallback to any registered initial value.
However, this makes difficult to properly enumerate custom properties
for exposure via the `CSSStyleDeclaration.item()` API and indeed our
current implementation only exposes the properties actually present in
`ComputedCustomProperties`.

Additionally, such a representation conflicts with pre-existent
representation of guaranteed-invalid values as absent values, causing
some issues e.g. bad handling of invalid at computed-value time [1] [2].

This patch changes `ComputedCustomProperties` so that registered initial
values are always stored in the `non_inherited` map, immediately fixing
the issue with `CSSStyleDeclaration.item()` and preparing follow-up
work on guaranteed-invalid values.

To avoid excessive increase of memory usage, the `non_inherited` map
becomes ref-counted. The associated Stylist contains an up-to-date
ComputedCustomProperties with registered custom properties that have
initial values, and the `non_inherited` map can generally just be
shallow-cloned from it.

A new test `get-computed-style-enumeration.html` is added to make sure
custom properties are correctly exposed when enumerating
`CSSStyleDeclaration` as a list. A similar but more restricted version
already exists: `cssstyledeclaration-registered-custom-properties.html`.
Two test cases are also added to `determine-registration.html` in order
to cover some issue previously detected during the review of
`get_custom_property_initial_values`.

[1] https://drafts.csswg.org/css-variables-2/#invalid-at-computed-value-time
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=1855946

Differential Revision: https://phabricator.services.mozilla.com/D189999
2023-10-06 12:03:16 +00:00
Frederic Wang
c6427f7491 Bug 1857158 - CSSPropertyRule.name should not serialize @property name as identifier. r=emilio
The spec just says to return the name as is [1]. This aligns with
WebKit and Chrome's behavior and fixes remaining  issue in [2].

[1] https://drafts.css-houdini.org/css-properties-values-api/#the-css-property-rule-interface
[2] /css/css-properties-values-api/at-property-cssom.html

Differential Revision: https://phabricator.services.mozilla.com/D190184
2023-10-05 16:49:05 +00:00
Emilio Cobos Álvarez
202ac16182 Bug 1855668 - Make ::backdrop inherit from the originating element. r=zrhoffman
This is as a result of a spec change (see link in the test), but it
addresses a very long-standing issue with this pseudo-element, see
https://github.com/whatwg/fullscreen/issues/124.

Differential Revision: https://phabricator.services.mozilla.com/D189484
2023-10-02 08:53:54 +00:00