jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/373901 )

Change subject: Debounce FocusableNode#redrawHighlights
......................................................................


Debounce FocusableNode#redrawHighlights

Change-Id: I4c0ec1dd04fd373201eed43d9fb777e83391c39f
---
M src/ce/ve.ce.FocusableNode.js
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  DLynch: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/ce/ve.ce.FocusableNode.js b/src/ce/ve.ce.FocusableNode.js
index 1594ac9..c75ee99 100644
--- a/src/ce/ve.ce.FocusableNode.js
+++ b/src/ce/ve.ce.FocusableNode.js
@@ -45,6 +45,10 @@
                this.$highlights.addClass( config.classes.join( ' ' ) );
        }
 
+       // Use a debounced handler as some actions can trigger redrawHighlights
+       // twice in quick succession resizeEnd+rerender
+       this.redrawHighlightsDebounced = ve.debounce( 
this.redrawHighlights.bind( this ), 100 );
+
        // DOM changes
        this.$element
                .addClass( 've-ce-focusableNode' )
@@ -564,7 +568,7 @@
  * @method
  */
 ve.ce.FocusableNode.prototype.onFocusableResizeEnd = function () {
-       this.redrawHighlights();
+       this.redrawHighlightsDebounced();
 };
 
 /**
@@ -574,7 +578,7 @@
  */
 ve.ce.FocusableNode.prototype.onFocusableRerender = function () {
        if ( this.focused && this.focusableSurface ) {
-               this.redrawHighlights();
+               this.redrawHighlightsDebounced();
                // reposition menu
                
this.focusableSurface.getSurface().getContext().updateDimensions( true );
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/373901
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4c0ec1dd04fd373201eed43d9fb777e83391c39f
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: DLynch <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to