Bug 385823 - Let us call NotifyPercentHeight even when computed height is already set, because it'll be set on imageFrames. r+sr=dbaron, a=beltzner
authordholbert@cs.stanford.edu
Tue, 06 Nov 2007 14:47:29 -0800
changeset 7370 a6a8d719df9dbe7666a06e6aff50173bbbddb065
parent 7369 cd61c091c792c08a241c832b1c1d024960e9016c
child 7371 a30b18e229742bd96032213073d2c1820b398924
push idunknown
push userunknown
push dateunknown
reviewersbeltzner
bugs385823
milestone1.9a9pre
Bug 385823 - Let us call NotifyPercentHeight even when computed height is already set, because it'll be set on imageFrames. r+sr=dbaron, a=beltzner
layout/generic/nsFrame.cpp
layout/tables/nsTableCellFrame.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -3155,24 +3155,21 @@ nsFrame::DidReflow(nsPresContext*       
 {
   NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS,
                      ("nsFrame::DidReflow: aStatus=%d", aStatus));
   if (NS_FRAME_REFLOW_FINISHED == aStatus) {
     mState &= ~(NS_FRAME_IN_REFLOW | NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
                 NS_FRAME_HAS_DIRTY_CHILDREN);
   }
 
-  // Notify the percent height observer if there is a percent height
-  // but no computed height. The observer may be able to initiate
-  // another reflow with a computed height. This happens in the case
-  // where a table cell has no computed height but can fabricate one
-  // when the cell height is known.
+  // Notify the percent height observer if there is a percent height.
+  // The observer may be able to initiate another reflow with a computed
+  // height. This happens in the case where a table cell has no computed
+  // height but can fabricate one when the cell height is known.
   if (aReflowState && aReflowState->mPercentHeightObserver &&
-      ((NS_UNCONSTRAINEDSIZE == aReflowState->ComputedHeight()) ||         // no computed height 
-       (0                    == aReflowState->ComputedHeight()))        && 
       (eStyleUnit_Percent == aReflowState->mStylePosition->mHeight.GetUnit())) {
 
     nsIFrame* prevInFlow = GetPrevInFlow();
     if (!prevInFlow) { // 1st in flow
       aReflowState->mPercentHeightObserver->NotifyPercentHeight(*aReflowState);
     }
   }
 
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -830,20 +830,26 @@ NS_METHOD nsTableCellFrame::Reflow(nsPre
     }
   }      
   else {
     SetHasPctOverHeight(PR_FALSE);
   }
 
   nsHTMLReflowState kidReflowState(aPresContext, aReflowState, firstKid,
                                    availSize);
-  // mIPercentHeightObserver is for children of cells in quirks mode,
-  // but only those than are tables in standards mode.  NeedsToObserve
-  // will determine how far this is propagated to descendants.
-  kidReflowState.mPercentHeightObserver = this;
+
+  // Don't be a percent height observer if we're in the middle of
+  // special-height reflow, in case we get an accidental NotifyPercentHeight()
+  // call (which we shouldn't honor during special-height reflow)
+  if (!aReflowState.mFlags.mSpecialHeightReflow) {
+    // mPercentHeightObserver is for children of cells in quirks mode,
+    // but only those than are tables in standards mode.  NeedsToObserve
+    // will determine how far this is propagated to descendants.
+    kidReflowState.mPercentHeightObserver = this;
+  }
   // Don't propagate special height reflow state to our kids
   kidReflowState.mFlags.mSpecialHeightReflow = PR_FALSE;
   
   if (aReflowState.mFlags.mSpecialHeightReflow ||
       (GetFirstInFlow()->GetStateBits() & NS_TABLE_CELL_HAD_SPECIAL_REFLOW)) {
     // We need to force the kid to have mVResize set if we've had a
     // special reflow in the past, since the non-special reflow needs to
     // resize back to what it was without the special height reflow.