[Webkit-unassigned] [Bug 175728] Web Inspector: Create experimental Layers tab

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Aug 23 14:18:53 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=175728

--- Comment #16 from Devin Rousso <webkit at devinrousso.com> ---
Comment on attachment 318641
  --> https://bugs.webkit.org/attachment.cgi?id=318641
Patch

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

>>> Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js:34
>>> +        WI.layerTreeManager.addEventListener(WI.LayerTreeManager.Event.LayerTreeDidChange, this._layerTreeDidChange, this);
>> 
>> This listener needs to be removed when the ContentView is closed().
>> 
>> Additionally, this event is going to be firing whenever the view is not visible.  It might be better to move the add/remove of this event listener to shown()/hidden().  As far as I understand, layout() should be called when shown() gets called, so you're already going to redraw anyways.
> 
> These are actually brand-new changes from after WIP Patch #4, and serve to address two issues that I was facing with the shown()/hidden() approach (which you reviewed at that time).
> 
> Issue #1 is that a Dirty layout() doesn't occur when a tab is restored from a previous inspector session. Issue #2 is that LayerTreeDidChange would be ignored if we get a new document while a different inspector tab is being viewed and then return to Layers. _layersChangedWhileHidden fixes both of these issues.
> 
> I can certainly add a removeEventListener in closed() if you'd like. The reason I didn't is because it seems like most View classes that call addEventListener from the constructor do not bother to call removeEventListener (presumably due to implicit destruction in JS).

The problem with _layersChangedWhileHidden is that it does unnecessary work while the tab isn't visible.  What I'm proposing is that you always call needsLayout() in shown(), which fixes issues #1 and #2, and move the addEventListener to shown() so that work is done while the tab is not visible.

    shown()
    {
        super.shown();

        this.needsLayout();

        WI.layerTreeManager.addEventListener(WI.LayerTreeManager.Event.LayerTreeDidChange, this._layerTreeDidChange, this);

        this._animate();
    }

    hidden()
    {
        WI.layerTreeManager.removeEventListener(WI.LayerTreeManager.Event.LayerTreeDidChange, this._layerTreeDidChange, this);

        this._stopAnimation();

        super.hidden();
    }

I am still not very convinced that having layersForNode() in layout() is the right way to go here.  I understand that it lets us avoid duplicate logic, but I also think that it's a bit of a hack and isn't being used properly.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170823/2252205d/attachment.html>


More information about the webkit-unassigned mailing list