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

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

Issue 131993002: Stop infinite recursion when generating anonymous table boxes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update baseline too Created 6 years, 11 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 | « LayoutTests/fast/table/crash-col-in-anonymous-table-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderTable.cpp
diff --git a/Source/core/rendering/RenderTable.cpp b/Source/core/rendering/RenderTable.cpp
index e83b217775b4d939c46d9e00808a67f81b412f02..a87d1c12c93a08026325789459332056186812ff 100644
--- a/Source/core/rendering/RenderTable.cpp
+++ b/Source/core/rendering/RenderTable.cpp
@@ -116,6 +116,14 @@ static inline void resetSectionPointerIfNotBefore(RenderTableSection*& ptr, Rend
ptr = 0;
}
+static inline bool needsTableSection(RenderObject* object)
+{
+ // Return true if 'object' can't exist in an anonymous table without being
+ // wrapped in a table section box.
+ EDisplay display = object->style()->display();
+ return display != TABLE_CAPTION && display != TABLE_COLUMN_GROUP && display != TABLE_COLUMN;
+}
+
void RenderTable::addChild(RenderObject* child, RenderObject* beforeChild)
{
bool wrapInAnonymousSection = !child->isOutOfFlowPositioned();
@@ -155,9 +163,7 @@ void RenderTable::addChild(RenderObject* child, RenderObject* beforeChild)
default:
ASSERT_NOT_REACHED();
}
- } else if (child->isTableCell() || child->isTableRow())
- wrapInAnonymousSection = true;
- else
+ } else
wrapInAnonymousSection = true;
if (child->isTableSection())
@@ -185,7 +191,7 @@ void RenderTable::addChild(RenderObject* child, RenderObject* beforeChild)
}
RenderObject* lastBox = beforeChild;
- while (lastBox && lastBox->parent()->isAnonymous() && !lastBox->isTableSection() && lastBox->style()->display() != TABLE_CAPTION && lastBox->style()->display() != TABLE_COLUMN_GROUP)
+ while (lastBox && lastBox->parent()->isAnonymous() && !lastBox->isTableSection() && needsTableSection(lastBox))
lastBox = lastBox->parent();
if (lastBox && lastBox->isAnonymous() && !isAfterContent(lastBox)) {
if (beforeChild == lastBox)
@@ -194,7 +200,7 @@ void RenderTable::addChild(RenderObject* child, RenderObject* beforeChild)
return;
}
- if (beforeChild && !beforeChild->isTableSection() && beforeChild->style()->display() != TABLE_CAPTION && beforeChild->style()->display() != TABLE_COLUMN_GROUP)
+ if (beforeChild && !beforeChild->isTableSection() && needsTableSection(beforeChild))
beforeChild = 0;
RenderTableSection* section = RenderTableSection::createAnonymousWithParentRenderer(this);
« no previous file with comments | « LayoutTests/fast/table/crash-col-in-anonymous-table-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698