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 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 void RenderBlock::collapseAnonymousBoxChild(RenderBlock* parent, RenderObject* c
hild) | 1138 void RenderBlock::collapseAnonymousBoxChild(RenderBlock* parent, RenderObject* c
hild) |
1139 { | 1139 { |
1140 parent->setNeedsLayoutAndPrefWidthsRecalc(); | 1140 parent->setNeedsLayoutAndPrefWidthsRecalc(); |
1141 parent->setChildrenInline(child->childrenInline()); | 1141 parent->setChildrenInline(child->childrenInline()); |
1142 RenderObject* nextSibling = child->nextSibling(); | 1142 RenderObject* nextSibling = child->nextSibling(); |
1143 | 1143 |
1144 RenderFlowThread* childFlowThread = child->enclosingRenderFlowThread(); | 1144 RenderFlowThread* childFlowThread = child->enclosingRenderFlowThread(); |
1145 RenderBlock* anonBlock = toRenderBlock(parent->children()->removeChildNode(p
arent, child, child->hasLayer())); | 1145 RenderBlock* anonBlock = toRenderBlock(parent->children()->removeChildNode(p
arent, child, child->hasLayer())); |
1146 anonBlock->moveAllChildrenTo(parent, nextSibling, child->hasLayer()); | 1146 anonBlock->moveAllChildrenTo(parent, nextSibling, child->hasLayer()); |
1147 // Delete the now-empty block's lines and nuke it. | 1147 // Delete the now-empty block's lines and nuke it. |
1148 if (!parent->documentBeingDestroyed()) | 1148 anonBlock->deleteLineBoxTree(); |
1149 anonBlock->deleteLineBoxTree(); | 1149 if (childFlowThread && childFlowThread->isRenderNamedFlowThread()) |
1150 if (!parent->documentBeingDestroyed() && childFlowThread && childFlowThread-
>isRenderNamedFlowThread()) | |
1151 toRenderNamedFlowThread(childFlowThread)->removeFlowChildInfo(anonBlock)
; | 1150 toRenderNamedFlowThread(childFlowThread)->removeFlowChildInfo(anonBlock)
; |
1152 anonBlock->destroy(); | 1151 anonBlock->destroy(); |
1153 } | 1152 } |
1154 | 1153 |
1155 void RenderBlock::removeChild(RenderObject* oldChild) | 1154 void RenderBlock::removeChild(RenderObject* oldChild) |
1156 { | 1155 { |
| 1156 // No need to waste time in merging or removing empty anonymous blocks. |
| 1157 // We can just bail out if our document is getting destroyed. |
| 1158 if (documentBeingDestroyed()) { |
| 1159 RenderBox::removeChild(oldChild); |
| 1160 return; |
| 1161 } |
| 1162 |
1157 // If this child is a block, and if our previous and next siblings are | 1163 // If this child is a block, and if our previous and next siblings are |
1158 // both anonymous blocks with inline content, then we can go ahead and | 1164 // both anonymous blocks with inline content, then we can go ahead and |
1159 // fold the inline content back together. | 1165 // fold the inline content back together. |
1160 RenderObject* prev = oldChild->previousSibling(); | 1166 RenderObject* prev = oldChild->previousSibling(); |
1161 RenderObject* next = oldChild->nextSibling(); | 1167 RenderObject* next = oldChild->nextSibling(); |
1162 bool canMergeAnonymousBlocks = canMergeContiguousAnonymousBlocks(oldChild, p
rev, next); | 1168 bool canMergeAnonymousBlocks = canMergeContiguousAnonymousBlocks(oldChild, p
rev, next); |
1163 if (canMergeAnonymousBlocks && prev && next) { | 1169 if (canMergeAnonymousBlocks && prev && next) { |
1164 prev->setNeedsLayoutAndPrefWidthsRecalc(); | 1170 prev->setNeedsLayoutAndPrefWidthsRecalc(); |
1165 RenderBlock* nextBlock = toRenderBlock(next); | 1171 RenderBlock* nextBlock = toRenderBlock(next); |
1166 RenderBlock* prevBlock = toRenderBlock(prev); | 1172 RenderBlock* prevBlock = toRenderBlock(prev); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 // block with pseudo-style element siblings (e.g. first-letter). If thes
e | 1222 // block with pseudo-style element siblings (e.g. first-letter). If thes
e |
1217 // are floating, then we need to pull the content up also. | 1223 // are floating, then we need to pull the content up also. |
1218 RenderBlock* anonBlock = toRenderBlock((prev && prev->isAnonymousBlock()
) ? prev : next); | 1224 RenderBlock* anonBlock = toRenderBlock((prev && prev->isAnonymousBlock()
) ? prev : next); |
1219 if ((anonBlock->previousSibling() || anonBlock->nextSibling()) | 1225 if ((anonBlock->previousSibling() || anonBlock->nextSibling()) |
1220 && (!anonBlock->previousSibling() || (anonBlock->previousSibling()->
style()->styleType() != NOPSEUDO && anonBlock->previousSibling()->isFloating() &
& !anonBlock->previousSibling()->previousSibling())) | 1226 && (!anonBlock->previousSibling() || (anonBlock->previousSibling()->
style()->styleType() != NOPSEUDO && anonBlock->previousSibling()->isFloating() &
& !anonBlock->previousSibling()->previousSibling())) |
1221 && (!anonBlock->nextSibling() || (anonBlock->nextSibling()->style()-
>styleType() != NOPSEUDO && anonBlock->nextSibling()->isFloating() && !anonBlock
->nextSibling()->nextSibling()))) { | 1227 && (!anonBlock->nextSibling() || (anonBlock->nextSibling()->style()-
>styleType() != NOPSEUDO && anonBlock->nextSibling()->isFloating() && !anonBlock
->nextSibling()->nextSibling()))) { |
1222 collapseAnonymousBoxChild(this, anonBlock); | 1228 collapseAnonymousBoxChild(this, anonBlock); |
1223 } | 1229 } |
1224 } | 1230 } |
1225 | 1231 |
1226 if (!firstChild() && !documentBeingDestroyed()) { | 1232 if (!firstChild()) { |
1227 // If this was our last child be sure to clear out our line boxes. | 1233 // If this was our last child be sure to clear out our line boxes. |
1228 if (childrenInline()) | 1234 if (childrenInline()) |
1229 deleteLineBoxTree(); | 1235 deleteLineBoxTree(); |
1230 | 1236 |
1231 // If we are an empty anonymous block in the continuation chain, | 1237 // If we are an empty anonymous block in the continuation chain, |
1232 // we need to remove ourself and fix the continuation chain. | 1238 // we need to remove ourself and fix the continuation chain. |
1233 if (!beingDestroyed() && isAnonymousBlockContinuation() && !oldChild->is
ListMarker()) { | 1239 if (!beingDestroyed() && isAnonymousBlockContinuation() && !oldChild->is
ListMarker()) { |
1234 RenderObject* containingBlockIgnoringAnonymous = containingBlock(); | 1240 RenderObject* containingBlockIgnoringAnonymous = containingBlock(); |
1235 while (containingBlockIgnoringAnonymous && containingBlockIgnoringAn
onymous->isAnonymousBlock()) | 1241 while (containingBlockIgnoringAnonymous && containingBlockIgnoringAn
onymous->isAnonymousBlock()) |
1236 containingBlockIgnoringAnonymous = containingBlockIgnoringAnonym
ous->containingBlock(); | 1242 containingBlockIgnoringAnonymous = containingBlockIgnoringAnonym
ous->containingBlock(); |
(...skipping 6241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7478 } | 7484 } |
7479 | 7485 |
7480 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 7486 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
7481 { | 7487 { |
7482 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr
ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating
Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped
MaxY()); | 7488 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr
ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating
Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped
MaxY()); |
7483 } | 7489 } |
7484 | 7490 |
7485 #endif | 7491 #endif |
7486 | 7492 |
7487 } // namespace WebCore | 7493 } // namespace WebCore |
OLD | NEW |