Commit Graph

191 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
e623bb8997 Bug 1919853 - Make InspectorUtils able to return CSSNestedDeclarations too. r=devtools-reviewers,nchevobbe,dshin
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
2024-09-20 15:59:53 +00:00
Emilio Cobos Álvarez
62087dd417 Bug 1918408 - Implement the nested declarations rule. r=dshin,webidl,smaug
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
2024-09-19 20:23:22 +00:00
David Shin
672b87571d Bug 1909346: Implement CSSPositionTryRule interface. r=firefox-style-system-reviewers,webidl,emilio
Differential Revision: https://phabricator.services.mozilla.com/D217627
2024-08-16 13:14:04 +00:00
Norisz Fay
d9e5dbdd0b Backed out 5 changesets (bug 1900233, bug 1911353, bug 1909346) for causing mochitest failures on test_property_syntax_errors.html CLOSED TREE
Backed out changeset e19f73882313 (bug 1911353)
Backed out changeset da10b514e301 (bug 1900233)
Backed out changeset a806c12d47f9 (bug 1909346)
Backed out changeset 46695f2f204a (bug 1909346)
Backed out changeset 82856fd84c5a (bug 1900233)
2024-08-15 04:58:45 +03:00
David Shin
d06e12ef20 Bug 1909346: Implement CSSPositionTryRule interface. r=firefox-style-system-reviewers,webidl,emilio
Differential Revision: https://phabricator.services.mozilla.com/D217627
2024-08-14 23:26:13 +00:00
Narcis Beleuzu
0c2b24def6 Backed out 5 changesets (bug 1909346, bug 1911353, bug 1900233) for Bp bustages on ServoStyleSet.cpp . CLOSED TREE
Backed out changeset f6e3cddaa98e (bug 1911353)
Backed out changeset d8ec18178fed (bug 1900233)
Backed out changeset f6e45aa1a0f9 (bug 1909346)
Backed out changeset 7903b612930c (bug 1909346)
Backed out changeset c400d8d1a91f (bug 1900233)
2024-08-06 21:34:13 +03:00
David Shin
9287ae6a8f Bug 1909346: Implement CSSPositionTryRule interface. r=firefox-style-system-reviewers,webidl,emilio
Differential Revision: https://phabricator.services.mozilla.com/D217627
2024-08-06 16:59:27 +00:00
Nicolas Chevobbe
67c4f26a6e Bug 1905569 - [devtools] Add InspectorUtils.getCSSRegisteredProperty. r=emilio.
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
2024-07-01 13:35:27 +00:00
Boris Chiou
c67d3ccd79 Bug 1893409 - Make getCSSStyleRules() work for starting style as well. r=layout-reviewers,firefox-style-system-reviewers,nchevobbe,emilio
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
2024-06-04 03:15:00 +00:00
Nicolas Chevobbe
498865d822 Bug 1899533 - [devtools] Add InspectorUtils method to validate a value against a given syntax. r=emilio.
Differential Revision: https://phabricator.services.mozilla.com/D211975
2024-06-03 19:53:00 +00:00
Ting-Yu Lin
5cd68a11de Bug 1896516 Part 9 - Remove nsIScrollableFrame usages under dom/. r=layout-reviewers,emilio
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
2024-05-30 06:32:21 +00:00
Sebastian Hengst
bf4dfe53f8 Backed out 15 changesets (bug 1896516) for causing scrolling crashes on macOS. a=backout
Backed out changeset fd6904338812 (bug 1896516)
Backed out changeset 2977ff81a23e (bug 1896516)
Backed out changeset c8a6b0e526d6 (bug 1896516)
Backed out changeset 3c06f22da72b (bug 1896516)
Backed out changeset f63b0c4335fe (bug 1896516)
Backed out changeset 6f7ab8adfa6e (bug 1896516)
Backed out changeset 997c9249dbed (bug 1896516)
Backed out changeset c964fccd5180 (bug 1896516)
Backed out changeset 7b481b747b7a (bug 1896516)
Backed out changeset 42e1bbe0ecb6 (bug 1896516)
Backed out changeset 717dac08b607 (bug 1896516)
Backed out changeset 2f0817331dbe (bug 1896516)
Backed out changeset b765169a7a8f (bug 1896516)
Backed out changeset a2d37b98273c (bug 1896516)
Backed out changeset ea9ecb543e66 (bug 1896516)
2024-05-29 11:22:52 +02:00
Emilio Cobos Álvarez
7ed6c6abba Bug 1899103 - Add InspectorUtils.isUsedColorSchemeDark. r=nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D211718
2024-05-28 13:16:52 +00:00
Ting-Yu Lin
5d5204f810 Bug 1896516 Part 9 - Remove nsIScrollableFrame usages under dom/. r=layout-reviewers,emilio
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
2024-05-28 04:46:20 +00:00
Daniel Holbert
c7015be9b2 Bug 1896711 part 1: Use MakeRefPtr to reduce boilerplate, in layout/{build,inspector,mathml}. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D210387
2024-05-15 07:29:19 +00:00
Nicolas Chevobbe
3f151d357e 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
2644f82de7 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
0a0aa568db 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
Cristian Tuns
e28581a958 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
90f93535fd 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
Nicolas Chevobbe
b9b393ff8a Bug 1886392 - [devtools] Show @property rules in StyleEditor at-rules sidebar. r=devtools-reviewers,ochameau.
Differential Revision: https://phabricator.services.mozilla.com/D205195
2024-03-21 06:14:51 +00:00
David Shin
d8686f3e77 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
Nicolas Chevobbe
65e6901eaa Bug 1884072 - [devtools] Make getStyleSheetRuleCountAndAtRules faster. r=layout-reviewers,devtools-reviewers,emilio,ochameau.
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
2024-03-14 10:57:05 +00:00
Cristian Tuns
8505013d68 Backed out changeset ae42893523cc (bug 1884072) for causing dt failures in browser_resources_stylesheets.js CLOSED TREE 2024-03-13 08:55:09 -04:00
Nicolas Chevobbe
0a015b760b Bug 1884072 - [devtools] Make getStyleSheetRuleCountAndAtRules faster. r=layout-reviewers,devtools-reviewers,emilio,ochameau.
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
2024-03-13 11:02:37 +00:00
Otto Länd
a53b9a4a91 Bug 1882964: apply code formatting via Lando
# ignore-this-changeset
2024-03-05 08:39:03 +00:00
Nicolas Chevobbe
20cbbb211e Bug 1882964 - Add InspectorUtils.getRuleBodyTextOffsets. r=emilio.
Differential Revision: https://phabricator.services.mozilla.com/D203233
2024-03-05 08:36:23 +00:00
Tiaan Louw
880b676126 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
Nicolas Chevobbe
e61d28e54f Bug 1247751 - [devtools] Add InspectorUtils.getRuleIndex. r=emilio,devtools-reviewers,ochameau.
Differential Revision: https://phabricator.services.mozilla.com/D201383
2024-02-15 14:04:32 +00:00
Sandor Molnar
36d03656a2 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
fd08eba46d 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
Nicolas Chevobbe
ff33ba0c47 Bug 1873207 - Call UpdateStylistIfNeeded in InspectorUtils::GetCSSRegisteredProperties. r=emilio.
Differential Revision: https://phabricator.services.mozilla.com/D197789
2024-01-16 19:31:06 +00:00
Nicolas Chevobbe
f9c638efa2 Bug 1870844 - Add -- prefix to InspectorUtils::GetCSSRegisteredProperties property definition names. r=emilio,zrhoffman.
This will make it easier to handle those in DevTools

Differential Revision: https://phabricator.services.mozilla.com/D196847
2024-01-16 19:31:05 +00:00
Emilio Cobos Álvarez
eca1a48b86 Bug 1871540 - Fix an inspector assertion when inspecting ::cue pseudos. r=dshin
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
2023-12-22 18:02:56 +00:00
Nicolas Chevobbe
fb736185ad Bug 1866707 - Make InspectorUtils.isInheritedProperty check property definition in custom properties registry. r=zrhoffman.
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
2023-11-27 18:39:10 +00:00
Olli Pettay
09966ae20f Bug 1844755 - Consider to not create ServoStyleSet for data documents, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D191485
2023-10-23 16:10:41 +00:00
Natalia Csoregi
936df55967 Backed out changeset f1426851ae30 (bug 1844755) for causing failures on test_printpreview.xhtml. CLOSED TREE 2023-10-23 13:44:53 +03:00
Olli Pettay
ce1ccc4967 Bug 1844755 - Consider to not create ServoStyleSet for data documents, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D191485
2023-10-23 09:42:42 +00:00
Jonathan Kew
e28c4ba6cc Bug 1857076 - Add an InspectorUtils API to get the number of lines in a block after reflow. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D190210
2023-10-05 20:37:54 +00:00
Nicolas Chevobbe
8845a2527d Bug 1841265 - Add InspectorUtils.getCSSRegisteredProperties. r=emilio,zrhoffman.
Differential Revision: https://phabricator.services.mozilla.com/D188215
2023-09-25 15:02:51 +00:00
Nicolas Chevobbe
262c8fba62 Bug 1840872 - Add InspectorUtils.getRegisteredCssHighlights method. r=jjaschke.
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
2023-08-16 09:56:43 +00:00
Emilio Cobos Álvarez
2ad7f748ea Bug 1847440 - Always store relative line numbers in CSS rules. r=zrhoffman
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
2023-08-16 09:37:27 +00:00
Emilio Cobos Álvarez
e56ad86be6 Bug 1846745 - Remove nsColorNames.h. r=tlouw
Use the CSS parser to parse named colors.

Differential Revision: https://phabricator.services.mozilla.com/D185156
2023-08-03 10:52:14 +00:00
Jan-Niklas Jaeschke
4134763b27 Bug 1838262, part 2: Implemented getComputedStyle() for custom highlight api. r=emilio
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
2023-07-31 13:47:54 +00:00
Nicolas Chevobbe
3910665495 Bug 1839168 - [devtools] Add InspectorUtils.getAllStyleSheetCSSStyleRules method. r=emilio.
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
2023-06-21 18:48:39 +00:00
Emilio Cobos Álvarez
dde7ee0dea Bug 1838627 - Refactor InspectorUtils APIs that just forward to CSSStyleRule, and expose desugared selectors on them. r=nchevobbe,webidl,firefox-style-system-reviewers,smaug,devtools-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D181109
2023-06-21 07:14:57 +00:00
Emilio Cobos Álvarez
2239425e0a Bug 1837638 - Merge CSSStyleRule and BindingStyleRule. r=dholbert
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
2023-06-09 17:16:34 +00:00
Butkovits Atila
30bc067c96 Backed out changeset ab9f3266184b (bug 1815186) for causing failures at test_color_to.html. 2023-05-22 23:29:17 +03:00
Tiaan Louw
2b549f2962 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

Differential Revision: https://phabricator.services.mozilla.com/D169942
2023-05-22 17:19:14 +00:00
Emilio Cobos Álvarez
2319f4f573 Bug 1832803 - Remove some magic from the bindings. r=boris
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
2023-05-12 23:33:12 +00:00