When unhidding a ::marker element, we construct its generated item, and
then call StyleNewSubtree() on this generated item. During traversal, we
may update any animation related values in Gecko_UpdateAnimations(), which
may update the base styles for animation properties.
The test case is an animation segment from "null" to "inital" value. We
replace the "null" value with the base style value for the specific animation
property, so we can do interpolation properly.
(e.g. opacity: "null => initial" becomes "1.0 => initial")
If we don't update the animation related values in
Gecko_UpdateAnimations after generating ::marker, we may do
interpolation from "null" to "initial", which causes a panic.
Differential Revision: https://phabricator.services.mozilla.com/D73408
That way elements inside links, form controls, etc have the right
contrast, even if the page overrides the color.
We can't do it when inheriting from transparent because we've already
forgotten about the "right" color to inherit, so the default color makes
sense. But that is a pretty unlikely edge case.
Differential Revision: https://phabricator.services.mozilla.com/D73069
This way, something like:
*:where(.foo, .bar)
Will end up twice on the selector map, just as if you would've written
.foo, .bar.
But we're a bit careful to not be wasteful, so:
.foo:where(div, span)
Will still end up using the .foo bucket.
It needs a bit of borrow-checker gymnastics to avoid cloning the entry
in the common path. It's a bit gross but not too terrible I think.
Differential Revision: https://phabricator.services.mozilla.com/D71457
See the comment about why this is valuable. For a selector like:
.foo:is(.bar) > .baz
Before this patch we'd generate an Dependency for .bar like this:
Dependency {
selector: .bar,
offset: 0,
parent: Some(Dependency {
selector: .foo:is(.bar) > .baz,
offset: 1, // Pointing to the `>` combinator.
parent: None,
}),
}
After this patch we'd generate just:
Dependency {
selector: .foo:is(.bar) > .baz,
offset: 1, // Pointing to the `>` combinator.
parent: None,
}
This is not only less memory but also less work. The reason for that is that,
before this patch, when .bar changes, we'd look the dependency, and see there's
a parent, and then scan that, so we'd match `.bar` two times, one for the
initial dependency, and one for .foo:is(.bar).
Instead, with this we'd only check `.foo:is(.bar)` once.
Differential Revision: https://phabricator.services.mozilla.com/D71423
That way we can look at the parent dependency as described in the previous
patch. An alternative would be to add a:
parent_dependency: Option<&'a Dependency>
on construction to `Invalidation`, but this way seems slightly better to avoid
growing the struct. It's not even one more indirection because the selector is
contained directly in the Dependency struct.
Differential Revision: https://phabricator.services.mozilla.com/D71422
The tricky part of :is() and :where() is that they can have combinators inside,
so something like this is valid:
foo:is(#bar > .baz) ~ taz
The current invalidation logic is based on the assumption that you can
represent a combinator as a (selector, offset) tuple, which are stored in the
Dependency struct. This assumption breaks with :is() and :where(), so we need
to make them be able to represent a combinator in an "inner" selector.
For this purpose, we add a `parent` dependency. With it, when invalidating
inside the `:is()` we can represent combinators inside as a stack.
The basic idea is that, for the example above, when an id of "bar" is added or
removed, we'd find a dependency like:
Dependency {
selector: #bar > .baz,
offset: 1, // pointing to the `>` combinator
parent: Some(Dependency {
selector: foo:is(#bar > .baz) > taz,
offset: 1, // Pointing to the `~` combinator.
parent: None,
})
}
That way, we'd start matching at the element that changed, towards the right,
and if we find an element that matches .baz, instead of invalidating that
element, we'd look at the parent dependency, then double-check that the whole
left-hand-side of the selector (foo:is(#bar > .baz)) actually changed, and then
keep invalidating to the right using the parent dependency as usual.
This patch only builds the data structure and keeps the code compiling, the
actual invalidation work will come in a following patch.
Differential Revision: https://phabricator.services.mozilla.com/D71421
This way, something like:
*:where(.foo, .bar)
Will end up twice on the selector map, just as if you would've written
.foo, .bar.
But we're a bit careful to not be wasteful, so:
.foo:where(div, span)
Will still end up using the .foo bucket.
It needs a bit of borrow-checker gymnastics to avoid cloning the entry
in the common path. It's a bit gross but not too terrible I think.
Differential Revision: https://phabricator.services.mozilla.com/D71457
See the comment about why this is valuable. For a selector like:
.foo:is(.bar) > .baz
Before this patch we'd generate an Dependency for .bar like this:
Dependency {
selector: .bar,
offset: 0,
parent: Some(Dependency {
selector: .foo:is(.bar) > .baz,
offset: 1, // Pointing to the `>` combinator.
parent: None,
}),
}
After this patch we'd generate just:
Dependency {
selector: .foo:is(.bar) > .baz,
offset: 1, // Pointing to the `>` combinator.
parent: None,
}
This is not only less memory but also less work. The reason for that is that,
before this patch, when .bar changes, we'd look the dependency, and see there's
a parent, and then scan that, so we'd match `.bar` two times, one for the
initial dependency, and one for .foo:is(.bar).
Instead, with this we'd only check `.foo:is(.bar)` once.
Differential Revision: https://phabricator.services.mozilla.com/D71423
That way we can look at the parent dependency as described in the previous
patch. An alternative would be to add a:
parent_dependency: Option<&'a Dependency>
on construction to `Invalidation`, but this way seems slightly better to avoid
growing the struct. It's not even one more indirection because the selector is
contained directly in the Dependency struct.
Differential Revision: https://phabricator.services.mozilla.com/D71422
The tricky part of :is() and :where() is that they can have combinators inside,
so something like this is valid:
foo:is(#bar > .baz) ~ taz
The current invalidation logic is based on the assumption that you can
represent a combinator as a (selector, offset) tuple, which are stored in the
Dependency struct. This assumption breaks with :is() and :where(), so we need
to make them be able to represent a combinator in an "inner" selector.
For this purpose, we add a `parent` dependency. With it, when invalidating
inside the `:is()` we can represent combinators inside as a stack.
The basic idea is that, for the example above, when an id of "bar" is added or
removed, we'd find a dependency like:
Dependency {
selector: #bar > .baz,
offset: 1, // pointing to the `>` combinator
parent: Some(Dependency {
selector: foo:is(#bar > .baz) > taz,
offset: 1, // Pointing to the `~` combinator.
parent: None,
})
}
That way, we'd start matching at the element that changed, towards the right,
and if we find an element that matches .baz, instead of invalidating that
element, we'd look at the parent dependency, then double-check that the whole
left-hand-side of the selector (foo:is(#bar > .baz)) actually changed, and then
keep invalidating to the right using the parent dependency as usual.
This patch only builds the data structure and keeps the code compiling, the
actual invalidation work will come in a following patch.
Differential Revision: https://phabricator.services.mozilla.com/D71421
This works even if the Rust standard library’s allocator is not `libc::malloc`,
so we can remove the `known_system_malloc `feature flag
and make the `fallible` crate unconditional.
Differential Revision: https://phabricator.services.mozilla.com/D71742
This change adds support for canceling CSS transitions when a property
is no longer transitionable or when an element becomes styled with
display:none. Support for canceling and replacing CSS transitions when
the end value changes is still pending. This change also takes advantage
of updating the constellation message to fix a bug where transition
events could be sent for closed pipelines.
Cherry-picked from https://github.com/servo/servo/pull/26244
(though this is not part of the Gecko build).
This intermediate data structure doesn't really buy us anything and is a
bit confusing.
Cherry-picked from https://github.com/servo/servo/pull/26214
(though this is not part of the Gecko build).
RuleTree::gc is now a safe method that any thread can call
at any time, and StrongRuleNode values can all be dropped
whenever their owner want to, on any thread.
Cherry-picked from https://github.com/servo/servo/pull/26227
Just because we didn't find a child when read-locking a node children list
doesn't mean it still won't exist while we wait to upgrade the read lock
into a write lock to create the child.
This cherry-picks https://github.com/servo/servo/pull/26220
MANUAL PUSH: So that I can preserve reviewer information.
This implements the easy / straight-forward parts of the :where / :is
selectors.
The biggest missing piece is to handle properly invalidation when there
are combinators present inside the :where. That's the hard part of this,
actually.
But this is probably worth landing in the interim. This fixes some of
the visitors that were easy to fix.
Differential Revision: https://phabricator.services.mozilla.com/D70788
This uses Mako-1.1.2 wheel format, rather than zip, and works with py3 and py2.
It'd be great to make mako more like other third party python dependencies but
this allows me to build central again.
This is downloaded from:
f6ade1e18aadce2fcbc7b31be5f615/Mako-1.1.2-py2.py3-none-any.whl
Via pip-download.
Differential Revision: https://phabricator.services.mozilla.com/D70517
--HG--
extra : histedit_source : 1129829891d5afd7dcaa913d0ddfb5b0d69b0fc9
- Add new CSS Error
- Add new test case for error
- Ensure that test cases use `replace()` and `replaceSync()`
Differential Revision: https://phabricator.services.mozilla.com/D69423
--HG--
extra : moz-landing-system : lando
Are there any Rust crates outside mozilla-central that include or emit Mozilla C++ code that should be updated to use [[nodiscard]] instead of MOZ_MUST_USE?
Depends on D68751
Differential Revision: https://phabricator.services.mozilla.com/D69319
--HG--
extra : moz-landing-system : lando
This patch computes the author-specified properties during the CSS cascade, and
removes the complex rule-tree-based implementation that tries to do the cascade
again.
This changes behavior in two ways, one of them which is not observable to
content, I believe:
* revert now re-enables the native styling. This was brought up in
https://github.com/w3c/csswg-drafts/issues/4777 and I think it is a bug-fix.
This is observable to content, and I'm adding a test for it.
* We don't look at inherited styles from our ancestors when `inherit` is
specified in a non-author stylesheet. This was introduced for bug 452969 but
we don't seem to inherit background anymore for file controls or such. It
seems back then file controls used to have a text-field.
I audited forms.css and ua.css and we don't explicitly inherit
padding / border / background-color into any nested form control.
We keep the distinction between border/background and padding, because the later
has some callers. I think we should try to align with Chromium in the long run
and remove the padding bit.
We need to give an appearance to the range-thumb and such so that we can assert
that we don't call HasAuthorSpecifiedRules on non-themed stuff. I used a new
internal value for that.
Differential Revision: https://phabricator.services.mozilla.com/D67722
--HG--
extra : moz-landing-system : lando
This patch computes the author-specified properties during the CSS cascade, and
removes the complex rule-tree-based implementation that tries to do the cascade
again.
This changes behavior in two ways, one of them which is not observable to
content, I believe:
* revert now re-enables the native styling. This was brought up in
https://github.com/w3c/csswg-drafts/issues/4777 and I think it is a bug-fix.
This is observable to content, and I'm adding a test for it.
* We don't look at inherited styles from our ancestors when `inherit` is
specified in a non-author stylesheet. This was introduced for bug 452969 but
we don't seem to inherit background anymore for file controls or such. It
seems back then file controls used to have a text-field.
I audited forms.css and ua.css and we don't explicitly inherit
padding / border / background-color into any nested form control.
We keep the distinction between border/background and padding, because the later
has some callers. I think we should try to align with Chromium in the long run
and remove the padding bit.
We need to give an appearance to the range-thumb and such so that we can assert
that we don't call HasAuthorSpecifiedRules on non-themed stuff. I used a new
internal value for that.
Differential Revision: https://phabricator.services.mozilla.com/D67722
--HG--
extra : moz-landing-system : lando
We have this optimization where, for non-generic structs, we generate just a
clone / move as the ToComputedValue / ToResolvedValue implementation.
This moves the optimization a bit further down, and refines it so that we still
generate all the relevant where clauses that make it sound, that is, that all
the ToComputedValue implementations of the fields return the same type.
Otherwise this wouldn't be sound and the type would need to become generic.
We add an escape hatch (no_field_bound) for fields that need to be cloned but
which don't implement the trait. This is right now only for the RefPtr<> in the
shared font-family list, and a piece of code in PaintWorklet which looks kinda
fishy, and probably should be fixed (but we don't ship it in Firefox and there's
a pre-existing FIXME for servo, so I punted on it for now).
The other thing this patch does is adding a bunch of ToComputedValue /
ToResolvedValue implementations that are trivial and were missing.
Differential Revision: https://phabricator.services.mozilla.com/D67913
--HG--
extra : moz-landing-system : lando
Per the spec it shouldn't match, and the front-end has been bitten by this
multiple times.
Differential Revision: https://phabricator.services.mozilla.com/D68213
--HG--
extra : moz-landing-system : lando
Rename fill_idx to fill_start, to indicate it is not a single value but a
range. Also change a numeric_limits<>::max() involving the fill_start to use
decltype() to ensure its type matches that of the auto-generated structure's
field, while we're touching that code.
The test to ensure only a single repeat value is allowed will be removed by a
later commit.
Differential Revision: https://phabricator.services.mozilla.com/D60929
--HG--
extra : moz-landing-system : lando
Rename fill_idx to fill_start, to indicate it is not a single value but a
range. Also change a numeric_limits<>::max() involving the fill_start to use
decltype() to ensure its type matches that of the auto-generated structure's
field, while we're touching that code.
The test to ensure only a single repeat value is allowed will be removed by a
later commit.
Differential Revision: https://phabricator.services.mozilla.com/D60929
--HG--
extra : moz-landing-system : lando
This never worked, but it's more visible with the new form controls which have
more padding.
Make the anonymous div and co a pseudo-element, so that they inherit from the
<input> properly in all cases. This works for non-number inputs because the
editor root is a direct child of the <input>, but it doesn't for number inputs
because there's a flex wrapper in between.
This way overflow-clip-box: inherit does what we want. Reset the padding in the
inline direction, as the padding for <input type=number> applies to the arrow
boxes as well, and thus we'd double-apply it.
Differential Revision: https://phabricator.services.mozilla.com/D65271
--HG--
extra : moz-landing-system : lando
It's not ambiguous, and <width> <style> <color> seems like a more common order.
This is just a minor perf tweak, as the CSS parser token cache will most often
kick in to avoid re-tokenizing values.
Also remove a redundant continue statement.
Differential Revision: https://phabricator.services.mozilla.com/D67224
--HG--
extra : moz-landing-system : lando
Expect forced-colors-mode-backplate tests to fail because they were passing for the wrong reason,
and the backplate is now properly applied, causing them to fail.
Remove tests for field and fieldtext from color-valid.html because they are tested again
in system-color-valid.html.
Differential Revision: https://phabricator.services.mozilla.com/D66879
--HG--
extra : moz-landing-system : lando
Expect forced-colors-mode-backplate tests to fail because they were passing for the wrong reason,
and the backplate is now properly applied, causing them to fail.
Remove tests for field and fieldtext from color-valid.html because they are tested again
in system-color-valid.html.
Differential Revision: https://phabricator.services.mozilla.com/D66879
--HG--
extra : moz-landing-system : lando
- Add enum AllowImportRules to CSS parsing.
- `replaceSync()` will skip over @import rules and continue parsing.
- `replace()` will skip over @import rules and continue parsing.
- `insertRule()` will throw a syntax error on @import rules.
- Modify WPT test cases to reflect these changes.
Differential Revision: https://phabricator.services.mozilla.com/D61882
--HG--
extra : moz-landing-system : lando
Other browsers allow this and the spec doesn't really disallow it, so fix it,
add a test and carry on.
Differential Revision: https://phabricator.services.mozilla.com/D65107
--HG--
extra : moz-landing-system : lando
This is probably an old-ish bug made more frequent by the font loading
optimizations.
PostRebuildAllStyleData is a bit of a misnomer, but was always calling
ClearCachedData() on the style set, even if we weren't guaranteed to restyle
every element.
This means both wasted work and correctness issues (as the "uses <rare-feature>"
bits are cleared during this call, on the assumption that we'll then visit all
elements and that'd recompute it properly).
For now, unify a bit the different code paths and only clear these bits if we're
guaranteed to restyle all elements.
I should rename this to something better in a follow-up, and ideally also
decouple the ClearCachedData() calls a bit...
Differential Revision: https://phabricator.services.mozilla.com/D65740
--HG--
extra : moz-landing-system : lando
This should be less confusing. This is not supported outside of chrome:// or
user-agent stylesheets so we can name this however we want.
Differential Revision: https://phabricator.services.mozilla.com/D65605
--HG--
extra : moz-landing-system : lando
I think this should work for the animation throttling stuff.
Opacity works on the element tree, so I think this is sound.
Differential Revision: https://phabricator.services.mozilla.com/D64441
--HG--
extra : moz-landing-system : lando
Removing unused arguments and so on.
The origin can always be inferred from the stylesheet so it wasn't being used.
Differential Revision: https://phabricator.services.mozilla.com/D64150
--HG--
extra : moz-landing-system : lando
Removing unused arguments and so on.
The origin can always be inferred from the stylesheet so it wasn't being used.
Differential Revision: https://phabricator.services.mozilla.com/D64150
--HG--
extra : moz-landing-system : lando
This used to be needed for Gecko interop, but now all this is in the Rust side
so we no longer need it.
Depends on D63861
Differential Revision: https://phabricator.services.mozilla.com/D63863
--HG--
extra : moz-landing-system : lando
The heuristic is that we show focus outlines for unknown or key focus, and not
for mouse / touch.
This is probably not the final heuristic we take, but this allows people to play
with it and file bugs.
Once this is mature enough we should remove :-moz-focusring in favor of
:focus-visible.
Differential Revision: https://phabricator.services.mozilla.com/D63861
--HG--
extra : moz-landing-system : lando
This used to be needed for Gecko interop, but now all this is in the Rust side
so we no longer need it.
Depends on D63861
Differential Revision: https://phabricator.services.mozilla.com/D63863
--HG--
extra : moz-landing-system : lando
The heuristic is that we show focus outlines for unknown or key focus, and not
for mouse / touch.
This is probably not the final heuristic we take, but this allows people to play
with it and file bugs.
Once this is mature enough we should remove :-moz-focusring in favor of
:focus-visible.
Differential Revision: https://phabricator.services.mozilla.com/D63861
--HG--
extra : moz-landing-system : lando
This also fixes some backwards logic in nsBlockFrame::ReflowDirtyLines, and adds
some static assertions to nsGenericHTMLElement that almost cause a very subtle
bug.
Depends on D63792
Differential Revision: https://phabricator.services.mozilla.com/D63793
--HG--
extra : moz-landing-system : lando
* Use debug_unreachable for really unreachable code (having a release
unreachable!() there gives us little to no benefit, as a borked union can
already confuse us into reading an arbitrary pointer as a CalcPercentage).
* Avoid a clone of the calc variant when clamping. We only need to mutate the
clamping mode. This was the only clamp_to_non_negative function that didn't
consume the value.
Differential Revision: https://phabricator.services.mozilla.com/D63584
--HG--
extra : moz-landing-system : lando
We never fast-reject numbers (because they could be part of a product). Without
this refactoring we'd accept stuff like calc(10) and crash during the evaluation
for obvious reasons.
Differential Revision: https://phabricator.services.mozilla.com/D63401
--HG--
extra : moz-landing-system : lando
So as to avoid allocating an intermediate tree in Rust to resolve
`<length-percentage>` values.
Differential Revision: https://phabricator.services.mozilla.com/D63399
--HG--
extra : moz-landing-system : lando
This is the meat of the patch. There are a couple improvements done in a couple
later patches which should hopefully be straight-forward.
Differential Revision: https://phabricator.services.mozilla.com/D63397
--HG--
extra : moz-landing-system : lando
We'll have different leaf nodes as we progress in the value computation stage.
Differential Revision: https://phabricator.services.mozilla.com/D63396
--HG--
extra : moz-landing-system : lando
We'll use `CalcNode` as the specified value representation for <length> and
<length-percentage> values, so they'll have to implement ToCss.
There's one minor issue (two calls to to_css() instead of to_css_impl() which
are addressed later in the series).
Differential Revision: https://phabricator.services.mozilla.com/D63395
--HG--
extra : moz-landing-system : lando
This assert was wrong. The assert may fire if we resurrect the node from a
different thread and insert a kid fast enough.
We allow resurrecting nodes (bumping the nodes from zero to one) to avoid
allocation churn.
In particular, while the thread dropping the node gets to read the children (so
after the fetch_sub from the refcount, but before the read() of the children),
another thread could plausibly bumped the refcount back, and added a children.
This is a very big edge case of course, but I'm kinda sad I hadn't realized
before.
Differential Revision: https://phabricator.services.mozilla.com/D63286
--HG--
extra : moz-landing-system : lando
I don't think we want to keep the ugly widget hacks forever. Let me know if
you'd rather keep the property behind a pref but I don't think there's a point
in doing that.
Differential Revision: https://phabricator.services.mozilla.com/D62649
--HG--
extra : moz-landing-system : lando