Bug 203159 - Web Inspector: Elements: allow WebKit engineers to edit UserAgent shadow trees
Summary: Web Inspector: Elements: allow WebKit engineers to edit UserAgent shadow trees
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-10-18 10:43 PDT by Devin Rousso
Modified: 2019-10-18 15:59 PDT (History)
13 users (show)

See Also:


Attachments
Patch (23.30 KB, patch)
2019-10-18 11:54 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2019-10-18 10:43:01 PDT
This includes:
 - double-clicking on tags/attributes/text
 - context menu actions
 - Log Element
 - $0
Comment 1 Devin Rousso 2019-10-18 11:54:00 PDT
Created attachment 381320 [details]
Patch
Comment 2 EWS Watchlist 2019-10-18 11:54:53 PDT
This patch modifies the inspector protocol. Please ensure that any frontend changes appropriately use feature checks for new protocol features.
Comment 3 BJ Burg 2019-10-18 13:34:16 PDT
Comment on attachment 381320 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=381320&action=review

r=me with a question

> Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js:94
> +            this.dispatchEventToListeners(WI.StyleDetailsPanel.Event.NodeChanged);

I don't understand why this change is in the patch. Is it related?
Comment 4 Devin Rousso 2019-10-18 14:11:36 PDT
Comment on attachment 381320 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=381320&action=review

>> Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js:94
>> +            this.dispatchEventToListeners(WI.StyleDetailsPanel.Event.NodeChanged);
> 
> I don't understand why this change is in the patch. Is it related?

Previously, we would show the add button even if the selected node was inside a UserAgent shadow root.  This isn't a good idea because a lot of times the `WI.DOMNode.prototype.appropriateSelectorFor` is just `.div`, and the newly added rule wouldn't even apply to the UserAgent shadow tree anyways, so we'd basically be creating a rule that doesn't do anything.  This part of the patch is to make it so that the add button isn't even shown when the selected node is inside a UserAgent shadow tree.

This particular line of code was moved because the old position (in `WI.StyleDetailsPanel.prototype.refresh`) wouldn't fire "quick" enough.  It would fire _after_ the `WI.DOMNodeStyles` have refreshed, which involves three "concurrent" protocol commands (which are pretty hefty in size), which meant that the add button would sometimes be briefly visible and flash away.  By this point we already know the `WI.DOMNode`, so we can determine whether the selected node is inside a UserAgent shadow tree and can act on that.  Also, nobody was actually listening for `WI.StyleDetailsPanel.Event.Refreshed`, so it was fine to "replace".
Comment 5 WebKit Commit Bot 2019-10-18 15:54:16 PDT
Comment on attachment 381320 [details]
Patch

Clearing flags on attachment: 381320

Committed r251306: <https://trac.webkit.org/changeset/251306>
Comment 6 WebKit Commit Bot 2019-10-18 15:54:18 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2019-10-18 15:55:16 PDT
<rdar://problem/56422672>
Comment 8 Joseph Pecoraro 2019-10-18 15:59:14 PDT
Comment on attachment 381320 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=381320&action=review

> Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js:102
> +

Nit: Bad newline.