| 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 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 if (!child->isRenderBlock()) | 1588 if (!child->isRenderBlock()) |
| 1589 return false; | 1589 return false; |
| 1590 | 1590 |
| 1591 RenderBlock* blockRunIn = toRenderBlock(child); | 1591 RenderBlock* blockRunIn = toRenderBlock(child); |
| 1592 RenderObject* curr = blockRunIn->nextSibling(); | 1592 RenderObject* curr = blockRunIn->nextSibling(); |
| 1593 if (!curr || !curr->isRenderBlock() || !curr->childrenInline() || curr->isRu
nIn() || curr->isAnonymous() || curr->isFloatingOrPositioned()) | 1593 if (!curr || !curr->isRenderBlock() || !curr->childrenInline() || curr->isRu
nIn() || curr->isAnonymous() || curr->isFloatingOrPositioned()) |
| 1594 return false; | 1594 return false; |
| 1595 | 1595 |
| 1596 RenderBlock* currBlock = toRenderBlock(curr); | 1596 RenderBlock* currBlock = toRenderBlock(curr); |
| 1597 | 1597 |
| 1598 // First we destroy any :before/:after content. It will be regenerated by th
e new inline. |
| 1599 // Exception is if the run-in itself is generated. |
| 1600 if (child->style()->styleType() != BEFORE && child->style()->styleType() !=
AFTER) { |
| 1601 RenderObject* generatedContent; |
| 1602 if (child->getCachedPseudoStyle(BEFORE) && (generatedContent = child->be
forePseudoElementRenderer())) |
| 1603 generatedContent->destroy(); |
| 1604 if (child->getCachedPseudoStyle(AFTER) && (generatedContent = child->aft
erPseudoElementRenderer())) |
| 1605 generatedContent->destroy(); |
| 1606 } |
| 1607 |
| 1598 // Remove the old child. | 1608 // Remove the old child. |
| 1599 children()->removeChildNode(this, blockRunIn); | 1609 children()->removeChildNode(this, blockRunIn); |
| 1600 | 1610 |
| 1601 // Create an inline. | 1611 // Create an inline. |
| 1602 Node* runInNode = blockRunIn->node(); | 1612 Node* runInNode = blockRunIn->node(); |
| 1603 RenderInline* inlineRunIn = new (renderArena()) RenderInline(runInNode ? run
InNode : document()); | 1613 RenderInline* inlineRunIn = new (renderArena()) RenderInline(runInNode ? run
InNode : document()); |
| 1604 inlineRunIn->setStyle(blockRunIn->style()); | 1614 inlineRunIn->setStyle(blockRunIn->style()); |
| 1605 | 1615 |
| 1606 bool runInIsGenerated = child->style()->styleType() == BEFORE || child->styl
e()->styleType() == AFTER; | 1616 // Move the nodes from the old child to the new child |
| 1607 | |
| 1608 // Move the nodes from the old child to the new child, but skip any :before/
:after content. It has already | |
| 1609 // been regenerated by the new inline. | |
| 1610 for (RenderObject* runInChild = blockRunIn->firstChild(); runInChild;) { | 1617 for (RenderObject* runInChild = blockRunIn->firstChild(); runInChild;) { |
| 1611 RenderObject* nextSibling = runInChild->nextSibling(); | 1618 RenderObject* nextSibling = runInChild->nextSibling(); |
| 1612 if (runInIsGenerated || (runInChild->style()->styleType() != BEFORE && r
unInChild->style()->styleType() != AFTER)) { | 1619 blockRunIn->children()->removeChildNode(blockRunIn, runInChild, false); |
| 1613 blockRunIn->children()->removeChildNode(blockRunIn, runInChild, fals
e); | 1620 inlineRunIn->addChild(runInChild); // Use addChild instead of appendChil
dNode since it handles correct placement of the children relative to :after-gene
rated content. |
| 1614 inlineRunIn->addChild(runInChild); // Use addChild instead of append
ChildNode since it handles correct placement of the children relative to :after-
generated content. | |
| 1615 } | |
| 1616 runInChild = nextSibling; | 1621 runInChild = nextSibling; |
| 1617 } | 1622 } |
| 1618 | 1623 |
| 1619 // Now insert the new child under |currBlock|. Use addChild instead of inser
tChildNode since it handles correct placement of the children, esp where we cann
ot insert | 1624 // Now insert the new child under |currBlock|. Use addChild instead of inser
tChildNode since it handles correct placement of the children, esp where we cann
ot insert |
| 1620 // anything before the first child. e.g. details tag. See https://bugs.webki
t.org/show_bug.cgi?id=58228. | 1625 // anything before the first child. e.g. details tag. See https://bugs.webki
t.org/show_bug.cgi?id=58228. |
| 1621 currBlock->addChild(inlineRunIn, currBlock->firstChild()); | 1626 currBlock->addChild(inlineRunIn, currBlock->firstChild()); |
| 1622 | 1627 |
| 1623 // If the run-in had an element, we need to set the new renderer. | 1628 // If the run-in had an element, we need to set the new renderer. |
| 1624 if (runInNode) | 1629 if (runInNode) |
| 1625 runInNode->setRenderer(inlineRunIn); | 1630 runInNode->setRenderer(inlineRunIn); |
| (...skipping 5282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6908 } | 6913 } |
| 6909 | 6914 |
| 6910 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 6915 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
| 6911 { | 6916 { |
| 6912 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); | 6917 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); |
| 6913 } | 6918 } |
| 6914 | 6919 |
| 6915 #endif | 6920 #endif |
| 6916 | 6921 |
| 6917 } // namespace WebCore | 6922 } // namespace WebCore |
| OLD | NEW |