Web Inspector: Canvas: don't start with auto-capture enabled
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Nov 2018 12:01:31 +0000 (12:01 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Nov 2018 12:01:31 +0000 (12:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191553

Reviewed by Matt Baker.

* UserInterface/Views/CanvasOverviewContentView.js:
(WI.CanvasOverviewContentView.prototype._setRecordingAutoCaptureFrameCount):
(WI.CanvasOverviewContentView.prototype._updateRecordingAutoCaptureInputElementSize):
(WI.CanvasOverviewContentView.prototype._handleRecordingAutoCaptureInput):
* UserInterface/Views/CanvasOverviewContentView.css:
(.navigation-bar > .item.canvas-recording-auto-capture > label > input):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238169 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/CanvasOverviewContentView.css
Source/WebInspectorUI/UserInterface/Views/CanvasOverviewContentView.js

index ee5db56..cdcb444 100644 (file)
@@ -1,5 +1,19 @@
 2018-11-14  Devin Rousso  <drousso@apple.com>
 
+        Web Inspector: Canvas: don't start with auto-capture enabled
+        https://bugs.webkit.org/show_bug.cgi?id=191553
+
+        Reviewed by Matt Baker.
+
+        * UserInterface/Views/CanvasOverviewContentView.js:
+        (WI.CanvasOverviewContentView.prototype._setRecordingAutoCaptureFrameCount):
+        (WI.CanvasOverviewContentView.prototype._updateRecordingAutoCaptureInputElementSize):
+        (WI.CanvasOverviewContentView.prototype._handleRecordingAutoCaptureInput):
+        * UserInterface/Views/CanvasOverviewContentView.css:
+        (.navigation-bar > .item.canvas-recording-auto-capture > label > input):
+
+2018-11-14  Devin Rousso  <drousso@apple.com>
+
         Web Inspector: Network Graphs are missing minimum sizes, might have no graph at all
         https://bugs.webkit.org/show_bug.cgi?id=191208
 
index 3d7ac66..e08885d 100644 (file)
 .navigation-bar > .item.canvas-recording-auto-capture > label > input {
     width: 1.5em;
     min-width: 1.5em;
-    margin: 0 4px;
+    margin: 0 var(--recording-auto-capture-input-margin); 
     text-align: center;
+
+    --recording-auto-capture-input-margin: 4px; /* Keep this in sync with `recordingAutoCaptureInputMargin`. */
 }
 
 .navigation-bar > .item.canvas-recording-auto-capture > label > input::-webkit-inner-spin-button {
index 2a750c1..7198d56 100644 (file)
@@ -202,7 +202,10 @@ WI.CanvasOverviewContentView = class CanvasOverviewContentView extends WI.Collec
         let frameCount = parseInt(this._recordingAutoCaptureFrameCountInputElement.value);
         console.assert(!isNaN(frameCount) && frameCount >= 0);
 
-        let enabled = frameCount && !!this._recordingAutoCaptureNavigationItem.checked;
+        if (this._recordingAutoCaptureNavigationItem.checked)
+            frameCount = Math.max(1, frameCount);
+
+        let enabled = frameCount > 0 && !!this._recordingAutoCaptureNavigationItem.checked;
 
         WI.canvasManager.setRecordingAutoCaptureFrameCount(enabled, frameCount);
     }
@@ -221,17 +224,21 @@ WI.CanvasOverviewContentView = class CanvasOverviewContentView extends WI.Collec
                 this._recordingAutoCaptureFrameCountInputElement.__cachedFont = computedStyle.font;
             }
 
+            const recordingAutoCaptureInputMargin = 8; // Keep this in sync with `--recording-auto-capture-input-margin`.
+
             context.font = this._recordingAutoCaptureFrameCountInputElement.__cachedFont;
             let textMetrics = context.measureText(this._recordingAutoCaptureFrameCountInputElement.value);
-            this._recordingAutoCaptureFrameCountInputElement.style.setProperty("width", (textMetrics.width + 8) + "px");
+            this._recordingAutoCaptureFrameCountInputElement.style.setProperty("width", (textMetrics.width + recordingAutoCaptureInputMargin) + "px");
         });
 
-        this._recordingAutoCaptureNavigationItem.checked = !!frameCount;
+        return frameCount;
     }
 
     _handleRecordingAutoCaptureInput(event)
     {
-        this._updateRecordingAutoCaptureInputElementSize();
+        let frameCount = this._updateRecordingAutoCaptureInputElementSize();
+        this._recordingAutoCaptureNavigationItem.checked = !!frameCount;
+
         this._setRecordingAutoCaptureFrameCount();
     }