Commit Graph

15401 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
de356745d0 Bug 1884879 - [css-syntax] [css-nesting] Implement recent spec change about blocks and custom / non-custom properties. r=firefox-style-system-reviewers,zrhoffman
From https://github.com/w3c/csswg-drafts/issues/9317

Do some gymnastics to avoid rewinding unnecessarily, since this is
super-hot code.

Differential Revision: https://phabricator.services.mozilla.com/D207797
2024-04-30 23:49:45 +00:00
Emilio Cobos Álvarez
13f6ad5ef7 Bug 1884879 - [css-syntax] Implement recent syntax spec change to avoid parsing custom properties that look like selectors. r=firefox-style-system-reviewers,zrhoffman,supply-chain-reviewers,glandium
This implements the:

> If the first two non-<whitespace-token> values of rule’s prelude are
> an <ident-token> whose value starts with "--" followed by a
> <colon-token>, then...

From https://drafts.csswg.org/css-syntax/#consume-qualified-rule

Differential Revision: https://phabricator.services.mozilla.com/D207796
2024-04-30 23:49:44 +00:00
Boris Chiou
ca4cb0656a Bug 1834876 - Part 4: Fix the case when changing the display from none. r=layout-reviewers,firefox-style-system-reviewers,emilio
Add one extra branch if we have before-change style but its display
is none, and the new style is not display:none. Also, we add an extra
subtest if we use the container query to change the display property.

Differential Revision: https://phabricator.services.mozilla.com/D208572
2024-04-30 05:06:54 +00:00
Boris Chiou
8772ca331e Bug 1834876 - Part 3: Use starting style for CSS Transitions. r=layout-reviewers,firefox-style-system-reviewers,emilio
Now we use the starting style if we have, to replace the before-change
style. This includes a minor refactoring of the handling of transitions
because it becomes a little bit complicated.

Differential Revision: https://phabricator.services.mozilla.com/D208571
2024-04-30 05:06:54 +00:00
Boris Chiou
d975b03929 Bug 1834876 - Part 2: Resolve starting style if we don't have before-change style. r=layout-reviewers,firefox-style-system-reviewers,emilio
Per spec, we define starting style for an element as the after-change style
with @starting-style rules applied in addition.

If an element does not have a before-change style for a given style change
event, the starting style is used instead of the before-change style to
compare with the after-change style to start transitions.

The basic idea in this patch is:
1. We add a flag to indicate if this element may have starting style. We
   set this flag during its full matching, and store this flag in the
   element data.
2. So during process animations, we check this flag, if this element may
   have starting style and specifies transitions, we resolve the
   starting style. Use it as the before-change style.

The implmentation in process_animations() and tests are in the following
patches.

Differential Revision: https://phabricator.services.mozilla.com/D208570
2024-04-30 05:06:53 +00:00
Boris Chiou
4c920b2d33 Bug 1834876 - Part 1: Add a flag in Rule if it is inside @starting-style. r=layout-reviewers,firefox-style-system-reviewers,emilio
The rules inside @starting-style doesn't apply to primary style, and
they are used only for CSS transitions (when computing starting style).

So adding a flag to make us easier to filter them out.

Differential Revision: https://phabricator.services.mozilla.com/D208569
2024-04-30 05:06:53 +00:00
Emilio Cobos Álvarez
9acc400778 Bug 1892676 - Improve interaction of css zoom and non-absolute CSS units. r=dholbert
The values that we take from our parent should be zoomed in. Similarly,
root values should also be zoomed in by the effective zoom (for that, we
unzoom root values to zoom-independent pixels when storing them on the
device).

Container-relative units probably need more care / thought, because they
are in the layout (so zoom-independent) coordinate space already, since
they come from frames. Bug 1894104 is filed for this.

Differential Revision: https://phabricator.services.mozilla.com/D208599
2024-04-29 21:33:16 +00:00
Tiaan Louw
2ab102955e Bug 1892937 - Use a component parser that includes color-mix for origin colors r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D208344
2024-04-29 14:44:01 +00:00
Tiaan Louw
cdcc48b45f Bug 1892937 - Use origin color alpha if relative color alpha is omitted r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D208342
2024-04-29 14:44:01 +00:00
Tiaan Louw
3bfc24731e Bug 1892937 - Return correct values for legacy rgb() components r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D208341
2024-04-29 14:44:00 +00:00
Tiaan Louw
5ea801d0d3 Bug 1889561 - Parse color component symbols in calc expressions r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D206584
2024-04-29 14:44:00 +00:00
Tiaan Louw
2223254628 Bug 1889561 - Use a channel keyword enum for color components. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D208137
2024-04-29 14:43:59 +00:00
Nicolas Chevobbe
09fec812c0 Bug 1893923 - [devtools] Add ChromeOnly CSSStyleRule::querySelectorAll. r=layout-reviewers,emilio.
For the selector highlighter, we were retrieving the desugared selector of each
displayed rule, and using the selector text in querySelectorAll to retrieve the
elements matching the rule.
This can be very expensive, especially for deeply nested rule, for a feature that
might not even be used.
This patch is adding a method which takes a root node, and will return the
elements inside the root node that match the rule's selectors.
We're only exposing the method that existed in glue.rs to get the SelectorList
of a given Rule, and call `Servo_SelectorList_QueryAll` with it to get our NodeList.

A test file is added to ensure this works as expected.

Differential Revision: https://phabricator.services.mozilla.com/D208363
2024-04-29 06:43:23 +00:00
Emilio Cobos Álvarez
7e288d7f98 Bug 1893127 - Back out bug 1881220 for causing worse regressions than the problem it was fixing. r=layout-reviewers,firefox-style-system-reviewers,boris
As a short term fix this seems acceptable. Mark the test for the
regressing bug as failing.

Differential Revision: https://phabricator.services.mozilla.com/D208834
2024-04-27 22:42:42 +00:00
Tamas Szentpeteri
8c366161bb Backed out changeset d8e23e8fad18 (bug 1893127) for causing failures in calc-rounding-001.html. CLOSED TREE 2024-04-27 23:32:10 +03:00
Emilio Cobos Álvarez
22153710b5 Bug 1893127 - Back out bug 1881220 for causing worse regressions than the problem it was fixing. r=layout-reviewers,firefox-style-system-reviewers,boris
As a short term fix this seems acceptable. Mark the test for the
regressing bug as failing.

Differential Revision: https://phabricator.services.mozilla.com/D208834
2024-04-27 19:18:34 +00:00
Emilio Cobos Álvarez
872ff599a4 Bug 1891296 - Fix an assertion in selector-matching. r=dshin
We can have combinator sequences like [>, <part>], and they are fine.

Add a test to make sure they're handled correctly.

Differential Revision: https://phabricator.services.mozilla.com/D208668
2024-04-25 19:35:10 +00:00
David Shin
eb9c75ec17 Bug 1892727: Ensure KleeneValue's any_* functions are inlined. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D208513
2024-04-25 02:23:10 +00:00
Tiaan Louw
779d67e064 Bug 1892188 - Remove FromParsedColor trait r=layout-reviewers,emilio
Also removed unused component conversion functions.

Differential Revision: https://phabricator.services.mozilla.com/D207837
2024-04-19 09:32:48 +00:00
Tiaan Louw
6ca1dc6860 Bug 1892188 - Refactor ColorParser r=layout-reviewers,emilio
- Rename ColorParser to ComponentParser.
- Move origin color parsing to parse_color_function.
- Inline the parse_components function.

Differential Revision: https://phabricator.services.mozilla.com/D207836
2024-04-19 09:32:48 +00:00
Tiaan Louw
f3aa418364 Bug 1892188 - Move parser_(modern|legacy)_alpha to ColorParser r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D207835
2024-04-19 09:32:47 +00:00
Narcis Beleuzu
8d67200f2f Backed out 3 changesets (bug 1892188) for wpt failure on color-computed-relative-color.html . CLOSED TREE
Backed out changeset 712905edaaef (bug 1892188)
Backed out changeset 032a5034f221 (bug 1892188)
Backed out changeset 2f28639aaae1 (bug 1892188)
2024-04-19 02:01:55 +03:00
Tiaan Louw
ce1c6531e8 Bug 1892188 - Remove FromParsedColor trait r=layout-reviewers,emilio
Also removed unused component conversion functions.

Differential Revision: https://phabricator.services.mozilla.com/D207837
2024-04-18 20:14:38 +00:00
Tiaan Louw
122301297e Bug 1892188 - Refactor ColorParser r=layout-reviewers,emilio
- Rename ColorParser to ComponentParser.
- Move origin color parsing to parse_color_function.
- Inline the parse_components function.

Differential Revision: https://phabricator.services.mozilla.com/D207836
2024-04-18 20:14:38 +00:00
Tiaan Louw
41dd7e9a16 Bug 1892188 - Move parser_(modern|legacy)_alpha to ColorParser r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D207835
2024-04-18 20:14:37 +00:00
Emily McDonough
d999dfa37e Bug 1833466 - Implement CSSMarginRule and the corresponding DOM API. r=webidl,firefox-style-system-reviewers,smaug,emilio
Differential Revision: https://phabricator.services.mozilla.com/D206804
2024-04-16 19:52:39 +00:00
Tiaan Louw
bb878db393 Bug 1890724 - Interpret color channel keywords in relative color syntax r=layout-reviewers,emilio
When an origin color is specified in RCS, using the channel keywords
from the original color should be replaced by the values from the origin
color.

Differential Revision: https://phabricator.services.mozilla.com/D207117
2024-04-16 12:16:32 +00:00
Sandor Molnar
e4bf8a21e0 Backed out changeset ce926ee22c80 (bug 1833466) for causing build bustages @ layout/style/ServoStyleSet.cpp CLOSED TREE 2024-04-16 04:04:55 +03:00
Emily McDonough
7553005d7e Bug 1833466 - Implement CSSMarginRule and the corresponding DOM API. r=webidl,firefox-style-system-reviewers,smaug,emilio
Differential Revision: https://phabricator.services.mozilla.com/D206804
2024-04-15 23:55:12 +00:00
Sandor Molnar
47e280e34e Backed out changeset f2ae18495e1e (bug 1833466) for causing build bustages @ CSSMarginRule.cpp 2024-04-16 00:09:00 +03:00
Emily McDonough
6ccfb42cf6 Bug 1833466 - Implement CSSMarginRule and the corresponding DOM API. r=webidl,firefox-style-system-reviewers,smaug,emilio
Differential Revision: https://phabricator.services.mozilla.com/D206804
2024-04-15 18:14:42 +00:00
Nicolas Chevobbe
e6a3d588fb Bug 1887638 - [devtools] Expose CSS token value in InspectorCSSToken. r=emilio.
In some cases, it can be more useful to only get the token value than the whole
token text (e.g. for 'Function`, where the value is the function name, while
the text includes the opening parenthesis)
Refactor `test_lexer` to better test the tokens we get, including their value property.

Differential Revision: https://phabricator.services.mozilla.com/D207400
2024-04-15 17:14:43 +00:00
Nicolas Chevobbe
f6bb5f8a6c Bug 1887638 - [devtools] Add InspectorCSSParser. r=emilio,devtools-reviewers,frontend-codestyle-reviewers,bomsy.
This new InspectorCSSParser makes use of the cssparser crate so DevTools end
up using the same code as the CSS engine.
At the moment, we can't get the token start and end offsets, so we create
a JS wrapper class to compute them in JS. This might be removed if we get
a way to retrieve utf16 position from the cssparser.
The existing lexer xpcshell test is modified so it can run against both js-based
and rust-based lexers.

Differential Revision: https://phabricator.services.mozilla.com/D202909
2024-04-15 17:14:42 +00:00
Aron Cseh
a56e183ac5 Backed out changeset eb313b2b8b12 (bug 1890724) for causing wpt failures on color-computed-relative-color.html. CLOSED TREE 2024-04-15 19:41:48 +03:00
Tiaan Louw
12ec2696ab Bug 1890724 - Interpret color channel keywords in relative color syntax r=layout-reviewers,emilio
When an origin color is specified in RCS, using the channel keywords
from the original color should be replaced by the values from the origin
color.

Differential Revision: https://phabricator.services.mozilla.com/D207117
2024-04-15 10:51:34 +00:00
Ashley Hale
303ff331d8 Bug 1885716 - Fix HSL/HWB/LCH/OKLCH gradient longer hue interpolation 1-stop case r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D206976
2024-04-12 04:14:16 +00:00
Nicolas Chevobbe
e99d49e5e2 Bug 1890775 - [devtools] Fix get_byte_index_from_line_and_column line index computation. r=layout-reviewers,devtools-reviewers,emilio.
We were getting a line byte index for the
actual char matching the line we want, but
we actually need the index _after_ that
new line char.
A test case is added to cover this fix.

Differential Revision: https://phabricator.services.mozilla.com/D207156
2024-04-11 12:57:38 +00:00
Emilio Cobos Álvarez
427eff1774 Bug 1878919 - Add a forced-colors: requested chrome-only media feature value. r=morgan,dao
This is to be able to let the browser chrome observe the in-content
forced-color values too.

Differential Revision: https://phabricator.services.mozilla.com/D200856
2024-04-10 14:34:44 +00:00
Tiaan Louw
4884a8c671 Bug 1886170 - Change Color Parser trait into a concrete type r=layout-reviewers,emilio
The ColorParser trait only has one implementation so we can make it a
concrete type now.  It will be extended in the future.

Differential Revision: https://phabricator.services.mozilla.com/D207009
2024-04-09 14:00:02 +00:00
Tiaan Louw
e92422d5f8 Bug 1886170 - Remove ColorParser::Output abstraction r=layout-reviewers,emilio
This abstraction was in place when the color parsing still lived in
the cssparser crate, but now it is not needed any more and by removing
it we make the parsing more flexible.

Note: the ColorParser trait itself is still in tact and will be
addressed in another patch.

Differential Revision: https://phabricator.services.mozilla.com/D207008
2024-04-09 14:00:01 +00:00
Tiaan Louw
725ddad5fa Bug 1886170 - Add ColorFunction enum r=layout-reviewers,emilio
Add a ColorFunction enum that can hold the results of a parsed color
with all the required information still intact.

Differential Revision: https://phabricator.services.mozilla.com/D207007
2024-04-09 14:00:01 +00:00
Tiaan Louw
b41a9c96a5 Bug 1890502 - Unify the color component parsing functions r=layout-reviewers,emilio
No behaviour is changed and the functions are only merged to a single
more generic version.  Avoid code duplication and will make future
changes much easier and less error prone.

Differential Revision: https://phabricator.services.mozilla.com/D206993
2024-04-09 14:00:00 +00:00
Tiaan Louw
5fdf075a6d Bug 1889133 - Parse the from <color> part of the relative color syntax. r=layout-reviewers,emilio
All color functions support a from keyword as part of the relative color
syntax.

https://drafts.csswg.org/css-color-5/#relative-colors

This patch adds a pref layout.css.relative-color-syntax.enabled that is
off by default.

We start passing tests that only check for the validity of the `from`
keyword in different color functions.

Differential Revision: https://phabricator.services.mozilla.com/D206374
2024-04-08 15:26:25 +00:00
Emilio Cobos Álvarez
206ca74d01 Bug 1864418 - Append implicit parent selector during parsing. r=dshin,devtools-reviewers,nchevobbe
This matches recent spec changes.

Differential Revision: https://phabricator.services.mozilla.com/D206766
2024-04-08 08:44:42 +00:00
Nicolas Chevobbe
8003c92d48 Bug 1882964 - [devtools] Turn getRuleBodyTextOffsets into getRuleBodyText for easier unicode chars handling. r=layout-reviewers,devtools-reviewers,emilio,ochameau.
`InspectorUtils.getRuleBodyTextOffset` was returning bytes position, and we
were using them directly in Javascript `substring`, which causes problem
with non-ascii chars.
Instead of returning offsets to compute the rule string, we directly return
the string from InspectorUtils which is easier to work with.

Differential Revision: https://phabricator.services.mozilla.com/D204523
2024-04-08 08:37:14 +00:00
Nicolas Chevobbe
d6cde62e67 Bug 1882964 - [devtools] Add InspectorUtils.replaceBlockRuleBodyTextInStylesheet. r=layout-reviewers,devtools-reviewers,emilio,ochameau.
The next patch modifies `getRuleText` so it only returns the text, and no
longer the offset at which the rule starts.
The only consumer of the returned offset was in `StyleRuleActor#setRuleText`,
so we migrate this directly to a InspectorUtils method to avoid mixing JS string
indexes with Rust bytes position.

Differential Revision: https://phabricator.services.mozilla.com/D204522
2024-04-08 08:37:13 +00:00
Boris Chiou
f28ff20558 Bug 1889496 - Part 2: Implement CSSStartingStyleRule interface. r=webidl,firefox-style-system-reviewers,layout-reviewers,emilio
Introduce CSSStartingStyleRule and add one extra parsing test for
@starting-style rule.

Differential Revision: https://phabricator.services.mozilla.com/D206564
2024-04-05 21:03:07 +00:00
Boris Chiou
8bc06baebe Bug 1889496 - Part 1: Parse @starting-style rule. r=layout-reviewers,firefox-style-system-reviewers,emilio
We introduce this rule and parse it in this patch. Also, fix some wpt
expectations for ERROR.

We will introduce CSSStartingStyleRule in the following patch, and test
it there.

Differential Revision: https://phabricator.services.mozilla.com/D206428
2024-04-05 21:03:06 +00:00
Emilio Cobos Álvarez
089ca4e279 Bug 1889670 - Add code to track accurate allocation size in servo-arc. r=firefox-style-system-reviewers,zrhoffman
See comments.

Differential Revision: https://phabricator.services.mozilla.com/D206659
2024-04-05 19:23:42 +00:00
Cristian Tuns
ec18448a53 Backed out 2 changesets (bug 1889496) for causing build bustages in RefPtr.h CLOSED TREE
Backed out changeset 7689f9c266fc (bug 1889496)
Backed out changeset abbbf327c4f1 (bug 1889496)
2024-04-04 19:15:49 -04:00