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 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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 | 936 |
937 if ((prev && (prev->isRubyRun() || prev->isRubyBase())) | 937 if ((prev && (prev->isRubyRun() || prev->isRubyBase())) |
938 || (next && (next->isRubyRun() || next->isRubyBase()))) | 938 || (next && (next->isRubyRun() || next->isRubyBase()))) |
939 return false; | 939 return false; |
940 | 940 |
941 if (!prev || !next) | 941 if (!prev || !next) |
942 return true; | 942 return true; |
943 | 943 |
944 // Make sure the types of the anonymous blocks match up. | 944 // Make sure the types of the anonymous blocks match up. |
945 return prev->isAnonymousColumnsBlock() == next->isAnonymousColumnsBlock() | 945 return prev->isAnonymousColumnsBlock() == next->isAnonymousColumnsBlock() |
946 && prev->isAnonymousColumnSpanBlock() == prev->isAnonymousColumnSpanB
lock(); | 946 && prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanB
lock(); |
947 } | 947 } |
948 | 948 |
949 void RenderBlock::removeChild(RenderObject* oldChild) | 949 void RenderBlock::removeChild(RenderObject* oldChild) |
950 { | 950 { |
951 // If this child is a block, and if our previous and next siblings are | 951 // If this child is a block, and if our previous and next siblings are |
952 // both anonymous blocks with inline content, then we can go ahead and | 952 // both anonymous blocks with inline content, then we can go ahead and |
953 // fold the inline content back together. | 953 // fold the inline content back together. |
954 RenderObject* prev = oldChild->previousSibling(); | 954 RenderObject* prev = oldChild->previousSibling(); |
955 RenderObject* next = oldChild->nextSibling(); | 955 RenderObject* next = oldChild->nextSibling(); |
956 bool canMergeAnonymousBlocks = canMergeContiguousAnonymousBlocks(oldChild, p
rev, next); | 956 bool canMergeAnonymousBlocks = canMergeContiguousAnonymousBlocks(oldChild, p
rev, next); |
(...skipping 13 matching lines...) Expand all Loading... |
970 ASSERT(!inlineChildrenBlock->continuation()); | 970 ASSERT(!inlineChildrenBlock->continuation()); |
971 RefPtr<RenderStyle> newStyle = RenderStyle::create(); | 971 RefPtr<RenderStyle> newStyle = RenderStyle::create(); |
972 newStyle->inheritFrom(style()); | 972 newStyle->inheritFrom(style()); |
973 children()->removeChildNode(this, inlineChildrenBlock, inlineChildre
nBlock->hasLayer()); | 973 children()->removeChildNode(this, inlineChildrenBlock, inlineChildre
nBlock->hasLayer()); |
974 inlineChildrenBlock->setStyle(newStyle); | 974 inlineChildrenBlock->setStyle(newStyle); |
975 | 975 |
976 // Now just put the inlineChildrenBlock inside the blockChildrenBloc
k. | 976 // Now just put the inlineChildrenBlock inside the blockChildrenBloc
k. |
977 blockChildrenBlock->children()->insertChildNode(blockChildrenBlock,
inlineChildrenBlock, prev == inlineChildrenBlock ? blockChildrenBlock->firstChil
d() : 0, | 977 blockChildrenBlock->children()->insertChildNode(blockChildrenBlock,
inlineChildrenBlock, prev == inlineChildrenBlock ? blockChildrenBlock->firstChil
d() : 0, |
978 inlineChildrenBlock-
>hasLayer() || blockChildrenBlock->hasLayer()); | 978 inlineChildrenBlock-
>hasLayer() || blockChildrenBlock->hasLayer()); |
979 next->setNeedsLayoutAndPrefWidthsRecalc(); | 979 next->setNeedsLayoutAndPrefWidthsRecalc(); |
| 980 |
| 981 // inlineChildrenBlock got reparented to blockChildrenBlock, so it i
s no longer a child |
| 982 // of "this". we null out prev or next so that is not used later in
the function. |
| 983 if (inlineChildrenBlock == prevBlock) |
| 984 prev = 0; |
| 985 else |
| 986 next = 0; |
980 } else { | 987 } else { |
981 // Take all the children out of the |next| block and put them in | 988 // Take all the children out of the |next| block and put them in |
982 // the |prev| block. | 989 // the |prev| block. |
983 nextBlock->moveAllChildrenTo(prevBlock, nextBlock->hasLayer() || pre
vBlock->hasLayer()); | 990 nextBlock->moveAllChildrenTo(prevBlock, nextBlock->hasLayer() || pre
vBlock->hasLayer()); |
984 | 991 |
985 // Delete the now-empty block's lines and nuke it. | 992 // Delete the now-empty block's lines and nuke it. |
986 nextBlock->deleteLineBoxTree(); | 993 nextBlock->deleteLineBoxTree(); |
987 nextBlock->destroy(); | 994 nextBlock->destroy(); |
| 995 next = 0; |
988 } | 996 } |
989 } | 997 } |
990 | 998 |
991 RenderBox::removeChild(oldChild); | 999 RenderBox::removeChild(oldChild); |
992 | 1000 |
993 RenderObject* child = prev ? prev : next; | 1001 RenderObject* child = prev ? prev : next; |
994 if (canMergeAnonymousBlocks && child && !child->previousSibling() && !child-
>nextSibling() && !isFlexibleBox()) { | 1002 if (canMergeAnonymousBlocks && child && !child->previousSibling() && !child-
>nextSibling() && !isFlexibleBox()) { |
995 // The removal has knocked us down to containing only a single anonymous | 1003 // The removal has knocked us down to containing only a single anonymous |
996 // box. We can go ahead and pull the content right back up into our | 1004 // box. We can go ahead and pull the content right back up into our |
997 // box. | 1005 // box. |
(...skipping 5398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6396 else if (isAnonymous()) | 6404 else if (isAnonymous()) |
6397 return "RenderBlock (generated)"; | 6405 return "RenderBlock (generated)"; |
6398 if (isRelPositioned()) | 6406 if (isRelPositioned()) |
6399 return "RenderBlock (relative positioned)"; | 6407 return "RenderBlock (relative positioned)"; |
6400 if (isRunIn()) | 6408 if (isRunIn()) |
6401 return "RenderBlock (run-in)"; | 6409 return "RenderBlock (run-in)"; |
6402 return "RenderBlock"; | 6410 return "RenderBlock"; |
6403 } | 6411 } |
6404 | 6412 |
6405 } // namespace WebCore | 6413 } // namespace WebCore |
OLD | NEW |