Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(984)

Side by Side Diff: Source/WebCore/rendering/RenderBlock.cpp

Issue 9568036: Merge 108606 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 } 765 }
766 return columnsBlockAncestor; 766 return columnsBlockAncestor;
767 } 767 }
768 768
769 void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild, RenderObject* beforeChild) 769 void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild, RenderObject* beforeChild)
770 { 770 {
771 // Make sure we don't append things after :after-generated content if we hav e it. 771 // Make sure we don't append things after :after-generated content if we hav e it.
772 if (!beforeChild) 772 if (!beforeChild)
773 beforeChild = afterPseudoElementRenderer(); 773 beforeChild = afterPseudoElementRenderer();
774 774
775 // If the requested beforeChild is not one of our children, then this is bec ause
776 // there is an anonymous container within this object that contains the befo reChild.
777 if (beforeChild && beforeChild->parent() != this) { 775 if (beforeChild && beforeChild->parent() != this) {
778 RenderObject* beforeChildAnonymousContainer = anonymousContainer(beforeC hild); 776 RenderObject* beforeChildContainer = beforeChild->parent();
779 ASSERT(beforeChildAnonymousContainer); 777 while (beforeChildContainer->parent() != this)
780 ASSERT(beforeChildAnonymousContainer->isAnonymous()); 778 beforeChildContainer = beforeChildContainer->parent();
779 ASSERT(beforeChildContainer);
781 780
782 if (beforeChildAnonymousContainer->isAnonymousBlock()) { 781 if (beforeChildContainer->isAnonymous()) {
783 // Insert the child into the anonymous block box instead of here. 782 // If the requested beforeChild is not one of our children, then thi s is because
784 if (newChild->isInline() || beforeChild->parent()->firstChild() != b eforeChild) 783 // there is an anonymous container within this object that contains the beforeChild.
785 beforeChild->parent()->addChild(newChild, beforeChild); 784 RenderObject* beforeChildAnonymousContainer = beforeChildContainer;
786 else 785 if (beforeChildAnonymousContainer->isAnonymousBlock()) {
787 addChild(newChild, beforeChild->parent()); 786 // Insert the child into the anonymous block box instead of here .
788 return; 787 if (newChild->isInline() || beforeChild->parent()->firstChild() != beforeChild)
788 beforeChild->parent()->addChild(newChild, beforeChild);
789 else
790 addChild(newChild, beforeChild->parent());
791 return;
792 }
793
794 ASSERT(beforeChildAnonymousContainer->isTable());
795 if (newChild->isTablePart()) {
796 // Insert into the anonymous table.
797 beforeChildAnonymousContainer->addChild(newChild, beforeChild);
798 return;
799 }
800
801 beforeChild = splitTablePartsAroundChild(beforeChild);
802
803 ASSERT(beforeChild->parent() == this);
804 if (beforeChild->parent() != this) {
805 // We should never reach here. If we do, we need to use the
806 // safe fallback to use the topmost beforeChild container.
807 beforeChild = beforeChildContainer;
808 }
809 } else {
810 // We will reach here when beforeChild is a run-in element.
811 // If run-in element precedes a block-level element, it becomes the
812 // the first inline child of that block level element. The insertion
813 // point will be before that block-level element.
814 ASSERT(beforeChild->isRunIn());
815 beforeChild = beforeChildContainer;
789 } 816 }
790
791 ASSERT(beforeChildAnonymousContainer->isTable());
792 if ((newChild->isTableCol() && newChild->style()->display() == TABLE_COL UMN_GROUP)
793 || (newChild->isTableCaption())
794 || newChild->isTableSection()
795 || newChild->isTableRow()
796 || newChild->isTableCell()) {
797 // Insert into the anonymous table.
798 beforeChildAnonymousContainer->addChild(newChild, beforeChild);
799 return;
800 }
801
802 beforeChild = splitTablePartsAroundChild(beforeChild);
803 } 817 }
804 818
805 // Check for a spanning element in columns. 819 // Check for a spanning element in columns.
806 RenderBlock* columnsBlockAncestor = columnsBlockForSpanningElement(newChild) ; 820 RenderBlock* columnsBlockAncestor = columnsBlockForSpanningElement(newChild) ;
807 if (columnsBlockAncestor) { 821 if (columnsBlockAncestor) {
808 // We are placing a column-span element inside a block. 822 // We are placing a column-span element inside a block.
809 RenderBlock* newBox = createAnonymousColumnSpanBlock(); 823 RenderBlock* newBox = createAnonymousColumnSpanBlock();
810 824
811 if (columnsBlockAncestor != this) { 825 if (columnsBlockAncestor != this) {
812 // We are nested inside a multi-column element and are being split b y the span. We have to break up 826 // We are nested inside a multi-column element and are being split b y the span. We have to break up
(...skipping 6365 matching lines...) Expand 10 before | Expand all | Expand 10 after
7178 } 7192 }
7179 7193
7180 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject) 7194 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject)
7181 { 7195 {
7182 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x( ), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); 7196 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x( ), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY());
7183 } 7197 }
7184 7198
7185 #endif 7199 #endif
7186 7200
7187 } // namespace WebCore 7201 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/runin/runin-table-before-child-expected.txt ('k') | Source/WebCore/rendering/RenderObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698