Backed out changeset 0799176cb906 (bug 1120570) for m-oth test regressions on a CLOSED TREE

This commit is contained in:
Carsten "Tomcat" Book 2015-02-18 16:57:48 +01:00
parent 5e0543cb02
commit bc0abc10a8
5 changed files with 22 additions and 50 deletions

View File

@ -435,8 +435,11 @@ function Rule(aElementStyle, aOptions) {
this.keyframes = aOptions.keyframes || null;
this._modificationDepth = 0;
if (this.domRule && this.domRule.mediaText) {
this.mediaText = this.domRule.mediaText;
if (this.domRule) {
let parentRule = this.domRule.parentRule;
if (parentRule && parentRule.type == Ci.nsIDOMCSSRule.MEDIA_RULE) {
this.mediaText = parentRule.mediaText;
}
}
// Populate the text properties with the style's current cssText
@ -504,7 +507,7 @@ Rule.prototype = {
* The rule's line within a stylesheet
*/
get ruleLine() {
return this.domRule ? this.domRule.line : "";
return this.domRule ? this.domRule.line : null;
},
/**
@ -526,12 +529,10 @@ Rule.prototype = {
if (this._originalSourceStrings) {
return promise.resolve(this._originalSourceStrings);
}
return this.domRule.getOriginalLocation().then(({href, line, mediaText}) => {
let mediaString = mediaText ? " @" + mediaText : "";
return this.domRule.getOriginalLocation().then(({href, line}) => {
let sourceStrings = {
full: (href || CssLogic.l10n("rule.sourceInline")) + ":" + line + mediaString,
short: CssLogic.shortSource({href: href}) + ":" + line + mediaString
full: href + ":" + line,
short: CssLogic.shortSource({href: href}) + ":" + line
};
this._originalSourceStrings = sourceStrings;

View File

@ -12,10 +12,8 @@ add_task(function*() {
info("Creating the test document");
let style = "" +
"@media screen and (min-width: 10px) {" +
" #testid {" +
" background-color: blue;" +
" }" +
"#testid {" +
" background-color: blue;" +
"}" +
".testclass, .unmatched {" +
" background-color: green;" +
@ -37,15 +35,6 @@ function* testContentAfterNodeSelection(inspector, ruleView) {
"After highlighting null, has a no-results element again.");
yield selectNode("#testid", inspector);
let linkText = getRuleViewLinkTextByIndex(ruleView, 1);
is(linkText, "inline:1 @screen and (min-width: 10px)",
"link text at index 1 contains media query text.");
linkText = getRuleViewLinkTextByIndex(ruleView, 2);
is(linkText, "inline:1",
"link text at index 2 contains no media query text.");
let classEditor = getRuleViewRuleEditor(ruleView, 2);
is(classEditor.selectorText.querySelector(".ruleview-selector-matched").textContent,
".testclass", ".textclass should be matched.");

View File

@ -693,17 +693,6 @@ function getRuleViewLinkByIndex(view, index) {
return links[index];
}
/**
* Get rule-link text from the rule-view given its index
* @param {CssRuleView} view The instance of the rule-view panel
* @param {Number} index The index of the link to get
* @return {String} The string at this index
*/
function getRuleViewLinkTextByIndex(view, index) {
let link = getRuleViewLinkByIndex(view, index);
return link.querySelector(".source-link-label").value;
}
/**
* Get the rule editor from the rule-view given its index
* @param {CssRuleView} view The instance of the rule-view panel

View File

@ -991,17 +991,6 @@ var StyleRuleActor = protocol.ActorClass({
if (this.rawRule.parentRule) {
form.parentRule = this.pageStyle._styleRef(this.rawRule.parentRule).actorID;
// CSS rules that we call media rules are STYLE_RULES that are children
// of MEDIA_RULEs. We need to check the parentRule to check if a rule is
// a media rule so we do this here instead of in the switch statement
// below.
if (this.rawRule.parentRule.type === Ci.nsIDOMCSSRule.MEDIA_RULE) {
form.media = [];
for (let i = 0, n = this.rawRule.parentRule.media.length; i < n; i++) {
form.media.push(this.rawRule.parentRule.media.item(i));
}
}
}
if (this.rawRule.parentStyleSheet) {
form.parentStyleSheet = this.pageStyle._sheetRef(this.rawRule.parentStyleSheet).actorID;
@ -1025,6 +1014,12 @@ var StyleRuleActor = protocol.ActorClass({
case Ci.nsIDOMCSSRule.IMPORT_RULE:
form.href = this.rawRule.href;
break;
case Ci.nsIDOMCSSRule.MEDIA_RULE:
form.media = [];
for (let i = 0, n = this.rawRule.media.length; i < n; i++) {
form.media.push(this.rawRule.media.item(i));
}
break;
case Ci.nsIDOMCSSRule.KEYFRAMES_RULE:
form.cssText = this.rawRule.cssText;
form.name = this.rawRule.name;
@ -1250,10 +1245,9 @@ var StyleRuleFront = protocol.FrontClass(StyleRuleActor, {
if (this._originalLocation) {
return promise.resolve(this._originalLocation);
}
let parentSheet = this.parentStyleSheet;
if (!parentSheet) {
// This rule doesn't belong to a stylesheet so it is an inline style.
// Inline styles do not have any mediaText so we can return early.
return promise.resolve(this.location);
}
return parentSheet.getOriginalLocation(this.line, this.column)
@ -1261,9 +1255,8 @@ var StyleRuleFront = protocol.FrontClass(StyleRuleActor, {
let location = {
href: source,
line: line,
column: column,
mediaText: this.mediaText
};
column: column
}
if (fromSourceMap === false) {
location.source = this.parentStyleSheet;
}
@ -1272,7 +1265,7 @@ var StyleRuleFront = protocol.FrontClass(StyleRuleActor, {
}
this._originalLocation = location;
return location;
});
})
}
});

View File

@ -713,7 +713,7 @@ let StyleSheetActor = protocol.ActorClass({
source: this.href,
line: line,
column: column
};
}
});
}, {
request: {