| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r
ights reserved. |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 return flow->addChildIgnoringContinuation(newChild, 0); // Just treat li
ke an append. | 336 return flow->addChildIgnoringContinuation(newChild, 0); // Just treat li
ke an append. |
| 337 return beforeChildParent->addChildIgnoringContinuation(newChild, beforeChild
); | 337 return beforeChildParent->addChildIgnoringContinuation(newChild, beforeChild
); |
| 338 } | 338 } |
| 339 | 339 |
| 340 | 340 |
| 341 void RenderBlock::addChildToAnonymousColumnBlocks(RenderObject* newChild, Render
Object* beforeChild) | 341 void RenderBlock::addChildToAnonymousColumnBlocks(RenderObject* newChild, Render
Object* beforeChild) |
| 342 { | 342 { |
| 343 ASSERT(!continuation()); // We don't yet support column spans that aren't im
mediate children of the multi-column block. | 343 ASSERT(!continuation()); // We don't yet support column spans that aren't im
mediate children of the multi-column block. |
| 344 | 344 |
| 345 // The goal is to locate a suitable box in which to place our child. | 345 // The goal is to locate a suitable box in which to place our child. |
| 346 RenderBlock* beforeChildParent = toRenderBlock(beforeChild ? beforeChild->pa
rent() : lastChild()); | 346 RenderBlock* beforeChildParent = toRenderBlock(beforeChild && beforeChild->p
arent()->isRenderBlock() ? beforeChild->parent() : lastChild()); |
| 347 | 347 |
| 348 // If the new child is floating or positioned it can just go in that block. | 348 // If the new child is floating or positioned it can just go in that block. |
| 349 if (newChild->isFloatingOrPositioned()) | 349 if (newChild->isFloatingOrPositioned()) |
| 350 return beforeChildParent->addChildIgnoringAnonymousColumnBlocks(newChild
, beforeChild); | 350 return beforeChildParent->addChildIgnoringAnonymousColumnBlocks(newChild
, beforeChild); |
| 351 | 351 |
| 352 // See if the child can be placed in the box. | 352 // See if the child can be placed in the box. |
| 353 bool newChildHasColumnSpan = newChild->style()->columnSpan() && !newChild->i
sInline(); | 353 bool newChildHasColumnSpan = newChild->style()->columnSpan() && !newChild->i
sInline(); |
| 354 bool beforeChildParentHoldsColumnSpans = beforeChildParent->isAnonymousColum
nSpanBlock(); | 354 bool beforeChildParentHoldsColumnSpans = beforeChildParent->isAnonymousColum
nSpanBlock(); |
| 355 | 355 |
| 356 if (newChildHasColumnSpan == beforeChildParentHoldsColumnSpans) | 356 if (newChildHasColumnSpan == beforeChildParentHoldsColumnSpans) |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 // (1) Immediate children of a multi-column block can span. | 613 // (1) Immediate children of a multi-column block can span. |
| 614 // (2) Nested block-level children with only block-level ancestors between t
hem and the multi-column block can span. | 614 // (2) Nested block-level children with only block-level ancestors between t
hem and the multi-column block can span. |
| 615 // (3) Nested children with block or inline ancestors between them and the m
ulti-column block can span (this is when we | 615 // (3) Nested children with block or inline ancestors between them and the m
ulti-column block can span (this is when we |
| 616 // cross the streams and have to cope with both types of continuations mixed
together). | 616 // cross the streams and have to cope with both types of continuations mixed
together). |
| 617 // This function currently supports (1) and (2). | 617 // This function currently supports (1) and (2). |
| 618 RenderBlock* columnsBlockAncestor = 0; | 618 RenderBlock* columnsBlockAncestor = 0; |
| 619 if (!newChild->isText() && newChild->style()->columnSpan() && !newChild->isF
loatingOrPositioned() | 619 if (!newChild->isText() && newChild->style()->columnSpan() && !newChild->isF
loatingOrPositioned() |
| 620 && !newChild->isInline() && !isAnonymousColumnSpanBlock()) { | 620 && !newChild->isInline() && !isAnonymousColumnSpanBlock()) { |
| 621 if (style()->specifiesColumns()) | 621 if (style()->specifiesColumns()) |
| 622 columnsBlockAncestor = this; | 622 columnsBlockAncestor = this; |
| 623 else | 623 else if (parent() && parent()->isRenderBlock()) |
| 624 columnsBlockAncestor = toRenderBlock(parent())->containingColumnsBlo
ck(false); | 624 columnsBlockAncestor = toRenderBlock(parent())->containingColumnsBlo
ck(false); |
| 625 } | 625 } |
| 626 return columnsBlockAncestor; | 626 return columnsBlockAncestor; |
| 627 } | 627 } |
| 628 | 628 |
| 629 void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild,
RenderObject* beforeChild) | 629 void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild,
RenderObject* beforeChild) |
| 630 { | 630 { |
| 631 // Make sure we don't append things after :after-generated content if we hav
e it. | 631 // Make sure we don't append things after :after-generated content if we hav
e it. |
| 632 if (!beforeChild) { | 632 if (!beforeChild) { |
| 633 RenderObject* lastRenderer = lastChild(); | 633 RenderObject* lastRenderer = lastChild(); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 anonBlock->moveAllChildrenTo(this, child->hasLayer()); | 1010 anonBlock->moveAllChildrenTo(this, child->hasLayer()); |
| 1011 // Delete the now-empty block's lines and nuke it. | 1011 // Delete the now-empty block's lines and nuke it. |
| 1012 anonBlock->deleteLineBoxTree(); | 1012 anonBlock->deleteLineBoxTree(); |
| 1013 anonBlock->destroy(); | 1013 anonBlock->destroy(); |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 if (!firstChild() && !documentBeingDestroyed()) { | 1016 if (!firstChild() && !documentBeingDestroyed()) { |
| 1017 // If this was our last child be sure to clear out our line boxes. | 1017 // If this was our last child be sure to clear out our line boxes. |
| 1018 if (childrenInline()) | 1018 if (childrenInline()) |
| 1019 lineBoxes()->deleteLineBoxes(renderArena()); | 1019 lineBoxes()->deleteLineBoxes(renderArena()); |
| 1020 // If we're now an empty anonymous columns or column span block, then go
ahead and delete ourselves. | |
| 1021 else if ((isAnonymousColumnsBlock() || isAnonymousColumnSpanBlock()) &&
parent() && parent()->isRenderBlock() && !continuation()) | |
| 1022 destroy(); | |
| 1023 } | 1020 } |
| 1024 } | 1021 } |
| 1025 | 1022 |
| 1026 bool RenderBlock::isSelfCollapsingBlock() const | 1023 bool RenderBlock::isSelfCollapsingBlock() const |
| 1027 { | 1024 { |
| 1028 // We are not self-collapsing if we | 1025 // We are not self-collapsing if we |
| 1029 // (a) have a non-zero height according to layout (an optimization to avoid
wasting time) | 1026 // (a) have a non-zero height according to layout (an optimization to avoid
wasting time) |
| 1030 // (b) are a table, | 1027 // (b) are a table, |
| 1031 // (c) have border/padding, | 1028 // (c) have border/padding, |
| 1032 // (d) have a min-height | 1029 // (d) have a min-height |
| (...skipping 4687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5720 else if (isAnonymous()) | 5717 else if (isAnonymous()) |
| 5721 return "RenderBlock (generated)"; | 5718 return "RenderBlock (generated)"; |
| 5722 if (isRelPositioned()) | 5719 if (isRelPositioned()) |
| 5723 return "RenderBlock (relative positioned)"; | 5720 return "RenderBlock (relative positioned)"; |
| 5724 if (isRunIn()) | 5721 if (isRunIn()) |
| 5725 return "RenderBlock (run-in)"; | 5722 return "RenderBlock (run-in)"; |
| 5726 return "RenderBlock"; | 5723 return "RenderBlock"; |
| 5727 } | 5724 } |
| 5728 | 5725 |
| 5729 } // namespace WebCore | 5726 } // namespace WebCore |
| OLD | NEW |