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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 } | 759 } |
760 return columnsBlockAncestor; | 760 return columnsBlockAncestor; |
761 } | 761 } |
762 | 762 |
763 void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild,
RenderObject* beforeChild) | 763 void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild,
RenderObject* beforeChild) |
764 { | 764 { |
765 // Make sure we don't append things after :after-generated content if we hav
e it. | 765 // Make sure we don't append things after :after-generated content if we hav
e it. |
766 if (!beforeChild) | 766 if (!beforeChild) |
767 beforeChild = afterPseudoElementRenderer(); | 767 beforeChild = afterPseudoElementRenderer(); |
768 | 768 |
769 // If the requested beforeChild is not one of our children, then this is bec
ause | |
770 // there is an anonymous container within this object that contains the befo
reChild. | |
771 if (beforeChild && beforeChild->parent() != this) { | 769 if (beforeChild && beforeChild->parent() != this) { |
772 RenderObject* beforeChildAnonymousContainer = anonymousContainer(beforeC
hild); | 770 RenderObject* beforeChildContainer = beforeChild->parent(); |
773 ASSERT(beforeChildAnonymousContainer); | 771 while (beforeChildContainer->parent() != this) |
774 ASSERT(beforeChildAnonymousContainer->isAnonymous()); | 772 beforeChildContainer = beforeChildContainer->parent(); |
| 773 ASSERT(beforeChildContainer); |
775 | 774 |
776 if (beforeChildAnonymousContainer->isAnonymousBlock()) { | 775 if (beforeChildContainer->isAnonymous()) { |
777 // Insert the child into the anonymous block box instead of here. | 776 // If the requested beforeChild is not one of our children, then thi
s is because |
778 if (newChild->isInline() || beforeChild->parent()->firstChild() != b
eforeChild) | 777 // there is an anonymous container within this object that contains
the beforeChild. |
779 beforeChild->parent()->addChild(newChild, beforeChild); | 778 RenderObject* beforeChildAnonymousContainer = beforeChildContainer; |
780 else | 779 if (beforeChildAnonymousContainer->isAnonymousBlock()) { |
781 addChild(newChild, beforeChild->parent()); | 780 // Insert the child into the anonymous block box instead of here
. |
782 return; | 781 if (newChild->isInline() || beforeChild->parent()->firstChild()
!= beforeChild) |
| 782 beforeChild->parent()->addChild(newChild, beforeChild); |
| 783 else |
| 784 addChild(newChild, beforeChild->parent()); |
| 785 return; |
| 786 } |
| 787 |
| 788 ASSERT(beforeChildAnonymousContainer->isTable()); |
| 789 if (newChild->isTablePart()) { |
| 790 // Insert into the anonymous table. |
| 791 beforeChildAnonymousContainer->addChild(newChild, beforeChild); |
| 792 return; |
| 793 } |
| 794 |
| 795 beforeChild = splitTablePartsAroundChild(beforeChild); |
| 796 |
| 797 ASSERT(beforeChild->parent() == this); |
| 798 if (beforeChild->parent() != this) { |
| 799 // We should never reach here. If we do, we need to use the |
| 800 // safe fallback to use the topmost beforeChild container. |
| 801 beforeChild = beforeChildContainer; |
| 802 } |
| 803 } else { |
| 804 // We will reach here when beforeChild is a run-in element. |
| 805 // If run-in element precedes a block-level element, it becomes the |
| 806 // the first inline child of that block level element. The insertion |
| 807 // point will be before that block-level element. |
| 808 ASSERT(beforeChild->isRunIn()); |
| 809 beforeChild = beforeChildContainer; |
783 } | 810 } |
784 | |
785 ASSERT(beforeChildAnonymousContainer->isTable()); | |
786 if ((newChild->isTableCol() && newChild->style()->display() == TABLE_COL
UMN_GROUP) | |
787 || (newChild->isTableCaption()) | |
788 || newChild->isTableSection() | |
789 || newChild->isTableRow() | |
790 || newChild->isTableCell()) { | |
791 // Insert into the anonymous table. | |
792 beforeChildAnonymousContainer->addChild(newChild, beforeChild); | |
793 return; | |
794 } | |
795 | |
796 beforeChild = splitTablePartsAroundChild(beforeChild); | |
797 } | 811 } |
798 | 812 |
799 // Check for a spanning element in columns. | 813 // Check for a spanning element in columns. |
800 RenderBlock* columnsBlockAncestor = columnsBlockForSpanningElement(newChild)
; | 814 RenderBlock* columnsBlockAncestor = columnsBlockForSpanningElement(newChild)
; |
801 if (columnsBlockAncestor) { | 815 if (columnsBlockAncestor) { |
802 // We are placing a column-span element inside a block. | 816 // We are placing a column-span element inside a block. |
803 RenderBlock* newBox = createAnonymousColumnSpanBlock(); | 817 RenderBlock* newBox = createAnonymousColumnSpanBlock(); |
804 | 818 |
805 if (columnsBlockAncestor != this) { | 819 if (columnsBlockAncestor != this) { |
806 // We are nested inside a multi-column element and are being split b
y the span. We have to break up | 820 // We are nested inside a multi-column element and are being split b
y the span. We have to break up |
(...skipping 6340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7147 } | 7161 } |
7148 | 7162 |
7149 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 7163 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
7150 { | 7164 { |
7151 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); | 7165 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); |
7152 } | 7166 } |
7153 | 7167 |
7154 #endif | 7168 #endif |
7155 | 7169 |
7156 } // namespace WebCore | 7170 } // namespace WebCore |
OLD | NEW |