WebKit Bugzilla
Attachment 362730 Details for
Bug 194950
: Web Inspector: Canvas: if no auto-capture value is specified, don't force the input to have "0" as the value
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194950-20190222104259.patch (text/plain), 6.61 KB, created by
Devin Rousso
on 2019-02-22 10:42:59 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Devin Rousso
Created:
2019-02-22 10:42:59 PST
Size:
6.61 KB
patch
obsolete
>diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index fce7a3e86b94317037527189770742a439698881..1cf04c73293452ea2ab021721b0cd95a1dc4cb30 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,25 @@ >+2019-02-22 Devin Rousso <drousso@apple.com> >+ >+ 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 NOBODY (OOPS!). >+ >+ 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-21 Devin Rousso <drousso@apple.com> > > Web Inspector: Canvas: recordings with a single frame sometimes missing TreeElement >diff --git a/Source/WebInspectorUI/UserInterface/Views/CanvasOverviewContentView.js b/Source/WebInspectorUI/UserInterface/Views/CanvasOverviewContentView.js >index 942b44f2f7152af683b20b50447c18e03fa82958..242fd137b435a75a511640b2bad7b4f3f355a58b 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/CanvasOverviewContentView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/CanvasOverviewContentView.js >@@ -48,8 +48,8 @@ WI.CanvasOverviewContentView = class CanvasOverviewContentView extends WI.Collec > 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 @@ WI.CanvasOverviewContentView = class CanvasOverviewContentView extends WI.Collec > _setRecordingAutoCaptureFrameCount(frameCount) > { > if (isNaN(frameCount)) >- frameCount = parseInt(this._recordingAutoCaptureFrameCountInputElement.value); >+ frameCount = this._recordingAutoCaptureFrameCountInputElementValue; > > console.assert(!isNaN(frameCount) && frameCount >= 0); > >@@ -205,7 +205,7 @@ WI.CanvasOverviewContentView = class CanvasOverviewContentView extends WI.Collec > _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 @@ WI.CanvasOverviewContentView = class CanvasOverviewContentView extends WI.Collec > } > } > >+ 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 @@ WI.CanvasOverviewContentView = class CanvasOverviewContentView extends WI.Collec > 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 @@ WI.CanvasOverviewContentView = class CanvasOverviewContentView extends WI.Collec > _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); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194950
: 362730