WIP disable comment dialog animations (bug 1115707); r!smacleod draft
authorbyron jones <glob@mozilla.com>
Thu, 25 Aug 2016 14:07:28 +0800
changeset 85 f63bc4097a9ff6e528236007d1f823460dca4706
parent 84 2fbbe6da231cc4110ced884f7890d3ff3765862a
child 86 9b745b9a4e464165f848855ddcd26ec018d0ed32
push idunknown
push userunknown
push dateunknown
bugs1115707
WIP disable comment dialog animations (bug 1115707); r!smacleod Disable the comment dialog animations in order to improve responsiveness. This involves setting a boolean to false, and fixing the places where setting this boolean to false broke the dialog. MozReview-Commit-ID: 9YC4Mij3w6n
reviewboard/reviewboard/static/rb/js/views/commentDialogView.js
--- a/reviewboard/reviewboard/static/rb/js/views/commentDialogView.js
+++ b/reviewboard/reviewboard/static/rb/js/views/commentDialogView.js
@@ -158,17 +158,19 @@ RB.CommentDialogView = Backbone.View.ext
     initialize: function() {
     },
 
     render: function() {
         var userSession = RB.UserSession.instance,
             reviewRequest = this.model.get('reviewRequest'),
             reviewRequestEditor = this.model.get('reviewRequestEditor');
 
-        this.options.animate = (this.options.animate !== false);
+        // MozReview: don't animate
+        // this.options.animate = (this.options.animate !== false);
+        this.options.animate = false;
 
         this.$el
             .hide()
             .html(this.template({
                 authenticated: userSession.get('authenticated'),
                 hasDraft: reviewRequest.get('hasDraft'),
                 markdownDocsURL: MANUAL_URL + 'users/markdown/',
                 markdownText: gettext('Markdown'),
@@ -350,34 +352,36 @@ RB.CommentDialogView = Backbone.View.ext
      * Opens the comment dialog and focuses the text field.
      */
     open: function() {
         function openDialog() {
             this.$el.scrollIntoView();
             this._textEditor.focus();
         }
 
-        this.$el
-            .css({
-                top: parseInt(this.$el.css("top"), 10) - this.SLIDE_DISTANCE,
-                opacity: 0
-            })
-            .show();
+        if (this.options.animate) {
+            this.$el
+                .css({
+                    top: parseInt(this.$el.css("top"), 10) - this.SLIDE_DISTANCE,
+                    opacity: 0
+                });
+        }
+        this.$el.show();
 
         this._handleResize();
 
         if (this.model.get('canEdit')) {
             this.model.beginEdit();
         }
 
         if (this.options.animate) {
             this.$el.animate({
                 top: "+=" + this.SLIDE_DISTANCE + "px",
                 opacity: 1
-            }, 350, "swing", _.bind(openDialog, this));
+            }, 150, "swing", _.bind(openDialog, this));
         } else {
             openDialog.call(this);
         }
     },
 
     /*
      * Closes the comment dialog, discarding the comment block if empty.
      *
@@ -390,23 +394,25 @@ RB.CommentDialogView = Backbone.View.ext
             this.$el.remove();
             this.trigger("closed");
 
             if (_.isFunction(onClosed)) {
                 onClosed.call(context);
             }
         }
 
-        if (this.options.animate && this.$el.is(":visible")) {
-            this.$el.animate({
-                top: "-=" + this.SLIDE_DISTANCE + "px",
-                opacity: 0
-            }, 350, "swing", _.bind(closeDialog, this));
-        } else {
-            closeDialog.call(this);
+        if (this.$el.is(":visible")) {
+            if (this.options.animate) {
+                this.$el.animate({
+                    top: "-=" + this.SLIDE_DISTANCE + "px",
+                    opacity: 0
+                }, 350, "swing", _.bind(closeDialog, this));
+            } else {
+                closeDialog.call(this);
+            }
         }
     },
 
     /*
      * Moves the comment dialog to the given coordinates.
      */
     move: function(x, y) {
         this.$el.move(x, y);