Bug 1085119 - Part 1: Make devtools css-logic consider column when choosing best rule r=tromey
This allows minified CSS to be displayed correctly, as in http://jsfiddle.net/oy4rkyax/ MozReview-Commit-ID: F8buX4gYY2P
This commit is contained in:
@@ -915,6 +915,7 @@ function CssRule(cssSheet, domRule, element) {
|
|||||||
// parse domRule.selectorText on call to this.selectors
|
// parse domRule.selectorText on call to this.selectors
|
||||||
this._selectors = null;
|
this._selectors = null;
|
||||||
this.line = domUtils.getRuleLine(this.domRule);
|
this.line = domUtils.getRuleLine(this.domRule);
|
||||||
|
this.column = domUtils.getRuleColumn(this.domRule);
|
||||||
this.source = this._cssSheet.shortSource + ":" + this.line;
|
this.source = this._cssSheet.shortSource + ":" + this.line;
|
||||||
if (this.mediaText) {
|
if (this.mediaText) {
|
||||||
this.source += " @media " + this.mediaText;
|
this.source += " @media " + this.mediaText;
|
||||||
@@ -1107,6 +1108,16 @@ CssSelector.prototype = {
|
|||||||
return this.cssRule.line;
|
return this.cssRule.line;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the column of the parent CSSStyleRule in the parent CSSStyleSheet.
|
||||||
|
*
|
||||||
|
* @return {number} the column of the parent CSSStyleRule in the parent
|
||||||
|
* stylesheet.
|
||||||
|
*/
|
||||||
|
get ruleColumn() {
|
||||||
|
return this.cssRule.column;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve specificity information for the current selector.
|
* Retrieve specificity information for the current selector.
|
||||||
*
|
*
|
||||||
@@ -1391,6 +1402,16 @@ CssSelectorInfo.prototype = {
|
|||||||
return this.selector.ruleLine;
|
return this.selector.ruleLine;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the column of the parent CSSStyleRule in the parent CSSStyleSheet.
|
||||||
|
*
|
||||||
|
* @return {number} the column of the parent CSSStyleRule in the parent
|
||||||
|
* stylesheet.
|
||||||
|
*/
|
||||||
|
get ruleColumn() {
|
||||||
|
return this.selector.ruleColumn;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the selector comes from a browser-provided stylesheet.
|
* Check if the selector comes from a browser-provided stylesheet.
|
||||||
*
|
*
|
||||||
@@ -1458,6 +1479,13 @@ CssSelectorInfo.prototype = {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.ruleColumn > that.ruleColumn) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (that.ruleColumn > this.ruleColumn) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user