Bug 1779180 - [devtools] Replace usages of InspectorUtils.getRuleLine with InspectorUtils.getRelativeRuleLine. r=jdescottes.

For <style> elements, `getRelativeRuleLine` gives us the position of the rule
inside a stylesheet, when `getRuleLine` gives the position of the rule relatively
to the whole HTML source.
The former is more accurate for us when we want to display such line number in
DevTools UI (for example in the StyleEditor media query sidebar).

Test will be added in next patch of this queue.

Differential Revision: https://phabricator.services.mozilla.com/D151596
This commit is contained in:
Nicolas Chevobbe 2022-07-18 07:05:18 +00:00
Родитель 5ecfe80ddd
Коммит 597135d899
3 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -959,7 +959,7 @@ function CssRule(cssSheet, domRule, element) {
if (this._cssSheet) {
// parse domRule.selectorText on call to this.selectors
this._selectors = null;
this.line = InspectorUtils.getRuleLine(this.domRule);
this.line = InspectorUtils.getRelativeRuleLine(this.domRule);
this.column = InspectorUtils.getRuleColumn(this.domRule);
this.source = this._cssSheet.shortSource + ":" + this.line;
if (this.mediaText) {

Просмотреть файл

@ -35,7 +35,7 @@ var MediaRuleActor = protocol.ActorClassWithSpec(mediaRuleSpec, {
this._matchesChange = this._matchesChange.bind(this);
this.line = InspectorUtils.getRuleLine(mediaRule);
this.line = InspectorUtils.getRelativeRuleLine(mediaRule);
this.column = InspectorUtils.getRuleColumn(mediaRule);
try {

Просмотреть файл

@ -603,7 +603,7 @@ class StyleSheetsManager extends EventEmitter {
mediaText: rule.media.mediaText,
conditionText: rule.conditionText,
matches,
line: InspectorUtils.getRuleLine(rule),
line: InspectorUtils.getRelativeRuleLine(rule),
column: InspectorUtils.getRuleColumn(rule),
};
});