1921 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Boris Chiou
5c44bb5d97 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-04 19:39:29 +00:00
Emily McDonough
5cf392ec59 Bug 1868215 - Change css::PageRule to inherit from css::GroupRule rather than css::Rule r=webidl,firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D206073
2024-04-04 01:04:41 +00:00
Boris Chiou
4385764edf Bug 1884425 - Introduce PathOrShapeFunciton for path() and shape(). r=firefox-style-system-reviewers,zrhoffman
Use this as a wrapper for `path()` and `shape()`, so it'd be easier to
specialize its `Animate` trait.

Differential Revision: https://phabricator.services.mozilla.com/D205490
2024-03-28 19:42:13 +00:00
keithamus
a38bf0da3c Bug 1888098 - optimize nth-of dependency tracking for custom state r=dshin
Differential Revision: https://phabricator.services.mozilla.com/D205804
2024-03-27 21:43:01 +00:00
David Shin
b3e5b463c3 Bug 1887745: Correct relative selector parsing for inner rules in @scope. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D205718
2024-03-27 18:31:46 +00:00
keithamus
c9afd8368f Bug 1865589 - Notify PresShell of CustomState changes, so Restyle can invalidate. r=emilio,dshin
Differential Revision: https://phabricator.services.mozilla.com/D202460
2024-03-22 22:18:05 +00:00
Mike Hommey
5d6b940217 Bug 1878780 - Don't use refs to mut static directly. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D205010
2024-03-20 00:02:22 +00:00
David Shin
1e31a04af4 Bug 1882581: Implement @scope parsing. r=firefox-style-system-reviewers,saschanaz,emilio
Differential Revision: https://phabricator.services.mozilla.com/D203153
2024-03-19 13:36:48 +00:00
Oriol Brufau
c973ce585b Bug 1886141 - Simplify return type of relative_selector_search_direction(). r=emilio
Instead of Option<ElementSelectorFlags>, it can be ElementSelectorFlags,
representing None as ElementSelectorFlags::empty().

No change in behavior.

Differential Revision: https://phabricator.services.mozilla.com/D205051
2024-03-19 13:20:46 +00:00
Boris Chiou
86adb0bd63 Bug 1823463 - Render clip-path:shape(). r=emilio
Update clip-path-shape-003.html and clip-path-shape-004.html because
1. Per SVG2 spec, we don't accept comma among commands, so I remove them.
2. Basically, these two tests want to test the result of `shape()`
   should be identical to the result of `path()`. However, I noticed the
   original tests which put a `clip-path:path()` with `position:absolutely`
   may have a fuzzy result if the path has some curves there. This may be
   caused by anti-alias together with absoultely positioned element
   (note: perhaps there are some floating point calculation in layout for
   this, so the final rendering coordinates may have some fractions).
   Therefore, I drop the absolutely positioned element, and just test
   that if the result of `shape()` is identical to the result of `path()`.

Also, add two more tests for different reference-boxes together with
the usage of `shape()` (to make sure we resolve percentage values properly).

Differential Revision: https://phabricator.services.mozilla.com/D202884
2024-03-18 21:20:29 +00:00
Boris Chiou
6605350dc6 Bug 1823463 - Make PathCommand as the specialization of GenericShapeCommand. r=emilio
Also, we don't have Unkonwn type, so we have to do some minor
refactoring in BuildPath(), and templatize this function so we can use
it for both shape() and path().

This patch doesn't change the behavior.

Note that we instantiate BuildPath() with CSSFloat for now. Once we
instantiate it for StyleAngle and LengthPercentage (i.e. shape()), we
have to tweak this function more. Let's do that in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D202883
2024-03-18 21:20:29 +00:00
Zach Hoffman
09b59a7de6 Bug 1875546 - [css-properties-values-api] Support interpolating custom properties in transitions r=firefox-style-system-reviewers,emilio
There are still some unhandled edge cases, like making the removal of an
@property rule not interpolate (bug 1885798).

Also, a todo is added to more granularly handle custom properties in
is_discrete_animatable (bug 1885995).

Differential Revision: https://phabricator.services.mozilla.com/D204863
2024-03-18 19:42:13 +00:00
Natalia Csoregi
3db9556f81 Backed out 2 changesets (bug 1882581) for causing bustage on InspectorUtils.cpp. CLOSED TREE
Backed out changeset 9f390afd0df5 (bug 1882581)
Backed out changeset 4781bbc7324f (bug 1882581)
2024-03-19 05:38:08 +02:00
David Shin
0ed15605fb Bug 1882581: Implement @scope parsing. r=firefox-style-system-reviewers,saschanaz,emilio
Differential Revision: https://phabricator.services.mozilla.com/D203153
2024-03-18 18:31:18 +00:00
Zach Hoffman
ab5c06ed01 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
Cristian Tuns
e4866809a2 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
45d3aedb0d 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
Nicolas Chevobbe
01949043ec Bug 1882964 - Add InspectorUtils.getRuleBodyTextOffsets. r=emilio.
Differential Revision: https://phabricator.services.mozilla.com/D203233
2024-03-05 08:36:23 +00:00
Emilio Cobos Álvarez
71aa26835f Bug 1881220 - Change calc() resolution mode to always round than truncate-by-default. r=firefox-style-system-reviewers,boris
The regressing bug regressed some calc() expressions like the one in the
test-case:

  max-width: calc(100% - <some-fixed-length>);

Where floating point precision basically made us lose a little bit of
precision here and there.

Before bug 1841612, this worked because we'd operate in fixed point for
such simple expressions at least. Things could easily go equally south
for more complex things including e.g. rem().

Rounding seems like the better default for calc() since we basically
have no idea of what the output is going to be, and makes the answer
more likely to be precise.

Note that this only affects actual mixed calc() expressions: If things
resolve to a percentage we keep existing behavior.

Differential Revision: https://phabricator.services.mozilla.com/D202746
2024-02-27 11:06:52 +00:00
Tiaan Louw
9bf53eeb62 Bug 1815186 - Add ColorTo to InspectorUtils to convert color to other color spaces. r=emilio,layout-reviewers,supply-chain-reviewers
This will allow calling InspectorUtils.ColorTo("red", "lab") and
receive {color: "lab(54.3 80.8 69.9)", components: [54.3, 80.8, 69.9, 1.0], adjusted: false}.

The adjusted value is always "false", because gamut checking and mapping
is not supported at the moment. See:
https://bugzilla.mozilla.org/show_bug.cgi?id=1823363

Depends on D192673

Differential Revision: https://phabricator.services.mozilla.com/D169942
2024-02-26 14:55:01 +00:00
Boris Chiou
ed8e803890 Bug 1805727 - Part 5: Support transition-behavior when animation values fall back to discrete. r=emilio
When transition-behavior is allow-discrete, the animation values are
transitionable even if they are not interpoltable, given that the
animation type of the CSS property is by computed value.

Also, we remove `animate()` check from `needs_transitions_update_per_property`.
This check was added for handling the transition between `auto` and
other values long time ago, but now it may be redundant (because we
still pass the tests without it) and we do the same things in
nsTransitionManager as well, so it should be fine to drop it, especially
after we support discrete transitions.

Differential Revision: https://phabricator.services.mozilla.com/D201865
2024-02-23 21:41:49 +00:00
Boris Chiou
79f4455f37 Bug 1805727 - Part 4: Implement transition-behavior for properties with discrete animation type. r=emilio
The implementation is straight-forward. We have to check
if `transition-behavior` is `allow-discrete` when trying to create a new
transition and when checking if we have to cancel a running transition.

Also, the test case is out-of-date, so I tweak it a little bit and add
more general test cases for transtiion-behavior. Besides, I enable the
preference in the WPT folders which use `transition-behavior` (but
those tests may be passed already or failed due to reasons other than
`transition-behavior`).

Differential Revision: https://phabricator.services.mozilla.com/D201864
2024-02-23 21:41:49 +00:00
Boris Chiou
9f6a2b2041 Bug 1805727 - Part 1: Support transition-behavior longhand in style. r=emilio
Add transition-behavior longhand property. This doesn't include layout
animation support.

Differential Revision: https://phabricator.services.mozilla.com/D200408
2024-02-23 21:41:48 +00:00
sunil mayya
022e5ba65d Bug 1864817 - initialize STYLE_THREAD_POOL in Sevo_initialize. r=emilio,jesup
Differential Revision: https://phabricator.services.mozilla.com/D201022
2024-02-22 10:43:49 +00:00
Sandor Molnar
032ee988a6 Backed out changeset 0cf3688e2bcf (bug 1879286) for causing mochitest failures at layout/inspector/tests/test_getRegisteredCustomProperties.html CLOSED TREE 2024-02-08 18:49:48 +02:00
Nicolas Chevobbe
2e5692b983 Bug 1879286 - [devtools] Return registered propertly location in InspectorUtils::GetCSSRegisteredProperties. r=emilio.
Differential Revision: https://phabricator.services.mozilla.com/D201059
2024-02-08 13:30:45 +00:00
Emilio Cobos Álvarez
0d81741c6d Bug 1874488 - Make Element.{client,scroll} APIs zoom aware. r=saschanaz,TYLin
Also extend scroll-zoom to cover scroll{Top,Left,To,By}, since that was
completely untested.

Differential Revision: https://phabricator.services.mozilla.com/D200029
2024-02-08 11:13:01 +00:00
Iulian Moraru
fd7cec7036 Backed out 3 changesets (bug 1874488) for causing multiple failures. CLOSED TREE
Backed out changeset 467c5213a79a (bug 1874488)
Backed out changeset 13da2be03857 (bug 1874488)
Backed out changeset 974683909782 (bug 1874488)
2024-02-08 01:29:54 +02:00
Emilio Cobos Álvarez
3f6f4db1d8 Bug 1874488 - Make Element.{client,scroll} APIs zoom aware. r=saschanaz,TYLin
Also extend scroll-zoom to cover scroll{Top,Left,To,By}, since that was
completely untested.

Differential Revision: https://phabricator.services.mozilla.com/D200029
2024-02-07 21:30:36 +00:00
Emilio Cobos Álvarez
a528778e6f 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
b59516559d Bug 1876541 - Zoom should affect intrinsic replaced element size. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D199990
2024-02-07 09:51:52 +00:00
Jonathan Kew
5741b2b190 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-26 09:40:02 +00:00