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
In some cases, DevTools might want to get the property definition of a given registered property,
so we're adding a new InspectorUtils method for this.
It returns null when there is no registered property matching the passed name.
A test is added to ensure this behaves as expected.
Differential Revision: https://phabricator.services.mozilla.com/D215317
Update the API, `nspectorUtils.getCSSStyleRules`. Add one extra
argument so the user can choose whether we should return the starting
style, for a given element, at this moment.
Differential Revision: https://phabricator.services.mozilla.com/D209318
Also, in EventStateManager, convert `ComputeScrollTarget()` and
`ComputeScrollTargetAndMayAdjustWheelEvent()` to return `ScrollContainerFrame*`
so that we can drop more unnecessarily `do_QueryFrame`.
Due to removing `nsIScrollableFrame` forward declaration in DOM headers, we have
to add `nsIScrollableFrame` forward declaration temporarily in
nsMenuPopupFrame.h to make this patch compile, but we'll remove it once we
remove `nsIScrollableFrame` under layout/.
Differential Revision: https://phabricator.services.mozilla.com/D211496
Also, in EventStateManager, convert `ComputeScrollTarget()` and
`ComputeScrollTargetAndMayAdjustWheelEvent()` to return `ScrollContainerFrame*`
so that we can drop more unnecessarily `do_QueryFrame`.
Due to removing `nsIScrollableFrame` forward declaration in DOM headers, we have
to add `nsIScrollableFrame` forward declaration temporarily in
nsMenuPopupFrame.h to make this patch compile, but we'll remove it once we
remove `nsIScrollableFrame` under layout/.
Differential Revision: https://phabricator.services.mozilla.com/D211496
`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
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
We were returning the whole list of rules for a given stylesheet, and then
picking the at-rules we wanted in JS.
This patch make it so that the InspectorUtils method will only return the
at-rules we want directly, so we're building a smaller array of rule in the end.
Since `getStyleSheetRuleCountAndAtRules` also need to return the total number
of rules, this adds a simple `InspectorUtils.getStyleSheetRulesCount` method that
does that.
Differential Revision: https://phabricator.services.mozilla.com/D203878
We were returning the whole list of rules for a given stylesheet, and then
picking the at-rules we wanted in JS.
This patch make it so that the InspectorUtils method will only return the
at-rules we want directly, so we're building a smaller array of rule in the end.
Since `getStyleSheetRuleCountAndAtRules` also need to return the total number
of rules, this adds a simple `InspectorUtils.getStyleSheetRulesCount` method that
does that.
Differential Revision: https://phabricator.services.mozilla.com/D203878
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
I noticed that we weren't finding the :host::cue rule in the inspector,
even though it was applying and working.
When we're a NAC pseudo-element, also look at the relevant shadow root.
Could probably write a test for this, but I think I want to make the
setup for ::cue (which is the only weird pseudo like this) a bit nicer,
so not sure it's worth it.
Differential Revision: https://phabricator.services.mozilla.com/D197185
Since registered custom properties can be specified to not inherit,
DevTools need to retrieve this information in order to display accurate
data in the rules view.
The method signature is changed and now take a Document so we can lookup
the registry.
The existing test is updated with registered and unregistered custom properties.
Next patch in queue handles the impact in DevTools code.
Differential Revision: https://phabricator.services.mozilla.com/D194629
This will be used by DevTools to retrieve the name of registered, active, highlights,
in order to display the CSS rules for the `::highlight` pseudo element rules.
Differential Revision: https://phabricator.services.mozilla.com/D186006
CSS rules were storing absolute rather than relative line numbers (this
was done to match the old style system).
So when we hit the cached inline stylesheet code-path, for which we
share the CSS rules of the stylesheet, for the cache hit the line
numbers were completely off.
This particular page was probably regressed by bug 1834081, but the
issue could happen before with Shadow DOM.
Always store relative numbers and convert to absolute when asked by the
inspector, rather than the other way around.
This is simpler and makes the cache work.
Differential Revision: https://phabricator.services.mozilla.com/D185916
This patch introduces functional pseudo parameters, i.e. `::highlight(foo)`,
for `getComputedStyle()`. This required adapting the parse algorithm (`nsCSSPseudoElements::ParsePseudoElement()`) and forwarding the functional pseudo parameter into the style engine.
Differential Revision: https://phabricator.services.mozilla.com/D183773
This method returns a flat list of all the rules in a given stylesheet.
This will be helpful for DevTools so we don't have to recursively walk through
all the children rules (which is slow on the JS DevTools server).
Differential Revision: https://phabricator.services.mozilla.com/D181505
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
This simplifies a tiny bit our bindings in some places, and complicates
it in others, but over all I think it's better.
It requires a bit more manual code in the rust side to drop and cast the
relevant pointers (which was done implicitly before), but it's a lot
less magic than it used to be, and that's all autogenerated so consumers
don't need to care about it.
The set up is still not ideal. I don't like that we rely on destructors
running in both sides of the FFI boundary, but that's for another day.
This is the last usage of RawOffsetArc, so remove that. We now support
proper Arc<> in structs (GridTemplateAreas uses it), so I don't think
we'll need it any time soon.
Differential Revision: https://phabricator.services.mozilla.com/D177905