LayoutTests:
Reviewed by Darin.
- test for http://bugzilla.opendarwin.org/show_bug.cgi?id=8420
iExploder(#12): Assertion failure in RenderContainer::removeChildNode
* fast/forms/button-inner-block-reuse-expected.checksum: Added.
* fast/forms/button-inner-block-reuse-expected.png: Added.
* fast/forms/button-inner-block-reuse-expected.txt: Added.
* fast/forms/button-inner-block-reuse.html: Added.
WebCore:
Reviewed by Darin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8420
iExploder(#12): Assertion failure in RenderContainer::removeChildNode
Test: fast/forms/button-inner-block-reuse.html
Buttons have a distinguished anonymous child that holds all their other
descendants. Descendants ended up in a sibling anonymous block as the
initial anonymous child was being reused to hold the initial part of an
inline that got split.
* rendering/RenderInline.cpp:
(WebCore::RenderInline::splitFlow): Check if the anonymous block's parent
allows us to reuse it.
* rendering/RenderObject.h:
(WebCore::RenderObject::allowsReusingAnonymousChild): Added. Returns true.
* rendering/render_button.h:
(WebCore::RenderButton::allowsReusingAnonymousChild): Added. Returns false.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@13892 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/rendering/RenderInline.cpp b/WebCore/rendering/RenderInline.cpp
index 5ddb732..2051ed9 100644
--- a/WebCore/rendering/RenderInline.cpp
+++ b/WebCore/rendering/RenderInline.cpp
@@ -199,12 +199,11 @@
RenderBlock* pre = 0;
RenderBlock* block = containingBlock();
bool madeNewBeforeBlock = false;
- if (block->isAnonymousBlock()) {
+ if (block->isAnonymousBlock() && (!block->parent() || block->parent()->allowsReusingAnonymousChild())) {
// We can reuse this block and make it the preBlock of the next continuation.
pre = block;
block = block->containingBlock();
- }
- else {
+ } else {
// No anonymous block available for use. Make one.
pre = block->createAnonymousBlock();
madeNewBeforeBlock = true;