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 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 return false; | 1844 return false; |
1845 } | 1845 } |
1846 | 1846 |
1847 bool RenderBlock::handleRunInChild(RenderBox* child) | 1847 bool RenderBlock::handleRunInChild(RenderBox* child) |
1848 { | 1848 { |
1849 // See if we have a run-in element with inline children. If the | 1849 // See if we have a run-in element with inline children. If the |
1850 // children aren't inline, then just treat the run-in as a normal | 1850 // children aren't inline, then just treat the run-in as a normal |
1851 // block. | 1851 // block. |
1852 if (!child->isRunIn() || !child->childrenInline()) | 1852 if (!child->isRunIn() || !child->childrenInline()) |
1853 return false; | 1853 return false; |
| 1854 |
1854 // FIXME: We don't handle non-block elements with run-in for now. | 1855 // FIXME: We don't handle non-block elements with run-in for now. |
1855 if (!child->isRenderBlock()) | 1856 if (!child->isRenderBlock()) |
1856 return false; | 1857 return false; |
| 1858 |
1857 // Run-in child shouldn't intrude into the sibling block if it is part of a | 1859 // Run-in child shouldn't intrude into the sibling block if it is part of a |
1858 // continuation chain. In that case, treat it as a normal block. | 1860 // continuation chain. In that case, treat it as a normal block. |
1859 if (child->isElementContinuation() || child->virtualContinuation()) | 1861 if (child->isElementContinuation() || child->virtualContinuation()) |
1860 return false; | 1862 return false; |
1861 | 1863 |
| 1864 // Check if this node is allowed to run-in. E.g. <select> expects its render
er to |
| 1865 // be a RenderListBox or RenderMenuList, and hence cannot be a RenderInline
run-in. |
| 1866 Node* runInNode = child->node(); |
| 1867 if (runInNode && runInNode->hasTagName(selectTag)) |
| 1868 return false; |
| 1869 |
1862 RenderBlock* blockRunIn = toRenderBlock(child); | 1870 RenderBlock* blockRunIn = toRenderBlock(child); |
1863 RenderObject* curr = blockRunIn->nextSibling(); | 1871 RenderObject* curr = blockRunIn->nextSibling(); |
1864 if (!curr || !curr->isRenderBlock() || !curr->childrenInline() || curr->isRu
nIn() || curr->isAnonymous() || curr->isFloatingOrPositioned()) | 1872 if (!curr || !curr->isRenderBlock() || !curr->childrenInline() || curr->isRu
nIn() || curr->isAnonymous() || curr->isFloatingOrPositioned()) |
1865 return false; | 1873 return false; |
1866 | 1874 |
1867 RenderBlock* currBlock = toRenderBlock(curr); | 1875 RenderBlock* currBlock = toRenderBlock(curr); |
1868 | 1876 |
1869 // First we destroy any :before/:after content. It will be regenerated by th
e new inline. | 1877 // First we destroy any :before/:after content. It will be regenerated by th
e new inline. |
1870 // Exception is if the run-in itself is generated. | 1878 // Exception is if the run-in itself is generated. |
1871 if (child->style()->styleType() != BEFORE && child->style()->styleType() !=
AFTER) { | 1879 if (child->style()->styleType() != BEFORE && child->style()->styleType() !=
AFTER) { |
1872 RenderObject* generatedContent; | 1880 RenderObject* generatedContent; |
1873 if (child->getCachedPseudoStyle(BEFORE) && (generatedContent = child->be
forePseudoElementRenderer())) | 1881 if (child->getCachedPseudoStyle(BEFORE) && (generatedContent = child->be
forePseudoElementRenderer())) |
1874 generatedContent->destroy(); | 1882 generatedContent->destroy(); |
1875 if (child->getCachedPseudoStyle(AFTER) && (generatedContent = child->aft
erPseudoElementRenderer())) | 1883 if (child->getCachedPseudoStyle(AFTER) && (generatedContent = child->aft
erPseudoElementRenderer())) |
1876 generatedContent->destroy(); | 1884 generatedContent->destroy(); |
1877 } | 1885 } |
1878 | 1886 |
1879 // Remove the old child. | 1887 // Remove the old child. |
1880 children()->removeChildNode(this, blockRunIn); | 1888 children()->removeChildNode(this, blockRunIn); |
1881 | 1889 |
1882 // Create an inline. | 1890 // Create an inline. |
1883 Node* runInNode = blockRunIn->node(); | |
1884 RenderInline* inlineRunIn = new (renderArena()) RenderInline(runInNode ? run
InNode : document()); | 1891 RenderInline* inlineRunIn = new (renderArena()) RenderInline(runInNode ? run
InNode : document()); |
1885 inlineRunIn->setStyle(blockRunIn->style()); | 1892 inlineRunIn->setStyle(blockRunIn->style()); |
1886 | 1893 |
1887 // Move the nodes from the old child to the new child | 1894 // Move the nodes from the old child to the new child |
1888 for (RenderObject* runInChild = blockRunIn->firstChild(); runInChild;) { | 1895 for (RenderObject* runInChild = blockRunIn->firstChild(); runInChild;) { |
1889 RenderObject* nextSibling = runInChild->nextSibling(); | 1896 RenderObject* nextSibling = runInChild->nextSibling(); |
1890 blockRunIn->children()->removeChildNode(blockRunIn, runInChild); | 1897 blockRunIn->children()->removeChildNode(blockRunIn, runInChild); |
1891 inlineRunIn->addChild(runInChild); // Use addChild instead of appendChil
dNode since it handles correct placement of the children relative to :after-gene
rated content. | 1898 inlineRunIn->addChild(runInChild); // Use addChild instead of appendChil
dNode since it handles correct placement of the children relative to :after-gene
rated content. |
1892 runInChild = nextSibling; | 1899 runInChild = nextSibling; |
1893 } | 1900 } |
(...skipping 5542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7436 } | 7443 } |
7437 | 7444 |
7438 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 7445 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
7439 { | 7446 { |
7440 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); | 7447 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); |
7441 } | 7448 } |
7442 | 7449 |
7443 #endif | 7450 #endif |
7444 | 7451 |
7445 } // namespace WebCore | 7452 } // namespace WebCore |
OLD | NEW |