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

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

Issue 9562026: Merge 108127 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 years, 10 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/RenderObject.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 109407)
+++ Source/WebCore/rendering/RenderBlock.cpp (working copy)
@@ -599,6 +599,9 @@
RenderObject* RenderBlock::splitAnonymousBlocksAroundChild(RenderObject* beforeChild)
{
+ if (beforeChild->isTablePart())
+ beforeChild = splitTablePartsAroundChild(beforeChild);
+
while (beforeChild->parent() != this) {
RenderBlock* blockToSplit = toRenderBlock(beforeChild->parent());
if (blockToSplit->firstChild() != beforeChild) {
@@ -617,6 +620,69 @@
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 && !beforeChild->isTable()) {
+ RenderObject* tablePartToSplit = beforeChild->parent();
+ 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 = parentBlock->createAnonymousTable();
+ 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;
@@ -733,8 +799,7 @@
return;
}
- // Go on to insert before the anonymous table.
- beforeChild = beforeChildAnonymousContainer;
+ beforeChild = splitTablePartsAroundChild(beforeChild);
}
// Check for a spanning element in columns.
« no previous file with comments | « Source/WebCore/rendering/RenderBlock.h ('k') | Source/WebCore/rendering/RenderObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698