Title: [136418] trunk/Source/WebCore
Revision
136418
Author
aand...@chromium.org
Date
2012-12-03 10:59:29 -0800 (Mon, 03 Dec 2012)

Log Message

Web Inspector: [Canvas] show replay screenshot of the last call's canvas
https://bugs.webkit.org/show_bug.cgi?id=103739

Reviewed by Pavel Feldman.

When many canvases are being instrumented we'll want to show replay screenshots for each canvas.
Meanwhile, show the screenshot of the last-touched canvas during the current replay.

* inspector/InjectedScriptCanvasModuleSource.js:
(.):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136417 => 136418)


--- trunk/Source/WebCore/ChangeLog	2012-12-03 18:54:02 UTC (rev 136417)
+++ trunk/Source/WebCore/ChangeLog	2012-12-03 18:59:29 UTC (rev 136418)
@@ -1,3 +1,16 @@
+2012-12-03  Andrey Adaikin  <aand...@chromium.org>
+
+        Web Inspector: [Canvas] show replay screenshot of the last call's canvas
+        https://bugs.webkit.org/show_bug.cgi?id=103739
+
+        Reviewed by Pavel Feldman.
+
+        When many canvases are being instrumented we'll want to show replay screenshots for each canvas.
+        Meanwhile, show the screenshot of the last-touched canvas during the current replay.
+
+        * inspector/InjectedScriptCanvasModuleSource.js:
+        (.):
+
 2012-12-03  Joshua Bell  <jsb...@chromium.org>
 
         IndexedDB: Rename exception enum members from UGLY_ERR to PrettyError

Modified: trunk/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js (136417 => 136418)


--- trunk/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js	2012-12-03 18:54:02 UTC (rev 136417)
+++ trunk/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js	2012-12-03 18:59:29 UTC (rev 136418)
@@ -2414,13 +2414,17 @@
             this._resetCallback();
     },
 
+    /**
+     * @return {Call}
+     */
     step: function()
     {
-        this.stepTo(this._nextReplayStep);
+        return this.stepTo(this._nextReplayStep);
     },
 
     /**
      * @param {number} stepNum
+     * @return {Call}
      */
     stepTo: function(stepNum)
     {
@@ -2429,14 +2433,19 @@
         if (this._nextReplayStep > stepNum)
             this.reset();
         // FIXME: Replay all the cached resources first to warm-up.
+        var lastCall = null;
         var replayableCalls = this._traceLog.replayableCalls();
         while (this._nextReplayStep <= stepNum)
-            replayableCalls[this._nextReplayStep++].replay(this._replayWorldCache);
+            lastCall = replayableCalls[this._nextReplayStep++].replay(this._replayWorldCache);
+        return lastCall;
     },
 
+    /**
+     * @return {Call}
+     */
     replay: function()
     {
-        this.stepTo(this._traceLog.size() - 1);
+        return this.stepTo(this._traceLog.size() - 1);
     }
 }
 
@@ -2704,13 +2713,19 @@
             this._replayContexts = [];
             this._traceLogPlayer = new TraceLogPlayer(traceLog, this._onTraceLogPlayerReset.bind(this));
         }
-        this._traceLogPlayer.stepTo(stepNo);
+        var lastCall = this._traceLogPlayer.stepTo(stepNo);
         if (!this._replayContexts.length) {
             console.error("ASSERT_NOT_REACHED: replayTraceLog failed to create a replay canvas?!");
             return "";
         }
-        // Return current screenshot.
         // FIXME: Support replaying several canvases simultaneously.
+        var lastCallResourceContext = Resource.wrappedObject(lastCall.resource());
+        for (var i = 0, n = this._replayContexts.length; i < n; ++i) {
+            var context = this._replayContexts[i].context;
+            if (lastCallResourceContext === context)
+                return context.canvas.toDataURL();
+        }
+        console.assert("ASSERT_NOT_REACHED: replayTraceLog failed to match the replaying canvas?!");
         return this._replayContexts[0].context.canvas.toDataURL();
     },
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to