Bug 1265830 - Remove uses of nsIDOMCSSRule from devtools. r=bgrins

MozReview-Commit-ID: 9q9Ei38My4A

--HG--
extra : transplant_source : %EA%94%C5%B2%BD%7Fz%F6%1C3O%0B%22%AA%C8%3E%98Z1j
This commit is contained in:
Tom Tromey 2016-06-16 10:22:28 +01:00
Родитель ba0f9d2892
Коммит d7707e6975
5 изменённых файлов: 14 добавлений и 12 удалений

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

@ -6,6 +6,7 @@
"atob": true,
"btoa": true,
"Components": true,
"CSSRule": true,
"clearInterval": true,
"clearTimeout": true,
"console": true,

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

@ -1239,7 +1239,7 @@ CssRuleView.prototype = {
let isSelectorHighlighted = false;
let selectorNodes = [...rule.editor.selectorText.childNodes];
if (rule.domRule.type === Ci.nsIDOMCSSRule.KEYFRAME_RULE) {
if (rule.domRule.type === CSSRule.KEYFRAME_RULE) {
selectorNodes = [rule.editor.selectorText];
} else if (rule.domRule.type === ELEMENT_STYLE) {
selectorNodes = [];

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

@ -87,7 +87,7 @@ RuleEditor.prototype = {
let trait = this.isEditable &&
toolbox.target.client.traits.selectorEditable &&
this.rule.domRule.type !== ELEMENT_STYLE &&
this.rule.domRule.type !== Ci.nsIDOMCSSRule.KEYFRAME_RULE;
this.rule.domRule.type !== CSSRule.KEYFRAME_RULE;
// Do not allow editing anonymousselectors until we can
// detect mutations on pseudo elements in Bug 1034110.
@ -146,7 +146,7 @@ RuleEditor.prototype = {
});
}
if (this.rule.domRule.type !== Ci.nsIDOMCSSRule.KEYFRAME_RULE &&
if (this.rule.domRule.type !== CSSRule.KEYFRAME_RULE &&
this.rule.domRule.selectors) {
let selector = this.rule.domRule.selectors.join(", ");
@ -279,7 +279,7 @@ RuleEditor.prototype = {
// style, just show the text directly.
if (this.rule.domRule.type === ELEMENT_STYLE) {
this.selectorText.textContent = this.rule.selectorText;
} else if (this.rule.domRule.type === Ci.nsIDOMCSSRule.KEYFRAME_RULE) {
} else if (this.rule.domRule.type === CSSRule.KEYFRAME_RULE) {
this.selectorText.textContent = this.rule.domRule.keyText;
} else {
this.rule.domRule.selectors.forEach((selector, i) => {

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

@ -293,3 +293,4 @@ defineLazyGetter(globals, "URL", () => {
{wantGlobalProperties: ["URL"]});
return sandbox.URL;
});
defineLazyGetter(globals, "CSSRule", () => Ci.nsIDOMCSSRule);

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

@ -307,11 +307,11 @@ CssLogic.prototype = {
// Find import and keyframes rules.
for (let aDomRule of domSheet.cssRules) {
if (aDomRule.type == Ci.nsIDOMCSSRule.IMPORT_RULE &&
if (aDomRule.type == CSSRule.IMPORT_RULE &&
aDomRule.styleSheet &&
this.mediaMatches(aDomRule)) {
this._cacheSheet(aDomRule.styleSheet);
} else if (aDomRule.type == Ci.nsIDOMCSSRule.KEYFRAMES_RULE) {
} else if (aDomRule.type == CSSRule.KEYFRAMES_RULE) {
this._keyframesRules.push(aDomRule);
}
}
@ -626,7 +626,7 @@ CssLogic.prototype = {
let numDomRules = domRules ? domRules.Count() : 0;
for (let i = 0; i < numDomRules; i++) {
let domRule = domRules.GetElementAt(i);
if (domRule.type !== Ci.nsIDOMCSSRule.STYLE_RULE) {
if (domRule.type !== CSSRule.STYLE_RULE) {
continue;
}
@ -1342,10 +1342,10 @@ CssSheet.prototype = {
let domRules = this.domSheet.cssRules;
function _iterator(domRule) {
if (domRule.type == Ci.nsIDOMCSSRule.STYLE_RULE) {
if (domRule.type == CSSRule.STYLE_RULE) {
callback.call(scope, this.getRule(domRule));
ruleCount++;
} else if (domRule.type == Ci.nsIDOMCSSRule.MEDIA_RULE &&
} else if (domRule.type == CSSRule.MEDIA_RULE &&
domRule.cssRules && this._cssLogic.mediaMatches(domRule)) {
Array.prototype.forEach.call(domRule.cssRules, _iterator, this);
}
@ -1375,9 +1375,9 @@ CssSheet.prototype = {
forSomeRules: function (callback, scope) {
let domRules = this.domSheet.cssRules;
function _iterator(domRule) {
if (domRule.type == Ci.nsIDOMCSSRule.STYLE_RULE) {
if (domRule.type == CSSRule.STYLE_RULE) {
return callback.call(scope, this.getRule(domRule));
} else if (domRule.type == Ci.nsIDOMCSSRule.MEDIA_RULE &&
} else if (domRule.type == CSSRule.MEDIA_RULE &&
domRule.cssRules && this._cssLogic.mediaMatches(domRule)) {
return Array.prototype.some.call(domRule.cssRules, _iterator, this);
}
@ -1409,7 +1409,7 @@ function CssRule(cssSheet, domRule, element) {
this.domRule = domRule;
let parentRule = domRule.parentRule;
if (parentRule && parentRule.type == Ci.nsIDOMCSSRule.MEDIA_RULE) {
if (parentRule && parentRule.type == CSSRule.MEDIA_RULE) {
this.mediaText = parentRule.media.mediaText;
}