Bug 1033082 - Display exact line numbers for rules in @media sidebar. r=bgrins

This commit is contained in:
Heather Arthur 2014-07-17 00:59:00 -04:00
parent 53785f5afe
commit f727ad78df
3 changed files with 4 additions and 12 deletions

View File

@ -8,7 +8,7 @@ const MEDIA_PREF = "devtools.styleeditor.showMediaSidebar";
const RESIZE = 300;
const LABELS = ["not all", "all", "(max-width: 400px)", "(max-width: 600px)"];
const LINE_NOS = [2, 8, 20, 25];
const LINE_NOS = [1, 7, 19, 25];
const NEW_RULE = "\n@media (max-width: 600px) { div { color: blue; } }";
waitForExplicitFinish();

View File

@ -8,7 +8,7 @@ const MAP_PREF = "devtools.styleeditor.source-maps-enabled";
const LABELS = ["screen and (max-width: 320px)",
"screen and (min-width: 1200px)"];
const LINE_NOS = [4, 4];
const LINE_NOS = [5, 8];
waitForExplicitFinish();

View File

@ -304,16 +304,8 @@ let MediaRuleActor = protocol.ActorClass({
this._matchesChange = this._matchesChange.bind(this);
this.line = 0;
this.column = 0;
// We can't get the line of the @media rule itself, so get the line of
// the first rule in the media block. See bug 591303.
let firstRule = this.rawRule.cssRules[0];
if (firstRule && firstRule instanceof Ci.nsIDOMCSSStyleRule) {
this.line = DOMUtils.getRuleLine(firstRule);
this.column = DOMUtils.getRuleColumn(firstRule);
}
this.line = DOMUtils.getRuleLine(aMediaRule);
this.column = DOMUtils.getRuleColumn(aMediaRule);
try {
this.mql = this.window.matchMedia(aMediaRule.media.mediaText);