Title: [242079] trunk/Source/WebInspectorUI
- Revision
- 242079
- Author
- [email protected]
- Date
- 2019-02-26 00:11:37 -0800 (Tue, 26 Feb 2019)
Log Message
Web Inspector: Canvas: if no auto-capture value is specified, don't force the input to have "0" as the value
https://bugs.webkit.org/show_bug.cgi?id=194950
<rdar://problem/48276798>
Reviewed by Joseph Pecoraro.
Create a getter/setter for the value of the auto-capture frame count <input> so that all
code follows the same path.
If the <input> currently has no content and the frame count is 0, only set the placeholder.
* UserInterface/Views/CanvasOverviewContentView.js:
(WI.CanvasOverviewContentView):
(WI.CanvasOverviewContentView.prototype._setRecordingAutoCaptureFrameCount):
(WI.CanvasOverviewContentView.prototype._updateRecordingAutoCaptureCheckboxLabel):
(WI.CanvasOverviewContentView.prototype.get _recordingAutoCaptureFrameCountInputElementValue): Added.
(WI.CanvasOverviewContentView.prototype.set _recordingAutoCaptureFrameCountInputElementValue): Added.
(WI.CanvasOverviewContentView.prototype._updateRecordingAutoCaptureInputElementSize):
(WI.CanvasOverviewContentView.prototype._handleCanvasRecordingAutoCaptureFrameCountChanged):
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (242078 => 242079)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-02-26 08:00:26 UTC (rev 242078)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-02-26 08:11:37 UTC (rev 242079)
@@ -1,5 +1,27 @@
2019-02-26 Devin Rousso <[email protected]>
+ Web Inspector: Canvas: if no auto-capture value is specified, don't force the input to have "0" as the value
+ https://bugs.webkit.org/show_bug.cgi?id=194950
+ <rdar://problem/48276798>
+
+ Reviewed by Joseph Pecoraro.
+
+ Create a getter/setter for the value of the auto-capture frame count <input> so that all
+ code follows the same path.
+
+ If the <input> currently has no content and the frame count is 0, only set the placeholder.
+
+ * UserInterface/Views/CanvasOverviewContentView.js:
+ (WI.CanvasOverviewContentView):
+ (WI.CanvasOverviewContentView.prototype._setRecordingAutoCaptureFrameCount):
+ (WI.CanvasOverviewContentView.prototype._updateRecordingAutoCaptureCheckboxLabel):
+ (WI.CanvasOverviewContentView.prototype.get _recordingAutoCaptureFrameCountInputElementValue): Added.
+ (WI.CanvasOverviewContentView.prototype.set _recordingAutoCaptureFrameCountInputElementValue): Added.
+ (WI.CanvasOverviewContentView.prototype._updateRecordingAutoCaptureInputElementSize):
+ (WI.CanvasOverviewContentView.prototype._handleCanvasRecordingAutoCaptureFrameCountChanged):
+
+2019-02-26 Devin Rousso <[email protected]>
+
Web Inspector: Console: dragging a selection outside the selected element clears the selection
https://bugs.webkit.org/show_bug.cgi?id=194660
<rdar://problem/46719239>
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CanvasOverviewContentView.js (242078 => 242079)
--- trunk/Source/WebInspectorUI/UserInterface/Views/CanvasOverviewContentView.js 2019-02-26 08:00:26 UTC (rev 242078)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CanvasOverviewContentView.js 2019-02-26 08:11:37 UTC (rev 242079)
@@ -48,8 +48,8 @@
this._recordingAutoCaptureFrameCountInputElement = document.createElement("input");
this._recordingAutoCaptureFrameCountInputElement.type = "number";
this._recordingAutoCaptureFrameCountInputElement.min = 0;
- this._recordingAutoCaptureFrameCountInputElement.value = WI.settings.canvasRecordingAutoCaptureFrameCount.value;
this._recordingAutoCaptureFrameCountInputElement.addEventListener("input", this._handleRecordingAutoCaptureInput.bind(this));
+ this._recordingAutoCaptureFrameCountInputElementValue = WI.settings.canvasRecordingAutoCaptureFrameCount.value;
const label = null;
this._recordingAutoCaptureNavigationItem = new WI.CheckboxNavigationItem("canvas-recording-auto-capture", label, !!WI.settings.canvasRecordingAutoCaptureEnabled.value);
@@ -190,7 +190,7 @@
_setRecordingAutoCaptureFrameCount(frameCount)
{
if (isNaN(frameCount))
- frameCount = parseInt(this._recordingAutoCaptureFrameCountInputElement.value);
+ frameCount = this._recordingAutoCaptureFrameCountInputElementValue;
console.assert(!isNaN(frameCount) && frameCount >= 0);
@@ -205,7 +205,7 @@
_updateRecordingAutoCaptureCheckboxLabel(frameCount)
{
if (isNaN(frameCount))
- frameCount = parseInt(this._recordingAutoCaptureFrameCountInputElement.value);
+ frameCount = this._recordingAutoCaptureFrameCountInputElementValue;
let label = frameCount === 1 ? WI.UIString("Record first %s frame") : WI.UIString("Record first %s frames");
@@ -229,12 +229,25 @@
}
}
+ get _recordingAutoCaptureFrameCountInputElementValue()
+ {
+ return parseInt(this._recordingAutoCaptureFrameCountInputElement.value);
+ }
+
+ set _recordingAutoCaptureFrameCountInputElementValue(frameCount)
+ {
+ if (this._recordingAutoCaptureFrameCountInputElement.value || frameCount)
+ this._recordingAutoCaptureFrameCountInputElement.value = frameCount;
+
+ this._recordingAutoCaptureFrameCountInputElement.placeholder = frameCount;
+ }
+
_updateRecordingAutoCaptureInputElementSize()
{
- let frameCount = parseInt(this._recordingAutoCaptureFrameCountInputElement.value);
+ let frameCount = this._recordingAutoCaptureFrameCountInputElementValue;
if (isNaN(frameCount) || frameCount < 0) {
frameCount = 0;
- this._recordingAutoCaptureFrameCountInputElement.value = frameCount;
+ this._recordingAutoCaptureFrameCountInputElementValue = frameCount;
}
WI.ImageUtilities.scratchCanvasContext2D((context) => {
@@ -246,7 +259,7 @@
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);
+ let textMetrics = context.measureText(this._recordingAutoCaptureFrameCountInputElement.value || this._recordingAutoCaptureFrameCountInputElement.placeholder);
this._recordingAutoCaptureFrameCountInputElement.style.setProperty("width", (textMetrics.width + recordingAutoCaptureInputMargin) + "px");
});
@@ -274,8 +287,8 @@
_handleCanvasRecordingAutoCaptureFrameCountChanged(event)
{
// Only update the value if it is different to prevent mangling the selection.
- if (parseInt(this._recordingAutoCaptureFrameCountInputElement.value) !== WI.settings.canvasRecordingAutoCaptureFrameCount.value)
- this._recordingAutoCaptureFrameCountInputElement.value = WI.settings.canvasRecordingAutoCaptureFrameCount.value;
+ if (this._recordingAutoCaptureFrameCountInputElementValue !== WI.settings.canvasRecordingAutoCaptureFrameCount.value)
+ this._recordingAutoCaptureFrameCountInputElementValue = WI.settings.canvasRecordingAutoCaptureFrameCount.value;
this._updateRecordingAutoCaptureCheckboxLabel(WI.settings.canvasRecordingAutoCaptureFrameCount.value);
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes