diff options
Diffstat (limited to '')
-rw-r--r-- | devtools/server/actors/page-style.js | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/devtools/server/actors/page-style.js b/devtools/server/actors/page-style.js index b37816c85f..7a425bc3d5 100644 --- a/devtools/server/actors/page-style.js +++ b/devtools/server/actors/page-style.js @@ -9,7 +9,6 @@ const { pageStyleSpec, } = require("resource://devtools/shared/specs/page-style.js"); -const { getCSSLexer } = require("resource://devtools/shared/css/lexer.js"); const { LongStringActor, } = require("resource://devtools/server/actors/string.js"); @@ -709,7 +708,7 @@ class PageStyleActor extends Actor { case "::marker": return this._nodeIsListItem(node); case "::backdrop": - return node.matches(":modal"); + return node.matches(":modal, :popover-open"); case "::cue": return node.nodeName == "VIDEO"; case "::file-selector-button": @@ -897,13 +896,15 @@ class PageStyleActor extends Actor { // Traverse through all the available keyframes rule and add // the keyframes rule that matches the computed animation name for (const keyframesRule of this.cssLogic.keyframesRules) { - if (animationNames.indexOf(keyframesRule.name) > -1) { - for (const rule of keyframesRule.cssRules) { - entries.push({ - rule: this._styleRef(rule), - keyframes: this._styleRef(keyframesRule), - }); - } + if (!animationNames.includes(keyframesRule.name)) { + continue; + } + + for (const rule of keyframesRule.cssRules) { + entries.push({ + rule: this._styleRef(rule), + keyframes: this._styleRef(keyframesRule), + }); } } } @@ -1280,22 +1281,28 @@ class PageStyleActor extends Actor { return; } - const lexer = getCSSLexer(selectorText); + const lexer = new InspectorCSSParser(selectorText); let token; while ((token = lexer.nextToken())) { if ( - token.tokenType === "symbol" && - ((shouldRetrieveClasses && token.text === ".") || - (shouldRetrieveIds && token.text === "#")) + token.tokenType === "Delim" && + shouldRetrieveClasses && + token.text === "." ) { token = lexer.nextToken(); if ( - token.tokenType === "ident" && + token.tokenType === "Ident" && token.text.toLowerCase().startsWith(search) ) { result.add(token.text); } } + if (token.tokenType === "IDHash" && shouldRetrieveIds) { + const idWithoutHash = token.value; + if (idWithoutHash.startsWith(search)) { + result.add(idWithoutHash); + } + } } } } |