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 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 return false; | 1122 return false; |
1123 | 1123 |
1124 if (!prev || !next) | 1124 if (!prev || !next) |
1125 return true; | 1125 return true; |
1126 | 1126 |
1127 // Make sure the types of the anonymous blocks match up. | 1127 // Make sure the types of the anonymous blocks match up. |
1128 return prev->isAnonymousColumnsBlock() == next->isAnonymousColumnsBlock() | 1128 return prev->isAnonymousColumnsBlock() == next->isAnonymousColumnsBlock() |
1129 && prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanB
lock(); | 1129 && prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanB
lock(); |
1130 } | 1130 } |
1131 | 1131 |
1132 void RenderBlock::collapseAnonymousBoxChild(RenderBlock* parent, RenderObject* c
hild) | 1132 void RenderBlock::collapseAnonymousBlockChild(RenderBlock* parent, RenderBlock*
child) |
1133 { | 1133 { |
| 1134 // It's possible that this block's destruction may have been triggered by th
e |
| 1135 // child's removal. Just bail if the anonymous child block is already being |
| 1136 // destroyed. See crbug.com/282088 |
| 1137 if (child->beingDestroyed()) |
| 1138 return; |
1134 parent->setNeedsLayoutAndPrefWidthsRecalc(); | 1139 parent->setNeedsLayoutAndPrefWidthsRecalc(); |
1135 parent->setChildrenInline(child->childrenInline()); | 1140 parent->setChildrenInline(child->childrenInline()); |
1136 RenderObject* nextSibling = child->nextSibling(); | 1141 RenderObject* nextSibling = child->nextSibling(); |
1137 | 1142 |
1138 RenderFlowThread* childFlowThread = child->flowThreadContainingBlock(); | 1143 RenderFlowThread* childFlowThread = child->flowThreadContainingBlock(); |
1139 CurrentRenderFlowThreadMaintainer flowThreadMaintainer(childFlowThread); | 1144 CurrentRenderFlowThreadMaintainer flowThreadMaintainer(childFlowThread); |
1140 | 1145 |
1141 RenderBlock* anonBlock = toRenderBlock(parent->children()->removeChildNode(p
arent, child, child->hasLayer())); | 1146 parent->children()->removeChildNode(parent, child, child->hasLayer()); |
1142 anonBlock->moveAllChildrenTo(parent, nextSibling, child->hasLayer()); | 1147 child->moveAllChildrenTo(parent, nextSibling, child->hasLayer()); |
1143 // Delete the now-empty block's lines and nuke it. | 1148 // Explicitly delete the child's line box tree, or the special anonymous |
1144 anonBlock->deleteLineBoxTree(); | 1149 // block handling in willBeDestroyed will cause problems. |
| 1150 child->deleteLineBoxTree(); |
1145 if (childFlowThread && childFlowThread->isRenderNamedFlowThread()) | 1151 if (childFlowThread && childFlowThread->isRenderNamedFlowThread()) |
1146 toRenderNamedFlowThread(childFlowThread)->removeFlowChildInfo(anonBlock)
; | 1152 toRenderNamedFlowThread(childFlowThread)->removeFlowChildInfo(child); |
1147 anonBlock->destroy(); | 1153 child->destroy(); |
1148 } | 1154 } |
1149 | 1155 |
1150 void RenderBlock::moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, bool fu
llRemoveInsert) | 1156 void RenderBlock::moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, bool fu
llRemoveInsert) |
1151 { | 1157 { |
1152 moveAllChildrenTo(toBlock, fullRemoveInsert); | 1158 moveAllChildrenTo(toBlock, fullRemoveInsert); |
1153 | 1159 |
1154 // When a portion of the render tree is being detached, anonymous blocks | 1160 // When a portion of the render tree is being detached, anonymous blocks |
1155 // will be combined as their children are deleted. In this process, the | 1161 // will be combined as their children are deleted. In this process, the |
1156 // anonymous block later in the tree is merged into the one preceeding it. | 1162 // anonymous block later in the tree is merged into the one preceeding it. |
1157 // It can happen that the later block (this) contains floats that the | 1163 // It can happen that the later block (this) contains floats that the |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 } | 1255 } |
1250 } | 1256 } |
1251 | 1257 |
1252 RenderBox::removeChild(oldChild); | 1258 RenderBox::removeChild(oldChild); |
1253 | 1259 |
1254 RenderObject* child = prev ? prev : next; | 1260 RenderObject* child = prev ? prev : next; |
1255 if (canMergeAnonymousBlocks && child && !child->previousSibling() && !child-
>nextSibling() && canCollapseAnonymousBlockChild()) { | 1261 if (canMergeAnonymousBlocks && child && !child->previousSibling() && !child-
>nextSibling() && canCollapseAnonymousBlockChild()) { |
1256 // The removal has knocked us down to containing only a single anonymous | 1262 // The removal has knocked us down to containing only a single anonymous |
1257 // box. We can go ahead and pull the content right back up into our | 1263 // box. We can go ahead and pull the content right back up into our |
1258 // box. | 1264 // box. |
1259 collapseAnonymousBoxChild(this, child); | 1265 collapseAnonymousBlockChild(this, toRenderBlock(child)); |
1260 } else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymous
Block())) && canCollapseAnonymousBlockChild()) { | 1266 } else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymous
Block())) && canCollapseAnonymousBlockChild()) { |
1261 // It's possible that the removal has knocked us down to a single anonym
ous | 1267 // It's possible that the removal has knocked us down to a single anonym
ous |
1262 // block with pseudo-style element siblings (e.g. first-letter). If thes
e | 1268 // block with pseudo-style element siblings (e.g. first-letter). If thes
e |
1263 // are floating, then we need to pull the content up also. | 1269 // are floating, then we need to pull the content up also. |
1264 RenderBlock* anonBlock = toRenderBlock((prev && prev->isAnonymousBlock()
) ? prev : next); | 1270 RenderBlock* anonymousBlock = toRenderBlock((prev && prev->isAnonymousBl
ock()) ? prev : next); |
1265 if ((anonBlock->previousSibling() || anonBlock->nextSibling()) | 1271 if ((anonymousBlock->previousSibling() || anonymousBlock->nextSibling()) |
1266 && (!anonBlock->previousSibling() || (anonBlock->previousSibling()->
style()->styleType() != NOPSEUDO && anonBlock->previousSibling()->isFloating() &
& !anonBlock->previousSibling()->previousSibling())) | 1272 && (!anonymousBlock->previousSibling() || (anonymousBlock->previousS
ibling()->style()->styleType() != NOPSEUDO && anonymousBlock->previousSibling()-
>isFloating() && !anonymousBlock->previousSibling()->previousSibling())) |
1267 && (!anonBlock->nextSibling() || (anonBlock->nextSibling()->style()-
>styleType() != NOPSEUDO && anonBlock->nextSibling()->isFloating() && !anonBlock
->nextSibling()->nextSibling()))) { | 1273 && (!anonymousBlock->nextSibling() || (anonymousBlock->nextSibling()
->style()->styleType() != NOPSEUDO && anonymousBlock->nextSibling()->isFloating(
) && !anonymousBlock->nextSibling()->nextSibling()))) { |
1268 collapseAnonymousBoxChild(this, anonBlock); | 1274 collapseAnonymousBlockChild(this, anonymousBlock); |
1269 } | 1275 } |
1270 } | 1276 } |
1271 | 1277 |
1272 if (!firstChild()) { | 1278 if (!firstChild()) { |
1273 // If this was our last child be sure to clear out our line boxes. | 1279 // If this was our last child be sure to clear out our line boxes. |
1274 if (childrenInline()) | 1280 if (childrenInline()) |
1275 deleteLineBoxTree(); | 1281 deleteLineBoxTree(); |
1276 | 1282 |
1277 // If we are an empty anonymous block in the continuation chain, | 1283 // If we are an empty anonymous block in the continuation chain, |
1278 // we need to remove ourself and fix the continuation chain. | 1284 // we need to remove ourself and fix the continuation chain. |
(...skipping 6887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8166 | 8172 |
8167 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 8173 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
8168 { | 8174 { |
8169 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr
ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating
Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped
MaxY()); | 8175 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr
ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating
Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped
MaxY()); |
8170 } | 8176 } |
8171 | 8177 |
8172 | 8178 |
8173 #endif | 8179 #endif |
8174 | 8180 |
8175 } // namespace WebCore | 8181 } // namespace WebCore |
OLD | NEW |