RESOLVED FIXED Bug 139612
Web Inspector: Show Pseudo Elements in DOM Tree
https://bugs.webkit.org/show_bug.cgi?id=139612
Summary Web Inspector: Show Pseudo Elements in DOM Tree
Joseph Pecoraro
Reported 2014-12-12 18:18:14 PST
* SUMMARY It would be great to more directly see pseudo element styles for things like :before/:after/:first* content. They could naturally show up as some "token" in the DOMTree. *NOTES - Bug: 31749: Wanting :before and :after to show up in the Elements tab as "nodes" if there are styles assigned to these pseudo elements. Would also like the ability to select the nodes and see the specific styles assigned to them, as well as hover over them and have them be highlighted in the page view.
Attachments
[PATCH] Proposed Fix (81.39 KB, patch)
2015-07-24 16:33 PDT, Joseph Pecoraro
joepeck: commit-queue-
[IMAGE] Pseudo Element (145.93 KB, image/png)
2015-07-24 16:35 PDT, Joseph Pecoraro
no flags
[PATCH] Proposed Fix (84.64 KB, patch)
2015-07-24 18:22 PDT, Joseph Pecoraro
no flags
[PATCH] Proposed Fix (88.35 KB, patch)
2015-07-24 19:42 PDT, Joseph Pecoraro
timothy: review+
[PATCH] For Landing (88.15 KB, patch)
2015-07-27 14:43 PDT, Joseph Pecoraro
joepeck: commit-queue-
[PATCH] For Landing (88.05 KB, patch)
2015-07-27 15:07 PDT, Joseph Pecoraro
no flags
Radar WebKit Bug Importer
Comment 1 2014-12-17 11:23:15 PST
Joseph Pecoraro
Comment 2 2015-07-21 14:30:11 PDT
*** Bug 147151 has been marked as a duplicate of this bug. ***
Julian Kussman
Comment 3 2015-07-21 16:59:32 PDT
Please consider my use case in needing to see the computed values of pseudo elements in this request. This is not possible without a way to select them in them DOM list or through another method.
Timothy Hatcher
Comment 4 2015-07-21 18:48:06 PDT
A second request for this on twitter today: https://twitter.com/benfrain/status/623596363075428352
Joseph Pecoraro
Comment 5 2015-07-24 16:33:01 PDT
Created attachment 257490 [details] [PATCH] Proposed Fix A few remaining issues, that are relatively minor but I want to investigate before landing. 1. Fix "New Rule" button to create an appropriate selector. 2. Fix "Hover" and other pseudo elements to affect the host element. 3. Fix the "matched" selector list, shows every selector matching. 4. More testing in the frontend, specifically around a node with LOTS of children and ::after
WebKit Commit Bot
Comment 6 2015-07-24 16:34:37 PDT
Attachment 257490 [details] did not pass style-queue: ERROR: Source/WebCore/inspector/InspectorDOMAgent.h:238: The parameter name "element" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 1 in 30 files If any of these errors are false positives, please file a bug against check-webkit-style.
Joseph Pecoraro
Comment 7 2015-07-24 16:35:15 PDT
Created attachment 257491 [details] [IMAGE] Pseudo Element
Joseph Pecoraro
Comment 8 2015-07-24 16:36:25 PDT
> 2. Fix "Hover" and other pseudo elements to affect the host element. This should have read "pseudo classes to affect the host element".
Timothy Hatcher
Comment 9 2015-07-24 17:54:01 PDT
Is there any better text we can use in the tree outline? The bare ::before and ::after bothers me. Maybe the selector? p.both::after
Joseph Pecoraro
Comment 10 2015-07-24 18:00:41 PDT
(In reply to comment #9) > Is there any better text we can use in the tree outline? The bare ::before > and ::after bothers me. > > Maybe the selector? p.both::after Selector could work, but if there is a long selector or multiple different selectors that affect this before/after content it might look bad. We could just use the tag name. p::before Or perhaps making it appear more like an element would be good: <::before> <pseudo::before> [before]
Joseph Pecoraro
Comment 11 2015-07-24 18:22:03 PDT
Created attachment 257500 [details] [PATCH] Proposed Fix This fixes issues 1-3, I still have to do testing with large sets of children.
Joseph Pecoraro
Comment 12 2015-07-24 19:42:29 PDT
Created attachment 257506 [details] [PATCH] Proposed Fix This fixes "Show All Nodes (# more)" button and other miscellaneous handling. Other than tweaking the UI, I think this is functionally complete for ::before/::after.
Timothy Hatcher
Comment 13 2015-07-25 17:00:29 PDT
Comment on attachment 257506 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=257506&action=review Do we still show ::before and ::after matching style rules when selecting a normal element? We might want to filter those out now. > Source/WebCore/inspector/InspectorCSSAgent.cpp:558 > + InspectorStyleSheetForInlineStyle* styleSheet = asInspectorStyleSheet(parentElement); > + if (styleSheet) Nit: One line. > Source/WebCore/inspector/InspectorDOMAgent.cpp:1364 > + auto pseudoElements = buildArrayForPseudoElements(element, nodesMap); > + if (pseudoElements) Nit: One line. > Source/WebInspectorUI/ChangeLog:33 > + > + Nit: Double lines. > Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js:296 > + // FIXME: Handle shadow roots. We don't support shadow roots yet, and may never. Still worth adding this? > Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js:297 > + // FIXME: Handle template content. What about template content do we not support? Should file a bug for this. > Source/WebInspectorUI/UserInterface/Models/DOMNode.js:82 > + // FIXME: Handle templateContent. Nit: You say "template content" above. > Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css:158 > + color: brown; We usually only do keyword colors for white, black or transparent.
Joseph Pecoraro
Comment 14 2015-07-27 12:43:21 PDT
(In reply to comment #13) > Comment on attachment 257506 [details] > [PATCH] Proposed Fix > > View in context: > https://bugs.webkit.org/attachment.cgi?id=257506&action=review > > Do we still show ::before and ::after matching style rules when selecting a > normal element? We might want to filter those out now. Yes currently we do. I wanted to experiment with go-to buttons if the DOMNode has a before/after node. > > Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js:296 > > + // FIXME: Handle shadow roots. > > We don't support shadow roots yet, and may never. Still worth adding this? Well, we do support our Internal Shadow DOM, and I have to audit our implementation a little closer. > > Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js:297 > > + // FIXME: Handle template content. > > What about template content do we not support? Should file a bug for this. I'll have a follow-up for this. We already send the data we just don't use it.
Joseph Pecoraro
Comment 15 2015-07-27 14:43:22 PDT
Created attachment 257592 [details] [PATCH] For Landing
Joseph Pecoraro
Comment 16 2015-07-27 14:50:12 PDT
Comment on attachment 257592 [details] [PATCH] For Landing Going to update the text in Tests a bit.
Joseph Pecoraro
Comment 17 2015-07-27 15:07:29 PDT
Created attachment 257598 [details] [PATCH] For Landing
WebKit Commit Bot
Comment 18 2015-07-28 11:48:41 PDT
Comment on attachment 257598 [details] [PATCH] For Landing Clearing flags on attachment: 257598 Committed r187496: <http://trac.webkit.org/changeset/187496>
Alexey Proskuryakov
Comment 19 2015-07-28 17:05:59 PDT
inspector/css/pseudo-element-matches-for-pseudo-element-node.html always times out on Windows, and is flaky slow on Apple Yosemite Debug WK2. https://webkit-test-results.appspot.com/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=inspector%2Fcss%2Fpseudo-element-matches-for-pseudo-element-node.html
Note You need to log in before you can comment on or make changes to this bug.