Skip to content
Permalink
Browse files
Web Inspector: Sources: editing a breakpoint action to cause the Code…
…Mirror 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
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294968 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
dcrousso committed May 27, 2022
1 parent a64fa69 commit 8fd9f7e09b1578f20668946aee1ce8ecb780a16c
Showing 1 changed file with 8 additions and 12 deletions.
@@ -180,10 +180,9 @@ WI.BreakpointActionView = class BreakpointActionView extends WI.Object
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.javaScriptRuntimeCompletionProvider);
@@ -216,20 +215,17 @@ WI.BreakpointActionView = class BreakpointActionView extends WI.Object
this._action.data = event.target.value;
}

_handleJavaScriptCodeMirrorChange(event)
_handleJavaScriptCodeMirrorChanges(codeMirror, changes)
{
// Throw away the expression if it's just whitespace.
this._action.data = this._codeMirror.getValue().trim();
}

_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)

0 comments on commit 8fd9f7e

Please sign in to comment.