Commit Graph

193 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
302ad8f39b Bug 1899272 - Defer computation of registered custom color properties if needed. r=dshin,firefox-style-system-reviewers,zrhoffman
This is a bit less complicated than lengths because there's no cycle
possible which could turn the color-scheme declaration invalid afaict.

So it's just that we need to defer the colors when color-scheme is
specified, which is slightly annoying, but maybe not too bad.

I had to tweak a bit the code to defer properties to fix a bug that we
were papering over accidentally. We were using the wrong registration
here:

  https://searchfox.org/mozilla-central/rev/f60bb10a5fe6936f9e9f9e8a90d52c18a0ffd818/servo/components/style/custom_properties.rs#1613

That's the registration for reference.name, not for name, which
papered over some issues. The fix is simple tho, which is storing a
single CustomPropertiesMap.

Differential Revision: https://phabricator.services.mozilla.com/D211860
2024-05-29 14:19:02 +00:00
Emilio Cobos Álvarez
ac5d859c21 Bug 1899318 - Fix at-property-animation to account for spec ambiguity. r=firefox-style-system-reviewers,zrhoffman
See https://github.com/w3c/csswg-drafts/issues/10371 for the spec issue.

Differential Revision: https://phabricator.services.mozilla.com/D211871
2024-05-29 10:25:03 +00:00
Zach Hoffman
6034aef872 Bug 1894041 - If syntax is universal, convert substitution to universal. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D209545
2024-05-06 14:26:21 +00:00
Emilio Cobos Álvarez
ea87ba12aa Bug 1887063 - Use VibrancyManager / regular CSS to implement the unified toolbar looks. r=mstange,mac-reviewers,desktop-theme-reviewers,places-reviewers,dao
This is simpler given we only have a couple of windows with these looks,
and removes the dual mode of the ToolbarWindow class.

We just draw the title into the window frame and rely on CSS reserving
enough space (exposed as a new -moz-mac-titlebar-height environment
variable).

We remove the toolbox and toolbar appearance values on mac, now that
they do nothing (toolbar did, but it didn't support dark mode and is
effectively unused).

Differential Revision: https://phabricator.services.mozilla.com/D205469
2024-03-30 10:29:39 +00:00
Norisz Fay
45e9cdef83 Backed out 2 changesets (bug 1887063) for causing reftest failure on 1291413-1.html and nsCocoaWindow::IsVisible process-crash CLOSED TREE
Backed out changeset 4014cb772d7c (bug 1887063)
Backed out changeset 690b15c54c21 (bug 1887063)
2024-03-28 00:33:28 +02:00
Emilio Cobos Álvarez
9f042666d6 Bug 1887063 - Use VibrancyManager / regular CSS to implement the unified toolbar looks. r=mstange,mac-reviewers,desktop-theme-reviewers,places-reviewers,dao
This is simpler given we only have a couple of windows with these looks,
and removes the dual mode of the ToolbarWindow class.

We just draw the title into the window frame and rely on CSS reserving
enough space (exposed as a new -moz-mac-titlebar-height environment
variable).

We remove the toolbox and toolbar appearance values on mac, now that
they do nothing (toolbar did, but it didn't support dark mode and is
effectively unused).

Differential Revision: https://phabricator.services.mozilla.com/D205469
2024-03-27 17:07:23 +00:00
Zach Hoffman
fae0b0582c Bug 1877383 - Preserve computed registered custom property types. r=firefox-style-system-reviewers,emilio
Add a TODO for bug 1883255, since D203361 fixes bug 1870348.

Add a TODO for bug 1884606, since WPTs for interpolating custom
properties with syntax `<transform-function>` and with value `none` now
fail.

Differential Revision: https://phabricator.services.mozilla.com/D203361
2024-03-11 05:50:18 +00:00
Zach Hoffman
0f90018b66 Bug 1864736 - Use ComputedRegisteredValue for custom property maps. r=firefox-style-system-reviewers,emilio
Unparsed custom properties are the
ComputedRegisteredValueInner::Universal variant.

Although the inner value is the ComputedRegisteredValueInner type,
custom property maps hold only the
ComputedRegisteredValueInner::Universal variant to keep behavior
unchanged for now.

D203360 also removes Arc<> from the CustomPropertiesMap value.

Differential Revision: https://phabricator.services.mozilla.com/D203360
2024-03-11 05:50:17 +00:00
Zach Hoffman
4136c39fa7 Bug 1864736 - Rustfmt sources changed in bug 1864736. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D203357
2024-03-11 05:50:16 +00:00
Cristian Tuns
9164e25bb3 Backed out 5 changesets (bug 1864736, bug 1877383) for causing build bustages with is_parsed CLOSED TREE
Backed out changeset 230e45fd2ece (bug 1877383)
Backed out changeset 3f19bcf6a34f (bug 1864736)
Backed out changeset cc6c51d8d712 (bug 1864736)
Backed out changeset eefa88f79557 (bug 1864736)
Backed out changeset 7cddfe0bce3a (bug 1864736)
2024-03-11 01:11:17 -04:00
Zach Hoffman
f616434cb2 Bug 1877383 - Preserve computed registered custom property types. r=firefox-style-system-reviewers,emilio
Add a TODO for bug 1883255, since D203361 fixes bug 1870348.

Add a TODO for bug 1884606, since WPTs for interpolating custom
properties with syntax `<transform-function>` and with value `none` now
fail.

Differential Revision: https://phabricator.services.mozilla.com/D203361
2024-03-11 04:51:35 +00:00
Zach Hoffman
876a8e42d3 Bug 1864736 - Use ComputedRegisteredValue for custom property maps. r=firefox-style-system-reviewers,emilio
Unparsed custom properties are the
ComputedRegisteredValueInner::Universal variant.

Although the inner value is the ComputedRegisteredValueInner type,
custom property maps hold only the
ComputedRegisteredValueInner::Universal variant to keep behavior
unchanged for now.

D203360 also removes Arc<> from the CustomPropertiesMap value.

Differential Revision: https://phabricator.services.mozilla.com/D203360
2024-03-11 04:51:34 +00:00
Zach Hoffman
d8fbfe0d94 Bug 1864736 - Rustfmt sources changed in bug 1864736. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D203357
2024-03-11 04:51:33 +00:00
Emilio Cobos Álvarez
c39cabe97e Bug 1560702 - Improve hit boxes of titlebar buttons. r=stransky,desktop-theme-reviewers,dao
In order to do it, expose the button padding to CSS via env(), and make
the buttons just use the regular drawing.

This slightly changes the padding to the end of the titlebar to match
one half of the inter-button spacing, rather that however much padding
the headerbar has.

We could improve on this slightly by also exposing the headerbar padding
and applying that to the last button, but that's not terribly easy to do
due to us supporting re-ordering of the titlebar buttons, and reversing
their placement, so it'd involve some rather hacky CSS. Not impossible,
but not trivial, and this looks good enough IMO.

Differential Revision: https://phabricator.services.mozilla.com/D202616
2024-02-27 10:28:56 +00:00
Emilio Cobos Álvarez
b62e17605b Bug 1879743 - Rewrite custom property substitution to avoid re-tokenization. r=zrhoffman,firefox-style-system-reviewers
This speeds up custom variable substitution by avoiding re-tokenizing,
and variable reference parsing by avoiding doing duplicate work.

This is a very noticeable improvement in the NewsSite subtests of
speedometer 3 (see comparison posted in bug 1879318 and the #perf-sp3
matrix channel). But it also probably helps most websites using lots of
variables, and the browser UI itself.

Finally, it also avoids some duplication. Now regular substitution and
fallback substitution is handled uniformly, which causes a progression
in some properties-and-values tests.

Differential Revision: https://phabricator.services.mozilla.com/D201116
2024-02-11 15:23:22 +00:00
Emilio Cobos Álvarez
536229b5f9 Bug 1879318 - Store custom property references in a list. r=zrhoffman,firefox-style-system-reviewers
This is a preliminary patch to keep all references (even duplicates), in
order to speed up substitution by avoiding re-tokenizing.

The assumption is that referencing the same variable multiple times
on the declaration is not common, and thus it's not a big deal to
optimize for that.

Differential Revision: https://phabricator.services.mozilla.com/D201082
2024-02-10 16:57:40 +00:00
Emilio Cobos Álvarez
74c083797b Bug 1879162 - Rustfmt recent changes. r=firefox-style-system-reviewers,zrhoffman
Differential Revision: https://phabricator.services.mozilla.com/D200997
2024-02-07 21:28:58 +00:00
Emilio Cobos Álvarez
e310dec6f4 Bug 1879162 - Avoid Option<&PropertyRegistration>. r=firefox-style-system-reviewers,zrhoffman
Inherited properties with universal syntax and unregistered properties should
behave basically the same.

This removes some redundant checks and guarantees that we have the same
code-paths in those two cases.

Differential Revision: https://phabricator.services.mozilla.com/D200995
2024-02-07 21:28:57 +00:00
Emilio Cobos Álvarez
f1858e6c02 Bug 1879162 - Deduplicate a bit custom property cascade. r=firefox-style-system-reviewers,zrhoffman
Reduce the amount of times we need to manually call the custom property
registration code by handling values with and without references in the same
function.

Differential Revision: https://phabricator.services.mozilla.com/D200993
2024-02-07 21:28:57 +00:00
David Shin
40d7afc02f Bug 1875673: Do not prevent early substitution of for non-registered or registered non-length variables when they reference font-relative properties. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D199239
2024-01-23 14:03:56 +00:00
Zach Hoffman
0253a99c64 Bug 1856522 - Remove unneeded TODOs for bug 1856522 r=firefox-style-system-reviewers,emilio
Dependencies between custom properties and font-* properties are
resolved in bug 1855110, so these TODOs for bug 1856522 can be removed.

Differential Revision: https://phabricator.services.mozilla.com/D199208
2024-01-22 11:02:57 +00:00
David Shin
d75422678f 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
245bd7fc2e 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
Emilio Cobos Álvarez
2eb976c4ac 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
Emilio Cobos Álvarez
58aae8e34a 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
2efa0792a5 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
5261093d5d 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
f7058dcbbc 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
David Shin
12779151c1 Bug 1868436: Registered non-universal property dependency cycle resolve as if unset. r=zrhoffman
Differential Revision: https://phabricator.services.mozilla.com/D195576
2023-12-05 20:33:22 +00:00
Zach Hoffman
d909bab4cd 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
Emilio Cobos Álvarez
e1c3e23d63 Bug 1846625 - Fix custom properties url resolution. r=zsun,zrhoffman,firefox-style-system-reviewers
There are two issues here:

 * The first one is that we were serializing the specified url value,
   which arguably should include the whole expanded URI, but for reasons
   (mainly not copying urls around) doesn't. That means that
   ToComputedValue::from_computed_value(cv).to_css() is not equivalent
   to cv.to_css(). In order to fix that, teach the custom properties
   code to serialize computed values as well. This saves an extra
   conversion too.

 * The second one is that we were using the property registration's url
   data in order to resolve URIs against. That is not correct. Instead,
   use the value's URL data (introduced in bug 1863620) to do this.

With those two bugs fixed, we can resolve registered custom property
urls correctly. Use generics to avoid repetitive code.

Differential Revision: https://phabricator.services.mozilla.com/D194387
2023-11-22 17:48:53 +00:00
Zach Hoffman
e0b626cc3a Bug 1856524 - [css-properties-values-api] Compute <length> and <length-percentage>. r=firefox-style-system-reviewers,emilio
Also added a TODO for bug 1856522 for accurately computing registered
custom properties containing font-relative units.

Differential Revision: https://phabricator.services.mozilla.com/D194024
2023-11-21 11:53:05 +00:00
Emilio Cobos Álvarez
47599caca6 Bug 1863620 - Use an accelerated animation for overlay scrollbar. r=hiro
This also simplifies ScrollbarActivity, and removes some attributes that
aren't looked up while at it.

Differential Revision: https://phabricator.services.mozilla.com/D193049
2023-11-20 21:47:50 +00:00
Sandor Molnar
afac38ae76 Backed out 2 changesets (bug 1863620) for causing multiple failure CLOSED TREE
Backed out changeset 298c668b4347 (bug 1863620)
Backed out changeset e34670e74c31 (bug 1863620)
2023-11-20 14:02:26 +02:00
Emilio Cobos Álvarez
4b1fb498f0 Bug 1863620 - Use an accelerated animation for overlay scrollbar. r=hiro
This also simplifies ScrollbarActivity, and removes some attributes that
aren't looked up while at it.

Differential Revision: https://phabricator.services.mozilla.com/D193049
2023-11-20 09:32:00 +00:00
Zach Hoffman
1634bdbbb9 Bug 1858848 - [css-properties-values-api] Compute initial value r=firefox-style-system-reviewers,layout-reviewers,emilio
This patch computes initial value when initial values are collected. The
initial value cannot be computed earlier (for example, at parse time)
without breaking intended behavior, since CSSOM expects the initial
value string of a CSSPropertyRule to remain uncomputed.

Although <length> and <length-percentage> can be accurately computed
already for initial values since valid initial values are always
font-indepent, this patch leaves <length> and <length-percentage>
uncomputed for simplicity (until bug 1856524 is implemented).

Differential Revision: https://phabricator.services.mozilla.com/D193839
2023-11-17 19:21:12 +00:00
Ziran Sun
abe44dea05 Bug 1862903 - Registering a property should not affect cascade/parsing. r=zrhoffman,emilio
As per [1] - "If the specified value for a registered custom property violates
the registered syntax, however, the property becomes invalid at computed-value
time (and thus resets to the registered initial value)."

[1] https://drafts.css-houdini.org/css-properties-values-api-1/#calculation-of-computed-values

Differential Revision: https://phabricator.services.mozilla.com/D193446
2023-11-15 15:33:39 +00:00
Zach Hoffman
f292452e0c Bug 1858305 - Store ComputedPropertyValue without parsing r=firefox-style-system-reviewers,emilio
Depends on D193547

Differential Revision: https://phabricator.services.mozilla.com/D193549
2023-11-14 22:41:46 +00:00
Zach Hoffman
532bf23170 Bug 1858305 - Rewrite use of deprecated function TokenSerializationType::nothing() r=firefox-style-system-reviewers,emilio
Depends on D193547

Differential Revision: https://phabricator.services.mozilla.com/D193548
2023-11-14 21:44:45 +00:00
Emilio Cobos Álvarez
5c2c0fb023 Bug 1863620 - Remove a function that should land in one of the other patches in this bug.
MANUAL PUSH: Trivial bustage fix CLOSED TREE
2023-11-08 19:51:53 +01:00
Emilio Cobos Álvarez
ce7460dbbc 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
Zach Hoffman
4a9383f9c1 Bug 1857674 - Reuse is_root_element from style builder r=emilio
Depends on D191161

Differential Revision: https://phabricator.services.mozilla.com/D191615
2023-10-23 17:07:47 +00:00
Zach Hoffman
ce5521a678 Bug 1857674 - Reuse inherited custom properties from style builder r=emilio
Depends on D191160

Differential Revision: https://phabricator.services.mozilla.com/D191161
2023-10-23 17:07:46 +00:00
Zach Hoffman
f6a933dca6 Bug 1857674 - Reuse computed context when computing registered custom properties r=emilio
This should cause no change in behavior, but only because because
Cascade::apply_prioritary_properties is not yet called after font-*
declarations have been processed and before registered custom properties
are computed (see bug 1856522).

Depends on D191614

Differential Revision: https://phabricator.services.mozilla.com/D191160
2023-10-23 17:07:46 +00:00
Zach Hoffman
9af442a67a Bug 1857674 - Pass computed context to substitute_block r=firefox-style-system-reviewers,emilio
This is necessary in order to compute registered custom properties from
substitute_block.

Depends on D191159

Differential Revision: https://phabricator.services.mozilla.com/D191614
2023-10-23 17:07:45 +00:00
Zach Hoffman
b5f0fe0b38 Bug 1857674 - Add computed context to custom properties context r=emilio
Now that the custom properties context includes the computed context,
some other fields have been made redundant and can be removed (see
D191161).

Depends on D191613

Differential Revision: https://phabricator.services.mozilla.com/D191159
2023-10-23 17:07:45 +00:00
Zach Hoffman
8411018b54 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
Emilio Cobos Álvarez
2075b7cbb3 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
Zach Hoffman
746a0a2828 Bug 1857716 - Use generic types for specified registered property values r=fredw
D190382 replaces ValueComponent with a specified types specialization of
a generic type. D190383 specializes the new GenericValueComponent for
computed types.

The goal here is to no longer use Self as the ToComputedValue computed
value of ValueComponent.

Differential Revision: https://phabricator.services.mozilla.com/D190382
2023-10-11 19:16:15 +00:00
Zach Hoffman
16c1cb7561 Bug 1846632 - [css-properties-values-api] Use canonical values for font-independent types r=fredw,emilio
We resolve calc expressions and use appropriate units by computing
ToComputedValue trait, computing each component's value, then converting
it back to that component's type, before making a new VariableValue from
the computed value's CSS string to store in the computed properties map.

Differential Revision: https://phabricator.services.mozilla.com/D190254
2023-10-11 03:16:50 +00:00