Make InspectorUtils.getRuleBodyText handle CSSNestedDeclarations
Categories
(DevTools :: Inspector: Rules, defect, P2)
Tracking
(Not tracked)
People
(Reporter: nchevobbe, Assigned: nchevobbe)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
At the moment, we can't retrieve a CSSNestedDeclarations authored text as we explicitly bail out in https://searchfox.org/mozilla-release/rev/e38acda63624c7058df4c5adb1f61f9787ed1968/devtools/server/actors/style-rule.js#806,821-823
async getAuthoredCssText(skipCache = false) {
...
if (this.ruleClassName == "CSSNestedDeclarations") {
throw new Error("getRuleText doesn't deal well with bare declarations");
}
with Bug 1950551, we'll get the proper line and column for the rule, so we should try to make InspectorUtils.getRuleBodyText
work for CSSNestedDeclarations
This might also help with Bug 1946439 where we need to fix InspectorUtils.replaceBlockRuleBodyTextInStylesheet
, which is doing similar work than InspectorUtils.getRuleBodyText
Updated•4 months ago
|
Assignee | ||
Comment 1•4 months ago
|
||
Servo_GetRuleBodyText
needs to be modified: https://searchfox.org/mozilla-release/rev/350db22c9b6a687565189a42fc49dc58c05566b6/servo/ports/geckolib/glue.rs#9407-9446
Emilio, I was thinking of passing a new is_nested_declarations
bool parameter to the function, and then parse declarations until we find a selector or the parent rule closing curly bracket (or end of the file).
Do you think I could use https://docs.rs/cssparser/latest/cssparser/fn.parse_one_declaration.html until it returns a parse error? Or is there something else that I could do to achieve what I want?
Comment 2•4 months ago
|
||
You probably want something like https://searchfox.org/mozilla-release/rev/350db22c9b6a687565189a42fc49dc58c05566b6/servo/components/style/stylesheets/mod.rs#616
Assignee | ||
Comment 3•4 months ago
|
||
Updated•4 months ago
|
Description
•