| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 // If an element might be affected by the presence of floats, then alway
s mark it for | 387 // If an element might be affected by the presence of floats, then alway
s mark it for |
| 388 // layout. | 388 // layout. |
| 389 LayoutUnit fb = std::max(previousFloatLogicalBottom, lowestFloatLogicalB
ottom()); | 389 LayoutUnit fb = std::max(previousFloatLogicalBottom, lowestFloatLogicalB
ottom()); |
| 390 if (fb > logicalTopEstimate) | 390 if (fb > logicalTopEstimate) |
| 391 markDescendantsWithFloats = true; | 391 markDescendantsWithFloats = true; |
| 392 } | 392 } |
| 393 | 393 |
| 394 if (childRenderBlockFlow) { | 394 if (childRenderBlockFlow) { |
| 395 if (markDescendantsWithFloats) | 395 if (markDescendantsWithFloats) |
| 396 childRenderBlockFlow->markAllDescendantsWithFloatsForLayout(); | 396 childRenderBlockFlow->markAllDescendantsWithFloatsForLayout(); |
| 397 if (!child->isWritingModeRoot()) | 397 previousFloatLogicalBottom = std::max(previousFloatLogicalBottom, oldLog
icalTop + childRenderBlockFlow->lowestFloatLogicalBottom()); |
| 398 previousFloatLogicalBottom = std::max(previousFloatLogicalBottom, ol
dLogicalTop + childRenderBlockFlow->lowestFloatLogicalBottom()); | |
| 399 } | 398 } |
| 400 | 399 |
| 401 SubtreeLayoutScope layoutScope(*child); | 400 SubtreeLayoutScope layoutScope(*child); |
| 402 | 401 |
| 403 bool childHadLayout = child->everHadLayout(); | 402 bool childHadLayout = child->everHadLayout(); |
| 404 bool childNeededLayout = child->needsLayout(); | 403 bool childNeededLayout = child->needsLayout(); |
| 405 if (childNeededLayout) | 404 if (childNeededLayout) |
| 406 child->layout(); | 405 child->layout(); |
| 407 | 406 |
| 408 // Cache if we are at the top of the block right now. | 407 // Cache if we are at the top of the block right now. |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 } | 856 } |
| 858 | 857 |
| 859 LayoutUnit beforeChildMargin = marginBeforeForChild(child); | 858 LayoutUnit beforeChildMargin = marginBeforeForChild(child); |
| 860 positiveMarginBefore = std::max(positiveMarginBefore, beforeChildMargin); | 859 positiveMarginBefore = std::max(positiveMarginBefore, beforeChildMargin); |
| 861 negativeMarginBefore = std::max(negativeMarginBefore, -beforeChildMargin); | 860 negativeMarginBefore = std::max(negativeMarginBefore, -beforeChildMargin); |
| 862 | 861 |
| 863 if (!child->isRenderBlockFlow()) | 862 if (!child->isRenderBlockFlow()) |
| 864 return; | 863 return; |
| 865 | 864 |
| 866 RenderBlockFlow* childBlockFlow = toRenderBlockFlow(child); | 865 RenderBlockFlow* childBlockFlow = toRenderBlockFlow(child); |
| 867 if (childBlockFlow->childrenInline() || childBlockFlow->isWritingModeRoot()) | 866 if (childBlockFlow->childrenInline()) |
| 868 return; | 867 return; |
| 869 | 868 |
| 870 MarginInfo childMarginInfo(childBlockFlow, childBlockFlow->borderBefore() +
childBlockFlow->paddingBefore(), childBlockFlow->borderAfter() + childBlockFlow-
>paddingAfter()); | 869 MarginInfo childMarginInfo(childBlockFlow, childBlockFlow->borderBefore() +
childBlockFlow->paddingBefore(), childBlockFlow->borderAfter() + childBlockFlow-
>paddingAfter()); |
| 871 if (!childMarginInfo.canCollapseMarginBeforeWithChildren()) | 870 if (!childMarginInfo.canCollapseMarginBeforeWithChildren()) |
| 872 return; | 871 return; |
| 873 | 872 |
| 874 RenderBox* grandchildBox = childBlockFlow->firstChildBox(); | 873 RenderBox* grandchildBox = childBlockFlow->firstChildBox(); |
| 875 for ( ; grandchildBox; grandchildBox = grandchildBox->nextSiblingBox()) { | 874 for ( ; grandchildBox; grandchildBox = grandchildBox->nextSiblingBox()) { |
| 876 if (!grandchildBox->isFloatingOrOutOfFlowPositioned()) | 875 if (!grandchildBox->isFloatingOrOutOfFlowPositioned()) |
| 877 break; | 876 break; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); | 1055 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
| 1057 } | 1056 } |
| 1058 m_rareData->m_margins.setPositiveMarginAfter(pos); | 1057 m_rareData->m_margins.setPositiveMarginAfter(pos); |
| 1059 m_rareData->m_margins.setNegativeMarginAfter(neg); | 1058 m_rareData->m_margins.setNegativeMarginAfter(neg); |
| 1060 } | 1059 } |
| 1061 | 1060 |
| 1062 bool RenderBlockFlow::mustSeparateMarginBeforeForChild(const RenderBox* child) c
onst | 1061 bool RenderBlockFlow::mustSeparateMarginBeforeForChild(const RenderBox* child) c
onst |
| 1063 { | 1062 { |
| 1064 ASSERT(!child->selfNeedsLayout()); | 1063 ASSERT(!child->selfNeedsLayout()); |
| 1065 const RenderStyle* childStyle = child->style(); | 1064 const RenderStyle* childStyle = child->style(); |
| 1066 if (!child->isWritingModeRoot()) | 1065 return childStyle->marginBeforeCollapse() == MSEPARATE; |
| 1067 return childStyle->marginBeforeCollapse() == MSEPARATE; | |
| 1068 return childStyle->marginAfterCollapse() == MSEPARATE; | |
| 1069 } | 1066 } |
| 1070 | 1067 |
| 1071 bool RenderBlockFlow::mustSeparateMarginAfterForChild(const RenderBox* child) co
nst | 1068 bool RenderBlockFlow::mustSeparateMarginAfterForChild(const RenderBox* child) co
nst |
| 1072 { | 1069 { |
| 1073 ASSERT(!child->selfNeedsLayout()); | 1070 ASSERT(!child->selfNeedsLayout()); |
| 1074 const RenderStyle* childStyle = child->style(); | 1071 const RenderStyle* childStyle = child->style(); |
| 1075 if (!child->isWritingModeRoot()) | 1072 return childStyle->marginAfterCollapse() == MSEPARATE; |
| 1076 return childStyle->marginAfterCollapse() == MSEPARATE; | |
| 1077 return childStyle->marginBeforeCollapse() == MSEPARATE; | |
| 1078 } | 1073 } |
| 1079 | 1074 |
| 1080 void RenderBlockFlow::addOverflowFromFloats() | 1075 void RenderBlockFlow::addOverflowFromFloats() |
| 1081 { | 1076 { |
| 1082 // FIXME(sky): Remove this. | 1077 // FIXME(sky): Remove this. |
| 1083 } | 1078 } |
| 1084 | 1079 |
| 1085 void RenderBlockFlow::computeOverflow(LayoutUnit oldClientAfterEdge, bool recomp
uteFloats) | 1080 void RenderBlockFlow::computeOverflow(LayoutUnit oldClientAfterEdge, bool recomp
uteFloats) |
| 1086 { | 1081 { |
| 1087 RenderBlock::computeOverflow(oldClientAfterEdge, recomputeFloats); | 1082 RenderBlock::computeOverflow(oldClientAfterEdge, recomputeFloats); |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1445 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() | 1440 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() |
| 1446 { | 1441 { |
| 1447 if (m_rareData) | 1442 if (m_rareData) |
| 1448 return *m_rareData; | 1443 return *m_rareData; |
| 1449 | 1444 |
| 1450 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); | 1445 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
| 1451 return *m_rareData; | 1446 return *m_rareData; |
| 1452 } | 1447 } |
| 1453 | 1448 |
| 1454 } // namespace blink | 1449 } // namespace blink |
| OLD | NEW |