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

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

Issue 922173002: Don't pass semi-detached renderers to the flow thread (or anyone else). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: A child that got its children promoted will never be a last child in its parent. Created 5 years, 10 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 | « LayoutTests/fast/multicol/dynamic/insert-block-among-text-in-anonymous-wrapper-expected.html ('k') | no next file » | 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, 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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 ASSERT(!c->isInline()); 1018 ASSERT(!c->isInline());
1019 #endif 1019 #endif
1020 1020
1021 setShouldDoFullPaintInvalidation(); 1021 setShouldDoFullPaintInvalidation();
1022 } 1022 }
1023 1023
1024 void RenderBlock::removeLeftoverAnonymousBlock(RenderBlock* child) 1024 void RenderBlock::removeLeftoverAnonymousBlock(RenderBlock* child)
1025 { 1025 {
1026 ASSERT(child->isAnonymousBlock()); 1026 ASSERT(child->isAnonymousBlock());
1027 ASSERT(!child->childrenInline()); 1027 ASSERT(!child->childrenInline());
1028 ASSERT(child->parent() == this);
1028 1029
1029 if (child->continuation() || (child->firstChild() && (child->isAnonymousColu mnSpanBlock() || child->isAnonymousColumnsBlock()))) 1030 if (child->continuation() || (child->firstChild() && (child->isAnonymousColu mnSpanBlock() || child->isAnonymousColumnsBlock())))
1030 return; 1031 return;
1031 1032
1032 LayoutObject* firstAnChild = child->m_children.firstChild(); 1033 // Promote all the leftover anonymous block's children (to become children o f this block
1033 LayoutObject* lastAnChild = child->m_children.lastChild(); 1034 // instead). Put them right after the leftover block. We still want to keep the leftover block
1034 if (firstAnChild) { 1035 // in the tree for a moment, for notification purposes done further below (f low threads and
1035 LayoutObject* o = firstAnChild; 1036 // grids).
1036 while (o) { 1037 if (LayoutObject* firstPromotee = child->firstChild()) {
1038 LayoutObject* lastPromotee = child->lastChild();
1039 LayoutObject* nextSiblingOfPromotees = child->nextSibling();
1040 for (LayoutObject* o = firstPromotee; o; o = o->nextSibling())
1037 o->setParent(this); 1041 o->setParent(this);
1038 o = o->nextSibling(); 1042 child->children()->setFirstChild(0);
1039 } 1043 child->children()->setLastChild(0);
dsinclair 2015/02/17 18:25:01 nit: change the 0's to nullptrs
mstensho (USE GERRIT) 2015/02/18 20:02:25 Done.
1040 firstAnChild->setPreviousSibling(child->previousSibling()); 1044 firstPromotee->setPreviousSibling(child);
1041 lastAnChild->setNextSibling(child->nextSibling()); 1045 child->setNextSibling(firstPromotee);
1042 if (child->previousSibling()) 1046 lastPromotee->setNextSibling(nextSiblingOfPromotees);
1043 child->previousSibling()->setNextSibling(firstAnChild); 1047 if (nextSiblingOfPromotees)
1044 if (child->nextSibling()) 1048 nextSiblingOfPromotees->setPreviousSibling(lastPromotee);
1045 child->nextSibling()->setPreviousSibling(lastAnChild); 1049 if (children()->lastChild() == child)
1046 1050 children()->setLastChild(lastPromotee);
1047 if (child == m_children.firstChild())
1048 m_children.setFirstChild(firstAnChild);
1049 if (child == m_children.lastChild())
1050 m_children.setLastChild(lastAnChild);
1051 } else {
1052 if (child == m_children.firstChild())
1053 m_children.setFirstChild(child->nextSibling());
1054 if (child == m_children.lastChild())
1055 m_children.setLastChild(child->previousSibling());
1056
1057 if (child->previousSibling())
1058 child->previousSibling()->setNextSibling(child->nextSibling());
1059 if (child->nextSibling())
1060 child->nextSibling()->setPreviousSibling(child->previousSibling());
1061 } 1051 }
1062 1052
1063 child->children()->setFirstChild(0);
1064 child->m_next = nullptr;
1065
1066 // Remove all the information in the flow thread associated with the leftove r anonymous block. 1053 // Remove all the information in the flow thread associated with the leftove r anonymous block.
1067 child->removeFromLayoutFlowThread(); 1054 child->removeFromLayoutFlowThread();
1068 1055
1069 // RenderGrid keeps track of its children, we must notify it about changes i n the tree. 1056 // RenderGrid keeps track of its children, we must notify it about changes i n the tree.
1070 if (child->parent()->isRenderGrid()) 1057 if (child->parent()->isRenderGrid())
1071 toRenderGrid(child->parent())->dirtyGrid(); 1058 toRenderGrid(child->parent())->dirtyGrid();
1072 1059
1073 child->setParent(0); 1060 // Now remove the leftover anonymous block from the tree, and destroy it. We 'll rip it out
1074 child->setPreviousSibling(0); 1061 // manually from the tree before destroying it, because we don't want to tri gger any tree
1075 child->setNextSibling(0); 1062 // adjustments with regards to anonymous blocks (or any other kind of undesi red chain-reaction).
1076 1063 children()->removeChildNode(this, child, false);
1077 child->destroy(); 1064 child->destroy();
1078 } 1065 }
1079 1066
1080 static bool canMergeContiguousAnonymousBlocks(LayoutObject* oldChild, LayoutObje ct* prev, LayoutObject* next) 1067 static bool canMergeContiguousAnonymousBlocks(LayoutObject* oldChild, LayoutObje ct* prev, LayoutObject* next)
1081 { 1068 {
1082 if (oldChild->documentBeingDestroyed() || oldChild->isInline() || oldChild-> virtualContinuation()) 1069 if (oldChild->documentBeingDestroyed() || oldChild->isInline() || oldChild-> virtualContinuation())
1083 return false; 1070 return false;
1084 1071
1085 if ((prev && (!prev->isAnonymousBlock() || toRenderBlock(prev)->continuation () || toRenderBlock(prev)->beingDestroyed())) 1072 if ((prev && (!prev->isAnonymousBlock() || toRenderBlock(prev)->continuation () || toRenderBlock(prev)->beingDestroyed()))
1086 || (next && (!next->isAnonymousBlock() || toRenderBlock(next)->continuat ion() || toRenderBlock(next)->beingDestroyed()))) 1073 || (next && (!next->isAnonymousBlock() || toRenderBlock(next)->continuat ion() || toRenderBlock(next)->beingDestroyed())))
(...skipping 2858 matching lines...) Expand 10 before | Expand all | Expand 10 after
3945 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 3932 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
3946 { 3933 {
3947 showLayoutObject(); 3934 showLayoutObject();
3948 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 3935 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
3949 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 3936 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
3950 } 3937 }
3951 3938
3952 #endif 3939 #endif
3953 3940
3954 } // namespace blink 3941 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/multicol/dynamic/insert-block-among-text-in-anonymous-wrapper-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698