RESOLVED FIXED 146576
Web Inspector: CSS rule with 2 pseudo-selectors appears twice
https://bugs.webkit.org/show_bug.cgi?id=146576
Summary Web Inspector: CSS rule with 2 pseudo-selectors appears twice
Nikita Vasilyev
Reported 2015-07-02 23:20:11 PDT
Created attachment 256079 [details] [HTML] Reduction Originally reported by https://twitter.com/toolmantim. Animated GIF: https://cloudup.com/idEbO3X5_OS
Attachments
[HTML] Reduction (75 bytes, text/html)
2015-07-02 23:20 PDT, Nikita Vasilyev
no flags
Animated GIF of the problem (286.46 KB, image/gif)
2015-07-02 23:21 PDT, Nikita Vasilyev
no flags
Patch (2.20 KB, patch)
2015-07-04 17:11 PDT, Devin Rousso
no flags
Archive of layout-test-results from ews104 for mac-mavericks-wk2 (574.62 KB, application/zip)
2015-07-04 17:49 PDT, Build Bot
no flags
Patch (2.21 KB, patch)
2015-07-04 17:57 PDT, Devin Rousso
no flags
Patch (2.53 KB, patch)
2015-07-05 00:00 PDT, Devin Rousso
no flags
Radar WebKit Bug Importer
Comment 1 2015-07-02 23:20:32 PDT
Nikita Vasilyev
Comment 2 2015-07-02 23:21:19 PDT
Created attachment 256080 [details] Animated GIF of the problem
Devin Rousso
Comment 3 2015-07-04 11:47:38 PDT
I have a fix for this, but it relies upon https://bugs.webkit.org/show_bug.cgi?id=145979, so once that lands I can fix this.
Devin Rousso
Comment 4 2015-07-04 17:11:52 PDT
Timothy Hatcher
Comment 5 2015-07-04 17:15:38 PDT
Comment on attachment 256161 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=256161&action=review > Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js:183 > + if (pseudoElementSelectors.length && pseudoElementSelectors.lastValue.selectorText === selectorText) > + continue; What if the rules have different source locations?
Build Bot
Comment 6 2015-07-04 17:49:32 PDT
Comment on attachment 256161 [details] Patch Attachment 256161 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/5429194611752960 New failing tests: platform/mac-wk2/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-vertical.html
Build Bot
Comment 7 2015-07-04 17:49:34 PDT
Created attachment 256163 [details] Archive of layout-test-results from ews104 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Devin Rousso
Comment 8 2015-07-04 17:57:24 PDT
Timothy Hatcher
Comment 9 2015-07-04 18:31:18 PDT
Comment on attachment 256164 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=256164&action=review > Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js:182 > + if (pseudoElementSelectors.length && pseudoElementSelectors.lastValue.style.ownerRule.isEqualTo(style.ownerRule)) Wouldn't just preventing duplicates of the same style/ownerRule be enough? Why does the selector need a replace done and compared to others?
Timothy Hatcher
Comment 10 2015-07-04 19:58:03 PDT
Comment on attachment 256164 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=256164&action=review >> Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js:182 >> + if (pseudoElementSelectors.length && pseudoElementSelectors.lastValue.style.ownerRule.isEqualTo(style.ownerRule)) > > Wouldn't just preventing duplicates of the same style/ownerRule be enough? Why does the selector need a replace done and compared to others? Ah-ha, I think I understand now. Per pseudo element, uniqueOrderedStyles is called and it strips duplicates. But that duplicate matching does not happen across pseudo-elements, in the case of a selector like "*::before, *::after" which applies to two pseudo elements. Perhaps the same logic as uniqueOrderedStyles, should be used here? Not just adjacent duplicates, but all duplicates are removed.
Timothy Hatcher
Comment 11 2015-07-04 20:03:47 PDT
Comment on attachment 256164 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=256164&action=review >>> Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js:182 >>> + if (pseudoElementSelectors.length && pseudoElementSelectors.lastValue.style.ownerRule.isEqualTo(style.ownerRule)) >> >> Wouldn't just preventing duplicates of the same style/ownerRule be enough? Why does the selector need a replace done and compared to others? > > Ah-ha, I think I understand now. > > Per pseudo element, uniqueOrderedStyles is called and it strips duplicates. But that duplicate matching does not happen across pseudo-elements, in the case of a selector like "*::before, *::after" which applies to two pseudo elements. > > Perhaps the same logic as uniqueOrderedStyles, should be used here? Not just adjacent duplicates, but all duplicates are removed. One way to do this would be to concat all pseudoElement.orderedStyles together, then use uniqueOrderedStyles. Then loop over that uniqueOrderedStyles result and populate pseudoElementSelectors.
Devin Rousso
Comment 12 2015-07-05 00:00:19 PDT
Timothy Hatcher
Comment 13 2015-07-05 10:35:26 PDT
Comment on attachment 256172 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=256172&action=review > Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js:173 > + var pseudoElementsStyle = []; Nit: pseudoElementStyles would be better, since this is an array.
WebKit Commit Bot
Comment 14 2015-07-05 11:24:46 PDT
Comment on attachment 256172 [details] Patch Clearing flags on attachment: 256172 Committed r186288: <http://trac.webkit.org/changeset/186288>
WebKit Commit Bot
Comment 15 2015-07-05 11:24:51 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.