Title: [294968] trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js
- Revision
- 294968
- Author
- drou...@apple.com
- Date
- 2022-05-27 16:55:11 -0700 (Fri, 27 May 2022)
Log Message
Web Inspector: Sources: editing a breakpoint action to cause the CodeMirror to wrap doesn't update the `WI.Popover` size
https://bugs.webkit.org/show_bug.cgi?id=220643
<rdar://problem/73225206>
Reviewed by Patrick Angle.
* Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js:
(WI.BreakpointActionView.prototype._updateBody):
(WI.BreakpointActionView.prototype._handleJavaScriptCodeMirrorUpdate): Added.
(WI.BreakpointActionView.prototype._codeMirrorViewportChanged): Deleted.
Replace listening for `"viewportChange"` (and `"update"`) with `"updates"`, each time comparing the
`getScrollInfo().clientHeight` (we don't care about the `clientWidth` because it's hardcoded in the
CSS `.breakpoint-action-eval-editor > .CodeMirror`) with the last value. This is necessary because
`"viewportChange"` is only fired when the number of lines changes, which a wrapped line doesn't do.
Canonical link: https://commits.webkit.org/251072@main
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js (294967 => 294968)
--- trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js 2022-05-27 23:52:53 UTC (rev 294967)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js 2022-05-27 23:55:11 UTC (rev 294968)
@@ -180,10 +180,9 @@
value: this._action.data || "",
});
- this._codeMirror.on("viewportChange", this._codeMirrorViewportChanged.bind(this));
- this._codeMirror.on("change", this._handleJavaScriptCodeMirrorChange.bind(this));
+ this._codeMirrorClientHeight = NaN;
- this._codeMirrorViewport = {from: null, to: null};
+ this._codeMirror.on("changes", this._handleJavaScriptCodeMirrorChanges.bind(this));
var completionController = new WI.CodeMirrorCompletionController(this._delegate.breakpointActionViewCodeMirrorCompletionControllerMode(this, this._codeMirror), this._codeMirror);
completionController.addExtendedCompletionProvider("_javascript_", WI._javascript_RuntimeCompletionProvider);
@@ -216,20 +215,17 @@
this._action.data = ""
}
- _handleJavaScriptCodeMirrorChange(event)
+ _handleJavaScriptCodeMirrorChanges(codeMirror, changes)
{
// Throw away the _expression_ if it's just whitespace.
this._action.data = ""
- }
- _codeMirrorViewportChanged(event, from, to)
- {
- if (this._codeMirrorViewport.from === from && this._codeMirrorViewport.to === to)
- return;
+ let {clientHeight} = this._codeMirror.getScrollInfo();
+ if (clientHeight !== this._codeMirrorClientHeight) {
+ this._codeMirrorClientHeight = clientHeight;
- this._codeMirrorViewport.from = from;
- this._codeMirrorViewport.to = to;
- this._delegate.breakpointActionViewResized(this);
+ this._delegate.breakpointActionViewResized(this);
+ }
}
_handleEmulateUserGestureCheckboxChange(event)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes