Bug 398144 - Make blocks that are margin-roots never consider themselves empty. [p=roc r+sr=dbaron a=blocking1.9+]
authorreed@reedloden.com
Wed, 07 Nov 2007 19:55:12 -0800
changeset 7674 886e325f9f492247f3630d6e04e8d06e741c9e37
parent 7673 1a2839b5883eae90a78311af016cb8fb1db340d3
child 7675 4dbcc28ce7dfa252f78bb71395840abf085f123e
push idunknown
push userunknown
push dateunknown
reviewersblocking1.9
bugs398144
milestone1.9b2pre
Bug 398144 - Make blocks that are margin-roots never consider themselves empty. [p=roc r+sr=dbaron a=blocking1.9+]
layout/generic/nsBlockFrame.cpp
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -2569,16 +2569,22 @@ IsMarginZero(nsStyleUnit aUnit, nsStyleC
     return (aUnit == eStyleUnit_Auto ||
             (aUnit == eStyleUnit_Coord && aCoord.GetCoordValue() == 0) ||
             (aUnit == eStyleUnit_Percent && aCoord.GetPercentValue() == 0.0));
 }
 
 /* virtual */ PRBool
 nsBlockFrame::IsSelfEmpty()
 {
+  // Blocks which are margin-roots (including inline-blocks) cannot be treated
+  // as empty for margin-collapsing and other purposes. They're more like
+  // replaced elements.
+  if (GetStateBits() & NS_BLOCK_MARGIN_ROOT)
+    return PR_FALSE;
+
   const nsStylePosition* position = GetStylePosition();
 
   switch (position->mMinHeight.GetUnit()) {
     case eStyleUnit_Coord:
       if (position->mMinHeight.GetCoordValue() != 0)
         return PR_FALSE;
       break;
     case eStyleUnit_Percent: