Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1938)

Unified Diff: third_party/WebKit/Source/devtools/front_end/sources/StyleSheetOutlineDialog.js

Issue 2572053002: DevTools: kill SDK.CSSParser (Closed)
Patch Set: address comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/sdk/module.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/sources/StyleSheetOutlineDialog.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/StyleSheetOutlineDialog.js b/third_party/WebKit/Source/devtools/front_end/sources/StyleSheetOutlineDialog.js
index 83dc4bac8ccd750bb682482411f8c30176dfacd0..c8b9802d5e04ede5bd35c266feb291cf25b978a6 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/StyleSheetOutlineDialog.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/StyleSheetOutlineDialog.js
@@ -37,9 +37,12 @@ Sources.StyleSheetOutlineDialog = class extends UI.FilteredListWidget.Delegate {
constructor(uiSourceCode, selectItemCallback) {
super([]);
this._selectItemCallback = selectItemCallback;
- this._cssParser = new SDK.CSSParser();
- this._cssParser.addEventListener(SDK.CSSParser.Events.RulesParsed, this.refresh.bind(this));
- this._cssParser.parse(uiSourceCode.workingCopy());
+ /** @type {!Array<!Common.FormatterWorkerPool.CSSRule>} */
+ this._rules = [];
+ Common.formatterWorkerPool.parseCSS(uiSourceCode.workingCopy(), (isLastChunk, rules) => {
+ this._rules.push(...rules);
+ this.refresh();
+ });
}
/**
@@ -57,7 +60,7 @@ Sources.StyleSheetOutlineDialog = class extends UI.FilteredListWidget.Delegate {
* @return {number}
*/
itemCount() {
- return this._cssParser.rules().length;
+ return this._rules.length;
}
/**
@@ -66,7 +69,7 @@ Sources.StyleSheetOutlineDialog = class extends UI.FilteredListWidget.Delegate {
* @return {string}
*/
itemKeyAt(itemIndex) {
- var rule = this._cssParser.rules()[itemIndex];
+ var rule = this._rules[itemIndex];
return rule.selectorText || rule.atRule;
}
@@ -77,7 +80,7 @@ Sources.StyleSheetOutlineDialog = class extends UI.FilteredListWidget.Delegate {
* @return {number}
*/
itemScoreAt(itemIndex, query) {
- var rule = this._cssParser.rules()[itemIndex];
+ var rule = this._rules[itemIndex];
return -rule.lineNumber;
}
@@ -89,7 +92,7 @@ Sources.StyleSheetOutlineDialog = class extends UI.FilteredListWidget.Delegate {
* @param {!Element} subtitleElement
*/
renderItem(itemIndex, query, titleElement, subtitleElement) {
- var rule = this._cssParser.rules()[itemIndex];
+ var rule = this._rules[itemIndex];
titleElement.textContent = rule.selectorText || rule.atRule;
this.highlightRanges(titleElement, query);
subtitleElement.textContent = ':' + (rule.lineNumber + 1);
@@ -101,16 +104,9 @@ Sources.StyleSheetOutlineDialog = class extends UI.FilteredListWidget.Delegate {
* @param {string} promptValue
*/
selectItem(itemIndex, promptValue) {
- var rule = this._cssParser.rules()[itemIndex];
+ var rule = this._rules[itemIndex];
var lineNumber = rule.lineNumber;
if (!isNaN(lineNumber) && lineNumber >= 0)
this._selectItemCallback(lineNumber, rule.columnNumber);
}
-
- /**
- * @override
- */
- dispose() {
- this._cssParser.dispose();
- }
};
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/sdk/module.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698