+2006-09-19 David Hyatt <hyatt@apple.com>
+
+ Refine the fix for 9805 to really get all the complex cases right.
+
+ Reviewed by Eric
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::clearFloatsIfNeeded):
+ (WebCore::RenderBlock::handleBottomOfBlock):
+
2006-09-18 David Hyatt <hyatt@apple.com>
Fix for 9805, <hr> not positioned properly following a previous empty sibling
// The child needs to be lowered. Move the child so that it just clears the float.
child->setPos(child->xPos(), child->yPos() + heightIncrease);
- // Increase our height by the amount we had to clear.
- m_height += heightIncrease;
if (child->isSelfCollapsingBlock()) {
// For self-collapsing blocks that clear, they can still collapse their
// margins with following siblings. Reset the current margins to represent
// the self-collapsing block's margins only.
marginInfo.setPosMargin(max(child->maxTopMargin(true), child->maxBottomMargin(true)));
marginInfo.setNegMargin(max(child->maxTopMargin(false), child->maxBottomMargin(false)));
+
+ // Adjust our height such that we are ready to be collapsed with subsequent siblings.
+ m_height = child->yPos() - max(0, marginInfo.margin());
+
+ // Set a flag that we cleared a float so that we know both to increase the height of the block
+ // to compensate for the clear and to avoid collapsing our margins with the parent block's
+ // bottom margin.
marginInfo.setSelfCollapsingBlockClearedFloat(true);
- }
+ } else
+ // Increase our height by the amount we had to clear.
+ m_height += heightIncrease;
if (marginInfo.canCollapseWithTop()) {
// We can no longer collapse with the top of the block since a clear
// collapse it with the bottom of the block.
if (!marginInfo.selfCollapsingBlockClearedFloat())
marginInfo.setAtBottomOfBlock(true);
+ else {
+ // We have to special case the negative margin situation (where the collapsed
+ // margin of the self-collapsing block is negative), since there's no need
+ // to make an adjustment in that case.
+ if (marginInfo.margin() < 0)
+ marginInfo.clearMargin();
+ }
// If we can't collapse with children then go ahead and add in the bottom margin.
if (!marginInfo.canCollapseWithBottom() && !marginInfo.canCollapseWithTop()