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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 // to balance columns in the last fragmentainer group (if we need to bal
ance at all), so we | 490 // to balance columns in the last fragmentainer group (if we need to bal
ance at all), so we |
491 // want that last fragmentainer group to be the same one in all layout p
asses that follow. | 491 // want that last fragmentainer group to be the same one in all layout p
asses that follow. |
492 return; | 492 return; |
493 } | 493 } |
494 | 494 |
495 if (!columnSet->hasFragmentainerGroupForColumnAt(offsetInFlowThread, pageBou
ndaryRule)) { | 495 if (!columnSet->hasFragmentainerGroupForColumnAt(offsetInFlowThread, pageBou
ndaryRule)) { |
496 FragmentationContext* enclosingFragmentationContext = this->enclosingFra
gmentationContext(); | 496 FragmentationContext* enclosingFragmentationContext = this->enclosingFra
gmentationContext(); |
497 if (!enclosingFragmentationContext) | 497 if (!enclosingFragmentationContext) |
498 return; // Not nested. We'll never need more rows than the one we al
ready have then. | 498 return; // Not nested. We'll never need more rows than the one we al
ready have then. |
499 ASSERT(!isLayoutPagedFlowThread()); | 499 ASSERT(!isLayoutPagedFlowThread()); |
500 // We have run out of columns here, so we add another row to hold more c
olumns. When we add | 500 |
501 // a new row, it implicitly means that we're inserting another column in
our enclosing | 501 // We have run out of columns here, so we need to add at least one more
row to hold more |
502 // multicol container. That in turn may mean that we've run out of colum
ns there too. | 502 // columns. |
503 const MultiColumnFragmentainerGroup& newRow = columnSet->appendNewFragme
ntainerGroup(); | 503 do { |
504 if (LayoutMultiColumnFlowThread* enclosingFlowThread = enclosingFragment
ationContext->associatedFlowThread()) | 504 const MultiColumnFragmentainerGroup& newRow = columnSet->appendNewFr
agmentainerGroup(); |
505 enclosingFlowThread->appendNewFragmentainerGroupIfNeeded(newRow.bloc
kOffsetInEnclosingFragmentationContext(), AssociateWithLatterPage); | 505 // Zero-height rows should really not occur here, but if it does any
way, break, so that |
| 506 // we don't get stuck in an infinite loop. |
| 507 ASSERT(newRow.logicalHeight() > 0); |
| 508 if (newRow.logicalHeight() <= 0) |
| 509 break; |
| 510 } while (!columnSet->hasFragmentainerGroupForColumnAt(offsetInFlowThread
, pageBoundaryRule)); |
| 511 |
| 512 if (LayoutMultiColumnFlowThread* enclosingFlowThread = enclosingFragment
ationContext->associatedFlowThread()) { |
| 513 // When we add a new row here, it implicitly means that we're insert
ing another column |
| 514 // in our enclosing multicol container. That in turn may mean that w
e've run out of |
| 515 // columns there too. |
| 516 const MultiColumnFragmentainerGroup& lastRow = columnSet->lastFragme
ntainerGroup(); |
| 517 enclosingFlowThread->appendNewFragmentainerGroupIfNeeded(lastRow.blo
ckOffsetInEnclosingFragmentationContext(), AssociateWithLatterPage); |
| 518 } |
506 } | 519 } |
507 } | 520 } |
508 | 521 |
509 bool LayoutMultiColumnFlowThread::isFragmentainerLogicalHeightKnown() | 522 bool LayoutMultiColumnFlowThread::isFragmentainerLogicalHeightKnown() |
510 { | 523 { |
511 return isPageLogicalHeightKnown(); | 524 return isPageLogicalHeightKnown(); |
512 } | 525 } |
513 | 526 |
514 LayoutUnit LayoutMultiColumnFlowThread::fragmentainerLogicalHeightAt(LayoutUnit
blockOffset) | 527 LayoutUnit LayoutMultiColumnFlowThread::fragmentainerLogicalHeightAt(LayoutUnit
blockOffset) |
515 { | 528 { |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 } | 1004 } |
992 if (canContainSpannerInParentFragmentationContext(*object)) | 1005 if (canContainSpannerInParentFragmentationContext(*object)) |
993 next = object->nextInPreOrder(&root); | 1006 next = object->nextInPreOrder(&root); |
994 else | 1007 else |
995 next = object->nextInPreOrderAfterChildren(&root); | 1008 next = object->nextInPreOrderAfterChildren(&root); |
996 } | 1009 } |
997 return true; | 1010 return true; |
998 } | 1011 } |
999 | 1012 |
1000 } // namespace blink | 1013 } // namespace blink |
OLD | NEW |