Index: third_party/WebKit/WebCore/rendering/RenderBlock.cpp |
=================================================================== |
--- third_party/WebKit/WebCore/rendering/RenderBlock.cpp (revision 9391) |
+++ third_party/WebKit/WebCore/rendering/RenderBlock.cpp (working copy) |
@@ -1005,9 +1005,14 @@ |
RenderInline* inlineRunIn = new (renderArena()) RenderInline(blockRunIn->node()); |
inlineRunIn->setStyle(blockRunIn->style()); |
- // Move the nodes from the old child to the new child. |
- for (RenderObject* runInChild = blockRunIn->firstChild(); runInChild; runInChild = runInChild->nextSibling()) |
- moveChild(inlineRunIn, inlineRunIn->children(), blockRunIn, blockRunIn->children(), runInChild); |
+ // Move the nodes from the old child to the new child, but skip any :before/:after content. It has already |
+ // been regenerated by the new inline. |
+ for (RenderObject* runInChild = blockRunIn->firstChild(); runInChild; runInChild = runInChild->nextSibling()) { |
+ if (runInChild->style()->styleType() != BEFORE && runInChild->style()->styleType() != AFTER) { |
+ blockRunIn->children()->removeChildNode(blockRunIn, runInChild, false); |
+ inlineRunIn->addChild(runInChild); // Use addChild instead of appendChildNode since it handles correct placement of the children relative to :after-generated content. |
+ } |
+ } |
// Now insert the new child under |currBlock|. |
currBlock->children()->insertChildNode(currBlock, inlineRunIn, currBlock->firstChild()); |
@@ -3918,7 +3923,7 @@ |
return 0; |
} |
-static int getBorderPaddingMargin(const RenderBox* child, bool endOfInline) |
+static int getBorderPaddingMargin(const RenderBoxModelObject* child, bool endOfInline) |
{ |
RenderStyle* cstyle = child->style(); |
int result = 0; |
@@ -4021,7 +4026,7 @@ |
if (child->isRenderInline()) { |
// Add in padding/border/margin from the appropriate side of |
// the element. |
- int bpm = getBorderPaddingMargin(static_cast<RenderBox*>(child), childIterator.endOfInline); |
+ int bpm = getBorderPaddingMargin(toRenderInline(child), childIterator.endOfInline); |
childMin += bpm; |
childMax += bpm; |