Index: Source/core/rendering/RenderBlock.cpp |
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp |
index b99b8b0cdddd720c373e4d4d5506d200e7f45fff..4a2a5a89d8a94eb121702537cf41ea916636268d 100644 |
--- a/Source/core/rendering/RenderBlock.cpp |
+++ b/Source/core/rendering/RenderBlock.cpp |
@@ -450,11 +450,21 @@ RenderBlock* RenderBlock::continuationBefore(RenderObject* beforeChild) |
void RenderBlock::addChildToContinuation(RenderObject* newChild, RenderObject* beforeChild) |
{ |
RenderBlock* flow = continuationBefore(beforeChild); |
- ASSERT(!beforeChild || beforeChild->parent()->isAnonymousColumnSpanBlock() || beforeChild->parent()->isRenderBlock()); |
mstensho (USE GERRIT)
2015/01/28 10:43:16
This was probably here because someone knew that i
|
RenderBoxModelObject* beforeChildParent = 0; |
- if (beforeChild) |
+ if (beforeChild) { |
beforeChildParent = toRenderBoxModelObject(beforeChild->parent()); |
- else { |
+ // Don't attempt to insert into something that isn't a RenderBlockFlow (block |
mstensho (USE GERRIT)
2015/01/28 10:43:16
This is an attempt at a proper fix for the bug, an
|
+ // container). While the DOM nodes of |beforeChild| and |newChild| are siblings, there may |
+ // be anonymous table wrapper objects around |beforeChild| on the layout side. Therefore, |
+ // find the nearest RenderBlockFlow. If it turns out that the new renderer doesn't belong |
+ // inside the anonymous table, this will make sure that it's really put on the outside. If |
+ // it turns out that it does belong inside it, the normal child insertion machinery will |
+ // make sure it ends up there, and at the right place too. We cannot just guess that it's |
+ // going to be right under the parent of |beforeChild|. |
+ while (beforeChildParent && !beforeChildParent->isRenderBlockFlow()) |
Julien - ping for review
2015/01/28 17:29:53
This code can go past |this| while walking up the
mstensho (USE GERRIT)
2015/01/28 17:51:26
Yeah, I added an assert against that in the second
|
+ beforeChildParent = toRenderBoxModelObject(beforeChildParent->parent()); |
mstensho (USE GERRIT)
2015/01/28 10:43:16
Could add some assertions here, but I'll wait and
|
+ ASSERT(beforeChildParent); |
Julien - ping for review
2015/01/28 17:29:53
I don't know how:
beforeChildParent->addChildIgno
mstensho (USE GERRIT)
2015/01/28 17:51:26
One of the first things RenderBlock::addChildIgnor
Julien - ping for review
2015/01/29 10:28:31
Acknowledged.
|
+ } else { |
RenderBoxModelObject* cont = flow->continuation(); |
if (cont) |
beforeChildParent = cont; |