Bug 1161215 - Don't fire spurious resize events to content when the size didn't actually change. r=smaug
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 07 May 2015 16:02:38 -0400
changeset 274247 e76f9c955db8c5eee5409d8bb62242ad335ac130
parent 274246 f326f7d6ff52d94a7e49008b50a810df86f82109
child 274248 f009f29b2311aa7f75c0fb3d92d23d6f6c25f963
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1161215
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1161215 - Don't fire spurious resize events to content when the size didn't actually change. r=smaug
dom/ipc/TabChild.cpp
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -2024,18 +2024,21 @@ TabChild::RecvUpdateDimensions(const nsI
         return true;
     }
 
     mOuterRect = rect;
     mChromeDisp = chromeDisp;
 
     bool initialSizing = !HasValidInnerSize()
                       && (size.width != 0 && size.height != 0);
+    bool sizeChanged = true;
     if (initialSizing) {
       mHasValidInnerSize = true;
+    } else if (mInnerSize == size) {
+      sizeChanged = false;
     }
 
     mOrientation = orientation;
     ScreenIntSize oldScreenSize = mInnerSize;
     mInnerSize = size;
     mWidget->Resize(rect.x + chromeDisp.x, rect.y + chromeDisp.y, size.width, size.height,
                      true);
 
@@ -2046,17 +2049,19 @@ TabChild::RecvUpdateDimensions(const nsI
     if (initialSizing && mContentDocumentIsDisplayed) {
       // If this is the first time we're getting a valid mInnerSize, and the
       // before-first-paint event has already been handled, then we need to set
       // up our default viewport here. See the corresponding call to
       // InitializeRootMetrics in the before-first-paint handler.
       InitializeRootMetrics();
     }
 
-    HandlePossibleViewportChange(oldScreenSize);
+    if (sizeChanged) {
+      HandlePossibleViewportChange(oldScreenSize);
+    }
 
     return true;
 }
 
 bool
 TabChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics)
 {
   return TabChildBase::UpdateFrameHandler(aFrameMetrics);