diff -NrpU12 mozilla-trunk.0fd506b24a52/layout/generic/nsFrame.cpp mozilla-trunk/layout/generic/nsFrame.cpp --- mozilla-trunk.0fd506b24a52/layout/generic/nsFrame.cpp 2008-03-13 10:44:20.000000000 +1300 +++ mozilla-trunk/layout/generic/nsFrame.cpp 2008-03-13 10:44:20.000000000 +1300 @@ -5845,50 +5845,25 @@ nsFrame::RefreshSizeCache(nsBoxLayoutSta rect.x, rect.y, metrics->mBlockPrefSize.width, NS_UNCONSTRAINEDSIZE); nsRect newRect = GetRect(); // make sure we draw any size change if (oldRect.width != newRect.width || oldRect.height != newRect.height) { newRect.x = 0; newRect.y = 0; Redraw(aState, &newRect); } - metrics->mBlockMinSize.height = 0; - // ok we need the max ascent of the items on the line. So to do this - // ask the block for its line iterator. Get the max ascent. - nsCOMPtr lines = do_QueryInterface(static_cast(this)); - if (lines) - { - metrics->mBlockMinSize.height = 0; - int count = 0; - nsIFrame* firstFrame = nsnull; - PRInt32 framesOnLine; - nsRect lineBounds; - PRUint32 lineFlags; - - do { - lines->GetLine(count, &firstFrame, &framesOnLine, lineBounds, &lineFlags); - - if (lineBounds.height > metrics->mBlockMinSize.height) - metrics->mBlockMinSize.height = lineBounds.height; - - count++; - } while(firstFrame); - } else { - metrics->mBlockMinSize.height = desiredSize.height; - } - - metrics->mBlockPrefSize.height = metrics->mBlockMinSize.height; + metrics->mBlockMinSize.height = metrics->mBlockPrefSize.height = newRect.height; if (desiredSize.ascent == nsHTMLReflowMetrics::ASK_FOR_BASELINE) { if (!nsLayoutUtils::GetFirstLineBaseline(this, &metrics->mBlockAscent)) metrics->mBlockAscent = GetBaseline(); } else { metrics->mBlockAscent = desiredSize.ascent; } #ifdef DEBUG_adaptor printf("min=(%d,%d), pref=(%d,%d), ascent=%d\n", metrics->mBlockMinSize.width, metrics->mBlockMinSize.height, metrics->mBlockPrefSize.width, diff -NrpU12 mozilla-trunk.0fd506b24a52/layout/reftests/bugs/413027-2-ref.html mozilla-trunk/layout/reftests/bugs/413027-2-ref.html --- mozilla-trunk.0fd506b24a52/layout/reftests/bugs/413027-2-ref.html 1970-01-01 12:00:00.000000000 +1200 +++ mozilla-trunk/layout/reftests/bugs/413027-2-ref.html 2008-03-13 10:44:20.000000000 +1300 @@ -0,0 +1,12 @@ + + + + +
+
+ +
+
+ + + diff -NrpU12 mozilla-trunk.0fd506b24a52/layout/reftests/bugs/413027-2.html mozilla-trunk/layout/reftests/bugs/413027-2.html --- mozilla-trunk.0fd506b24a52/layout/reftests/bugs/413027-2.html 1970-01-01 12:00:00.000000000 +1200 +++ mozilla-trunk/layout/reftests/bugs/413027-2.html 2008-03-13 10:44:20.000000000 +1300 @@ -0,0 +1,12 @@ + + + + +
+
+ +
+
+ + + diff -NrpU12 mozilla-trunk.0fd506b24a52/layout/reftests/bugs/reftest.list mozilla-trunk/layout/reftests/bugs/reftest.list --- mozilla-trunk.0fd506b24a52/layout/reftests/bugs/reftest.list 2008-03-13 10:44:20.000000000 +1300 +++ mozilla-trunk/layout/reftests/bugs/reftest.list 2008-03-13 10:44:20.000000000 +1300 @@ -711,25 +712,26 @@ random == 403134-1.html 403134-1-ref.htm == 408782-2b.html 408782-2-ref.html == 409659-1a.html 409659-1-ref.html != 409659-1b.html 409659-1-ref.html != 409659-1c.html 409659-1-ref.html == 409659-1d.html 409659-1-ref.html == 411334-1.xml 411334-1-ref.xml == 411792-1.html 411792-1-ref.html == 412093-1.html 412093-1-ref.html == 412607-1a.html 412607-1-ref.html == 412607-1b.html 412607-1-ref.html == 412679-1.html 412679-1-ref.html == 412679-2.html 412679-2-ref.html -# == 413027-1.html 413027-1-ref.html +== 413027-1.html 413027-1-ref.html +== 413027-2.html 413027-2-ref.html == 413286-1a.html 413286-1-ref.html == 413286-1b.html 413286-1-ref.html == 413286-1c.html 413286-1-ref.html == 413286-2a.html 413286-2-ref.html == 413286-2b.html 413286-2-ref.html == 413286-2c.html 413286-2-ref.html == 413286-3.html 413286-3-ref.html == 413286-4a.html 413286-4-ref.html == 413286-4b.html 413286-4-ref.html == 413286-5.html 413286-5-ref.html == 413286-6.html 413286-6-ref.html == 413292-1.html 413292-1-ref.html diff -NrpU12 mozilla-trunk.0fd506b24a52/layout/xul/base/src/nsSprocketLayout.cpp mozilla-trunk/layout/xul/base/src/nsSprocketLayout.cpp --- mozilla-trunk.0fd506b24a52/layout/xul/base/src/nsSprocketLayout.cpp 2008-03-13 10:44:20.000000000 +1300 +++ mozilla-trunk/layout/xul/base/src/nsSprocketLayout.cpp 2008-03-13 10:44:20.000000000 +1300 @@ -221,24 +221,26 @@ nsSprocketLayout::Layout(nsIBox* aBox, n // -- make sure we remove our border and padding ---- nsRect clientRect; aBox->GetClientRect(clientRect); // |originalClientRect| represents the rect of the entire box (excluding borders // and padding). We store it here because we're going to use |clientRect| to hold // the required size for all our kids. As an example, consider an hbox with a // specified width of 300. If the kids total only 150 pixels of width, then // we have 150 pixels left over. |clientRect| is going to hold a width of 150 and // is going to be adjusted based off the value of the PACK property. If flexible // objects are in the box, then the two rects will match. + // XXX this should really be called "frameBounds" or something, and we + // really only need the size nsRect originalClientRect(clientRect); // The frame state contains cached knowledge about our box, such as our orientation // and direction. nsFrameState frameState = 0; GetFrameState(aBox, frameState); // Build a list of our children's desired sizes and computed sizes nsBoxSize* boxSizes = nsnull; nsComputedBoxSize* computedBoxSizes = nsnull; nscoord maxAscent = aBox->GetBoxAscent(aState); @@ -276,42 +278,43 @@ nsSprocketLayout::Layout(nsIBox* aBox, n } } else { clientRect.height = size; if (clientRect.width < min) clientRect.width = min; if (frameState & NS_STATE_AUTO_STRETCH) { if (clientRect.width > max) clientRect.width = max; } } + // Grow the frame size now if necessary + NS_ASSERTION(clientRect.TopLeft() == originalClientRect.TopLeft(), + "clientRect moved??"); + originalClientRect.UnionRectIncludeEmpty(originalClientRect, clientRect); + // With the sizes computed, now it's time to lay out our children. PRBool needsRedraw = PR_FALSE; PRBool finished; nscoord passes = 0; // We flow children at their preferred locations (along with the appropriate computed flex). // After we flow a child, it is possible that the child will change its size. If/when this happens, // we have to do another pass. Typically only 2 passes are required, but the code is prepared to // do as many passes as are necessary to achieve equilibrium. nscoord x = 0; nscoord y = 0; nscoord origX = 0; nscoord origY = 0; - // |childResized| lets us know if a child changed its size after we attempted to lay it out at - // the specified size. If this happens, we usually have to do another pass. - PRBool childResized = PR_FALSE; - // |passes| stores our number of passes. If for any reason we end up doing more than, say, 10 // passes, we assert to indicate that something is seriously screwed up. passes = 0; do { #ifdef DEBUG_REFLOW if (passes > 0) { AddIndents(); printf("ChildResized doing pass: %d\n", passes); } #endif @@ -540,27 +543,24 @@ nsSprocketLayout::Layout(nsIBox* aBox, n aState, child, childBoxSize, childComputedBoxSize, boxSizes, computedBoxSizes, childRect, newChildRect, clientRect, flexes, finished); - // We note that a child changed size, which means that another pass will be required. - childResized = PR_TRUE; - // Now that a child resized, it's entirely possible that OUR rect is too small. Now we // ensure that |originalClientRect| is grown to accommodate the size of |clientRect|. if (clientRect.width > originalClientRect.width || clientRect.height > originalClientRect.height) { if (clientRect.width > originalClientRect.width) originalClientRect.width = clientRect.width; if (clientRect.height > originalClientRect.height) originalClientRect.height = clientRect.height; } if (!(frameState & NS_STATE_IS_DIRECTION_NORMAL)) { // Our childRect had its XMost() or YMost() (depending on our layout @@ -635,43 +635,41 @@ nsSprocketLayout::Layout(nsIBox* aBox, n nsBoxSize* toDelete = boxSizes; boxSizes = boxSizes->next; delete toDelete; } while(computedBoxSizes) { nsComputedBoxSize* toDelete = computedBoxSizes; computedBoxSizes = computedBoxSizes->next; delete toDelete; } - if (childResized) { - // See if one of our children forced us to get bigger - nsRect tmpClientRect(originalClientRect); - nsMargin bp(0,0,0,0); - aBox->GetBorderAndPadding(bp); - tmpClientRect.Inflate(bp); + // See if one of our children forced us to get bigger + nsRect tmpClientRect(originalClientRect); + nsMargin bp(0,0,0,0); + aBox->GetBorderAndPadding(bp); + tmpClientRect.Inflate(bp); - if (tmpClientRect.width > originalSize.width || tmpClientRect.height > originalSize.height) - { - // if it did reset our bounds. - nsRect bounds(aBox->GetRect()); - if (tmpClientRect.width > originalSize.width) - bounds.width = tmpClientRect.width; + if (tmpClientRect.width > originalSize.width || tmpClientRect.height > originalSize.height) + { + // if it did reset our bounds. + nsRect bounds(aBox->GetRect()); + if (tmpClientRect.width > originalSize.width) + bounds.width = tmpClientRect.width; - if (tmpClientRect.height > originalSize.height) - bounds.height = tmpClientRect.height; + if (tmpClientRect.height > originalSize.height) + bounds.height = tmpClientRect.height; - aBox->SetBounds(aState, bounds); - } + aBox->SetBounds(aState, bounds); } // Because our size grew, we now have to readjust because of box packing. Repack // in order to update our x and y to the correct values. HandleBoxPack(aBox, frameState, x, y, originalClientRect, clientRect); // Compare against our original x and y and only worry about adjusting the children if // we really did have to change the positions because of packing (typically for 'center' // or 'end' pack values). if (x != origX || y != origY) { nsIBox* child = aBox->GetChildBox();