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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 return toLayoutMultiColumnFlowThread(locateFlowThreadContainingBlockOf(*
multiColumnBlockFlow())); | 440 return toLayoutMultiColumnFlowThread(locateFlowThreadContainingBlockOf(*
multiColumnBlockFlow())); |
441 return nullptr; | 441 return nullptr; |
442 } | 442 } |
443 | 443 |
444 bool LayoutMultiColumnFlowThread::hasFragmentainerGroupForColumnAt(LayoutUnit of
fsetInFlowThread) const | 444 bool LayoutMultiColumnFlowThread::hasFragmentainerGroupForColumnAt(LayoutUnit of
fsetInFlowThread) const |
445 { | 445 { |
446 // If there's no enclosing flow thread, there'll always be only one fragment
ainer group, and it | 446 // If there's no enclosing flow thread, there'll always be only one fragment
ainer group, and it |
447 // can hold as many columns as we like. We shouldn't even be here in that ca
se. | 447 // can hold as many columns as we like. We shouldn't even be here in that ca
se. |
448 ASSERT(enclosingFlowThread()); | 448 ASSERT(enclosingFlowThread()); |
449 | 449 |
| 450 if (!isPageLogicalHeightKnown()) { |
| 451 // If we have no clue about the height of the multicol container, bail.
This situation |
| 452 // occurs initially when an auto-height multicol container is nested ins
ide another |
| 453 // auto-height multicol container. We need at least an estimated height
of the outer |
| 454 // multicol container before we can check what an inner fragmentainer gr
oup has room for. |
| 455 // Its height height is indefinite for now. |
| 456 return true; |
| 457 } |
| 458 |
450 LayoutMultiColumnSet* lastColumnSet = lastMultiColumnSet(); | 459 LayoutMultiColumnSet* lastColumnSet = lastMultiColumnSet(); |
451 if (!lastColumnSet) { | 460 if (!lastColumnSet) { |
452 ASSERT_NOT_REACHED(); | 461 ASSERT_NOT_REACHED(); |
453 return true; | 462 return true; |
454 } | 463 } |
455 if (lastColumnSet->logicalTopInFlowThread() > offsetInFlowThread) | 464 if (lastColumnSet->logicalTopInFlowThread() > offsetInFlowThread) |
456 return true; | 465 return true; |
457 const MultiColumnFragmentainerGroup& lastRow = lastColumnSet->lastFragmentai
nerGroup(); | 466 const MultiColumnFragmentainerGroup& lastRow = lastColumnSet->lastFragmentai
nerGroup(); |
458 if (lastRow.logicalTopInFlowThread() > offsetInFlowThread) | 467 if (lastRow.logicalTopInFlowThread() > offsetInFlowThread) |
459 return true; | 468 return true; |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 // remaining in the currently last row. | 927 // remaining in the currently last row. |
919 LayoutRect layoutRect = layoutOverflowRect(); | 928 LayoutRect layoutRect = layoutOverflowRect(); |
920 LayoutUnit logicalBottomInFlowThread = isHorizontalWritingMode() ? l
ayoutRect.maxY() : layoutRect.maxX(); | 929 LayoutUnit logicalBottomInFlowThread = isHorizontalWritingMode() ? l
ayoutRect.maxY() : layoutRect.maxX(); |
921 ASSERT(logicalBottomInFlowThread >= logicalHeight()); | 930 ASSERT(logicalBottomInFlowThread >= logicalHeight()); |
922 lastSet->endFlow(logicalBottomInFlowThread); | 931 lastSet->endFlow(logicalBottomInFlowThread); |
923 } | 932 } |
924 } | 933 } |
925 m_lastSetWorkedOn = nullptr; | 934 m_lastSetWorkedOn = nullptr; |
926 } | 935 } |
927 | 936 |
928 void LayoutMultiColumnFlowThread::setPageBreak(LayoutUnit offset, LayoutUnit spa
ceShortage) | 937 void LayoutMultiColumnFlowThread::contentWasLaidOut(LayoutUnit logicalTopInFlowT
hreadAfterPagination) |
929 { | 938 { |
930 // Only positive values are interesting (and allowed) here. Zero space short
age may be reported | 939 // Check if we need another fragmentainer group. If we've run out of columns
in the last |
931 // when we're at the top of a column and the element has zero height. Ignore
this, and also | 940 // fragmentainer group (column row), we need to insert another fragmentainer
group to hold more |
932 // ignore any negative values, which may occur when we set an early break in
order to honor | 941 // columns. |
933 // widows in the next column. | 942 if (!multiColumnBlockFlow()->isInsideFlowThread()) |
934 if (spaceShortage <= 0) | 943 return; // Early bail. We're not nested, so waste no more time on this. |
| 944 if (!isInInitialLayoutPass()) { |
| 945 // We only insert additional fragmentainer groups in the initial layout
pass. We only want |
| 946 // to balance columns in the last fragmentainer group (if we need to bal
ance at all), so we |
| 947 // want that last fragmentainer group to be the same one in all layout p
asses that follow. |
935 return; | 948 return; |
936 | 949 } |
937 if (LayoutMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) | 950 LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(logicalTopInFlowThr
eadAfterPagination); |
938 multicolSet->recordSpaceShortage(offset, spaceShortage); | 951 if (!columnSet) |
| 952 return; |
| 953 MultiColumnFragmentainerGroup& row = columnSet->fragmentainerGroupAtFlowThre
adOffset(logicalTopInFlowThreadAfterPagination); |
| 954 if (!row.isLastGroup()) |
| 955 return; |
| 956 appendNewFragmentainerGroupIfNeeded(logicalTopInFlowThreadAfterPagination); |
939 } | 957 } |
940 | 958 |
941 void LayoutMultiColumnFlowThread::updateMinimumPageHeight(LayoutUnit offset, Lay
outUnit minHeight) | 959 void LayoutMultiColumnFlowThread::updateMinimumPageHeight(LayoutUnit offset, Lay
outUnit minHeight) |
942 { | 960 { |
943 if (LayoutMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) | 961 if (LayoutMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) |
944 multicolSet->updateMinimumColumnHeight(offset, minHeight); | 962 multicolSet->updateMinimumColumnHeight(offset, minHeight); |
945 } | 963 } |
946 | 964 |
947 bool LayoutMultiColumnFlowThread::addForcedColumnBreak(LayoutUnit offset, Layout
Object* /*breakChild*/, bool /*isBefore*/, LayoutUnit* offsetBreakAdjustment) | |
948 { | |
949 if (LayoutMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) { | |
950 multicolSet->addContentRun(offset); | |
951 if (offsetBreakAdjustment) | |
952 *offsetBreakAdjustment = pageLogicalHeightForOffset(offset) ? pageRe
mainingLogicalHeightForOffset(offset, AssociateWithFormerPage) : LayoutUnit(); | |
953 return true; | |
954 } | |
955 return false; | |
956 } | 965 } |
957 | |
958 } | |
OLD | NEW |