Changeset 229620 in webkit


Ignore:
Timestamp:
Mar 14, 2018 10:54:53 PM (6 years ago)
Author:
webkit@devinrousso.com
Message:

Web Inspector: Canvas: a recording initiated by the user should be shown immediately on completion
https://bugs.webkit.org/show_bug.cgi?id=183647
<rdar://problem/38479187>

Reviewed by Matt Baker.

Source/WebInspectorUI:

When recordings are initiated via console.record, we don't want to automatically show the
recording after it's payload is sent to the frontend. We determine whether a recording came
from the console by comparing the recording's associated canvas with the current value of
_recordingCanvas. Previously, when stopping a recording, we would always null the value,
which meant that all non-single-frame recordings (single-frame recordings are stopped by
the agent after the first paint or tick after an action is performed) would be categorized
as coming from the console, since _recordingCanvas would be null by the time the frontend
recieved the payload.

This patch changes it so that the nulling of _recordingCanvas in stopRecording is only
done if the agent command errors. It was already the case that _recordingCanvas was nulled
in stopRecording, so this patch just prevents it from being nulled too early.

  • UserInterface/Controllers/CanvasManager.js:

(WI.CanvasManager.prototype.stopRecording):

LayoutTests:

  • inspector/canvas/recording-2d.html:

Reorder the agent calls so that the CanvasManager _recordingCanvas state variable has a
chance to properly update after a recording is stopped.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r229617 r229620  
     12018-03-14  Devin Rousso  <webkit@devinrousso.com>
     2
     3        Web Inspector: Canvas: a recording initiated by the user should be shown immediately on completion
     4        https://bugs.webkit.org/show_bug.cgi?id=183647
     5        <rdar://problem/38479187>
     6
     7        Reviewed by Matt Baker.
     8
     9        * inspector/canvas/recording-2d.html:
     10        Reorder the agent calls so that the CanvasManager `_recordingCanvas` state variable has a
     11        chance to properly update after a recording is stopped.
     12
    1132018-03-14  Ryan Haddad  <ryanhaddad@apple.com>
    214
  • trunk/LayoutTests/inspector/canvas/recording-2d.html

    r225884 r229620  
    509509
    510510                ++eventCount;
    511                 if (eventCount == 1)
     511                if (eventCount == 1) {
    512512                    InspectorTest.pass("A recording should have been started and stopped once.");
    513                 else if (eventCount >= 2) {
     513
     514                    WI.canvasManager.startRecording(canvas);
     515                    WI.canvasManager.stopRecording();
     516                } else if (eventCount >= 2) {
    514517                    InspectorTest.pass("A recording should have been started and stopped twice.");
    515518
     
    519522            }
    520523            WI.canvasManager.addEventListener(WI.CanvasManager.Event.RecordingStopped, handleRecordingStopped);
    521 
    522             WI.canvasManager.startRecording(canvas);
    523             WI.canvasManager.stopRecording();
    524524
    525525            WI.canvasManager.startRecording(canvas);
  • trunk/Source/WebInspectorUI/ChangeLog

    r229543 r229620  
     12018-03-14  Devin Rousso  <webkit@devinrousso.com>
     2
     3        Web Inspector: Canvas: a recording initiated by the user should be shown immediately on completion
     4        https://bugs.webkit.org/show_bug.cgi?id=183647
     5        <rdar://problem/38479187>
     6
     7        Reviewed by Matt Baker.
     8
     9        When recordings are initiated via `console.record`, we don't want to automatically show the
     10        recording after it's payload is sent to the frontend. We determine whether a recording came
     11        from the console by comparing the recording's associated canvas with the current value of
     12        `_recordingCanvas`. Previously, when stopping a recording, we would always null the value,
     13        which meant that all non-single-frame recordings (single-frame recordings are stopped by
     14        the agent after the first paint or tick after an action is performed) would be categorized
     15        as coming from the console, since `_recordingCanvas` would be null by the time the frontend
     16        recieved the payload.
     17
     18        This patch changes it so that the nulling of `_recordingCanvas` in `stopRecording` is only
     19        done if the agent command errors. It was already the case that `_recordingCanvas` was nulled
     20        in `stopRecording`, so this patch just prevents it from being nulled too early.
     21
     22        * UserInterface/Controllers/CanvasManager.js:
     23        (WI.CanvasManager.prototype.stopRecording):
     24
    1252018-03-12  Jon Davis  <jond@apple.com>
    226
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js

    r225587 r229620  
    111111
    112112        let canvas = this._recordingCanvas;
    113         this._recordingCanvas = null;
    114113
    115114        CanvasAgent.stopRecording(canvas.identifier, (error) => {
     
    118117
    119118            console.error(error);
     119            this._recordingCanvas = null;
    120120            this.dispatchEventToListeners(WI.CanvasManager.Event.RecordingStopped, {canvas, recording: null});
    121121        });
Note: See TracChangeset for help on using the changeset viewer.