Remove refitting reply overlay
After moving reply dialog to Dialog element(Change 349454), the content
does not need to be explicitly refitted/resized as the native dialog
element should take care of resizing/centring.
Release-Notes: skip
Google-bug-id: b/255524908
Change-Id: I6497db1b4254dff37932898035c7f0ceba640d92
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
index aa85a7f..6cecfca 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
@@ -189,8 +189,6 @@
const REVIEWERS_REGEX = /^(R|CC)=/gm;
const MIN_CHECK_INTERVAL_SECS = 0;
-const REPLY_REFIT_DEBOUNCE_INTERVAL_MS = 500;
-
const ACCIDENTAL_STARRING_LIMIT_MS = 10 * 1000;
const TRAILING_WHITESPACE_REGEX = /[ \t]+$/gm;
@@ -555,8 +553,6 @@
private readonly getShortcutsService = resolve(this, shortcutsServiceToken);
- private replyRefitTask?: DelayedTask;
-
private scrollTask?: DelayedTask;
private lastStarredTimestamp?: number;
@@ -835,7 +831,6 @@
this.handleVisibilityChange
);
document.removeEventListener('scroll', this.handleScroll);
- this.replyRefitTask?.cancel();
this.scrollTask?.cancel();
if (this.updateCheckTimerHandle) {
@@ -1225,7 +1220,6 @@
.canBeStarted=${this.canStartReview()}
@send=${this.handleReplySent}
@cancel=${this.handleReplyCancel}
- @autogrow=${this.handleReplyAutogrow}
@send-disabled-changed=${this.resetReplyOverlayFocusStops}
>
</gr-reply-dialog>
@@ -2032,18 +2026,6 @@
this.replyOverlay.cancel();
}
- private handleReplyAutogrow() {
- // If the textarea resizes, we need to re-fit the overlay.
- this.replyRefitTask = debounce(
- this.replyRefitTask,
- () => {
- assertIsDefined(this.replyOverlay);
- this.replyOverlay.refit();
- },
- REPLY_REFIT_DEBOUNCE_INTERVAL_MS
- );
- }
-
// Private but used in tests.
handleShowReplyDialog(e: CustomEvent<{value: {ccsOnly: boolean}}>) {
let target = FocusTarget.REVIEWERS;
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
index b9b3b71..2e03799 100644
--- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
+++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
@@ -181,13 +181,6 @@
*/
/**
- * Fired when the main textarea's value changes, which may have triggered
- * a change in size for the dialog.
- *
- * @event autogrow
- */
-
- /**
* Fires to show an alert when a send is attempted on the non-latest patch.
*
* @event show-alert
@@ -748,12 +741,6 @@
this.computeMessagePlaceholder();
this.computeSendButtonLabel();
}
- if (changedProperties.has('reviewFormatting')) {
- this.handleHeightChanged();
- }
- if (changedProperties.has('draftCommentThreads')) {
- this.handleHeightChanged();
- }
if (changedProperties.has('sendDisabled')) {
this.sendDisabledChanged();
}
@@ -1976,10 +1963,6 @@
);
}
- handleHeightChanged() {
- fireEvent(this, 'autogrow');
- }
-
getLabelScores(): GrLabelScores {
return this.labelScores || queryAndAssert(this, 'gr-label-scores');
}
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.ts b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.ts
index ef781ba..4ad76f4 100644
--- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.ts
@@ -2022,17 +2022,6 @@
await promise;
});
- test('fires height change when the drafts comments load', async () => {
- // Flush DOM operations before binding to the autogrow event so we don't
- // catch the events fired from the initial layout.
- await element.updateComplete;
- const autoGrowHandler = sinon.stub();
- element.addEventListener('autogrow', autoGrowHandler);
- element.draftCommentThreads = [];
- await element.updateComplete;
- assert.isTrue(autoGrowHandler.called);
- });
-
suite('start review and save buttons', () => {
let sendStub: sinon.SinonStub;