Bug 978653 - Wait longer to fire 'style-applied' event after updating a style sheet in StyleSheetActor. r=pbrosset
authorHeather Arthur <fayearthur@gmail.com>
Mon, 03 Mar 2014 17:17:04 -0500
changeset 171538 01a05eb986294dd099cfe0d83f479194a574ecf3
parent 171537 9a0daca21f30eb75fc1a30026a728cb9392baca9
child 171614 89b58d927e8d07e739f65ae06a4b3b29f84496bf
push id5407
push userryanvm@gmail.com
push dateMon, 03 Mar 2014 22:16:41 +0000
treeherderfx-team@01a05eb98629 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbrosset
bugs978653
milestone30.0a1
Bug 978653 - Wait longer to fire 'style-applied' event after updating a style sheet in StyleSheetActor. r=pbrosset
browser/devtools/styleeditor/StyleEditorUI.jsm
toolkit/devtools/server/actors/stylesheets.js
--- a/browser/devtools/styleeditor/StyleEditorUI.jsm
+++ b/browser/devtools/styleeditor/StyleEditorUI.jsm
@@ -263,17 +263,16 @@ StyleEditorUI.prototype = {
     if (savedFile && !file) {
       file = savedFile;
     }
 
     let editor =
       new StyleSheetEditor(styleSheet, this._window, file, isNew, this._walker);
 
     editor.on("property-change", this._summaryChange.bind(this, editor));
-    editor.on("style-applied", this._summaryChange.bind(this, editor));
     editor.on("linked-css-file", this._summaryChange.bind(this, editor));
     editor.on("linked-css-file-error", this._summaryChange.bind(this, editor));
     editor.on("error", this._onError);
 
     this.editors.push(editor);
 
     editor.fetchSource(this._sourceLoaded.bind(this, editor));
     return editor;
--- a/toolkit/devtools/server/actors/stylesheets.js
+++ b/toolkit/devtools/server/actors/stylesheets.js
@@ -18,16 +18,17 @@ const events = require("sdk/event/core")
 const protocol = require("devtools/server/protocol");
 const {Arg, Option, method, RetVal, types} = protocol;
 const {LongStringActor, ShortLongString} = require("devtools/server/actors/string");
 
 loader.lazyGetter(this, "CssLogic", () => require("devtools/styleinspector/css-logic").CssLogic);
 
 let TRANSITION_CLASS = "moz-styleeditor-transitioning";
 let TRANSITION_DURATION_MS = 500;
+let TRANSITION_BUFFER_MS = 1000;
 let TRANSITION_RULE = "\
 :root.moz-styleeditor-transitioning, :root.moz-styleeditor-transitioning * {\
 transition-duration: " + TRANSITION_DURATION_MS + "ms !important; \
 transition-delay: 0ms !important;\
 transition-timing-function: ease-out !important;\
 transition-property: all !important;\
 }";
 
@@ -746,20 +747,20 @@ let StyleSheetActor = protocol.ActorClas
     // it only when all pending StyleSheets-generated transitions ended.
     if (this._transitionRefCount == 0) {
       this.rawSheet.insertRule(TRANSITION_RULE, this.rawSheet.cssRules.length);
       this.document.documentElement.classList.add(TRANSITION_CLASS);
     }
 
     this._transitionRefCount++;
 
-    // Set up clean up and commit after transition duration (+10% buffer)
+    // Set up clean up and commit after transition duration (+buffer)
     // @see _onTransitionEnd
     this.window.setTimeout(this._onTransitionEnd.bind(this),
-                           Math.floor(TRANSITION_DURATION_MS * 1.1));
+                           TRANSITION_DURATION_MS + TRANSITION_BUFFER_MS);
   },
 
   /**
    * This cleans up class and rule added for transition effect and then
    * notifies that the style has been applied.
    */
   _onTransitionEnd: function()
   {