| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 , m_columnCount(1) | 40 , m_columnCount(1) |
| 41 , m_columnWidth(0) | 41 , m_columnWidth(0) |
| 42 , m_columnHeightAvailable(0) | 42 , m_columnHeightAvailable(0) |
| 43 , m_inBalancingPass(false) | 43 , m_inBalancingPass(false) |
| 44 , m_needsRebalancing(false) | 44 , m_needsRebalancing(false) |
| 45 { | 45 { |
| 46 } | 46 } |
| 47 | 47 |
| 48 void RenderMultiColumnBlock::styleDidChange(StyleDifference diff, const RenderSt
yle* oldStyle) | 48 void RenderMultiColumnBlock::styleDidChange(StyleDifference diff, const RenderSt
yle* oldStyle) |
| 49 { | 49 { |
| 50 RenderBlock::styleDidChange(diff, oldStyle); | 50 RenderBlockFlow::styleDidChange(diff, oldStyle); |
| 51 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) | 51 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) |
| 52 child->setStyle(RenderStyle::createAnonymousStyleWithDisplay(style(), BL
OCK)); | 52 child->setStyle(RenderStyle::createAnonymousStyleWithDisplay(style(), BL
OCK)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void RenderMultiColumnBlock::computeColumnCountAndWidth() | 55 void RenderMultiColumnBlock::computeColumnCountAndWidth() |
| 56 { | 56 { |
| 57 // Calculate our column width and column count. | 57 // Calculate our column width and column count. |
| 58 // FIXME: Can overflow on fast/block/float/float-not-removed-from-next-sibli
ng4.html, see https://bugs.webkit.org/show_bug.cgi?id=68744 | 58 // FIXME: Can overflow on fast/block/float/float-not-removed-from-next-sibli
ng4.html, see https://bugs.webkit.org/show_bug.cgi?id=68744 |
| 59 m_columnCount = 1; | 59 m_columnCount = 1; |
| 60 m_columnWidth = contentLogicalWidth(); | 60 m_columnWidth = contentLogicalWidth(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 73 m_columnCount = max<LayoutUnit>(1, (availWidth + colGap) / (colWidth + c
olGap)); | 73 m_columnCount = max<LayoutUnit>(1, (availWidth + colGap) / (colWidth + c
olGap)); |
| 74 m_columnWidth = ((availWidth + colGap) / m_columnCount) - colGap; | 74 m_columnWidth = ((availWidth + colGap) / m_columnCount) - colGap; |
| 75 } else { | 75 } else { |
| 76 m_columnCount = max<LayoutUnit>(min<LayoutUnit>(colCount, (availWidth +
colGap) / (colWidth + colGap)), 1); | 76 m_columnCount = max<LayoutUnit>(min<LayoutUnit>(colCount, (availWidth +
colGap) / (colWidth + colGap)), 1); |
| 77 m_columnWidth = ((availWidth + colGap) / m_columnCount) - colGap; | 77 m_columnWidth = ((availWidth + colGap) / m_columnCount) - colGap; |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool RenderMultiColumnBlock::updateLogicalWidthAndColumnWidth() | 81 bool RenderMultiColumnBlock::updateLogicalWidthAndColumnWidth() |
| 82 { | 82 { |
| 83 bool relayoutChildren = RenderBlock::updateLogicalWidthAndColumnWidth(); | 83 bool relayoutChildren = RenderBlockFlow::updateLogicalWidthAndColumnWidth(); |
| 84 LayoutUnit oldColumnWidth = m_columnWidth; | 84 LayoutUnit oldColumnWidth = m_columnWidth; |
| 85 computeColumnCountAndWidth(); | 85 computeColumnCountAndWidth(); |
| 86 if (m_columnWidth != oldColumnWidth) | 86 if (m_columnWidth != oldColumnWidth) |
| 87 relayoutChildren = true; | 87 relayoutChildren = true; |
| 88 return relayoutChildren; | 88 return relayoutChildren; |
| 89 } | 89 } |
| 90 | 90 |
| 91 void RenderMultiColumnBlock::checkForPaginationLogicalHeightChange(LayoutUnit& /
*pageLogicalHeight*/, bool& /*pageLogicalHeightChanged*/, bool& /*hasSpecifiedPa
geLogicalHeight*/) | 91 void RenderMultiColumnBlock::checkForPaginationLogicalHeightChange(LayoutUnit& /
*pageLogicalHeight*/, bool& /*pageLogicalHeightChanged*/, bool& /*hasSpecifiedPa
geLogicalHeight*/) |
| 92 { | 92 { |
| 93 // We don't actually update any of the variables. We just subclassed to adju
st our column height. | 93 // We don't actually update any of the variables. We just subclassed to adju
st our column height. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 122 | 122 |
| 123 m_inBalancingPass = needsRelayout; | 123 m_inBalancingPass = needsRelayout; |
| 124 return needsRelayout; | 124 return needsRelayout; |
| 125 } | 125 } |
| 126 | 126 |
| 127 void RenderMultiColumnBlock::addChild(RenderObject* newChild, RenderObject* befo
reChild) | 127 void RenderMultiColumnBlock::addChild(RenderObject* newChild, RenderObject* befo
reChild) |
| 128 { | 128 { |
| 129 if (!m_flowThread) { | 129 if (!m_flowThread) { |
| 130 m_flowThread = RenderMultiColumnFlowThread::createAnonymous(&document())
; | 130 m_flowThread = RenderMultiColumnFlowThread::createAnonymous(&document())
; |
| 131 m_flowThread->setStyle(RenderStyle::createAnonymousStyleWithDisplay(styl
e(), BLOCK)); | 131 m_flowThread->setStyle(RenderStyle::createAnonymousStyleWithDisplay(styl
e(), BLOCK)); |
| 132 RenderBlock::addChild(m_flowThread); | 132 RenderBlockFlow::addChild(m_flowThread); |
| 133 } | 133 } |
| 134 m_flowThread->addChild(newChild, beforeChild); | 134 m_flowThread->addChild(newChild, beforeChild); |
| 135 } | 135 } |
| 136 | 136 |
| 137 RenderObject* RenderMultiColumnBlock::layoutSpecialExcludedChild(bool relayoutCh
ildren, SubtreeLayoutScope& layoutScope) | 137 RenderObject* RenderMultiColumnBlock::layoutSpecialExcludedChild(bool relayoutCh
ildren, SubtreeLayoutScope& layoutScope) |
| 138 { | 138 { |
| 139 if (!m_flowThread) | 139 if (!m_flowThread) |
| 140 return 0; | 140 return 0; |
| 141 | 141 |
| 142 // Update the dimensions of our regions before we lay out the flow thread. | 142 // Update the dimensions of our regions before we lay out the flow thread. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 if (isPseudoElement()) | 191 if (isPseudoElement()) |
| 192 return "RenderMultiColumnBlock (generated)"; | 192 return "RenderMultiColumnBlock (generated)"; |
| 193 if (isAnonymous()) | 193 if (isAnonymous()) |
| 194 return "RenderMultiColumnBlock (generated)"; | 194 return "RenderMultiColumnBlock (generated)"; |
| 195 if (isRelPositioned()) | 195 if (isRelPositioned()) |
| 196 return "RenderMultiColumnBlock (relative positioned)"; | 196 return "RenderMultiColumnBlock (relative positioned)"; |
| 197 return "RenderMultiColumnBlock"; | 197 return "RenderMultiColumnBlock"; |
| 198 } | 198 } |
| 199 | 199 |
| 200 } | 200 } |
| OLD | NEW |