| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 ColumnInfo* colInfo = columnInfo(); | 273 ColumnInfo* colInfo = columnInfo(); |
| 274 if (pageLogicalHeight) | 274 if (pageLogicalHeight) |
| 275 colInfo->setColumnCountAndHeight(count, pageLogicalHeight); | 275 colInfo->setColumnCountAndHeight(count, pageLogicalHeight); |
| 276 | 276 |
| 277 if (columnCount(colInfo)) { | 277 if (columnCount(colInfo)) { |
| 278 setLogicalHeight(borderBefore() + paddingBefore() + colInfo->columnHeigh
t() + borderAfter() + paddingAfter() + scrollbarLogicalHeight()); | 278 setLogicalHeight(borderBefore() + paddingBefore() + colInfo->columnHeigh
t() + borderAfter() + paddingAfter() + scrollbarLogicalHeight()); |
| 279 m_overflow.clear(); | 279 m_overflow.clear(); |
| 280 } | 280 } |
| 281 } | 281 } |
| 282 | 282 |
| 283 void RenderBlockFlow::setBreakAtLineToAvoidWidow(int lineToBreak) |
| 284 { |
| 285 ASSERT(lineToBreak >= 0); |
| 286 ensureRareData(); |
| 287 ASSERT(!m_rareData->m_didBreakAtLineToAvoidWidow); |
| 288 m_rareData->m_lineBreakToAvoidWidow = lineToBreak; |
| 289 } |
| 290 |
| 291 void RenderBlockFlow::setDidBreakAtLineToAvoidWidow() |
| 292 { |
| 293 ASSERT(!shouldBreakAtLineToAvoidWidow()); |
| 294 |
| 295 // This function should be called only after a break was applied to avoid wi
dows |
| 296 // so assert |m_rareData| exists. |
| 297 ASSERT(m_rareData); |
| 298 |
| 299 m_rareData->m_didBreakAtLineToAvoidWidow = true; |
| 300 } |
| 301 |
| 302 void RenderBlockFlow::clearDidBreakAtLineToAvoidWidow() |
| 303 { |
| 304 if (!m_rareData) |
| 305 return; |
| 306 |
| 307 m_rareData->m_didBreakAtLineToAvoidWidow = false; |
| 308 } |
| 309 |
| 310 void RenderBlockFlow::clearShouldBreakAtLineToAvoidWidow() const |
| 311 { |
| 312 ASSERT(shouldBreakAtLineToAvoidWidow()); |
| 313 if (!m_rareData) |
| 314 return; |
| 315 |
| 316 m_rareData->m_lineBreakToAvoidWidow = -1; |
| 317 } |
| 318 |
| 283 bool RenderBlockFlow::isSelfCollapsingBlock() const | 319 bool RenderBlockFlow::isSelfCollapsingBlock() const |
| 284 { | 320 { |
| 285 m_hasOnlySelfCollapsingChildren = RenderBlock::isSelfCollapsingBlock(); | 321 m_hasOnlySelfCollapsingChildren = RenderBlock::isSelfCollapsingBlock(); |
| 286 return m_hasOnlySelfCollapsingChildren; | 322 return m_hasOnlySelfCollapsingChildren; |
| 287 } | 323 } |
| 288 | 324 |
| 289 void RenderBlockFlow::layoutBlock(bool relayoutChildren) | 325 void RenderBlockFlow::layoutBlock(bool relayoutChildren) |
| 290 { | 326 { |
| 291 ASSERT(needsLayout()); | 327 ASSERT(needsLayout()); |
| 292 ASSERT(isInlineBlockOrInlineTable() || !isInline()); | 328 ASSERT(isInlineBlockOrInlineTable() || !isInline()); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 if (paginated) { | 586 if (paginated) { |
| 551 logicalTopAfterClear = adjustBlockChildForPagination(logicalTopAfterClea
r, estimateWithoutPagination, child, | 587 logicalTopAfterClear = adjustBlockChildForPagination(logicalTopAfterClea
r, estimateWithoutPagination, child, |
| 552 atBeforeSideOfBlock && logicalTopBeforeClear == logicalTopAfterClear
); | 588 atBeforeSideOfBlock && logicalTopBeforeClear == logicalTopAfterClear
); |
| 553 } | 589 } |
| 554 | 590 |
| 555 setLogicalTopForChild(child, logicalTopAfterClear); | 591 setLogicalTopForChild(child, logicalTopAfterClear); |
| 556 | 592 |
| 557 // Now we have a final top position. See if it really does end up being diff
erent from our estimate. | 593 // Now we have a final top position. See if it really does end up being diff
erent from our estimate. |
| 558 // clearFloatsIfNeeded can also mark the child as needing a layout even thou
gh we didn't move. This happens | 594 // clearFloatsIfNeeded can also mark the child as needing a layout even thou
gh we didn't move. This happens |
| 559 // when collapseMargins dynamically adds overhanging floats because of a chi
ld with negative margins. | 595 // when collapseMargins dynamically adds overhanging floats because of a chi
ld with negative margins. |
| 560 if (logicalTopAfterClear != logicalTopEstimate || child->needsLayout() || (p
aginated && childRenderBlock && childRenderBlock->shouldBreakAtLineToAvoidWidow(
))) { | 596 if (logicalTopAfterClear != logicalTopEstimate || child->needsLayout() || (p
aginated && childRenderBlockFlow && childRenderBlockFlow->shouldBreakAtLineToAvo
idWidow())) { |
| 561 SubtreeLayoutScope layoutScope(*child); | 597 SubtreeLayoutScope layoutScope(*child); |
| 562 if (child->shrinkToAvoidFloats()) { | 598 if (child->shrinkToAvoidFloats()) { |
| 563 // The child's width depends on the line width. | 599 // The child's width depends on the line width. |
| 564 // When the child shifts to clear an item, its width can | 600 // When the child shifts to clear an item, its width can |
| 565 // change (because it has more available line width). | 601 // change (because it has more available line width). |
| 566 // So go ahead and mark the item as dirty. | 602 // So go ahead and mark the item as dirty. |
| 567 layoutScope.setChildNeedsLayout(child); | 603 layoutScope.setChildNeedsLayout(child); |
| 568 } | 604 } |
| 569 | 605 |
| 570 if (childRenderBlock) { | 606 if (childRenderBlock) { |
| (...skipping 2329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2900 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() | 2936 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() |
| 2901 { | 2937 { |
| 2902 if (m_rareData) | 2938 if (m_rareData) |
| 2903 return *m_rareData; | 2939 return *m_rareData; |
| 2904 | 2940 |
| 2905 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); | 2941 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
| 2906 return *m_rareData; | 2942 return *m_rareData; |
| 2907 } | 2943 } |
| 2908 | 2944 |
| 2909 } // namespace WebCore | 2945 } // namespace WebCore |
| OLD | NEW |