Changeset 224200 in webkit


Ignore:
Timestamp:
Oct 30, 2017 1:53:02 PM (6 years ago)
Author:
webkit@devinrousso.com
Message:

Web Inspector: Canvas Tab: no path components shown in recording content view after selecting a recording via View Recordings... dropdown
https://bugs.webkit.org/show_bug.cgi?id=178807
<rdar://problem/35176463>

Reviewed by Brian Burg.

When the first Recording is taken of a canvas, it is immediately added as a child. When the
CanvasTreeElement is attached, however, it will attempt to regenerate its children if
necessary. This is especially true for canvases with ShaderPrograms, as they are added with
addRepresentedObjectToNewChildQueue, meaning that the child TreeElements aren't actually
added until the next tick, preventing the ContentBrowser logic from generating path
components correctly.

This patch switches to using addChildForRepresentedObject so that there is no delay when
adding children, and also ensures that any existing recordings are also added on regeneration.

  • UserInterface/Views/CanvasTabContentView.js:

(WI.CanvasTabContentView.prototype._recordingAdded):
Move logic for adding TreeElements for new Recordings to CanvasTreeElement.

  • UserInterface/Views/CanvasTreeElement.js:

(WI.CanvasTreeElement.createRecordingTreeElement):
(WI.CanvasTreeElement):
(WI.CanvasTreeElement.prototype.onattach):
(WI.CanvasTreeElement.prototype.ondetach):
(WI.CanvasTreeElement.prototype.onpopulate):
(WI.CanvasTreeElement.prototype._handleItemAdded):
(WI.CanvasTreeElement.prototype._handleItemRemoved):
(WI.CanvasTreeElement.prototype._shaderProgramAdded): Deleted.
(WI.CanvasTreeElement.prototype._shaderProgramRemoved): Deleted.

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r224175 r224200  
     12017-10-30  Devin Rousso  <webkit@devinrousso.com>
     2
     3        Web Inspector: Canvas Tab: no path components shown in recording content view after selecting a recording via View Recordings... dropdown
     4        https://bugs.webkit.org/show_bug.cgi?id=178807
     5        <rdar://problem/35176463>
     6
     7        Reviewed by Brian Burg.
     8
     9        When the first Recording is taken of a canvas, it is immediately added as a child. When the
     10        CanvasTreeElement is `attached`, however, it will attempt to regenerate its children if
     11        necessary. This is especially true for canvases with ShaderPrograms, as they are added with
     12        `addRepresentedObjectToNewChildQueue`, meaning that the child TreeElements aren't actually
     13        added until the next tick, preventing the ContentBrowser logic from generating path
     14        components correctly.
     15
     16        This patch switches to using `addChildForRepresentedObject` so that there is no delay when
     17        adding children, and also ensures that any existing recordings are also added on regeneration.
     18
     19        * UserInterface/Views/CanvasTabContentView.js:
     20        (WI.CanvasTabContentView.prototype._recordingAdded):
     21        Move logic for adding TreeElements for new Recordings to CanvasTreeElement.
     22
     23        * UserInterface/Views/CanvasTreeElement.js:
     24        (WI.CanvasTreeElement.createRecordingTreeElement):
     25        (WI.CanvasTreeElement):
     26        (WI.CanvasTreeElement.prototype.onattach):
     27        (WI.CanvasTreeElement.prototype.ondetach):
     28        (WI.CanvasTreeElement.prototype.onpopulate):
     29        (WI.CanvasTreeElement.prototype._handleItemAdded):
     30        (WI.CanvasTreeElement.prototype._handleItemRemoved):
     31        (WI.CanvasTreeElement.prototype._shaderProgramAdded): Deleted.
     32        (WI.CanvasTreeElement.prototype._shaderProgramRemoved): Deleted.
     33
    1342017-10-30  Fujii Hironori  <Hironori.Fujii@sony.com>
    235
  • trunk/Source/WebInspectorUI/UserInterface/Views/CanvasTabContentView.js

    r224081 r224200  
    285285    _recordingAdded(recording, options = {})
    286286    {
    287         const subtitle = null;
    288         let recordingTreeElement = new WI.GeneralTreeElement(["recording"], recording.displayName, subtitle, recording);
    289 
    290         if (recording.source) {
    291             let canvasTreeElement = this._canvasTreeOutline.findTreeElement(recording.source);
    292             console.assert(canvasTreeElement, "Missing tree element for canvas.", recording.source);
    293             if (canvasTreeElement)
    294                 canvasTreeElement.appendChild(recordingTreeElement);
    295         } else
     287        if (!recording.source) {
     288            const subtitle = null;
     289            let recordingTreeElement = new WI.GeneralTreeElement(["recording"], recording.displayName, subtitle, recording);
    296290            this._canvasTreeOutline.appendChild(recordingTreeElement);
     291        }
    297292
    298293        if (!options.suppressShowRecording) {
  • trunk/Source/WebInspectorUI/UserInterface/Views/CanvasTreeElement.js

    r220294 r224200  
    3434
    3535        this.registerFolderizeSettings("shader-programs", WI.UIString("Shader Programs"), this.representedObject.shaderProgramCollection, WI.ShaderProgramTreeElement);
     36
     37        function createRecordingTreeElement(recording) {
     38            return new WI.GeneralTreeElement(["recording"], recording.displayName, subtitle, recording);
     39        }
     40        this.registerFolderizeSettings("recordings", WI.UIString("Recordings"), this.representedObject.recordingCollection, createRecordingTreeElement);
    3641    }
    3742
     
    4247        super.onattach();
    4348
    44         this.representedObject.shaderProgramCollection.addEventListener(WI.Collection.Event.ItemAdded, this._shaderProgramAdded, this);
    45         this.representedObject.shaderProgramCollection.addEventListener(WI.Collection.Event.ItemRemoved, this._shaderProgramRemoved, this);
     49        this.representedObject.shaderProgramCollection.addEventListener(WI.Collection.Event.ItemAdded, this._handleItemAdded, this);
     50        this.representedObject.shaderProgramCollection.addEventListener(WI.Collection.Event.ItemRemoved, this._handleItemRemoved, this);
     51
     52        this.representedObject.recordingCollection.addEventListener(WI.Collection.Event.ItemAdded, this._handleItemAdded, this);
     53        this.representedObject.recordingCollection.addEventListener(WI.Collection.Event.ItemRemoved, this._handleItemRemoved, this);
    4654
    4755        this.element.addEventListener("mouseover", this._handleMouseOver.bind(this));
     
    5361    ondetach()
    5462    {
    55         this.representedObject.shaderProgramCollection.removeEventListener(WI.Collection.Event.ItemAdded, this._shaderProgramAdded, this);
    56         this.representedObject.shaderProgramCollection.removeEventListener(WI.Collection.Event.ItemRemoved, this._shaderProgramRemoved, this);
     63        this.representedObject.shaderProgramCollection.removeEventListener(WI.Collection.Event.ItemAdded, this._handleItemAdded, this);
     64        this.representedObject.shaderProgramCollection.removeEventListener(WI.Collection.Event.ItemRemoved, this._handleItemRemoved, this);
     65
     66        this.representedObject.recordingCollection.removeEventListener(WI.Collection.Event.ItemAdded, this._handleItemAdded, this);
     67        this.representedObject.recordingCollection.removeEventListener(WI.Collection.Event.ItemRemoved, this._handleItemRemoved, this);
    5768
    5869        super.ondetach();
     
    7283        for (let program of this.representedObject.shaderProgramCollection.items)
    7384            this.addChildForRepresentedObject(program);
     85
     86        for (let recording of this.representedObject.recordingCollection.items)
     87            this.addChildForRepresentedObject(recording);
    7488    }
    7589
     
    94108    // Private
    95109
    96     _shaderProgramAdded(event)
     110    _handleItemAdded(event)
    97111    {
    98         this.addRepresentedObjectToNewChildQueue(event.data.item);
     112        this.addChildForRepresentedObject(event.data.item);
    99113    }
    100114
    101     _shaderProgramRemoved(event)
     115    _handleItemRemoved(event)
    102116    {
    103117        this.removeChildForRepresentedObject(event.data.item);
Note: See TracChangeset for help on using the changeset viewer.