RESOLVED FIXED 178554
Web Inspector: Layer mutations should be purely based on layerId, not based on nodeId
https://bugs.webkit.org/show_bug.cgi?id=178554
Summary Web Inspector: Layer mutations should be purely based on layerId, not based o...
Ross Kirsling
Reported 2017-10-19 17:13:36 PDT
Created attachment 324318 [details] [Image] Problem The current implementation of LayerTreeManager#layerTreeMutations tries to cleverly detect when a compositing layer for a given DOM node has been destroyed and recreated (resulting a new layerId but the same nodeId). This is nonsense for two reasons: 1. Even if you call this layer "preserved", the old layer object and new layer object share NO data, so there's no way for a consumer to act on this supposed preservation. 2. Crucially, a single nodeId can correspond to multiple layerIds at once, such as when a pseudo-element of a DOM node gives rise to a layer of its own. Turns out that this causes problems even in the legacy Layers sidebar -- simply visit https://devinrousso.com/ for easy repro. (See attached image, where the layer count is incorrect and some popover content is missing.) This method should be rewritten to only check layerIds, not nodeIds.
Attachments
[Image] Problem (274.21 KB, image/png)
2017-10-19 17:13 PDT, Ross Kirsling
no flags
Patch (7.71 KB, patch)
2017-10-19 17:17 PDT, Ross Kirsling
no flags
Patch (8.19 KB, patch)
2017-10-23 10:48 PDT, Ross Kirsling
no flags
Ross Kirsling
Comment 1 2017-10-19 17:17:16 PDT
Devin Rousso
Comment 2 2017-10-20 22:10:29 PDT
Comment on attachment 324320 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=324320&action=review > Source/WebInspectorUI/ChangeLog:9 > + * UserInterface/Controllers/LayerTreeManager.js: > + (WI.LayerTreeManager.prototype.layerTreeMutations): This could use an explanation as to why this is needed or what the problem originally was. > Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js:-59 > - return layer.isGeneratedContent ? layer.pseudoElementId : layer.nodeId; Does this patch still work with pseudo-elements? Adding a test for this would be awesome =D > Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js:-73 > - if (layer.isReflection) Is the concept of `isReflection` no longer valid/useful?
Ross Kirsling
Comment 3 2017-10-21 16:19:35 PDT
(In reply to Devin Rousso from comment #2) > > + * UserInterface/Controllers/LayerTreeManager.js: > > + (WI.LayerTreeManager.prototype.layerTreeMutations): > > This could use an explanation as to why this is needed or what the problem > originally was. Can do. > > Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js:-59 > > - return layer.isGeneratedContent ? layer.pseudoElementId : layer.nodeId; > > Does this patch still work with pseudo-elements? Adding a test for this > would be awesome =D > > > Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js:-73 > > - if (layer.isReflection) > > Is the concept of `isReflection` no longer valid/useful? Sorry if this wasn't all clear above: It was incorrect to be looking for special cases involving nodeIds at all (as these need not be unique in the layer list). A preserved layer should be nothing more or less than a recycled layerId (the thing that *is* unique). Pseudo-elements were actually the very thing being mishandled on your website, as a result of this special-casing. :) Reflections should follow suit.
Ross Kirsling
Comment 4 2017-10-23 10:48:06 PDT
Ross Kirsling
Comment 5 2017-10-23 10:48:40 PDT
Comment on attachment 324564 [details] Patch Made ChangeLog and test more informative.
Devin Rousso
Comment 6 2017-10-24 13:07:01 PDT
Comment on attachment 324564 [details] Patch r=me
WebKit Commit Bot
Comment 7 2017-10-24 13:11:38 PDT
Comment on attachment 324564 [details] Patch Clearing flags on attachment: 324564 Committed r223914: <https://trac.webkit.org/changeset/223914>
WebKit Commit Bot
Comment 8 2017-10-24 13:11:40 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 9 2017-11-15 13:00:59 PST
Note You need to log in before you can comment on or make changes to this bug.