Back out patches 2 and 3 of bug 759755 for causing intermittent failures of layout/reftests/font-inflation/container-with-clamping.html .
authorL. David Baron <dbaron@dbaron.org>
Sun, 10 Jun 2012 17:36:18 -0700
changeset 101134 af2a59c2334728db194971a51392b5eb27a70b9d
parent 101133 8d57c055f951a32e903888e81ed2b07fb3b49f45
child 101135 6aab5d7f2cc78dafcf7dc485a216a10ab431216e
child 101155 75b67011b798fb0ab754da5ced223dd0d0eb996a
child 101357 c823ffa89a339c64a3cd219d3399e81219219200
push id1316
push userakeybl@mozilla.com
push dateMon, 27 Aug 2012 22:37:00 +0000
treeherdermozilla-beta@db4b09302ee2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs759755
milestone16.0a1
first release with
nightly linux32
af2a59c23347 / 16.0a1 / 20120611030526 / files
nightly linux64
af2a59c23347 / 16.0a1 / 20120611030526 / files
nightly mac
af2a59c23347 / 16.0a1 / 20120611030526 / files
nightly win32
af2a59c23347 / 16.0a1 / 20120611030526 / files
nightly win64
af2a59c23347 / 16.0a1 / 20120611030526 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Back out patches 2 and 3 of bug 759755 for causing intermittent failures of layout/reftests/font-inflation/container-with-clamping.html .
dom/base/nsDOMWindowUtils.cpp
layout/base/nsPresShell.cpp
layout/generic/nsFontInflationData.cpp
layout/generic/nsFontInflationData.h
layout/generic/nsHTMLReflowState.cpp
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -277,18 +277,17 @@ MaybeReflowForInflationScreenWidthChange
             mudv->AppendSubtree(array);
             for (PRUint32 i = 0, iEnd = array.Length(); i < iEnd; ++i) {
               nsCOMPtr<nsIPresShell> shell;
               nsCOMPtr<nsIContentViewer> cv = do_QueryInterface(array[i]);
               cv->GetPresShell(getter_AddRefs(shell));
               if (shell) {
                 nsIFrame *rootFrame = shell->GetRootFrame();
                 if (rootFrame) {
-                  shell->FrameNeedsReflow(rootFrame,
-                                          nsIPresShell::eStyleChange,
+                  shell->FrameNeedsReflow(rootFrame, nsIPresShell::eResize,
                                           NS_FRAME_IS_DIRTY);
                 }
               }
             }
           }
         }
       }
     }
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -2511,18 +2511,16 @@ PresShell::FrameNeedsReflow(nsIFrame *aF
            a && !FRAME_IS_REFLOW_ROOT(a);
            a = a->GetParent())
         a->MarkIntrinsicWidthsDirty();
     }
 
     if (aIntrinsicDirty == eStyleChange) {
       // Mark all descendants dirty (using an nsTArray stack rather than
       // recursion).
-      // Note that nsHTMLReflowState::InitResizeFlags has some similar
-      // code; see comments there for how and why it differs.
       nsAutoTArray<nsIFrame*, 32> stack;
       stack.AppendElement(subtreeRoot);
 
       do {
         nsIFrame *f = stack.ElementAt(stack.Length() - 1);
         stack.RemoveElementAt(stack.Length() - 1);
 
         if (f->GetType() == nsGkAtoms::placeholderFrame) {
--- a/layout/generic/nsFontInflationData.cpp
+++ b/layout/generic/nsFontInflationData.cpp
@@ -33,41 +33,31 @@ nsFontInflationData::FindFontInflationDa
   const nsIFrame *bfc = FlowRootFor(aFrame);
   NS_ASSERTION(bfc->GetStateBits() & NS_FRAME_FONT_INFLATION_FLOW_ROOT,
                "should have found a flow root");
 
   return static_cast<nsFontInflationData*>(
              bfc->Properties().Get(FontInflationDataProperty()));
 }
 
-/* static */ bool
+/* static */ void
 nsFontInflationData::UpdateFontInflationDataWidthFor(const nsHTMLReflowState& aReflowState)
 {
   nsIFrame *bfc = aReflowState.frame;
   NS_ASSERTION(bfc->GetStateBits() & NS_FRAME_FONT_INFLATION_FLOW_ROOT,
                "should have been given a flow root");
   FrameProperties bfcProps(bfc->Properties());
   nsFontInflationData *data = static_cast<nsFontInflationData*>(
                                 bfcProps.Get(FontInflationDataProperty()));
-  bool oldInflationEnabled;
-  nscoord oldNCAWidth;
-  if (data) {
-    oldNCAWidth = data->mNCAWidth;
-    oldInflationEnabled = data->mInflationEnabled;
-  } else {
+  if (!data) {
     data = new nsFontInflationData(bfc);
     bfcProps.Set(FontInflationDataProperty(), data);
-    oldNCAWidth = -1;
-    oldInflationEnabled = true; /* not relevant */
   }
 
   data->UpdateWidth(aReflowState);
-
-  return oldNCAWidth != data->mNCAWidth ||
-         oldInflationEnabled != data->mInflationEnabled;
 }
 
 /* static */ void
 nsFontInflationData::MarkFontInflationDataTextDirty(nsIFrame *aBFCFrame)
 {
   NS_ASSERTION(aBFCFrame->GetStateBits() & NS_FRAME_FONT_INFLATION_FLOW_ROOT,
                "should have been given a flow root");
 
--- a/layout/generic/nsFontInflationData.h
+++ b/layout/generic/nsFontInflationData.h
@@ -15,19 +15,17 @@
 struct nsHTMLReflowState;
 
 class nsFontInflationData
 {
 public:
 
   static nsFontInflationData* FindFontInflationDataFor(const nsIFrame *aFrame);
 
-  // Returns whether the effective width changed (which requires the
-  // caller to mark its descendants dirty
-  static bool
+  static void
     UpdateFontInflationDataWidthFor(const nsHTMLReflowState& aReflowState);
 
   static void MarkFontInflationDataTextDirty(nsIFrame *aFrame);
 
   bool InflationEnabled() {
     if (mTextDirty) {
       ScanText();
     }
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -303,16 +303,22 @@ nsHTMLReflowState::Init(nsPresContext* a
 
   NS_WARN_IF_FALSE((mFrameType == NS_CSS_FRAME_TYPE_INLINE &&
                     !frame->IsFrameOfType(nsIFrame::eReplaced)) ||
                    type == nsGkAtoms::textFrame ||
                    mComputedWidth != NS_UNCONSTRAINEDSIZE,
                    "have unconstrained width; this should only result from "
                    "very large sizes, not attempts at intrinsic width "
                    "calculation");
+
+  if (frame->GetStateBits() & NS_FRAME_FONT_INFLATION_FLOW_ROOT) {
+    // Create our font inflation data if we don't have it already, and
+    // give it our current width information.
+    nsFontInflationData::UpdateFontInflationDataWidthFor(*this);
+  }
 }
 
 void nsHTMLReflowState::InitCBReflowState()
 {
   if (!parentReflowState) {
     mCBReflowState = nsnull;
     return;
   }
@@ -356,97 +362,44 @@ IsQuirkContainingBlockHeight(const nsHTM
   }
   return true;
 }
 
 
 void
 nsHTMLReflowState::InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameType)
 {
-  if ((frame->GetStateBits() & NS_FRAME_FONT_INFLATION_FLOW_ROOT) &&
-      nsLayoutUtils::FontSizeInflationEnabled(aPresContext)) {
-    // Create our font inflation data if we don't have it already, and
-    // give it our current width information.
-    bool dirty = nsFontInflationData::UpdateFontInflationDataWidthFor(*this);
-    if (dirty) {
-      // When font size inflation is enabled, the change in the width of a
-      // block (or anything that returns true in
-      // IsContainerForFontSizeInflation) needs to cause a dirty reflow
-      // since it changes the size of text, line-heights, etc.  This is
-      // relatively similar to a classic case of style change reflow,
-      // except that because inflation doesn't affect the intrinsic sizing
-      // codepath, there's no need to invalidate intrinsic sizes.
-      //
-      // Note that this makes horizontal resizing a good bit more
-      // expensive.  However, font size inflation is targeted at a set of
-      // devices (zoom-and-pan devices) where the main use case for
-      // horizontal resizing needing to be efficient (window resizing) is
-      // not present.  It does still increase the cost of dynamic changes
-      // caused by script where a style or content change in one place
-      // causes a resize in another (e.g., rebalancing a table).
-
-      // FIXME: This isn't so great for the cases where
-      // nsHTMLReflowState::SetComputedWidth is called, if the first time
-      // we go through InitResizeFlags we set mHResize to true, and then
-      // the second time we'd set it to false even without the
-      // NS_FRAME_IS_DIRTY bit already set.
-      if (frame->GetType() == nsGkAtoms::svgForeignObjectFrame) {
-        // Foreign object frames use dirty bits in a special way.
-        frame->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
-        nsIFrame *kid = frame->GetFirstPrincipalChild();
-        if (kid) {
-          kid->AddStateBits(NS_FRAME_IS_DIRTY);
-        }
-      } else {
-        frame->AddStateBits(NS_FRAME_IS_DIRTY);
-      }
-
-      // Mark intrinsic widths on all descendants dirty.  We need to do
-      // this (1) since we're changing the size of text and need to
-      // clear text runs on text frames and (2) since we actually are
-      // changing some intrinsic widths, but only those that live inside
-      // of containers.
-
-      // It makes sense to do this for descendants but not ancestors
-      // (which is unusual) because we're only changing the unusual
-      // inflation-dependent intrinsic widths (i.e., ones computed with
-      // nsPresContext::mInflationDisabledForShrinkWrap set to false),
-      // which should never affect anything outside of their inflation
-      // flow root (or, for that matter, even their inflation
-      // container).
-
-      // This is also different from what PresShell::FrameNeedsReflow
-      // does because it doesn't go through placeholders.  It doesn't
-      // need to because we're actually doing something that cares about
-      // frame tree geometry (the width on an ancestor) rather than
-      // style.
-
-      nsAutoTArray<nsIFrame*, 32> stack;
-      stack.AppendElement(frame);
-
-      do {
-        nsIFrame *f = stack.ElementAt(stack.Length() - 1);
-        stack.RemoveElementAt(stack.Length() - 1);
-
-        nsIFrame::ChildListIterator lists(f);
-        for (; !lists.IsDone(); lists.Next()) {
-          nsFrameList::Enumerator childFrames(lists.CurrentList());
-          for (; !childFrames.AtEnd(); childFrames.Next()) {
-            nsIFrame* kid = childFrames.get();
-            kid->MarkIntrinsicWidthsDirty();
-            stack.AppendElement(kid);
-          }
-        }
-      } while (stack.Length() != 0);
-    }
-  }
-
   mFlags.mHResize = !(frame->GetStateBits() & NS_FRAME_IS_DIRTY) &&
                     frame->GetSize().width !=
                       mComputedWidth + mComputedBorderPadding.LeftRight();
+  if (mFlags.mHResize &&
+      nsLayoutUtils::FontSizeInflationEnabled(aPresContext)) {
+    // When font size inflation is enabled, the change in the width of a
+    // block (or anything that returns true in
+    // IsContainerForFontSizeInflation) needs to cause a dirty reflow
+    // since it changes the size of text, line-heights, etc.  This is
+    // relatively similar to a classic case of style change reflow,
+    // except that because inflation doesn't affect the intrinsic sizing
+    // codepath, there's no need to invalidate intrinsic sizes.
+    //
+    // Note that this makes horizontal resizing a good bit more
+    // expensive.  However, font size inflation is targeted at a set of
+    // devices (zoom-and-pan devices) where the main use case for
+    // horizontal resizing needing to be efficient (window resizing) is
+    // not present.  It does still increase the cost of dynamic changes
+    // caused by script where a style or content change in one place
+    // causes a resize in another (e.g., rebalancing a table).
+
+    // FIXME: This isn't so great for the cases where
+    // nsHTMLReflowState::SetComputedWith is called, if the first time
+    // we go through InitResizeFlags we set mHResize to true, and then
+    // the second time we'd set it to false even without the
+    // NS_FRAME_IS_DIRTY bit already set.
+    frame->AddStateBits(NS_FRAME_IS_DIRTY);
+  }
 
   // XXX Should we really need to null check mCBReflowState?  (We do for
   // at least nsBoxFrame).
   if (IS_TABLE_CELL(aFrameType) &&
       (mFlags.mSpecialHeightReflow ||
        (frame->GetFirstInFlow()->GetStateBits() &
          NS_TABLE_CELL_HAD_SPECIAL_REFLOW)) &&
       (frame->GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_HEIGHT)) {