Bug 949678 - Rule view should show inline sheet links as 'inline:<lineno>' instead of '/:<lineno>' when source maps are enabled; r=pbrosset

This commit is contained in:
Heather Arthur 2013-12-16 11:49:17 -08:00
parent c5250fd127
commit b5b4861210
3 changed files with 31 additions and 4 deletions

View File

@ -435,7 +435,28 @@ StyleEditorUI.prototype = {
editor.getSourceEditor().then(() => {
editor.sourceEditor.setCursor({line: line, ch: col});
});
this._view.activeSummary = editor.summary;
this.getEditorSummary(editor).then((summary) => {
this._view.activeSummary = summary;
})
},
getEditorSummary: function(editor) {
if (editor.summary) {
return promise.resolve(editor.summary);
}
let deferred = promise.defer();
let self = this;
this.on("editor-added", function onAdd(e, selected) {
if (selected == editor) {
self.off("editor-added", onAdd);
deferred.resolve(editor.summary);
}
});
return deferred.promise;
},
/**

View File

@ -49,10 +49,11 @@ function RuleViewTool(aInspector, aWindow, aIFrame)
// Chrome stylesheets are not listed in the style editor, so show
// these sheets in the view source window instead.
if (!sheet || !rule.href || sheet.isSystem) {
if (!sheet || sheet.isSystem) {
let contentDoc = this.inspector.selection.document;
let viewSourceUtils = this.inspector.viewSourceUtils;
viewSourceUtils.viewSource(rule.href, null, contentDoc, rule.line || 0);
let href = rule.nodeHref || rule.href;
viewSourceUtils.viewSource(href, null, contentDoc, rule.line || 0);
return;
}

View File

@ -769,7 +769,12 @@ var StyleRuleFront = protocol.FrontClass(StyleRuleActor, {
return this._form.href;
}
let sheet = this.parentStyleSheet;
return sheet.href || sheet.nodeHref;
return sheet.href;
},
get nodeHref() {
let sheet = this.parentStyleSheet;
return sheet ? sheet.nodeHref : "";
},
get location()