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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 1977823002: Move makeChildrenNonInline() and childBecameNonInline() to LayoutBlockFlow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
Index: third_party/WebKit/Source/core/layout/LayoutBlock.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index 9245ae6329a98073e1b6a28b078c2a7ed2bd2c7f..78906960d2b88a6f0bd5a3316e58fe6fa2aa04f6 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -374,94 +374,11 @@ void LayoutBlock::addChild(LayoutObject* newChild, LayoutObject* beforeChild)
LayoutBox::addChild(newChild, beforeChild);
}
-static void getInlineRun(LayoutObject* start, LayoutObject* boundary,
- LayoutObject*& inlineRunStart,
- LayoutObject*& inlineRunEnd)
-{
- // Beginning at |start| we find the largest contiguous run of inlines that
- // we can. We denote the run with start and end points, |inlineRunStart|
- // and |inlineRunEnd|. Note that these two values may be the same if
- // we encounter only one inline.
- //
- // We skip any non-inlines we encounter as long as we haven't found any
- // inlines yet.
- //
- // |boundary| indicates a non-inclusive boundary point. Regardless of whether |boundary|
- // is inline or not, we will not include it in a run with inlines before it. It's as though we encountered
- // a non-inline.
-
- // Start by skipping as many non-inlines as we can.
- LayoutObject * curr = start;
- bool sawInline;
- do {
- while (curr && !(curr->isInline() || curr->isFloatingOrOutOfFlowPositioned()))
- curr = curr->nextSibling();
-
- inlineRunStart = inlineRunEnd = curr;
-
- if (!curr)
- return; // No more inline children to be found.
-
- sawInline = curr->isInline();
-
- curr = curr->nextSibling();
- while (curr && (curr->isInline() || curr->isFloatingOrOutOfFlowPositioned()) && (curr != boundary)) {
- inlineRunEnd = curr;
- if (curr->isInline())
- sawInline = true;
- curr = curr->nextSibling();
- }
- } while (!sawInline);
-}
-
void LayoutBlock::deleteLineBoxTree()
{
ASSERT(!m_lineBoxes.firstLineBox());
}
-void LayoutBlock::makeChildrenNonInline(LayoutObject *insertionPoint)
-{
- // makeChildrenNonInline takes a block whose children are *all* inline and it
- // makes sure that inline children are coalesced under anonymous
- // blocks. If |insertionPoint| is defined, then it represents the insertion point for
- // the new block child that is causing us to have to wrap all the inlines. This
- // means that we cannot coalesce inlines before |insertionPoint| with inlines following
- // |insertionPoint|, because the new child is going to be inserted in between the inlines,
- // splitting them.
- ASSERT(isInlineBlockOrInlineTable() || !isInline());
- ASSERT(!insertionPoint || insertionPoint->parent() == this);
-
- setChildrenInline(false);
-
- LayoutObject* child = firstChild();
- if (!child)
- return;
-
- deleteLineBoxTree();
-
- while (child) {
- LayoutObject* inlineRunStart;
- LayoutObject* inlineRunEnd;
- getInlineRun(child, insertionPoint, inlineRunStart, inlineRunEnd);
-
- if (!inlineRunStart)
- break;
-
- child = inlineRunEnd->nextSibling();
-
- LayoutBlock* block = createAnonymousBlock();
- children()->insertChildNode(this, block, inlineRunStart);
- moveChildrenTo(block, inlineRunStart, child);
- }
-
-#if ENABLE(ASSERT)
- for (LayoutObject *c = firstChild(); c; c = c->nextSibling())
- ASSERT(!c->isInline());
-#endif
-
- setShouldDoFullPaintInvalidation();
-}
-
void LayoutBlock::removeLeftoverAnonymousBlock(LayoutBlock* child)
{
ASSERT(child->isAnonymousBlock());
@@ -1782,14 +1699,6 @@ LayoutBlockFlow* LayoutBlock::nearestInnerBlockWithFirstLine()
return nullptr;
}
-void LayoutBlock::childBecameNonInline(LayoutObject*)
-{
- makeChildrenNonInline();
- if (isAnonymousBlock() && parent() && parent()->isLayoutBlock())
- toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this);
- // |this| may be dead here
-}
-
void LayoutBlock::updateHitTestResult(HitTestResult& result, const LayoutPoint& point)
{
if (result.innerNode())
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698