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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 RenderMultiColumnSet* RenderMultiColumnFlowThread::lastMultiColumnSet() const | 67 RenderMultiColumnSet* RenderMultiColumnFlowThread::lastMultiColumnSet() const |
68 { | 68 { |
69 for (RenderObject* sibling = multiColumnBlockFlow()->lastChild(); sibling; s
ibling = sibling->previousSibling()) { | 69 for (RenderObject* sibling = multiColumnBlockFlow()->lastChild(); sibling; s
ibling = sibling->previousSibling()) { |
70 if (sibling->isRenderMultiColumnSet()) | 70 if (sibling->isRenderMultiColumnSet()) |
71 return toRenderMultiColumnSet(sibling); | 71 return toRenderMultiColumnSet(sibling); |
72 } | 72 } |
73 return 0; | 73 return 0; |
74 } | 74 } |
75 | 75 |
| 76 static RenderObject* firstRendererInSet(RenderMultiColumnSet* multicolSet) |
| 77 { |
| 78 RenderBox* sibling = multicolSet->previousSiblingMultiColumnBox(); |
| 79 if (!sibling) |
| 80 return multicolSet->flowThread()->firstChild(); |
| 81 // Adjacent column content sets should not occur. We would have no way of fi
guring out what each |
| 82 // of them contains then. |
| 83 ASSERT(sibling->isRenderMultiColumnSpannerPlaceholder()); |
| 84 return toRenderMultiColumnSpannerPlaceholder(sibling)->rendererInFlowThread(
)->nextInPreOrderAfterChildren(multicolSet->flowThread()); |
| 85 } |
| 86 |
| 87 static RenderObject* lastRendererInSet(RenderMultiColumnSet* multicolSet) |
| 88 { |
| 89 RenderBox* sibling = multicolSet->nextSiblingMultiColumnBox(); |
| 90 if (!sibling) |
| 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 |
| 93 // of them contains then. |
| 94 ASSERT(sibling->isRenderMultiColumnSpannerPlaceholder()); |
| 95 return toRenderMultiColumnSpannerPlaceholder(sibling)->rendererInFlowThread(
)->previousInPreOrder(multicolSet->flowThread()); |
| 96 } |
| 97 |
| 98 RenderMultiColumnSet* RenderMultiColumnFlowThread::findSetRendering(RenderObject
* renderer) const |
| 99 { |
| 100 ASSERT(!containingColumnSpannerPlaceholder(renderer)); // should not be used
for spanners or content inside them. |
| 101 ASSERT(renderer != this); |
| 102 ASSERT(renderer->isDescendantOf(this)); |
| 103 RenderMultiColumnSet* multicolSet = firstMultiColumnSet(); |
| 104 if (!multicolSet) |
| 105 return 0; |
| 106 if (!multicolSet->nextSiblingMultiColumnSet()) |
| 107 return multicolSet; |
| 108 |
| 109 // This is potentially SLOW! But luckily very uncommon. You would have to dy
namically insert a |
| 110 // spanner into the middle of column contents to need this. |
| 111 for (; multicolSet; multicolSet = multicolSet->nextSiblingMultiColumnSet())
{ |
| 112 RenderObject* firstRenderer = firstRendererInSet(multicolSet); |
| 113 RenderObject* lastRenderer = lastRendererInSet(multicolSet); |
| 114 ASSERT(firstRenderer); |
| 115 |
| 116 for (RenderObject* walker = firstRenderer; walker; walker = walker->next
InPreOrder(this)) { |
| 117 if (walker == renderer) |
| 118 return multicolSet; |
| 119 if (walker == lastRenderer) |
| 120 break; |
| 121 } |
| 122 } |
| 123 |
| 124 return 0; |
| 125 } |
| 126 |
76 RenderMultiColumnSpannerPlaceholder* RenderMultiColumnFlowThread::containingColu
mnSpannerPlaceholder(const RenderObject* descendant) const | 127 RenderMultiColumnSpannerPlaceholder* RenderMultiColumnFlowThread::containingColu
mnSpannerPlaceholder(const RenderObject* descendant) const |
77 { | 128 { |
78 ASSERT(descendant->isDescendantOf(this)); | 129 ASSERT(descendant->isDescendantOf(this)); |
79 | 130 |
80 // Before we spend time on searching the ancestry, see if there's a quick wa
y to determine | 131 // Before we spend time on searching the ancestry, see if there's a quick wa
y to determine |
81 // whether there might be any spanners at all. | 132 // whether there might be any spanners at all. |
82 RenderBox* firstBox = firstMultiColumnBox(); | 133 RenderBox* firstBox = firstMultiColumnBox(); |
83 if (!firstBox || (firstBox == lastMultiColumnBox() && firstBox->isRenderMult
iColumnSet())) | 134 if (!firstBox || (firstBox == lastMultiColumnBox() && firstBox->isRenderMult
iColumnSet())) |
84 return 0; | 135 return 0; |
85 | 136 |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 } | 547 } |
497 | 548 |
498 bool RenderMultiColumnFlowThread::isPageLogicalHeightKnown() const | 549 bool RenderMultiColumnFlowThread::isPageLogicalHeightKnown() const |
499 { | 550 { |
500 if (RenderMultiColumnSet* columnSet = lastMultiColumnSet()) | 551 if (RenderMultiColumnSet* columnSet = lastMultiColumnSet()) |
501 return columnSet->pageLogicalHeight(); | 552 return columnSet->pageLogicalHeight(); |
502 return false; | 553 return false; |
503 } | 554 } |
504 | 555 |
505 } | 556 } |
OLD | NEW |