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

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

Issue 7946014: Merge 95461 - Child not placed correctly when beforeChild (table part) (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/874/
Patch Set: Created 9 years, 3 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
« no previous file with comments | « no previous file | Source/WebCore/rendering/RenderObject.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 } 675 }
676 } 676 }
677 } 677 }
678 } 678 }
679 return columnsBlockAncestor; 679 return columnsBlockAncestor;
680 } 680 }
681 681
682 void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild, RenderObject* beforeChild) 682 void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild, RenderObject* beforeChild)
683 { 683 {
684 // Make sure we don't append things after :after-generated content if we hav e it. 684 // Make sure we don't append things after :after-generated content if we hav e it.
685 if (!beforeChild) { 685 if (!beforeChild)
686 RenderObject* lastRenderer = lastChild(); 686 beforeChild = findAfterContentRenderer();
687 while (lastRenderer && lastRenderer->isAnonymous() && !isAfterContent(la stRenderer))
688 lastRenderer = lastRenderer->lastChild();
689 if (lastRenderer && isAfterContent(lastRenderer))
690 beforeChild = lastRenderer;
691 }
692 687
693 // If the requested beforeChild is not one of our children, then this is bec ause 688 // If the requested beforeChild is not one of our children, then this is bec ause
694 // there is an anonymous container within this object that contains the befo reChild. 689 // there is an anonymous container within this object that contains the befo reChild.
695 if (beforeChild && beforeChild->parent() != this) { 690 if (beforeChild && beforeChild->parent() != this) {
696 RenderObject* anonymousChild = beforeChild->parent(); 691 RenderObject* beforeChildAnonymousContainer = anonymousContainer(beforeC hild);
697 ASSERT(anonymousChild); 692 ASSERT(beforeChildAnonymousContainer);
693 ASSERT(beforeChildAnonymousContainer->isAnonymous());
698 694
699 while (anonymousChild->parent() != this) 695 if (beforeChildAnonymousContainer->isAnonymousBlock()) {
700 anonymousChild = anonymousChild->parent();
701
702 ASSERT(anonymousChild->isAnonymous());
703
704 if (anonymousChild->isAnonymousBlock()) {
705 // Insert the child into the anonymous block box instead of here. 696 // Insert the child into the anonymous block box instead of here.
706 if (newChild->isInline() || beforeChild->parent()->firstChild() != b eforeChild) 697 if (newChild->isInline() || beforeChild->parent()->firstChild() != b eforeChild)
707 beforeChild->parent()->addChild(newChild, beforeChild); 698 beforeChild->parent()->addChild(newChild, beforeChild);
708 else 699 else
709 addChild(newChild, beforeChild->parent()); 700 addChild(newChild, beforeChild->parent());
710 return; 701 return;
711 } 702 }
712 703
713 ASSERT(anonymousChild->isTable()); 704 ASSERT(beforeChildAnonymousContainer->isTable());
714 if ((newChild->isTableCol() && newChild->style()->display() == TABLE_COL UMN_GROUP) 705 if ((newChild->isTableCol() && newChild->style()->display() == TABLE_COL UMN_GROUP)
715 || (newChild->isRenderBlock() && newChild->style()->display() == TABLE_CAPTION) 706 || (newChild->isRenderBlock() && newChild->style()->display() == TABLE_CAPTION)
716 || newChild->isTableSection() 707 || newChild->isTableSection()
717 || newChild->isTableRow() 708 || newChild->isTableRow()
718 || newChild->isTableCell()) { 709 || newChild->isTableCell()) {
719 // Insert into the anonymous table. 710 // Insert into the anonymous table.
720 anonymousChild->addChild(newChild, beforeChild); 711 beforeChildAnonymousContainer->addChild(newChild, beforeChild);
721 return; 712 return;
722 } 713 }
723 714
724 // Go on to insert before the anonymous table. 715 // Go on to insert before the anonymous table.
725 beforeChild = anonymousChild; 716 beforeChild = beforeChildAnonymousContainer;
726 } 717 }
727 718
728 // Check for a spanning element in columns. 719 // Check for a spanning element in columns.
729 RenderBlock* columnsBlockAncestor = columnsBlockForSpanningElement(newChild) ; 720 RenderBlock* columnsBlockAncestor = columnsBlockForSpanningElement(newChild) ;
730 if (columnsBlockAncestor) { 721 if (columnsBlockAncestor) {
731 // We are placing a column-span element inside a block. 722 // We are placing a column-span element inside a block.
732 RenderBlock* newBox = createAnonymousColumnSpanBlock(); 723 RenderBlock* newBox = createAnonymousColumnSpanBlock();
733 724
734 if (columnsBlockAncestor != this) { 725 if (columnsBlockAncestor != this) {
735 // We are nested inside a multi-column element and are being split b y the span. We have to break up 726 // We are nested inside a multi-column element and are being split b y the span. We have to break up
(...skipping 5890 matching lines...) Expand 10 before | Expand all | Expand 10 after
6626 } 6617 }
6627 6618
6628 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject) 6619 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject)
6629 { 6620 {
6630 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x( ), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); 6621 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x( ), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY());
6631 } 6622 }
6632 6623
6633 #endif 6624 #endif
6634 6625
6635 } // namespace WebCore 6626 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/WebCore/rendering/RenderObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698