Index: Source/core/layout/LayoutBlockFlow.cpp |
diff --git a/Source/core/layout/LayoutBlockFlow.cpp b/Source/core/layout/LayoutBlockFlow.cpp |
index 1b07bd2e6254cef617e69ca710f4141f59067539..0f0156ca07bb95dd2b9eb28a4ef600c7462d5579 100644 |
--- a/Source/core/layout/LayoutBlockFlow.cpp |
+++ b/Source/core/layout/LayoutBlockFlow.cpp |
@@ -548,13 +548,16 @@ void LayoutBlockFlow::layoutBlockChild(LayoutBox& child, MarginInfo& marginInfo, |
// Cache if we are at the top of the block right now. |
bool atBeforeSideOfBlock = marginInfo.atBeforeSideOfBlock(); |
bool childIsSelfCollapsing = child.isSelfCollapsingBlock(); |
+ bool childDiscardMarginBefore = mustDiscardMarginBeforeForChild(child); |
+ bool childDiscardMarginAfter = mustDiscardMarginAfterForChild(child); |
// Now determine the correct ypos based off examination of collapsing margin |
// values. |
- LayoutUnit logicalTopBeforeClear = collapseMargins(child, marginInfo, childIsSelfCollapsing); |
+ LayoutUnit logicalTopBeforeClear = collapseMargins(child, marginInfo, childIsSelfCollapsing, childDiscardMarginBefore, childDiscardMarginAfter); |
// Now check for clear. |
- LayoutUnit logicalTopAfterClear = clearFloatsIfNeeded(child, marginInfo, oldPosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear, childIsSelfCollapsing); |
+ bool childDiscardMargin = childDiscardMarginBefore || childDiscardMarginAfter; |
+ LayoutUnit logicalTopAfterClear = clearFloatsIfNeeded(child, marginInfo, oldPosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear, childIsSelfCollapsing, childDiscardMargin); |
bool paginated = view()->layoutState()->isPaginated(); |
if (paginated) { |
@@ -1116,11 +1119,8 @@ LayoutBlockFlow::MarginValues LayoutBlockFlow::marginValuesForChild(LayoutBox& c |
return LayoutBlockFlow::MarginValues(childBeforePositive, childBeforeNegative, childAfterPositive, childAfterNegative); |
} |
-LayoutUnit LayoutBlockFlow::collapseMargins(LayoutBox& child, MarginInfo& marginInfo, bool childIsSelfCollapsing) |
+LayoutUnit LayoutBlockFlow::collapseMargins(LayoutBox& child, MarginInfo& marginInfo, bool childIsSelfCollapsing, bool childDiscardMarginBefore, bool childDiscardMarginAfter) |
{ |
- bool childDiscardMarginBefore = mustDiscardMarginBeforeForChild(child); |
- bool childDiscardMarginAfter = mustDiscardMarginAfterForChild(child); |
- |
// The child discards the before margin when the the after margin has discard in the case of a self collapsing block. |
childDiscardMarginBefore = childDiscardMarginBefore || (childDiscardMarginAfter && childIsSelfCollapsing); |
@@ -1298,7 +1298,7 @@ void LayoutBlockFlow::adjustPositionedBlock(LayoutBox& child, const MarginInfo& |
childLayer->setStaticBlockPosition(logicalTop); |
} |
-LayoutUnit LayoutBlockFlow::clearFloatsIfNeeded(LayoutBox& child, MarginInfo& marginInfo, LayoutUnit oldTopPosMargin, LayoutUnit oldTopNegMargin, LayoutUnit yPos, bool childIsSelfCollapsing) |
+LayoutUnit LayoutBlockFlow::clearFloatsIfNeeded(LayoutBox& child, MarginInfo& marginInfo, LayoutUnit oldTopPosMargin, LayoutUnit oldTopNegMargin, LayoutUnit yPos, bool childIsSelfCollapsing, bool childDiscardMargin) |
{ |
LayoutUnit heightIncrease = getClearDelta(&child, yPos); |
marginInfo.setLastChildIsSelfCollapsingBlockWithClearance(false); |
@@ -1308,7 +1308,6 @@ LayoutUnit LayoutBlockFlow::clearFloatsIfNeeded(LayoutBox& child, MarginInfo& ma |
if (childIsSelfCollapsing) { |
marginInfo.setLastChildIsSelfCollapsingBlockWithClearance(true); |
- bool childDiscardMargin = mustDiscardMarginBeforeForChild(child) || mustDiscardMarginAfterForChild(child); |
marginInfo.setDiscardMargin(childDiscardMargin); |
// For self-collapsing blocks that clear, they can still collapse their |