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

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

Issue 6913011: Merge 85355 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/742/
Patch Set: Created 9 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/RenderTable.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/rendering/RenderTable.cpp
===================================================================
--- Source/WebCore/rendering/RenderTable.cpp (revision 85557)
+++ Source/WebCore/rendering/RenderTable.cpp (working copy)
@@ -116,11 +116,15 @@
RenderObject* o = beforeChild->previousSibling();
while (o && o != m_caption)
o = o->previousSibling();
- if (!o)
+ if (!o) {
m_caption = 0;
+ setNeedsSectionRecalc();
+ }
}
if (!m_caption)
m_caption = toRenderBlock(child);
+ else
+ setNeedsSectionRecalc();
wrapInAnonymousSection = false;
} else if (child->isTableCol()) {
m_hasColElements = true;
@@ -198,6 +202,9 @@
void RenderTable::removeChild(RenderObject* oldChild)
{
RenderBox::removeChild(oldChild);
+
+ if (m_caption && oldChild == m_caption && node())
+ node()->setNeedsStyleRecalc();
setNeedsSectionRecalc();
}
@@ -688,6 +695,25 @@
return 0;
}
+void RenderTable::recalcCaption(RenderBlock* caption) const
+{
+ if (!m_caption) {
+ m_caption = caption;
+ m_caption->setNeedsLayout(true);
+ } else {
+ // Detach the child from the table.
+ const RenderBlock* block = static_cast<const RenderBlock*>(this);
+ const_cast<RenderBlock*>(block)->removeChild(caption);
+
+ // Make sure to null out the child's renderer.
+ if (Node* node = caption->node())
+ node->setRenderer(0);
+
+ // Destroy the child now.
+ caption->destroy();
+ }
+}
+
void RenderTable::recalcSections() const
{
m_caption = 0;
@@ -697,13 +723,13 @@
m_hasColElements = false;
// We need to get valid pointers to caption, head, foot and first body again
- for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
+ RenderObject* nextSibling;
+ for (RenderObject* child = firstChild(); child; child = nextSibling) {
+ nextSibling = child->nextSibling();
switch (child->style()->display()) {
case TABLE_CAPTION:
- if (!m_caption && child->isRenderBlock()) {
- m_caption = toRenderBlock(child);
- m_caption->setNeedsLayout(true);
- }
+ if (child->isRenderBlock())
+ recalcCaption(toRenderBlock(child));
break;
case TABLE_COLUMN:
case TABLE_COLUMN_GROUP:
« no previous file with comments | « Source/WebCore/rendering/RenderTable.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698