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

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

Issue 295513003: add 'slow' prefix to RenderObject's firstChild() / lastChild() methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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
« no previous file with comments | « Source/core/rendering/InlineIterator.h ('k') | Source/core/rendering/RenderBlockLineLayout.cpp » ('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 25c4d2a6ee51a933700af5e15b0dabfed9b9ada1..a1d94cdef85ba53682b4fbd83d968893fdd8dfe7 100644
--- a/Source/core/rendering/RenderBlock.cpp
+++ b/Source/core/rendering/RenderBlock.cpp
@@ -801,7 +801,7 @@ void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild,
|| beforeChildAnonymousContainer->isRenderFullScreenPlaceholder()
) {
// Insert the child into the anonymous block box instead of here.
- if (newChild->isInline() || newChild->isFloatingOrOutOfFlowPositioned() || beforeChild->parent()->firstChild() != beforeChild)
+ if (newChild->isInline() || newChild->isFloatingOrOutOfFlowPositioned() || beforeChild->parent()->slowFirstChild() != beforeChild)
beforeChild->parent()->addChild(newChild, beforeChild);
else
addChild(newChild, beforeChild->parent());
@@ -2681,7 +2681,7 @@ void RenderBlock::removePercentHeightDescendantIfNeeded(RenderBox* descendant)
void RenderBlock::clearPercentHeightDescendantsFrom(RenderBox* parent)
{
ASSERT(gPercentHeightContainerMap);
- for (RenderObject* curr = parent->firstChild(); curr; curr = curr->nextInPreOrder(parent)) {
+ for (RenderObject* curr = parent->slowFirstChild(); curr; curr = curr->nextInPreOrder(parent)) {
if (!curr->isBox())
continue;
@@ -3881,10 +3881,12 @@ RenderBlock* RenderBlock::firstLineBlock() const
// FIXME: Remove when buttons are implemented with align-items instead
// of flexbox.
if (firstLineBlock->isReplaced() || firstLineBlock->isFloating()
- || !parentBlock || parentBlock->firstChild() != firstLineBlock
+ || !parentBlock
|| (!parentBlock->isRenderBlockFlow() && !parentBlock->isRenderButton()))
break;
ASSERT_WITH_SECURITY_IMPLICATION(parentBlock->isRenderBlock());
+ if (toRenderBlock(parentBlock)->firstChild() != firstLineBlock)
+ break;
firstLineBlock = toRenderBlock(parentBlock);
}
@@ -3939,8 +3941,12 @@ static inline RenderObject* findFirstLetterBlock(RenderBlock* start)
return firstLetterBlock;
RenderObject* parentBlock = firstLetterBlock->parent();
- if (firstLetterBlock->isReplaced() || !parentBlock || parentBlock->firstChild() != firstLetterBlock ||
- (!parentBlock->isRenderBlockFlow() && !parentBlock->isRenderButton()))
+ if (firstLetterBlock->isReplaced() || !parentBlock
+ || (!parentBlock->isRenderBlockFlow() && !parentBlock->isRenderButton())) {
+ return 0;
+ }
+ ASSERT(parentBlock->isRenderBlock());
+ if (toRenderBlock(parentBlock)->firstChild() != firstLetterBlock)
return 0;
firstLetterBlock = parentBlock;
}
@@ -3966,7 +3972,7 @@ void RenderBlock::updateFirstLetterStyle(RenderObject* firstLetterBlock, RenderO
// Move the first letter into the new renderer.
LayoutStateDisabler layoutStateDisabler(*this);
- while (RenderObject* child = firstLetter->firstChild()) {
+ while (RenderObject* child = firstLetter->slowFirstChild()) {
if (child->isText())
toRenderText(child)->removeAndDestroyTextBoxes();
firstLetter->removeChild(child);
@@ -3989,7 +3995,7 @@ void RenderBlock::updateFirstLetterStyle(RenderObject* firstLetterBlock, RenderO
} else
firstLetter->setStyle(pseudoStyle);
- for (RenderObject* genChild = firstLetter->firstChild(); genChild; genChild = genChild->nextSibling()) {
+ for (RenderObject* genChild = firstLetter->slowFirstChild(); genChild; genChild = genChild->nextSibling()) {
if (genChild->isText())
genChild->setStyle(pseudoStyle);
}
@@ -4092,7 +4098,7 @@ void RenderBlock::updateFirstLetter()
return;
// Drill into inlines looking for our first text child.
- RenderObject* currChild = firstLetterBlock->firstChild();
+ RenderObject* currChild = firstLetterBlock->slowFirstChild();
unsigned length = 0;
while (currChild) {
if (currChild->isText()) {
@@ -4106,18 +4112,19 @@ void RenderBlock::updateFirstLetter()
currChild = currChild->nextSibling();
} else if (currChild->isFloatingOrOutOfFlowPositioned()) {
if (currChild->style()->styleType() == FIRST_LETTER) {
- currChild = currChild->firstChild();
+ currChild = currChild->slowFirstChild();
break;
}
currChild = currChild->nextSibling();
- } else if (currChild->isReplaced() || currChild->isRenderButton() || currChild->isMenuList())
+ } else if (currChild->isReplaced() || currChild->isRenderButton() || currChild->isMenuList()) {
break;
- else if (currChild->style()->hasPseudoStyle(FIRST_LETTER) && currChild->canHaveGeneratedChildren()) {
+ } else if (currChild->style()->hasPseudoStyle(FIRST_LETTER) && currChild->canHaveGeneratedChildren()) {
// We found a lower-level node with first-letter, which supersedes the higher-level style
firstLetterBlock = currChild;
- currChild = currChild->firstChild();
- } else
- currChild = currChild->firstChild();
+ currChild = currChild->slowFirstChild();
+ } else {
+ currChild = currChild->slowFirstChild();
+ }
}
if (!currChild)
« no previous file with comments | « Source/core/rendering/InlineIterator.h ('k') | Source/core/rendering/RenderBlockLineLayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698