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

Side by Side Diff: Source/core/layout/LayoutBlock.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: Code review - make a helper method. Created 5 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
« no previous file with comments | « Source/core/layout/LayoutBlock.h ('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 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 } 1016 }
1017 1017
1018 #if ENABLE(ASSERT) 1018 #if ENABLE(ASSERT)
1019 for (LayoutObject *c = firstChild(); c; c = c->nextSibling()) 1019 for (LayoutObject *c = firstChild(); c; c = c->nextSibling())
1020 ASSERT(!c->isInline()); 1020 ASSERT(!c->isInline());
1021 #endif 1021 #endif
1022 1022
1023 setShouldDoFullPaintInvalidation(); 1023 setShouldDoFullPaintInvalidation();
1024 } 1024 }
1025 1025
1026 void LayoutBlock::promoteAllChildrenAndInsertAfter()
1027 {
1028 LayoutObject* firstPromotee = firstChild();
1029 if (!firstPromotee)
1030 return;
1031 LayoutObject* lastPromotee = lastChild();
1032 LayoutBlock* parent = toLayoutBlock(this->parent());
1033 LayoutObject* nextSiblingOfPromotees = nextSibling();
1034 for (LayoutObject* o = firstPromotee; o; o = o->nextSibling())
1035 o->setParent(parent);
1036 children()->setFirstChild(nullptr);
1037 children()->setLastChild(nullptr);
1038 firstPromotee->setPreviousSibling(this);
1039 setNextSibling(firstPromotee);
1040 lastPromotee->setNextSibling(nextSiblingOfPromotees);
1041 if (nextSiblingOfPromotees)
1042 nextSiblingOfPromotees->setPreviousSibling(lastPromotee);
1043 if (parent->children()->lastChild() == this)
1044 parent->children()->setLastChild(lastPromotee);
1045 }
1046
1026 void LayoutBlock::removeLeftoverAnonymousBlock(LayoutBlock* child) 1047 void LayoutBlock::removeLeftoverAnonymousBlock(LayoutBlock* child)
1027 { 1048 {
1028 ASSERT(child->isAnonymousBlock()); 1049 ASSERT(child->isAnonymousBlock());
1029 ASSERT(!child->childrenInline()); 1050 ASSERT(!child->childrenInline());
1051 ASSERT(child->parent() == this);
1030 1052
1031 if (child->continuation() || (child->firstChild() && (child->isAnonymousColu mnSpanBlock() || child->isAnonymousColumnsBlock()))) 1053 if (child->continuation() || (child->firstChild() && (child->isAnonymousColu mnSpanBlock() || child->isAnonymousColumnsBlock())))
1032 return; 1054 return;
1033 1055
1034 LayoutObject* firstAnChild = child->m_children.firstChild(); 1056 // Promote all the leftover anonymous block's children (to become children o f this block
1035 LayoutObject* lastAnChild = child->m_children.lastChild(); 1057 // instead). We still want to keep the leftover block in the tree for a mome nt, for notification
1036 if (firstAnChild) { 1058 // purposes done further below (flow threads and grids).
1037 LayoutObject* o = firstAnChild; 1059 child->promoteAllChildrenAndInsertAfter();
1038 while (o) {
1039 o->setParent(this);
1040 o = o->nextSibling();
1041 }
1042 firstAnChild->setPreviousSibling(child->previousSibling());
1043 lastAnChild->setNextSibling(child->nextSibling());
1044 if (child->previousSibling())
1045 child->previousSibling()->setNextSibling(firstAnChild);
1046 if (child->nextSibling())
1047 child->nextSibling()->setPreviousSibling(lastAnChild);
1048
1049 if (child == m_children.firstChild())
1050 m_children.setFirstChild(firstAnChild);
1051 if (child == m_children.lastChild())
1052 m_children.setLastChild(lastAnChild);
1053 } else {
1054 if (child == m_children.firstChild())
1055 m_children.setFirstChild(child->nextSibling());
1056 if (child == m_children.lastChild())
1057 m_children.setLastChild(child->previousSibling());
1058
1059 if (child->previousSibling())
1060 child->previousSibling()->setNextSibling(child->nextSibling());
1061 if (child->nextSibling())
1062 child->nextSibling()->setPreviousSibling(child->previousSibling());
1063 }
1064
1065 child->children()->setFirstChild(0);
1066 child->m_next = nullptr;
1067 1060
1068 // Remove all the information in the flow thread associated with the leftove r anonymous block. 1061 // Remove all the information in the flow thread associated with the leftove r anonymous block.
1069 child->removeFromLayoutFlowThread(); 1062 child->removeFromLayoutFlowThread();
1070 1063
1071 // LayoutGrid keeps track of its children, we must notify it about changes i n the tree. 1064 // LayoutGrid keeps track of its children, we must notify it about changes i n the tree.
1072 if (child->parent()->isLayoutGrid()) 1065 if (child->parent()->isLayoutGrid())
1073 toLayoutGrid(child->parent())->dirtyGrid(); 1066 toLayoutGrid(child->parent())->dirtyGrid();
1074 1067
1075 child->setParent(0); 1068 // Now remove the leftover anonymous block from the tree, and destroy it. We 'll rip it out
1076 child->setPreviousSibling(0); 1069 // manually from the tree before destroying it, because we don't want to tri gger any tree
1077 child->setNextSibling(0); 1070 // adjustments with regards to anonymous blocks (or any other kind of undesi red chain-reaction).
1078 1071 children()->removeChildNode(this, child, false);
1079 child->destroy(); 1072 child->destroy();
1080 } 1073 }
1081 1074
1082 static bool canMergeContiguousAnonymousBlocks(LayoutObject* oldChild, LayoutObje ct* prev, LayoutObject* next) 1075 static bool canMergeContiguousAnonymousBlocks(LayoutObject* oldChild, LayoutObje ct* prev, LayoutObject* next)
1083 { 1076 {
1084 if (oldChild->documentBeingDestroyed() || oldChild->isInline() || oldChild-> virtualContinuation()) 1077 if (oldChild->documentBeingDestroyed() || oldChild->isInline() || oldChild-> virtualContinuation())
1085 return false; 1078 return false;
1086 1079
1087 if ((prev && (!prev->isAnonymousBlock() || toLayoutBlock(prev)->continuation () || toLayoutBlock(prev)->beingDestroyed())) 1080 if ((prev && (!prev->isAnonymousBlock() || toLayoutBlock(prev)->continuation () || toLayoutBlock(prev)->beingDestroyed()))
1088 || (next && (!next->isAnonymousBlock() || toLayoutBlock(next)->continuat ion() || toLayoutBlock(next)->beingDestroyed()))) 1081 || (next && (!next->isAnonymousBlock() || toLayoutBlock(next)->continuat ion() || toLayoutBlock(next)->beingDestroyed())))
(...skipping 2840 matching lines...) Expand 10 before | Expand all | Expand 10 after
3929 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 3922 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
3930 { 3923 {
3931 showLayoutObject(); 3924 showLayoutObject();
3932 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 3925 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
3933 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 3926 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
3934 } 3927 }
3935 3928
3936 #endif 3929 #endif
3937 3930
3938 } // namespace blink 3931 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698