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:

committed by
Becky Siegel

parent
2eaf593b63
commit
d85a501c58
@@ -37,6 +37,8 @@
|
|||||||
|
|
||||||
const SMALL_RELATED_HEIGHT = 400;
|
const SMALL_RELATED_HEIGHT = 400;
|
||||||
|
|
||||||
|
const REPLY_REFIT_DEBOUNCE_INTERVAL_MS = 500;
|
||||||
|
|
||||||
Polymer({
|
Polymer({
|
||||||
is: 'gr-change-view',
|
is: 'gr-change-view',
|
||||||
|
|
||||||
@@ -458,7 +460,10 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
_handleReplyAutogrow(e) {
|
_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) {
|
_handleShowReplyDialog(e) {
|
||||||
|
@@ -777,10 +777,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
_handleHeightChanged(e) {
|
_handleHeightChanged(e) {
|
||||||
// If the textarea resizes, we need to re-fit the overlay.
|
this.fire('autogrow');
|
||||||
this.debounce('autogrow', () => {
|
|
||||||
this.fire('autogrow');
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_handleLabelsChanged() {
|
_handleLabelsChanged() {
|
||||||
|
Reference in New Issue
Block a user