summaryrefslogtreecommitdiffstats
path: root/devtools/server/actors/utils/stylesheets-manager.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /devtools/server/actors/utils/stylesheets-manager.js
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/server/actors/utils/stylesheets-manager.js')
-rw-r--r--devtools/server/actors/utils/stylesheets-manager.js31
1 files changed, 21 insertions, 10 deletions
diff --git a/devtools/server/actors/utils/stylesheets-manager.js b/devtools/server/actors/utils/stylesheets-manager.js
index a9c0705e8d..1c065afd4e 100644
--- a/devtools/server/actors/utils/stylesheets-manager.js
+++ b/devtools/server/actors/utils/stylesheets-manager.js
@@ -446,10 +446,12 @@ class StyleSheetsManager extends EventEmitter {
InspectorUtils.parseStyleSheet(styleSheet, text);
modifiedStyleSheets.set(styleSheet, text);
- const { atRules, ruleCount } =
- this.getStyleSheetRuleCountAndAtRules(styleSheet);
-
+ // getStyleSheetRuleCountAndAtRules can be costly, so only call it when needed,
+ // i.e. when the whole stylesheet is modified, not when a rule body is.
+ let atRules, ruleCount;
if (kind !== UPDATE_PRESERVING_RULES) {
+ ({ atRules, ruleCount } =
+ this.getStyleSheetRuleCountAndAtRules(styleSheet));
this.#notifyPropertyChanged(resourceId, "ruleCount", ruleCount);
}
@@ -465,13 +467,15 @@ class StyleSheetsManager extends EventEmitter {
});
}
- this.#onStyleSheetUpdated({
- resourceId,
- updateKind: "at-rules-changed",
- updates: {
- resourceUpdates: { atRules },
- },
- });
+ if (kind !== UPDATE_PRESERVING_RULES) {
+ this.#onStyleSheetUpdated({
+ resourceId,
+ updateKind: "at-rules-changed",
+ updates: {
+ resourceUpdates: { atRules },
+ },
+ });
+ }
}
/**
@@ -705,6 +709,13 @@ class StyleSheetsManager extends EventEmitter {
line: InspectorUtils.getRelativeRuleLine(rule),
column: InspectorUtils.getRuleColumn(rule),
});
+ } else if (className === "CSSPropertyRule") {
+ atRules.push({
+ type: "property",
+ propertyName: rule.name,
+ line: InspectorUtils.getRelativeRuleLine(rule),
+ column: InspectorUtils.getRuleColumn(rule),
+ });
}
}
return {