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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 { | 88 { |
89 LayoutBox* sibling = multicolSet->nextSiblingMultiColumnBox(); | 89 LayoutBox* sibling = multicolSet->nextSiblingMultiColumnBox(); |
90 if (!sibling) | 90 if (!sibling) |
91 return 0; // By right we should return lastLeafChild() here, but the cal
ler doesn't care, so just return 0. | 91 return 0; // By right we should return lastLeafChild() here, but the cal
ler doesn't care, so just return 0. |
92 // Adjacent column content sets should not occur. We would have no way of fi
guring out what each | 92 // Adjacent column content sets should not occur. We would have no way of fi
guring out what each |
93 // of them contains then. | 93 // of them contains then. |
94 ASSERT(sibling->isLayoutMultiColumnSpannerPlaceholder()); | 94 ASSERT(sibling->isLayoutMultiColumnSpannerPlaceholder()); |
95 return toLayoutMultiColumnSpannerPlaceholder(sibling)->layoutObjectInFlowThr
ead()->previousInPreOrder(multicolSet->flowThread()); | 95 return toLayoutMultiColumnSpannerPlaceholder(sibling)->layoutObjectInFlowThr
ead()->previousInPreOrder(multicolSet->flowThread()); |
96 } | 96 } |
97 | 97 |
98 LayoutMultiColumnSet* LayoutMultiColumnFlowThread::findSetLayoutObjects(LayoutOb
ject* layoutObject) const | 98 LayoutMultiColumnSet* LayoutMultiColumnFlowThread::mapDescendantToColumnSet(Layo
utObject* layoutObject) const |
99 { | 99 { |
100 ASSERT(!containingColumnSpannerPlaceholder(layoutObject)); // should not be
used for spanners or content inside them. | 100 ASSERT(!containingColumnSpannerPlaceholder(layoutObject)); // should not be
used for spanners or content inside them. |
101 ASSERT(layoutObject != this); | 101 ASSERT(layoutObject != this); |
102 ASSERT(layoutObject->isDescendantOf(this)); | 102 ASSERT(layoutObject->isDescendantOf(this)); |
103 LayoutMultiColumnSet* multicolSet = firstMultiColumnSet(); | 103 LayoutMultiColumnSet* multicolSet = firstMultiColumnSet(); |
104 if (!multicolSet) | 104 if (!multicolSet) |
105 return 0; | 105 return 0; |
106 if (!multicolSet->nextSiblingMultiColumnSet()) | 106 if (!multicolSet->nextSiblingMultiColumnSet()) |
107 return multicolSet; | 107 return multicolSet; |
108 | 108 |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 // which means that we simply insert a new spanner place
holder at the | 509 // which means that we simply insert a new spanner place
holder at the |
510 // beginning. | 510 // beginning. |
511 insertBefore = firstMultiColumnBox(); | 511 insertBefore = firstMultiColumnBox(); |
512 } else if (LayoutMultiColumnSpannerPlaceholder* previousPlac
eholder = containingColumnSpannerPlaceholder(previousLayoutObject)) { | 512 } else if (LayoutMultiColumnSpannerPlaceholder* previousPlac
eholder = containingColumnSpannerPlaceholder(previousLayoutObject)) { |
513 // Before us is another spanner. We belong right after i
t then. | 513 // Before us is another spanner. We belong right after i
t then. |
514 insertBefore = previousPlaceholder->nextSiblingMultiColu
mnBox(); | 514 insertBefore = previousPlaceholder->nextSiblingMultiColu
mnBox(); |
515 } else { | 515 } else { |
516 // We're inside regular column content with both feet. F
ind out which column | 516 // We're inside regular column content with both feet. F
ind out which column |
517 // set this is. It needs to be split it into two sets, s
o that we can insert | 517 // set this is. It needs to be split it into two sets, s
o that we can insert |
518 // a new spanner placeholder between them. | 518 // a new spanner placeholder between them. |
519 setToSplit = findSetLayoutObjects(previousLayoutObject); | 519 setToSplit = mapDescendantToColumnSet(previousLayoutObje
ct); |
520 ASSERT(setToSplit == findSetLayoutObjects(objectAfterSub
tree)); | 520 ASSERT(setToSplit == mapDescendantToColumnSet(objectAfte
rSubtree)); |
521 setToSplit->setNeedsLayoutAndFullPaintInvalidation(Layou
tInvalidationReason::ColumnsChanged); | 521 setToSplit->setNeedsLayoutAndFullPaintInvalidation(Layou
tInvalidationReason::ColumnsChanged); |
522 insertBefore = setToSplit->nextSiblingMultiColumnBox(); | 522 insertBefore = setToSplit->nextSiblingMultiColumnBox(); |
523 // We've found out which set that needs to be split. Now
proceed to | 523 // We've found out which set that needs to be split. Now
proceed to |
524 // inserting the spanner placeholder, and then insert a
second column set. | 524 // inserting the spanner placeholder, and then insert a
second column set. |
525 } | 525 } |
526 } | 526 } |
527 ASSERT(setToSplit || insertBefore); | 527 ASSERT(setToSplit || insertBefore); |
528 } | 528 } |
529 createAndInsertSpannerPlaceholder(toLayoutBox(layoutObject), insertB
efore); | 529 createAndInsertSpannerPlaceholder(toLayoutBox(layoutObject), insertB
efore); |
530 if (setToSplit) | 530 if (setToSplit) |
(...skipping 18 matching lines...) Expand all Loading... |
549 } | 549 } |
550 if (objectAfterSubtree) { | 550 if (objectAfterSubtree) { |
551 if (LayoutMultiColumnSpannerPlaceholder* placeholder = objectAfterSu
btree->spannerPlaceholder()) { | 551 if (LayoutMultiColumnSpannerPlaceholder* placeholder = objectAfterSu
btree->spannerPlaceholder()) { |
552 // If inserted right before a spanner, we need to make sure that
there's a set for us there. | 552 // If inserted right before a spanner, we need to make sure that
there's a set for us there. |
553 LayoutBox* previous = placeholder->previousSiblingMultiColumnBox
(); | 553 LayoutBox* previous = placeholder->previousSiblingMultiColumnBox
(); |
554 if (!previous || !previous->isLayoutMultiColumnSet()) | 554 if (!previous || !previous->isLayoutMultiColumnSet()) |
555 createAndInsertMultiColumnSet(placeholder); | 555 createAndInsertMultiColumnSet(placeholder); |
556 } else { | 556 } else { |
557 // Otherwise, since |objectAfterSubtree| isn't a spanner, it has
to mean that there's | 557 // Otherwise, since |objectAfterSubtree| isn't a spanner, it has
to mean that there's |
558 // already a set for that content. We can use it for this layout
Object too. | 558 // already a set for that content. We can use it for this layout
Object too. |
559 ASSERT(findSetLayoutObjects(objectAfterSubtree)); | 559 ASSERT(mapDescendantToColumnSet(objectAfterSubtree)); |
560 ASSERT(findSetLayoutObjects(layoutObject) == findSetLayoutObject
s(objectAfterSubtree)); | 560 ASSERT(mapDescendantToColumnSet(layoutObject) == mapDescendantTo
ColumnSet(objectAfterSubtree)); |
561 } | 561 } |
562 } else { | 562 } else { |
563 // Inserting at the end. Then we just need to make sure that there's
a column set at the end. | 563 // Inserting at the end. Then we just need to make sure that there's
a column set at the end. |
564 LayoutBox* lastColumnBox = lastMultiColumnBox(); | 564 LayoutBox* lastColumnBox = lastMultiColumnBox(); |
565 if (!lastColumnBox || !lastColumnBox->isLayoutMultiColumnSet()) | 565 if (!lastColumnBox || !lastColumnBox->isLayoutMultiColumnSet()) |
566 createAndInsertMultiColumnSet(); | 566 createAndInsertMultiColumnSet(); |
567 } | 567 } |
568 } | 568 } |
569 } | 569 } |
570 | 570 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 return; // Preceded by column content. Set still needed. | 616 return; // Preceded by column content. Set still needed. |
617 } | 617 } |
618 LayoutMultiColumnSpannerPlaceholder* adjacentNextSpannerPlaceholder = 0; | 618 LayoutMultiColumnSpannerPlaceholder* adjacentNextSpannerPlaceholder = 0; |
619 LayoutObject* nextLayoutObject = descendant->nextInPreOrderAfterChildren(thi
s); | 619 LayoutObject* nextLayoutObject = descendant->nextInPreOrderAfterChildren(thi
s); |
620 if (nextLayoutObject) { | 620 if (nextLayoutObject) { |
621 adjacentNextSpannerPlaceholder = containingColumnSpannerPlaceholder(next
LayoutObject); | 621 adjacentNextSpannerPlaceholder = containingColumnSpannerPlaceholder(next
LayoutObject); |
622 if (!adjacentNextSpannerPlaceholder) | 622 if (!adjacentNextSpannerPlaceholder) |
623 return; // Followed by column content. Set still needed. | 623 return; // Followed by column content. Set still needed. |
624 } | 624 } |
625 // We have now determined that, with the removal of |descendant|, we should
remove a column | 625 // We have now determined that, with the removal of |descendant|, we should
remove a column |
626 // set. Locate it and remove it. Do it without involving findSetLayoutObject
s(), as that might be | 626 // set. Locate it and remove it. Do it without involving mapDescendantToColu
mnSet(), as that |
627 // very slow. Deduce the right set from the spanner placeholders that we've
already found. | 627 // might be very slow. Deduce the right set from the spanner placeholders th
at we've already |
| 628 // found. |
628 LayoutMultiColumnSet* columnSetToRemove; | 629 LayoutMultiColumnSet* columnSetToRemove; |
629 if (adjacentNextSpannerPlaceholder) { | 630 if (adjacentNextSpannerPlaceholder) { |
630 columnSetToRemove = toLayoutMultiColumnSet(adjacentNextSpannerPlaceholde
r->previousSiblingMultiColumnBox()); | 631 columnSetToRemove = toLayoutMultiColumnSet(adjacentNextSpannerPlaceholde
r->previousSiblingMultiColumnBox()); |
631 ASSERT(!adjacentPreviousSpannerPlaceholder || columnSetToRemove == adjac
entPreviousSpannerPlaceholder->nextSiblingMultiColumnBox()); | 632 ASSERT(!adjacentPreviousSpannerPlaceholder || columnSetToRemove == adjac
entPreviousSpannerPlaceholder->nextSiblingMultiColumnBox()); |
632 } else if (adjacentPreviousSpannerPlaceholder) { | 633 } else if (adjacentPreviousSpannerPlaceholder) { |
633 columnSetToRemove = toLayoutMultiColumnSet(adjacentPreviousSpannerPlaceh
older->nextSiblingMultiColumnBox()); | 634 columnSetToRemove = toLayoutMultiColumnSet(adjacentPreviousSpannerPlaceh
older->nextSiblingMultiColumnBox()); |
634 } else { | 635 } else { |
635 // If there were no adjacent spanners, it has to mean that there's only
one column set, | 636 // If there were no adjacent spanners, it has to mean that there's only
one column set, |
636 // since it's only spanners that may cause creation of multiple sets. | 637 // since it's only spanners that may cause creation of multiple sets. |
637 columnSetToRemove = firstMultiColumnSet(); | 638 columnSetToRemove = firstMultiColumnSet(); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 } | 731 } |
731 | 732 |
732 bool LayoutMultiColumnFlowThread::isPageLogicalHeightKnown() const | 733 bool LayoutMultiColumnFlowThread::isPageLogicalHeightKnown() const |
733 { | 734 { |
734 if (LayoutMultiColumnSet* columnSet = lastMultiColumnSet()) | 735 if (LayoutMultiColumnSet* columnSet = lastMultiColumnSet()) |
735 return columnSet->pageLogicalHeight(); | 736 return columnSet->pageLogicalHeight(); |
736 return false; | 737 return false; |
737 } | 738 } |
738 | 739 |
739 } | 740 } |
OLD | NEW |