Changeset 223952 in webkit


Ignore:
Timestamp:
Oct 25, 2017 12:39:05 AM (6 years ago)
Author:
webkit@devinrousso.com
Message:

Web Inspector: preserve Recordings for each Canvas after closing the Canvas tab
https://bugs.webkit.org/show_bug.cgi?id=178767
<rdar://problem/35167239>

Reviewed by Brian Burg.

Source/WebInspectorUI:

  • UserInterface/Test.html:

Include CollectionTypes for tests.

  • UserInterface/Controllers/CanvasManager.js:

(WI.CanvasManager.prototype.recordingFinished):

  • UserInterface/Models/Canvas.js:

(WI.Canvas):
(WI.Canvas.prototype.get recordingCollection):

  • UserInterface/Models/CollectionTypes.js:

(WI.CanvasCollection):
(WI.RecordingCollection):

  • UserInterface/Views/CanvasContentView.js:

(WI.CanvasContentView.prototype.initialLayout):
(WI.CanvasContentView.prototype._addRecording):
(WI.CanvasContentView.prototype._recordingStopped):

  • UserInterface/Views/CanvasTabContentView.js:

(WI.CanvasTabContentView.prototype.attached):
(WI.CanvasTabContentView.prototype._recordingAdded):

LayoutTests:

  • inspector/canvas/resources/recording-utilities.js:

(TestPage.registerInitializer.window.startRecording):
Add assertions that the recording is added to the canvas' RecordingCollection.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r223947 r223952  
     12017-10-25  Devin Rousso  <webkit@devinrousso.com>
     2
     3        Web Inspector: preserve Recordings for each Canvas after closing the Canvas tab
     4        https://bugs.webkit.org/show_bug.cgi?id=178767
     5        <rdar://problem/35167239>
     6
     7        Reviewed by Brian Burg.
     8
     9        * inspector/canvas/resources/recording-utilities.js:
     10        (TestPage.registerInitializer.window.startRecording):
     11        Add assertions that the recording is added to the canvas' RecordingCollection.
     12
    1132017-10-24  Ryosuke Niwa  <rniwa@webkit.org>
    214
  • trunk/LayoutTests/inspector/canvas/resources/recording-utilities.js

    r222888 r223952  
    105105
    106106            let recording = event.data.recording;
     107            InspectorTest.assert(recording.source === canvas, "Recording should be of the given canvas.");
    107108            InspectorTest.assert(recording.source.contextType === type, `Recording should be of a canvas with type "${type}".`);
     109            InspectorTest.assert(recording.source.recordingCollection.items.has(recording), "Recording should be in the canvas' list of recordings.");
    108110
    109111            return recording.actions.then(() => {
  • trunk/Source/WebInspectorUI/ChangeLog

    r223948 r223952  
     12017-10-25  Devin Rousso  <webkit@devinrousso.com>
     2
     3        Web Inspector: preserve Recordings for each Canvas after closing the Canvas tab
     4        https://bugs.webkit.org/show_bug.cgi?id=178767
     5        <rdar://problem/35167239>
     6
     7        Reviewed by Brian Burg.
     8
     9        * UserInterface/Test.html:
     10        Include CollectionTypes for tests.
     11
     12        * UserInterface/Controllers/CanvasManager.js:
     13        (WI.CanvasManager.prototype.recordingFinished):
     14
     15        * UserInterface/Models/Canvas.js:
     16        (WI.Canvas):
     17        (WI.Canvas.prototype.get recordingCollection):
     18
     19        * UserInterface/Models/CollectionTypes.js:
     20        (WI.CanvasCollection):
     21        (WI.RecordingCollection):
     22
     23        * UserInterface/Views/CanvasContentView.js:
     24        (WI.CanvasContentView.prototype.initialLayout):
     25        (WI.CanvasContentView.prototype._addRecording):
     26        (WI.CanvasContentView.prototype._recordingStopped):
     27
     28        * UserInterface/Views/CanvasTabContentView.js:
     29        (WI.CanvasTabContentView.prototype.attached):
     30        (WI.CanvasTabContentView.prototype._recordingAdded):
     31
    1322017-10-24  Joseph Pecoraro  <pecoraro@apple.com>
    233
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js

    r223920 r223952  
    155155            return;
    156156
    157         let recording = recordingPayload ? WI.Recording.fromPayload(recordingPayload) : null
     157        let recording = recordingPayload ? WI.Recording.fromPayload(recordingPayload) : null;
    158158        if (recording) {
    159159            recording.source = canvas;
    160160            recording.createDisplayName();
     161
     162            canvas.recordingCollection.add(recording);
    161163        }
    162164
  • trunk/Source/WebInspectorUI/UserInterface/Models/Canvas.js

    r223920 r223952  
    4444        this._cssCanvasClientNodes = null;
    4545        this._shaderProgramCollection = new WI.Collection(WI.Collection.TypeVerifier.ShaderProgram);
     46        this._recordingCollection = new WI.RecordingCollection;
    4647
    4748        this._nextShaderProgramDisplayNumber = 1;
     
    110111    get contextAttributes() { return this._contextAttributes; }
    111112    get shaderProgramCollection() { return this._shaderProgramCollection; }
     113    get recordingCollection() { return this._recordingCollection; }
    112114
    113115    get isRecording()
  • trunk/Source/WebInspectorUI/UserInterface/Models/CollectionTypes.js

    r223011 r223952  
    2626WI.CanvasCollection = class CanvasCollection extends WI.Collection
    2727{
    28     constructor(canvases)
     28    constructor(canvases = [])
    2929    {
    3030        super((item) => item instanceof WI.Canvas);
     
    3434    }
    3535};
     36
     37WI.RecordingCollection = class RecordingCollection extends WI.Collection
     38{
     39    constructor(recordings = [])
     40    {
     41        super((item) => item instanceof WI.Recording);
     42
     43        for (let recording of recordings)
     44            this.add(recording);
     45    }
     46};
  • trunk/Source/WebInspectorUI/UserInterface/Test.html

    r223929 r223952  
    116116    <script src="Models/CollectionEntry.js"></script>
    117117    <script src="Models/CollectionEntryPreview.js"></script>
     118    <script src="Models/CollectionTypes.js"></script>
    118119    <script src="Models/Color.js"></script>
    119120    <script src="Models/ConsoleCommandResultMessage.js"></script>
  • trunk/Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js

    r223918 r223952  
    129129        this._recordingSelectElement.addEventListener("change", this._handleRecordingSelectElementChange.bind(this));
    130130
     131        for (let recording of this.representedObject.recordingCollection.items)
     132            this._addRecording(recording);
     133
    131134        let flexibleSpaceElement = footer.appendChild(document.createElement("div"));
    132135        flexibleSpaceElement.className = "flexible-space";
     
    231234    }
    232235
     236    _addRecording(recording)
     237    {
     238        let optionElement = this._recordingSelectElement.appendChild(document.createElement("option"));
     239        optionElement.textContent = recording.displayName;
     240
     241        this._recordingOptionElementMap.set(optionElement, recording);
     242
     243        let recordingCount = this._recordingSelectElement.options.length;
     244        this._recordingSelectText.textContent = WI.UIString("View Recordings... (%d)").format(recordingCount);
     245        this._recordingSelectContainer.classList.remove("hidden");
     246
     247        this._recordingSelectElement.selectedIndex = -1;
     248    }
     249
    233250    _toggleRecording(event)
    234251    {
     
    254271            return;
    255272
    256         const subtitle = null;
    257         let recordingTreeElement = new WI.GeneralTreeElement(["recording"], recording.displayName, subtitle, recording);
    258         recordingTreeElement.tooltip = ""; // Tree element tooltips aren't needed in a popover.
    259 
    260         let optionElement = this._recordingSelectElement.appendChild(document.createElement("option"));
    261         optionElement.textContent = recording.displayName;
    262 
    263         this._recordingOptionElementMap.set(optionElement, recording);
    264 
    265         let recordingCount = this._recordingSelectElement.options.length;
    266         this._recordingSelectText.textContent = WI.UIString("View Recordings... (%d)").format(recordingCount);
    267         this._recordingSelectContainer.classList.remove("hidden");
    268 
    269         WI.showRepresentedObject(event.data.recording);
     273        this._addRecording(recording);
    270274    }
    271275
  • trunk/Source/WebInspectorUI/UserInterface/Views/CanvasTabContentView.js

    r223921 r223952  
    152152        this._canvasCollection = new WI.CanvasCollection(WI.canvasManager.canvases);
    153153
    154         for (let canvas of this._canvasCollection.items)
     154        for (let canvas of this._canvasCollection.items) {
    155155            this._canvasTreeOutline.appendChild(new WI.CanvasTreeElement(canvas));
     156
     157            for (let recording of canvas.recordingCollection.items)
     158                this._recordingAdded(recording, {suppressShowRecording: true});
     159        }
    156160    }
    157161
     
    265269    }
    266270
    267     _recordingAdded(recording)
     271    _recordingAdded(recording, options = {})
    268272    {
    269273        const subtitle = null;
     
    278282            this._canvasTreeOutline.appendChild(recordingTreeElement);
    279283
    280         this.showRepresentedObject(recording);
    281         this._updateActionIndex(0, {suppressNavigationSidebarUpdate: true});
     284        if (!options.suppressShowRecording) {
     285            this.showRepresentedObject(recording);
     286            this._updateActionIndex(0, {suppressNavigationSidebarUpdate: true});
     287        }
    282288    }
    283289
Note: See TracChangeset for help on using the changeset viewer.