Web Inspector: Rule line numbers are not updated as properties are added/removed in the preceding rules
https://bugs.webkit.org/show_bug.cgi?id=87361
Summary Web Inspector: Rule line numbers are not updated as properties are added/remo...
Alexander Pavlov (apavlov)
Reported 2012-05-24 02:25:52 PDT
Consider a stylesheet: body { } div { margin: 2px; } If you add a property into the "body" rule, the "div" selector line is not updated in the Styles sidebar pane.
Attachments
Patch (27.81 KB, patch)
2012-05-30 05:38 PDT, Alexander Pavlov (apavlov)
no flags
Patch (27.84 KB, patch)
2012-05-30 06:10 PDT, Alexander Pavlov (apavlov)
no flags
Alexander Pavlov (apavlov)
Comment 1 2012-05-30 05:38:01 PDT
Build Bot
Comment 2 2012-05-30 05:46:24 PDT
Alexander Pavlov (apavlov)
Comment 3 2012-05-30 06:10:26 PDT
Pavel Feldman
Comment 4 2012-06-01 02:18:50 PDT
Comment on attachment 144792 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=144792&action=review > Source/WebCore/css/CSSStyleRule.cpp:125 > + CSSStyleSheet::RuleMutationScope mutationScope(this); You should not mutate CSSOM.
Pavel Feldman
Comment 5 2012-06-04 12:54:57 PDT
Comment on attachment 144792 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=144792&action=review > Source/WebCore/inspector/front-end/StylesSidebarPane.js:432 > + rulesById[this._cssIdAsString(ruleArray[i].id)] = ruleArray[i]; Why do we need this mapping? It adds a bit of complexity to the code.
Alexander Pavlov (apavlov)
Comment 6 2012-06-04 13:05:01 PDT
(In reply to comment #5) > (From update of attachment 144792 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=144792&action=review > > > Source/WebCore/inspector/front-end/StylesSidebarPane.js:432 > > + rulesById[this._cssIdAsString(ruleArray[i].id)] = ruleArray[i]; > > Why do we need this mapping? It adds a bit of complexity to the code. OK, let me explain what is going on here. It was a first stab at the task and I agree it looks somewhat awkward. When committing property values, only the computed style is retrieved, and property overrides are recalculated across all matched rules. Obviously, the computed style does not give any matched rules line delta, so we need to get the matched rules for the focused element and use their data to retrieve the updated selector lines in the source. We might want to retrieve all matched rules instead of this two-step scheme - wdyt?
Pavel Feldman
Comment 7 2012-07-10 10:51:35 PDT
Comment on attachment 144792 [details] Patch Clearing r? from the obsolete patch.
Brian Burg
Comment 8 2014-12-01 14:42:37 PST
Still reproduces.. :(
Radar WebKit Bug Importer
Comment 9 2014-12-01 14:42:56 PST
Note You need to log in before you can comment on or make changes to this bug.