Commit 831beecd authored by hyatt@apple.com's avatar hyatt@apple.com

2009-01-26 David Hyatt <hyatt@apple.com>

        Change display:run-in handling so that we no longer reuse RenderBlock as though it is an inline flow.
        Instead we create a new RenderInline, move the RenderBlock's children underneath it, and then set the
        inline as the new element's renderer.

        Reviewed by Dan Bernstein

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::handleRunInChild):
        * rendering/RenderInline.cpp:
        (WebCore::RenderInline::renderName):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@40254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 88bc8bec
......@@ -8,7 +8,7 @@ layer at (0,0) size 800x178
text run at (0,0) width 51: "Case A:"
RenderBlock {DIV} at (0,18) size 784x18
RenderBlock (anonymous) at (0,0) size 784x18
RenderBlock (run-in) {DIV} at (0,0) size 78x18
RenderInline (run-in) {DIV} at (0,0) size 78x18
RenderText {#text} at (0,0) size 78x18
text run at (0,0) width 78: "This should "
RenderInline {DIV} at (0,0) size 41x18
......@@ -20,7 +20,7 @@ layer at (0,0) size 800x178
text run at (0,0) width 50: "Case B:"
RenderBlock {DIV} at (0,54) size 784x18
RenderBlock (anonymous) at (0,0) size 784x18
RenderBlock (run-in) {DIV} at (0,0) size 78x18
RenderInline (run-in) {DIV} at (0,0) size 78x18
RenderText {#text} at (0,0) size 78x18
text run at (0,0) width 78: "This should "
RenderText {#text} at (78,0) size 41x18
......@@ -30,7 +30,7 @@ layer at (0,0) size 800x178
text run at (0,0) width 50: "Case C:"
RenderBlock {DIV} at (0,90) size 784x18
RenderBlock {DIV} at (0,0) size 784x18
RenderBlock (run-in) {DIV} at (0,0) size 78x18
RenderInline (run-in) {DIV} at (0,0) size 78x18
RenderText {#text} at (0,0) size 78x18
text run at (0,0) width 78: "This should "
RenderText {#text} at (78,0) size 41x18
......
2009-01-26 David Hyatt <hyatt@apple.com>
Change display:run-in handling so that we no longer reuse RenderBlock as though it is an inline flow.
Instead we create a new RenderInline, move the RenderBlock's children underneath it, and then set the
inline as the new element's renderer.
Reviewed by Dan Bernstein
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::handleRunInChild):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::renderName):
2009-01-26 Dimitri Glazkov <dglazkov@chromium.org>
Reviewed by Darin Adler.
......@@ -32,6 +32,7 @@
#include "HitTestResult.h"
#include "InlineTextBox.h"
#include "RenderImage.h"
#include "RenderInline.h"
#include "RenderMarquee.h"
#include "RenderReplica.h"
#include "RenderTableCell.h"
......@@ -937,29 +938,43 @@ void RenderBlock::insertCompactIfNeeded(RenderBox* child, CompactInfo& compactIn
}
}
RenderBox* RenderBlock::handleRunInChild(RenderBox* child, bool& handled)
RenderBox* RenderBlock::handleRunInChild(RenderBox* blockRunIn, bool& handled)
{
// See if we have a run-in element with inline children. If the
// children aren't inline, then just treat the run-in as a normal
// block.
if (child->isRunIn() && (child->childrenInline() || child->isReplaced())) {
if (blockRunIn->isRunIn() && (blockRunIn->childrenInline() || blockRunIn->isReplaced())) {
// Get the next non-positioned/non-floating RenderBlock.
RenderObject* curr = child->nextSibling();
RenderObject* curr = blockRunIn->nextSibling();
while (curr && curr->isFloatingOrPositioned())
curr = curr->nextSibling();
if (curr && (curr->isRenderBlock() && curr->childrenInline() && !curr->isCompact() && !curr->isRunIn())) {
// The block acts like an inline, so just null out its
// position.
handled = true;
child->setInline(true);
child->setLocation(0,0);
// Remove the child.
RenderBox* next = child->nextSiblingBox();
removeChildNode(child);
// Remove the old child.
RenderBox* next = blockRunIn->nextSiblingBox();
removeChildNode(blockRunIn);
// Create an inline.
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())
inlineRunIn->moveChildNode(runInChild);
// Now insert the new child under |curr|.
curr->insertChildNode(inlineRunIn, curr->firstChild());
// Now insert the child under |curr|.
curr->insertChildNode(child, curr->firstChild());
// If the run-in had an element, we need to set the new renderer.
if (blockRunIn->element())
blockRunIn->element()->setRenderer(inlineRunIn);
// Destroy the block run-in.
blockRunIn->destroy();
return next;
}
}
......
......@@ -343,6 +343,8 @@ const char* RenderInline::renderName() const
return "RenderInline (relative positioned)";
if (isAnonymous())
return "RenderInline (generated)";
if (isRunIn())
return "RenderInline (run-in)";
return "RenderInline";
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment