Fire resize events every 200ms during resizing, not just 200ms after resizing stops. (Bug 114649) r+sr=roc
authorJonathan Watt <jwatt@jwatt.org>
Mon, 29 Sep 2008 15:57:38 -0700
changeset 19887 8110e3bae4bf03c2f6771678641ebe0c096cac9e
parent 19886 07da123ca0b317daecc47134c7a643c30c91da89
child 19888 8f53fcb8bde55931bb7a60835f858db3af67bc6a
push id2518
push userdbaron@mozilla.com
push dateMon, 29 Sep 2008 22:58:27 +0000
treeherdermozilla-central@8f53fcb8bde5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs114649
milestone1.9.1b1pre
Fire resize events every 200ms during resizing, not just 200ms after resizing stops. (Bug 114649) r+sr=roc
layout/base/nsPresShell.cpp
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -2576,17 +2576,19 @@ PresShell::ResizeReflow(nscoord aWidth, 
   return NS_OK; //XXX this needs to be real. MMP
 }
 
 #define RESIZE_EVENT_DELAY 200
 
 void
 PresShell::CreateResizeEventTimer ()
 {
-  KillResizeEventTimer();
+  // if we already have a timer set, ignore this call
+  if (mResizeEventTimer)
+    return;
 
   if (mIsDocumentGone)
     return;
 
   mResizeEventTimer = do_CreateInstance("@mozilla.org/timer;1");
   if (mResizeEventTimer) {
     mResizeEventTimer->InitWithFuncCallback(sResizeEventCallback, this, RESIZE_EVENT_DELAY, 
                                             nsITimer::TYPE_ONE_SHOT);
@@ -2612,16 +2614,19 @@ PresShell::sResizeEventCallback(nsITimer
 }
 
 void
 PresShell::FireResizeEvent()
 {
   if (mIsDocumentGone)
     return;
 
+  // allow a new timer to be set
+  mResizeEventTimer = nsnull;
+
   //Send resize event from here.
   nsEvent event(PR_TRUE, NS_RESIZE_EVENT);
   nsEventStatus status = nsEventStatus_eIgnore;
 
   nsPIDOMWindow *window = mDocument->GetWindow();
   if (window) {
     nsEventDispatcher::Dispatch(window, mPresContext, &event, nsnull, &status);
   }