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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 | 46 |
47 RenderMultiColumnFlowThread* RenderMultiColumnFlowThread::createAnonymous(Docume
nt& document, RenderStyle* parentStyle) | 47 RenderMultiColumnFlowThread* RenderMultiColumnFlowThread::createAnonymous(Docume
nt& document, RenderStyle* parentStyle) |
48 { | 48 { |
49 RenderMultiColumnFlowThread* renderer = new RenderMultiColumnFlowThread(); | 49 RenderMultiColumnFlowThread* renderer = new RenderMultiColumnFlowThread(); |
50 renderer->setDocumentForAnonymous(&document); | 50 renderer->setDocumentForAnonymous(&document); |
51 renderer->setStyle(RenderStyle::createAnonymousStyleWithDisplay(parentStyle,
BLOCK)); | 51 renderer->setStyle(RenderStyle::createAnonymousStyleWithDisplay(parentStyle,
BLOCK)); |
52 return renderer; | 52 return renderer; |
53 } | 53 } |
54 | 54 |
| 55 void RenderMultiColumnFlowThread::populate() |
| 56 { |
| 57 RenderBlockFlow* multicolContainer = multiColumnBlockFlow(); |
| 58 ASSERT(!nextSibling()); |
| 59 // Reparent children preceding the flow thread into the flow thread. It's mu
lticol content |
| 60 // now. At this point there's obviously nothing after the flow thread, but r
enderers (column |
| 61 // sets and spanners) will be inserted there as we insert elements into the
flow thread. |
| 62 multicolContainer->moveChildrenTo(this, multicolContainer->firstChild(), thi
s, true); |
| 63 } |
| 64 |
| 65 void RenderMultiColumnFlowThread::evacuateAndDestroy() |
| 66 { |
| 67 RenderBlockFlow* multicolContainer = multiColumnBlockFlow(); |
| 68 |
| 69 // Remove all sets. |
| 70 for (RenderBox* sibling = nextSiblingBox(); sibling;) { |
| 71 RenderBox* nextSibling = sibling->nextSiblingBox(); |
| 72 if (sibling->isRenderMultiColumnSet()) |
| 73 sibling->destroy(); |
| 74 sibling = nextSibling; |
| 75 } |
| 76 |
| 77 ASSERT(!previousSibling()); |
| 78 ASSERT(!nextSibling()); |
| 79 |
| 80 // Finally we can promote all flow thread's children. Before we move them to
the flow thread's |
| 81 // container, we need to unregister the flow thread, so that they aren't jus
t re-added again to |
| 82 // the flow thread that we're trying to empty. |
| 83 multicolContainer->resetMultiColumnFlowThread(); |
| 84 moveAllChildrenTo(multicolContainer, true); |
| 85 |
| 86 destroy(); |
| 87 } |
| 88 |
55 void RenderMultiColumnFlowThread::layoutColumns(bool relayoutChildren, SubtreeLa
youtScope& layoutScope) | 89 void RenderMultiColumnFlowThread::layoutColumns(bool relayoutChildren, SubtreeLa
youtScope& layoutScope) |
56 { | 90 { |
57 // Update the dimensions of our regions before we lay out the flow thread. | 91 // Update the dimensions of our regions before we lay out the flow thread. |
58 // FIXME: Eventually this is going to get way more complicated, and we will
be destroying regions | 92 // FIXME: Eventually this is going to get way more complicated, and we will
be destroying regions |
59 // instead of trying to keep them around. | 93 // instead of trying to keep them around. |
60 RenderBlockFlow* container = multiColumnBlockFlow(); | 94 RenderBlockFlow* container = multiColumnBlockFlow(); |
61 bool shouldInvalidateRegions = false; | 95 bool shouldInvalidateRegions = false; |
62 for (RenderBox* childBox = container->firstChildBox(); childBox; childBox =
childBox->nextSiblingBox()) { | 96 for (RenderBox* childBox = container->firstChildBox(); childBox; childBox =
childBox->nextSiblingBox()) { |
63 if (childBox == this) | 97 if (childBox == this) |
64 continue; | 98 continue; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 { | 267 { |
234 for (RenderBox* renderer = parentBox()->lastChildBox(); renderer; renderer =
renderer->previousSiblingBox()) { | 268 for (RenderBox* renderer = parentBox()->lastChildBox(); renderer; renderer =
renderer->previousSiblingBox()) { |
235 if (renderer->isRenderMultiColumnSet()) | 269 if (renderer->isRenderMultiColumnSet()) |
236 return toRenderMultiColumnSet(renderer)->computedColumnHeight(); | 270 return toRenderMultiColumnSet(renderer)->computedColumnHeight(); |
237 } | 271 } |
238 // A column set hasn't been created yet. Height may already be known if colu
mn-fill is 'auto', though. | 272 // A column set hasn't been created yet. Height may already be known if colu
mn-fill is 'auto', though. |
239 return !requiresBalancing(); | 273 return !requiresBalancing(); |
240 } | 274 } |
241 | 275 |
242 } | 276 } |
OLD | NEW |