X-Git-Url: https://git.webkit.org/?p=WebKit-https.git;a=blobdiff_plain;f=WebCore%2Frendering%2FRenderBlock.cpp;h=4ba0948a73247e9d60a44672d74f4bfc6d802ab5;hp=86a445944dae23dd8c982b83dd47a07f5233e879;hb=8af97f62f21160ac14403e18fd651223a1e22ef8;hpb=69fa83cbe4304930b4873261221bb9524cb7ce57 diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp index 86a445944dae..4ba0948a7324 100644 --- a/WebCore/rendering/RenderBlock.cpp +++ b/WebCore/rendering/RenderBlock.cpp @@ -269,6 +269,18 @@ static void getInlineRun(RenderObject* start, RenderObject* boundary, } while (!sawInline); } +void RenderBlock::deleteLineBoxTree() +{ + InlineFlowBox* line = m_firstLineBox; + InlineFlowBox* nextLine; + while (line) { + nextLine = line->nextFlowBox(); + line->deleteLine(renderArena()); + line = nextLine; + } + m_firstLineBox = m_lastLineBox = 0; +} + void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint) { // makeChildrenNonInline takes a block whose children are *all* inline and it @@ -283,14 +295,7 @@ void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint) m_childrenInline = false; - InlineFlowBox* line = m_firstLineBox; - InlineFlowBox* nextLine; - while (line) { - nextLine = line->nextFlowBox(); - line->deleteLine(renderArena()); - line = nextLine; - } - m_firstLineBox = m_lastLineBox = 0; + deleteLineBoxTree(); RenderObject *child = firstChild(); @@ -343,25 +348,9 @@ void RenderBlock::removeChild(RenderObject *oldChild) prev->appendChildNode(next->removeChildNode(no)); no->setNeedsLayoutAndMinMaxRecalc(); } - - // Do the same with line boxes. - RenderBlock* prevBlock = static_cast(prev); + RenderBlock* nextBlock = static_cast(next); - if (RootInlineBox* box = nextBlock->firstRootBox()) { - if (prevBlock->lastRootBox()) { - prevBlock->lastRootBox()->setNextLineBox(box); - box->setPreviousLineBox(prevBlock->lastRootBox()); - } else - prevBlock->m_firstLineBox = box; - - while (box) { - prevBlock->m_lastLineBox = box; - box->m_object = prevBlock; - box = box->nextRootBox(); - } - nextBlock->m_firstLineBox = 0; - nextBlock->m_lastLineBox = 0; - } + nextBlock->deleteLineBoxTree(); // Nuke the now-empty block. next->destroy(); @@ -385,18 +374,8 @@ void RenderBlock::removeChild(RenderObject *oldChild) no->setNeedsLayoutAndMinMaxRecalc(); } - // Take over the anonymous child's line boxes. - RootInlineBox* box = anonBlock->firstRootBox(); - m_firstLineBox = box; - while (box) { - m_lastLineBox = box; - box->m_object = this; - box = box->nextRootBox(); - } - anonBlock->m_firstLineBox = 0; - anonBlock->m_lastLineBox = 0; - - // Nuke the now-empty block. + // Delete the now-empty block's lines and nuke it. + anonBlock->deleteLineBoxTree(); anonBlock->destroy(); } }