| 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, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights 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 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1769 return false; | 1769 return false; |
| 1770 } | 1770 } |
| 1771 | 1771 |
| 1772 bool RenderBlock::handleRunInChild(RenderBox* child) | 1772 bool RenderBlock::handleRunInChild(RenderBox* child) |
| 1773 { | 1773 { |
| 1774 // See if we have a run-in element with inline children. If the | 1774 // See if we have a run-in element with inline children. If the |
| 1775 // children aren't inline, then just treat the run-in as a normal | 1775 // children aren't inline, then just treat the run-in as a normal |
| 1776 // block. | 1776 // block. |
| 1777 if (!child->isRunIn() || !child->childrenInline()) | 1777 if (!child->isRunIn() || !child->childrenInline()) |
| 1778 return false; | 1778 return false; |
| 1779 |
| 1779 // FIXME: We don't handle non-block elements with run-in for now. | 1780 // FIXME: We don't handle non-block elements with run-in for now. |
| 1780 if (!child->isRenderBlock()) | 1781 if (!child->isRenderBlock()) |
| 1781 return false; | 1782 return false; |
| 1783 |
| 1782 // Run-in child shouldn't intrude into the sibling block if it is part of a | 1784 // Run-in child shouldn't intrude into the sibling block if it is part of a |
| 1783 // continuation chain. In that case, treat it as a normal block. | 1785 // continuation chain. In that case, treat it as a normal block. |
| 1784 if (child->isElementContinuation() || child->virtualContinuation()) | 1786 if (child->isElementContinuation() || child->virtualContinuation()) |
| 1785 return false; | 1787 return false; |
| 1786 | 1788 |
| 1789 // Check if this node is allowed to run-in. E.g. <select> expects its render
er to |
| 1790 // be a RenderListBox or RenderMenuList, and hence cannot be a RenderInline
run-in. |
| 1791 Node* runInNode = child->node(); |
| 1792 if (runInNode && runInNode->hasTagName(selectTag)) |
| 1793 return false; |
| 1794 |
| 1787 RenderBlock* blockRunIn = toRenderBlock(child); | 1795 RenderBlock* blockRunIn = toRenderBlock(child); |
| 1788 RenderObject* curr = blockRunIn->nextSibling(); | 1796 RenderObject* curr = blockRunIn->nextSibling(); |
| 1789 if (!curr || !curr->isRenderBlock() || !curr->childrenInline() || curr->isRu
nIn() || curr->isAnonymous() || curr->isFloatingOrPositioned()) | 1797 if (!curr || !curr->isRenderBlock() || !curr->childrenInline() || curr->isRu
nIn() || curr->isAnonymous() || curr->isFloatingOrPositioned()) |
| 1790 return false; | 1798 return false; |
| 1791 | 1799 |
| 1792 RenderBlock* currBlock = toRenderBlock(curr); | 1800 RenderBlock* currBlock = toRenderBlock(curr); |
| 1793 | 1801 |
| 1794 // First we destroy any :before/:after content. It will be regenerated by th
e new inline. | 1802 // First we destroy any :before/:after content. It will be regenerated by th
e new inline. |
| 1795 // Exception is if the run-in itself is generated. | 1803 // Exception is if the run-in itself is generated. |
| 1796 if (child->style()->styleType() != BEFORE && child->style()->styleType() !=
AFTER) { | 1804 if (child->style()->styleType() != BEFORE && child->style()->styleType() !=
AFTER) { |
| 1797 RenderObject* generatedContent; | 1805 RenderObject* generatedContent; |
| 1798 if (child->getCachedPseudoStyle(BEFORE) && (generatedContent = child->be
forePseudoElementRenderer())) | 1806 if (child->getCachedPseudoStyle(BEFORE) && (generatedContent = child->be
forePseudoElementRenderer())) |
| 1799 generatedContent->destroy(); | 1807 generatedContent->destroy(); |
| 1800 if (child->getCachedPseudoStyle(AFTER) && (generatedContent = child->aft
erPseudoElementRenderer())) | 1808 if (child->getCachedPseudoStyle(AFTER) && (generatedContent = child->aft
erPseudoElementRenderer())) |
| 1801 generatedContent->destroy(); | 1809 generatedContent->destroy(); |
| 1802 } | 1810 } |
| 1803 | 1811 |
| 1804 // Remove the old child. | 1812 // Remove the old child. |
| 1805 children()->removeChildNode(this, blockRunIn); | 1813 children()->removeChildNode(this, blockRunIn); |
| 1806 | 1814 |
| 1807 // Create an inline. | 1815 // Create an inline. |
| 1808 Node* runInNode = blockRunIn->node(); | |
| 1809 RenderInline* inlineRunIn = new (renderArena()) RenderInline(runInNode ? run
InNode : document()); | 1816 RenderInline* inlineRunIn = new (renderArena()) RenderInline(runInNode ? run
InNode : document()); |
| 1810 inlineRunIn->setStyle(blockRunIn->style()); | 1817 inlineRunIn->setStyle(blockRunIn->style()); |
| 1811 | 1818 |
| 1812 // Move the nodes from the old child to the new child | 1819 // Move the nodes from the old child to the new child |
| 1813 for (RenderObject* runInChild = blockRunIn->firstChild(); runInChild;) { | 1820 for (RenderObject* runInChild = blockRunIn->firstChild(); runInChild;) { |
| 1814 RenderObject* nextSibling = runInChild->nextSibling(); | 1821 RenderObject* nextSibling = runInChild->nextSibling(); |
| 1815 blockRunIn->children()->removeChildNode(blockRunIn, runInChild); | 1822 blockRunIn->children()->removeChildNode(blockRunIn, runInChild); |
| 1816 inlineRunIn->addChild(runInChild); // Use addChild instead of appendChil
dNode since it handles correct placement of the children relative to :after-gene
rated content. | 1823 inlineRunIn->addChild(runInChild); // Use addChild instead of appendChil
dNode since it handles correct placement of the children relative to :after-gene
rated content. |
| 1817 runInChild = nextSibling; | 1824 runInChild = nextSibling; |
| 1818 } | 1825 } |
| (...skipping 5446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7265 } | 7272 } |
| 7266 | 7273 |
| 7267 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 7274 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
| 7268 { | 7275 { |
| 7269 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); | 7276 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); |
| 7270 } | 7277 } |
| 7271 | 7278 |
| 7272 #endif | 7279 #endif |
| 7273 | 7280 |
| 7274 } // namespace WebCore | 7281 } // namespace WebCore |
| OLD | NEW |