Debounce reply overlay refitting

Gathering metrics to refit an overlay forces an expensive reflow of the
document, and the gr-reply-dialog was refitting the overlay on each
keystroke causing cascading typing lag in the UI. With this change, the
refit call is debounced.

Bug: Issue 7461
Change-Id: Ie03b81360c7642ecc0703ff2343c46e5ea5cac80
This commit is contained in:
Wyatt Allen
2017-10-17 16:43:05 -07:00
committed by Becky Siegel
parent 2eaf593b63
commit d85a501c58
2 changed files with 7 additions and 5 deletions

View File

@@ -37,6 +37,8 @@
const SMALL_RELATED_HEIGHT = 400;
const REPLY_REFIT_DEBOUNCE_INTERVAL_MS = 500;
Polymer({
is: 'gr-change-view',
@@ -458,7 +460,10 @@
},
_handleReplyAutogrow(e) {
this.$.replyOverlay.refit();
// If the textarea resizes, we need to re-fit the overlay.
this.debounce('reply-overlay-refit', () => {
this.$.replyOverlay.refit();
}, REPLY_REFIT_DEBOUNCE_INTERVAL_MS);
},
_handleShowReplyDialog(e) {

View File

@@ -777,10 +777,7 @@
},
_handleHeightChanged(e) {
// If the textarea resizes, we need to re-fit the overlay.
this.debounce('autogrow', () => {
this.fire('autogrow');
});
this.fire('autogrow');
},
_handleLabelsChanged() {