We recently fixed a related bug (bug 1530612) but that didn't fix this. It only made it better for <link>'d stylesheets.
For inline <style> stylesheets, the problem still exists.
The first problem we have is that when the link is clicked in the console, the information sent to the style-editor is the URL, the line and the column.
The URL in this case is the URL of the parent HTML document. Now, because we only compare this to the stylesheet URLs in the style-editor, that doesn't work.
We need to make a change to
/devtools/client/styleeditor/StyleEditorUI.jsm so we also consider
editor.styleSheet.href does not exist.
But, that's not the only problem. There are 2 others.
- If there are several <style> stylesheets in the page, we won't know which one is the right one
- The line numbers displayed in the style-editor are relative to the <style> node, not absolute on the HTML page, which the CSS warning is.
So, I suggest the following:
StyleSheetActor form is passed to the client, it should come with an offset number. This would be the line number at which the parent <style> node appears in the HTML doc.
This way, when trying to select the right stylesheet in the style-editor, we would be able to compare the CSS warning line number to the offsets we have, to select the right one.
And we would also be able to subtract this offset from the absolute line number when trying to move the cursor.
If we do this, we should probably close bug 1324385. That one requests line numbers to be absolute in the rule-view, but if we did that, we would be jumping again to the wrong location.
Other take on this problem: stop showing inline stylesheets as separate files in the style-editor and instead show an entry for the HTML document where the entire document is displayed, with all its <style> tags. That would solve the problem of linking from the console to that document. But would make it less easily usable.
That's what Chrome does in its Sources tab, but they don't really have something like the Style Editor.