Bug 1577258 - early-return for noop resizes. r=botond
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 28 Aug 2019 22:03:26 +0000
changeset 490487 907ee4a0aa61f2ef1dc60e9abb3c21971a00eaa4
parent 490486 28ed211ab542dfb8c750688701f1353db47a912e
child 490488 170a5ba09a6f9847405bc522b4984f33dface562
push id36504
push userccoroiu@mozilla.com
push dateThu, 29 Aug 2019 04:08:39 +0000
treeherdermozilla-central@7004b8779a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1577258
milestone70.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 1577258 - early-return for noop resizes. r=botond This avoids doing wasted work and sending spurious resize events if this case would be hit. In practice, it cannot be hit yet, I think, because callers do check for this and bail out earlier. But there's no assertion to that respect so this shouldn't hurt. Differential Revision: https://phabricator.services.mozilla.com/D43798
layout/base/PresShell.cpp
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -1858,16 +1858,20 @@ nsresult PresShell::ResizeReflow(nscoord
 }
 
 nsresult PresShell::ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight,
                                                nscoord aOldWidth,
                                                nscoord aOldHeight,
                                                ResizeReflowOptions aOptions) {
   MOZ_ASSERT(!mIsReflowing, "Shouldn't be in reflow here!");
 
+  if (aWidth == aOldWidth && aHeight == aOldHeight) {
+    return NS_OK;
+  }
+
   nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
   if (!rootFrame) {
     // If we don't have a root frame yet, that means we haven't had our initial
     // reflow... If that's the case, and aWidth or aHeight is unconstrained,
     // ignore them altogether.
     if (aHeight == NS_UNCONSTRAINEDSIZE || aWidth == NS_UNCONSTRAINEDSIZE) {
       // We can't do the work needed for SizeToContent without a root
       // frame, and we want to return before setting the visible area.