Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1576)

Unified Diff: Source/core/rendering/RenderBlock.cpp

Issue 53373003: Remove display:run-in as per https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/_tHSX… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix test Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderFileUploadControl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBlock.cpp
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp
index 16d51d77f54893ce9479b589bde232a0e7345410..4eabe3c226e5d8a14c7f29292f5f35e9e3981a79 100644
--- a/Source/core/rendering/RenderBlock.cpp
+++ b/Source/core/rendering/RenderBlock.cpp
@@ -735,20 +735,9 @@ void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild,
// safe fallback to use the topmost beforeChild container.
beforeChild = beforeChildContainer;
}
- } else {
- // We will reach here when beforeChild is a run-in element.
- // If run-in element precedes a block-level element, it becomes the
- // the first inline child of that block level element. The insertion
- // point will be before that block-level element.
- ASSERT(beforeChild->isRunIn());
- beforeChild = beforeChildContainer;
}
}
- // Nothing goes before the intruded run-in.
- if (beforeChild && beforeChild->isRunIn() && runInIsPlacedIntoSiblingBlock(beforeChild))
- beforeChild = beforeChild->nextSibling();
-
// Check for a spanning element in columns.
if (gColumnFlowSplitEnabled) {
RenderBlock* columnsBlockAncestor = columnsBlockForSpanningElement(newChild);
@@ -816,9 +805,6 @@ void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild,
RenderBox::addChild(newChild, beforeChild);
- // Handle placement of run-ins.
- placeRunInIfNeeded(newChild);
-
if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isRenderBlock())
toRenderBlock(parent())->removeLeftoverAnonymousBlock(this);
// this object may be dead here
@@ -926,13 +912,6 @@ void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint)
deleteLineBoxTree();
- // Since we are going to have block children, we have to move
- // back the run-in to its original place.
- if (child->isRunIn()) {
- moveRunInToOriginalPosition(child);
- child = firstChild();
- }
-
while (child) {
RenderObject *inlineRunStart, *inlineRunEnd;
getInlineRun(child, insertionPoint, inlineRunStart, inlineRunEnd);
@@ -1016,10 +995,6 @@ static bool canMergeContiguousAnonymousBlocks(RenderObject* oldChild, RenderObje
|| (next && (!next->isAnonymousBlock() || toRenderBlock(next)->continuation() || toRenderBlock(next)->beingDestroyed())))
return false;
- // FIXME: This check isn't required when inline run-ins can't be split into continuations.
- if (prev && prev->firstChild() && prev->firstChild()->isInline() && prev->firstChild()->isRunIn())
- return false;
-
if ((prev && (prev->isRubyRun() || prev->isRubyBase()))
|| (next && (next->isRubyRun() || next->isRubyBase())))
return false;
@@ -1594,146 +1569,6 @@ bool RenderBlock::expandsToEncloseOverhangingFloats() const
|| hasColumns() || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() || isRoot();
}
-static void destroyRunIn(RenderBoxModelObject* runIn)
-{
- ASSERT(runIn->isRunIn());
- ASSERT(!runIn->firstChild());
-
- // Delete our line box tree. This is needed as our children got moved
- // and our line box tree is no longer valid.
- if (runIn->isRenderBlock())
- toRenderBlock(runIn)->deleteLineBoxTree();
- else if (runIn->isRenderInline())
- toRenderInline(runIn)->deleteLineBoxTree();
- else
- ASSERT_NOT_REACHED();
-
- runIn->destroy();
-}
-
-void RenderBlock::placeRunInIfNeeded(RenderObject* newChild)
-{
- if (newChild->isRunIn())
- moveRunInUnderSiblingBlockIfNeeded(newChild);
- else if (RenderObject* prevSibling = newChild->previousSibling()) {
- if (prevSibling->isRunIn())
- moveRunInUnderSiblingBlockIfNeeded(prevSibling);
- }
-}
-
-RenderBoxModelObject* RenderBlock::createReplacementRunIn(RenderBoxModelObject* runIn)
-{
- ASSERT(runIn->isRunIn());
- ASSERT(runIn->node());
-
- RenderBoxModelObject* newRunIn = 0;
- if (!runIn->isRenderBlockFlow())
- newRunIn = new RenderBlockFlow(runIn->node());
- else
- newRunIn = new RenderInline(toElement(runIn->node()));
-
- runIn->node()->setRenderer(newRunIn);
- newRunIn->setStyle(runIn->style());
-
- runIn->moveAllChildrenTo(newRunIn, true);
-
- return newRunIn;
-}
-
-void RenderBlock::moveRunInUnderSiblingBlockIfNeeded(RenderObject* runIn)
-{
- ASSERT(runIn->isRunIn());
-
- // See if we have inline children. If the children aren't inline,
- // then just treat the run-in as a normal block.
- if (!runIn->childrenInline())
- return;
-
- // FIXME: We don't handle non-block flow elements with run-in for now.
- if (!runIn->isRenderBlockFlow())
- return;
-
- // FIXME: We don't support run-ins with or as part of a continuation
- // as it makes the back-and-forth placing complex.
- if (runIn->isElementContinuation() || runIn->virtualContinuation())
- return;
-
- // Check if this node is allowed to run-in. E.g. <select> expects its renderer to
- // be a RenderListBox or RenderMenuList, and hence cannot be a RenderInline run-in.
- if (!runIn->canBeReplacedWithInlineRunIn())
- return;
-
- RenderObject* curr = runIn->nextSibling();
- if (!curr || !curr->isRenderBlock() || !curr->childrenInline())
- return;
-
- // Per CSS3, "A run-in cannot run in to a block that already starts with a
- // run-in or that itself is a run-in".
- if (curr->isRunIn() || (curr->firstChild() && curr->firstChild()->isRunIn()))
- return;
-
- if (curr->isAnonymous() || curr->isFloatingOrOutOfFlowPositioned())
- return;
-
- // FIXME: We don't support run-ins with or as part of a continuation
- // as it makes the back-and-forth placing complex.
- if (curr->isElementContinuation() || curr->virtualContinuation())
- return;
-
- RenderBoxModelObject* oldRunIn = toRenderBoxModelObject(runIn);
- RenderBoxModelObject* newRunIn = createReplacementRunIn(oldRunIn);
- destroyRunIn(oldRunIn);
-
- // Now insert the new child under |curr| block. Use addChild instead of insertChildNode
- // since it handles correct placement of the children, especially where we cannot insert
- // anything before the first child. e.g. details tag. See https://bugs.webkit.org/show_bug.cgi?id=58228.
- curr->addChild(newRunIn, curr->firstChild());
-
- // Make sure that |this| get a layout since its run-in child moved.
- curr->setNeedsLayoutAndPrefWidthsRecalc();
-}
-
-bool RenderBlock::runInIsPlacedIntoSiblingBlock(RenderObject* runIn)
-{
- ASSERT(runIn->isRunIn());
-
- // If we don't have a parent, we can't be moved into our sibling block.
- if (!parent())
- return false;
-
- // An intruded run-in needs to be an inline.
- if (!runIn->isRenderInline())
- return false;
-
- return true;
-}
-
-void RenderBlock::moveRunInToOriginalPosition(RenderObject* runIn)
-{
- ASSERT(runIn->isRunIn());
-
- if (!runInIsPlacedIntoSiblingBlock(runIn))
- return;
-
- // FIXME: Run-in that are now placed in sibling block can break up into continuation
- // chains when new children are added to it. We cannot easily send them back to their
- // original place since that requires writing integration logic with RenderInline::addChild
- // and all other places that might cause continuations to be created (without blowing away
- // |this|). Disabling this feature for now to prevent crashes.
- if (runIn->isElementContinuation() || runIn->virtualContinuation())
- return;
-
- RenderBoxModelObject* oldRunIn = toRenderBoxModelObject(runIn);
- RenderBoxModelObject* newRunIn = createReplacementRunIn(oldRunIn);
- destroyRunIn(oldRunIn);
-
- // Add the run-in block as our previous sibling.
- parent()->addChild(newRunIn, this);
-
- // Make sure that the parent holding the new run-in gets layout.
- parent()->setNeedsLayoutAndPrefWidthsRecalc();
-}
-
LayoutUnit RenderBlock::computeStartPositionDeltaForChildAvoidingFloats(const RenderBox* child, LayoutUnit childMarginStart, RenderRegion* region)
{
LayoutUnit startPosition = startOffsetForContent(region);
@@ -5127,7 +4962,7 @@ void RenderBlock::updateFirstLetter()
// (crawling into blocks).
static bool shouldCheckLines(RenderObject* obj)
{
- return !obj->isFloatingOrOutOfFlowPositioned() && !obj->isRunIn()
+ return !obj->isFloatingOrOutOfFlowPositioned()
&& obj->isRenderBlock() && obj->style()->height().isAuto()
&& (!obj->isDeprecatedFlexibleBox() || obj->style()->boxOrient() == VERTICAL);
}
@@ -5148,7 +4983,7 @@ static int getHeightForLineCount(RenderBlock* block, int l, bool includeBottom,
int result = getHeightForLineCount(toRenderBlock(obj), l, false, count);
if (result != -1)
return result + obj->y() + (includeBottom ? (block->borderBottom() + block->paddingBottom()) : LayoutUnit());
- } else if (!obj->isFloatingOrOutOfFlowPositioned() && !obj->isRunIn())
+ } else if (!obj->isFloatingOrOutOfFlowPositioned())
normalFlowChildWithoutLines = obj;
}
if (normalFlowChildWithoutLines && l == 0)
@@ -5954,8 +5789,6 @@ const char* RenderBlock::renderName() const
return "RenderBlock (relative positioned)";
if (isStickyPositioned())
return "RenderBlock (sticky positioned)";
- if (isRunIn())
- return "RenderBlock (run-in)";
return "RenderBlock";
}
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderFileUploadControl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698