This will make being more granular with cloning easier, and we don't
need it after the previous patch.
This leaves DeclarationBlock only for the style attribute for now, we
need it for the AttrStyles stuff. But I plan to move that to
MiscContainer instead or so.
Differential Revision: https://phabricator.services.mozilla.com/D300052
This makes us not have to care about the owning rule.
Make shmem rules immutable directly too, to avoid needing the
OwnerIsReadOnly() checks.
Differential Revision: https://phabricator.services.mozilla.com/D300026
Some sites probe `@supports selector(::-webkit-scrollbar)` to detect
WebKit/Blink and then ship styles that depend on real WebKit scrollbar
behavior, which our partial `::-webkit-scrollbar` support does not match.
Give us a way to disable the pseudo-element on specific domains while
keeping it enabled everywhere else; on listed domains the pseudo is
treated as unknown by the selector parser, so `@supports selector(...)`
also reports it as unsupported.
Differential Revision: https://phabricator.services.mozilla.com/D299295
Some sites probe `@supports selector(::-webkit-scrollbar)` to detect
WebKit/Blink and then ship styles that depend on real WebKit scrollbar
behavior, which our partial `::-webkit-scrollbar` support does not match.
Give us a way to disable the pseudo-element on specific domains while
keeping it enabled everywhere else; on listed domains the pseudo is
treated as unknown by the selector parser, so `@supports selector(...)`
also reports it as unsupported.
Differential Revision: https://phabricator.services.mozilla.com/D299295
I looked at this because in bug 2014331 I need to mark more pseudos as
element-backed, and it's kinda silly the state our setup is in right
now.
This is all a somewhat historical mess, because in the old style system
pseudo-elements were just atoms, and we had that different types of atom
setup. The source of truth for these right now lives in a header macro
file, which isn't very flexible.
But now we have PseudoStyleType which represents both pseudos and anon
boxes, and is similar to the rust side PseudoElement enum.
Plus, the ::-moz-tree pseudo-elements are defined as anon boxes which
doesn't make any sense, so move them to pseudo-elements while at it.
Unify this in a similar way we treat CSS properties: Source of truth is
in pseudo_elements.toml / anon_boxes.toml, and we generate Rust and C++
as needed. This allows removing the nsStaticAtom subclass thing from
XPCOM, too.
This avoids some nasty duplication around which pseudos are pref-gated
and what not as well.
Differential Revision: https://phabricator.services.mozilla.com/D282076
I looked at this because in bug 2014331 I need to mark more pseudos as
element-backed, and it's kinda silly the state our setup is in right
now.
This is all a somewhat historical mess, because in the old style system
pseudo-elements were just atoms, and we had that different types of atom
setup. The source of truth for these right now lives in a header macro
file, which isn't very flexible.
But now we have PseudoStyleType which represents both pseudos and anon
boxes, and is similar to the rust side PseudoElement enum.
Plus, the ::-moz-tree pseudo-elements are defined as anon boxes which
doesn't make any sense, so move them to pseudo-elements while at it.
Unify this in a similar way we treat CSS properties: Source of truth is
in pseudo_elements.toml / anon_boxes.toml, and we generate Rust and C++
as needed. This allows removing the nsStaticAtom subclass thing from
XPCOM, too.
This avoids some nasty duplication around which pseudos are pref-gated
and what not as well.
Differential Revision: https://phabricator.services.mozilla.com/D282076
This builds on top of bug 1910616.
I decided to bubble up the invalidation sets and keep the cascade data
difference in StylesheetInvalidationSet because it felt clearer (it
always was a bit of a wart that we had to pass the root and snapshot map
down to flush).
Now the caller is responsible to flush of course, but I think it's
nicer, specially now that we also merged the shadow dom invalidation
there.
Eventually, it might be worth moving most of the existing sets into the
`CascadeDataDifference`, to be able to track stuff more accurately...
Maybe we can just diff the ElementAndPseudoRules maps? Though given some
pages have hundreds of thousands of rules that might be too much, not
sure. Anyways, one step at a time.
Differential Revision: https://phabricator.services.mozilla.com/D277951
In order to support view transition pseudo-element, we have to pass the
pseudo element identifier to this function to retrive the correct
pseudo-element.
Differential Revision: https://phabricator.services.mozilla.com/D270626
This patch introduces a minimal implementation of StylePropertyMap.get and
StylePropertyMap.set to support the first steps of CSSStyleValue reification.
For now:
- .get and .set fall back to the standard CSS OM rather than optimized
reification paths.
- This is sufficient to allow initial WPT tests for reification to run and
exercise the infrastructure.
- More efficient handling (avoiding round-tripping through CSS text, and
reusing PropertyDeclarationBlock directly) will be added in follow-up patches.
Differential Revision: https://phabricator.services.mozilla.com/D264772
This patch adds implementation of CSSStyleRule.styleMap from the CSS Typed OM
Level 1 specification.
It connects the partial interface for CSSStyleRule and returns a cached stub
StylePropertyMap instance.
This is part of ongoing incremental development of the CSS Typed OM API.
Differential Revision: https://phabricator.services.mozilla.com/D256957
The raw declaration block might change for a given rule. We need to keep
track of it properly for devtools in order to not lose track of rules.
Could I convince someone from DevTools to write a test for this? :)
Otherwise please point me to the right test to extend / change, and I
can.
Differential Revision: https://phabricator.services.mozilla.com/D230439
And some related code, such as `KeyframeEffectParams` and
`IsSupportedPseudoForAnimations()`.
Note: `GetPseudoAtom()` and `GetPseudoType()` are redundant, so remove them.
Differential Revision: https://phabricator.services.mozilla.com/D228224
Rename getCSSStyleRules now that it can return something else, and
change getCSSStyleRules_starting_style.html to cover this again.
Unfortunately the asserts in ServoStyleRuleMap.cpp no longer hold,
because the style attribute and other declarations are expected not to
show up there.
Differential Revision: https://phabricator.services.mozilla.com/D222856
I didn't put this behind a pref because it was a bit annoying to do with
the parser changes while keeping it fast, and because, at least nesting
wise, this is unlikely to cause compat issues.
There are some complexities for @scope, which I think I got right.
Fixed the tests not to depend on @scope necessarily per the discussion
in https://github.com/web-platform-tests/interop/issues/697.
Differential Revision: https://phabricator.services.mozilla.com/D222817
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
* Make CSSKeyframeDeclaration final.
* Give DocToUpdate a default implementation returning nullptr. That way we can
use that for CSSKeyframeDeclaration, CSSPageRule, and CSSStyleRule.
* Make DocToUpdate final on nsDOMCSSAttrDeclaration and nsComputedDOMStyle.
Differential Revision: https://phabricator.services.mozilla.com/D207198
Lazily create the rule list since most style rules won't have child
rules.
Remaining failures in the cssom tests are tracked in other bugs.
Differential Revision: https://phabricator.services.mozilla.com/D180649
Lazily create the rule list since most style rules won't have child
rules.
Remaining failures in the cssom tests are tracked in other bugs.
Differential Revision: https://phabricator.services.mozilla.com/D180649
For non-adopted sheets, use the owner tree. Those are always good to go.
For constructed stylesheets, try to find the most likely candidate. It's
not perfect but it's likely to always be correct in practice.
We could ask for the specific host instead, though that can get rather
annoying in practice.
Differential Revision: https://phabricator.services.mozilla.com/D180347
It was an extra layer of abstraction that we needed when stylo and the
old style system co-existed, but we no longer need it, and can just
merge them.
This will make upcoming CSS nesting changes to the object model easier.
Differential Revision: https://phabricator.services.mozilla.com/D180439
See blocked bug.
For non-Locked types we can just use the same underlying type at the FFI
boundary. Port StylesheetContents and CssUrlData to this set-up.
CssUrlData is already generated by cbindgen anyways.
Differential Revision: https://phabricator.services.mozilla.com/D177559
The specifics of how this is going to work are still getting spec'd /
discussed in https://github.com/w3c/csswg-drafts/issues/6576, but this
allows DevTools to work fine and the feature to be complete enough for
Nightly experimentation (with the other in-flight patches).
Otherwise devtools crashes when trying to inspect pages that use them.
Differential Revision: https://phabricator.services.mozilla.com/D124656