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

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

Issue 10261009: Merge 113581 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 years, 8 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/WebCore/rendering/RenderBlock.h ('k') | Source/WebCore/rendering/RenderBox.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/rendering/RenderBlock.cpp
===================================================================
--- Source/WebCore/rendering/RenderBlock.cpp (revision 115616)
+++ Source/WebCore/rendering/RenderBlock.cpp (working copy)
@@ -481,7 +481,8 @@
}
// Split our anonymous blocks.
- RenderObject* newBeforeChild = splitAnonymousBlocksAroundChild(beforeChild);
+ RenderObject* newBeforeChild = splitAnonymousBoxesAroundChild(beforeChild);
+
// Create a new anonymous box of the appropriate type.
RenderBlock* newBox = newChildHasColumnSpan ? createAnonymousColumnSpanBlock() : createAnonymousColumnsBlock();
@@ -681,94 +682,6 @@
post->setNeedsLayoutAndPrefWidthsRecalc();
}
-RenderObject* RenderBlock::splitAnonymousBlocksAroundChild(RenderObject* beforeChild)
-{
- if (beforeChild->isTablePart())
- beforeChild = splitTablePartsAroundChild(beforeChild);
-
- while (beforeChild->parent() != this) {
- RenderBlock* blockToSplit = toRenderBlock(beforeChild->parent());
- if (blockToSplit->firstChild() != beforeChild) {
- // We have to split the parentBlock into two blocks.
- RenderBlock* post = toRenderBlock(blockToSplit->createAnonymousBoxWithSameTypeAs(this));
- post->setChildrenInline(blockToSplit->childrenInline());
- RenderBlock* parentBlock = toRenderBlock(blockToSplit->parent());
- parentBlock->children()->insertChildNode(parentBlock, post, blockToSplit->nextSibling());
- blockToSplit->moveChildrenTo(post, beforeChild, 0, blockToSplit->hasLayer());
- post->setNeedsLayoutAndPrefWidthsRecalc();
- blockToSplit->setNeedsLayoutAndPrefWidthsRecalc();
- beforeChild = post;
- } else
- beforeChild = blockToSplit;
- }
- return beforeChild;
-}
-
-static void markTableForSectionAndCellRecalculation(RenderObject* child)
-{
- RenderObject* curr = child;
- while (!curr->isTable()) {
- if (curr->isTableSection())
- toRenderTableSection(curr)->setNeedsCellRecalc();
- curr = curr->parent();
- }
-
- RenderTable* table = toRenderTable(curr);
- table->setNeedsSectionRecalc();
- table->setNeedsLayoutAndPrefWidthsRecalc();
-}
-
-static void moveAllTableChildrenTo(RenderObject* fromTablePart, RenderTable* toTable, RenderObject* startChild)
-{
- for (RenderObject* curr = startChild; curr;) {
- // Need to store next sibling as we won't have access to it
- // after we are removed from table.
- RenderObject* next = curr->nextSibling();
- fromTablePart->removeChild(curr);
- toTable->addChild(curr);
- if (curr->isTableSection())
- toRenderTableSection(curr)->setNeedsCellRecalc();
- curr->setNeedsLayoutAndPrefWidthsRecalc();
- curr = next;
- }
-
- // This marks fromTable for section and cell recalculation.
- markTableForSectionAndCellRecalculation(fromTablePart);
-
- // startChild is now part of toTable. This marks toTable for section and cell recalculation.
- markTableForSectionAndCellRecalculation(startChild);
-}
-
-RenderObject* RenderBlock::splitTablePartsAroundChild(RenderObject* beforeChild)
-{
- ASSERT(beforeChild->isTablePart());
-
- while (beforeChild->parent() != this) {
- RenderObject* tablePartToSplit = beforeChild->parent();
- if (!tablePartToSplit->isTablePart() && !tablePartToSplit->isTable())
- break;
- if (tablePartToSplit->firstChild() != beforeChild) {
- // Get our table container.
- RenderObject* curr = tablePartToSplit;
- while (!curr->isTable())
- curr = curr->parent();
- RenderTable* table = toRenderTable(curr);
-
- // Create an anonymous table container next to our table container.
- RenderBlock* parentBlock = toRenderBlock(table->parent());
- RenderTable* postTable = RenderTable::createAnonymousWithParentRenderer(parentBlock);
- parentBlock->children()->insertChildNode(parentBlock, postTable, table->nextSibling());
-
- // Move all the children from beforeChild to the newly created anonymous table container.
- moveAllTableChildrenTo(tablePartToSplit, postTable, beforeChild);
-
- beforeChild = postTable;
- } else
- beforeChild = tablePartToSplit;
- }
- return beforeChild;
-}
-
void RenderBlock::makeChildrenAnonymousColumnBlocks(RenderObject* beforeChild, RenderBlock* newBlockBox, RenderObject* newChild)
{
RenderBlock* pre = 0;
@@ -780,7 +693,7 @@
block->deleteLineBoxTree();
if (beforeChild && beforeChild->parent() != this)
- beforeChild = splitAnonymousBlocksAroundChild(beforeChild);
+ beforeChild = splitAnonymousBoxesAroundChild(beforeChild);
if (beforeChild != firstChild()) {
pre = block->createAnonymousColumnsBlock();
@@ -890,7 +803,7 @@
return;
}
- beforeChild = splitTablePartsAroundChild(beforeChild);
+ beforeChild = splitAnonymousBoxesAroundChild(beforeChild);
ASSERT(beforeChild->parent() == this);
if (beforeChild->parent() != this) {
@@ -1076,30 +989,6 @@
return rootBox;
}
-void RenderBlock::moveChildTo(RenderBlock* toBlock, RenderObject* child, RenderObject* beforeChild, bool fullRemoveInsert)
-{
- ASSERT(this == child->parent());
- ASSERT(!beforeChild || toBlock == beforeChild->parent());
- if (fullRemoveInsert) {
- // Takes care of adding the new child correctly if toBlock and fromBlock
- // have different kind of children (block vs inline).
- toBlock->addChildIgnoringContinuation(children()->removeChildNode(this, child), beforeChild);
- } else
- toBlock->children()->insertChildNode(toBlock, children()->removeChildNode(this, child, false), beforeChild, false);
-}
-
-void RenderBlock::moveChildrenTo(RenderBlock* toBlock, RenderObject* startChild, RenderObject* endChild, RenderObject* beforeChild, bool fullRemoveInsert)
-{
- ASSERT(!beforeChild || toBlock == beforeChild->parent());
-
- for (RenderObject* child = startChild; child && child != endChild; ) {
- // Save our next sibling as moveChildTo will clear it.
- RenderObject* nextSibling = child->nextSibling();
- moveChildTo(toBlock, child, beforeChild, fullRemoveInsert);
- child = nextSibling;
- }
-}
-
void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint)
{
// makeChildrenNonInline takes a block whose children are *all* inline and it
« no previous file with comments | « Source/WebCore/rendering/RenderBlock.h ('k') | Source/WebCore/rendering/RenderBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698