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, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights 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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 | 422 |
423 // Create a new anonymous box of the appropriate type. | 423 // Create a new anonymous box of the appropriate type. |
424 RenderBlock* newBox = newChildHasColumnSpan ? createAnonymousColumnSpanBlock
() : createAnonymousColumnsBlock(); | 424 RenderBlock* newBox = newChildHasColumnSpan ? createAnonymousColumnSpanBlock
() : createAnonymousColumnsBlock(); |
425 children()->insertChildNode(this, newBox, newBeforeChild); | 425 children()->insertChildNode(this, newBox, newBeforeChild); |
426 newBox->addChildIgnoringAnonymousColumnBlocks(newChild, 0); | 426 newBox->addChildIgnoringAnonymousColumnBlocks(newChild, 0); |
427 return; | 427 return; |
428 } | 428 } |
429 | 429 |
430 RenderBlock* RenderBlock::containingColumnsBlock(bool allowAnonymousColumnBlock) | 430 RenderBlock* RenderBlock::containingColumnsBlock(bool allowAnonymousColumnBlock) |
431 { | 431 { |
| 432 RenderBlock* firstChildIgnoringAnonymousWrappers = 0; |
432 for (RenderObject* curr = this; curr; curr = curr->parent()) { | 433 for (RenderObject* curr = this; curr; curr = curr->parent()) { |
433 if (!curr->isRenderBlock() || curr->isFloatingOrPositioned() || curr->is
TableCell() || curr->isRoot() || curr->isRenderView() || curr->hasOverflowClip() | 434 if (!curr->isRenderBlock() || curr->isFloatingOrPositioned() || curr->is
TableCell() || curr->isRoot() || curr->isRenderView() || curr->hasOverflowClip() |
434 || curr->isInlineBlockOrInlineTable()) | 435 || curr->isInlineBlockOrInlineTable()) |
435 return 0; | 436 return 0; |
436 | 437 |
437 RenderBlock* currBlock = toRenderBlock(curr); | 438 RenderBlock* currBlock = toRenderBlock(curr); |
| 439 if (!currBlock->createsAnonymousWrapper()) |
| 440 firstChildIgnoringAnonymousWrappers = currBlock; |
| 441 |
438 if (currBlock->style()->specifiesColumns() && (allowAnonymousColumnBlock
|| !currBlock->isAnonymousColumnsBlock())) | 442 if (currBlock->style()->specifiesColumns() && (allowAnonymousColumnBlock
|| !currBlock->isAnonymousColumnsBlock())) |
439 return currBlock; | 443 return firstChildIgnoringAnonymousWrappers; |
440 | 444 |
441 if (currBlock->isAnonymousColumnSpanBlock()) | 445 if (currBlock->isAnonymousColumnSpanBlock()) |
442 return 0; | 446 return 0; |
443 } | 447 } |
444 return 0; | 448 return 0; |
445 } | 449 } |
446 | 450 |
447 RenderBlock* RenderBlock::clone() const | 451 RenderBlock* RenderBlock::clone() const |
448 { | 452 { |
449 RenderBlock* cloneBlock; | 453 RenderBlock* cloneBlock; |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 // FIXME: This function is the gateway for the addition of column-span suppo
rt. It will | 670 // FIXME: This function is the gateway for the addition of column-span suppo
rt. It will |
667 // be added to in three stages: | 671 // be added to in three stages: |
668 // (1) Immediate children of a multi-column block can span. | 672 // (1) Immediate children of a multi-column block can span. |
669 // (2) Nested block-level children with only block-level ancestors between t
hem and the multi-column block can span. | 673 // (2) Nested block-level children with only block-level ancestors between t
hem and the multi-column block can span. |
670 // (3) Nested children with block or inline ancestors between them and the m
ulti-column block can span (this is when we | 674 // (3) Nested children with block or inline ancestors between them and the m
ulti-column block can span (this is when we |
671 // cross the streams and have to cope with both types of continuations mixed
together). | 675 // cross the streams and have to cope with both types of continuations mixed
together). |
672 // This function currently supports (1) and (2). | 676 // This function currently supports (1) and (2). |
673 RenderBlock* columnsBlockAncestor = 0; | 677 RenderBlock* columnsBlockAncestor = 0; |
674 if (!newChild->isText() && newChild->style()->columnSpan() && !newChild->isB
eforeOrAfterContent() | 678 if (!newChild->isText() && newChild->style()->columnSpan() && !newChild->isB
eforeOrAfterContent() |
675 && !newChild->isFloatingOrPositioned() && !newChild->isInline() && !isAn
onymousColumnSpanBlock()) { | 679 && !newChild->isFloatingOrPositioned() && !newChild->isInline() && !isAn
onymousColumnSpanBlock()) { |
676 if (style()->specifiesColumns()) | 680 columnsBlockAncestor = containingColumnsBlock(false); |
677 columnsBlockAncestor = this; | 681 if (columnsBlockAncestor) { |
678 else if (!isInline() && parent() && parent()->isRenderBlock()) { | 682 // Make sure that none of the parent ancestors have a continuation. |
679 columnsBlockAncestor = toRenderBlock(parent())->containingColumnsBlo
ck(false); | 683 // If yes, we do not want split the block into continuations. |
680 | 684 RenderObject* curr = this; |
681 if (columnsBlockAncestor) { | 685 while (curr && curr != columnsBlockAncestor) { |
682 // Make sure that none of the parent ancestors have a continuati
on. | 686 if (curr->isRenderBlock() && toRenderBlock(curr)->continuation()
) { |
683 // If yes, we do not want split the block into continuations. | 687 columnsBlockAncestor = 0; |
684 RenderObject* curr = this; | 688 break; |
685 while (curr && curr != columnsBlockAncestor) { | |
686 if (curr->isRenderBlock() && toRenderBlock(curr)->continuati
on()) { | |
687 columnsBlockAncestor = 0; | |
688 break; | |
689 } | |
690 curr = curr->parent(); | |
691 } | 689 } |
| 690 curr = curr->parent(); |
692 } | 691 } |
693 } | 692 } |
694 } | 693 } |
695 return columnsBlockAncestor; | 694 return columnsBlockAncestor; |
696 } | 695 } |
697 | 696 |
698 void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild,
RenderObject* beforeChild) | 697 void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild,
RenderObject* beforeChild) |
699 { | 698 { |
700 // Make sure we don't append things after :after-generated content if we hav
e it. | 699 // Make sure we don't append things after :after-generated content if we hav
e it. |
701 if (!beforeChild) | 700 if (!beforeChild) |
(...skipping 6406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7108 } | 7107 } |
7109 | 7108 |
7110 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 7109 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
7111 { | 7110 { |
7112 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); | 7111 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); |
7113 } | 7112 } |
7114 | 7113 |
7115 #endif | 7114 #endif |
7116 | 7115 |
7117 } // namespace WebCore | 7116 } // namespace WebCore |
OLD | NEW |