Merge relanding of bug 114649.
authorL. David Baron <dbaron@dbaron.org>
Wed, 01 Oct 2008 20:12:08 -0700
changeset 20070 a1c4e010b83f
parent 20068 4ed163dabf93 (current diff)
parent 20069 115934f340f0 (diff)
child 20071 6ec53662fbef
push id2620
push userdbaron@mozilla.com
push dateThu, 02 Oct 2008 03:12:35 +0000
treeherdermozilla-central@a1c4e010b83f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs114649
milestone1.9.1b1pre
Merge relanding of bug 114649.
--- 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);
   }
--- a/layout/base/tests/test_bug114649.html
+++ b/layout/base/tests/test_bug114649.html
@@ -50,18 +50,18 @@ function do_a_resize()
 
 function handle_child_resize()
 {
     gGotEventsAt.push(gCurrentWidth);
 }
 
 function check_for_resize_events()
 {
-	todo(gGotEventsAt.length >= 2, "got continuous events");
-	todo_isnot(gGotEventsAt[0], 400, "got continuous events");
+	ok(gGotEventsAt.length >= 2, "got continuous events");
+	isnot(gGotEventsAt[0], 400, "got continuous events");
 	is(gGotEventsAt[gGotEventsAt.length - 1], 400, "got last event");
 	SimpleTest.finish();
 }
 
 </script>
 </pre>
 </body>
 </html>