Bug 1393116 - In ResizeReflow, check width too, when refusing SizeToContent without root frame draft
authorangelsl <angelsl@in04.sg>
Thu, 21 Sep 2017 22:35:48 +0800
changeset 683953 974ab62c9fd5b56fbe4bb364129c08a93842abe5
parent 683863 d1e995c8640a191cd127e87273ec96cb2fabffa9
child 683954 9aab49fa4d4b1ed05fc694a4d75d0e31669e4410
push id85522
push userbmo:angelsl@in04.sg
push dateFri, 20 Oct 2017 16:34:02 +0000
bugs1393116
milestone58.0a1
Bug 1393116 - In ResizeReflow, check width too, when refusing SizeToContent without root frame MozReview-Commit-ID: 91D1cUB2JmW
layout/base/PresShell.cpp
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -1891,17 +1891,18 @@ nsresult
 PresShell::ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight, nscoord aOldWidth, nscoord aOldHeight)
 {
   NS_PRECONDITION(!mIsReflowing, "Shouldn't be in reflow here!");
 
   // 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.
   nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
-  if (!rootFrame && aHeight == NS_UNCONSTRAINEDSIZE) {
+  if (!rootFrame &&
+      (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.
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   mPresContext->SetVisibleArea(nsRect(0, 0, aWidth, aHeight));
 
   // There isn't anything useful we can do if the initial reflow hasn't happened.