Crash in RenderTable::removeCaption
authorjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2012 01:26:00 +0000 (01:26 +0000)
committerjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2012 01:26:00 +0000 (01:26 +0000)
commit6f9a4a2e7408c56ee08c6a9097a486ee38e6aae3
tree6cc92fd95c4d7c2c46c824dd1bfcea86cb6a0c33
parentf0723ca001ca45e318db058dc623285f97e21223
Crash in RenderTable::removeCaption
https://bugs.webkit.org/show_bug.cgi?id=95090

Reviewed by Abhishek Arya.

Source/WebCore:

The issue came from the caption addition logic not being called when
we move the caption due to being hooked on RenderTable::addChild
and not RenderTableCaption::insertedIntoTree. This change implemented
the previous hook and simplified our caption handling.

Test: fast/table/table-caption-moved-crash.html

* rendering/RenderTable.cpp:
(WebCore::RenderTable::addChild):
Removed the add-a-caption code as it is now executed from RenderTableCaption::insertedIntoTree.

(WebCore::RenderTable::addCaption):
Added this helper method.

(WebCore::RenderTable::removeCaption):
Changed this function to be more bullet-proof. The old code was checking |index| as it wasn't
bullet proof so let's keep it.

(WebCore::RenderTable::recalcSections):
Removed the caption handling code as we should properly handle them now.

* rendering/RenderTable.h:
Added addCaption.

* rendering/RenderTableCaption.cpp:
(WebCore::RenderTableCaption::insertedIntoTree):
* rendering/RenderTableCaption.h:
Added insertedIntoTree.

LayoutTests:

* fast/table/table-caption-moved-crash-expected.txt: Added.
* fast/table/table-caption-moved-crash.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@126833 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/table/table-caption-moved-crash-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/table-caption-moved-crash.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTable.h
Source/WebCore/rendering/RenderTableCaption.cpp
Source/WebCore/rendering/RenderTableCaption.h