ASSERTION FAILED: !needsLayout() in WebCore::RenderMathMLScripts::firstLineBaseline
authorfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Nov 2017 08:37:59 +0000 (08:37 +0000)
committerfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Nov 2017 08:37:59 +0000 (08:37 +0000)
commit843e74e40bb2ffdfc6beafdc05fd575892eed417
treeb2f91b1fba069b105388b614823f5a0187d4a0d8
parent195a9234bc3cdc23c74607aca325f3504c65461a
ASSERTION FAILED: !needsLayout() in WebCore::RenderMathMLScripts::firstLineBaseline
https://bugs.webkit.org/show_bug.cgi?id=174131

Patch by Frederic Wang <fwang@igalia.com> on 2017-11-21
Reviewed by Alejandro G. Castro.

Source/WebCore:

RenderMathMLScripts::firstLineBaseline() has an ASSERT at the beginning to ensure that the function
is called after the element was laid out. However, this is not respected by HTML table layout as
RenderBlock::firstLineBaseline() is called for elements in a table cell before they are laid out.
This happens for example for RenderGrid::firstLineBaseline() and probably for other renderers.
Additionally, RenderMathMLScripts::firstLineBaseline() only involves calling firstLineBaseline();
logicalTop() or logicalHeight() on the first child box so it is safe to call it before layout, even
if the return value might be wrong at that time. This patch removes this too restrictive ASSERT for
RenderMathMLScripts, for consistency with other implementations of firstLineBaseline().

Test: mathml/cells-and-scripts-crash.html

* rendering/mathml/RenderMathMLScripts.cpp:
(WebCore::RenderMathMLScripts::firstLineBaseline const): Remove the ASSERT.

LayoutTests:

Add tests for calling RenderMathMLScripts::firstLineBaseline with needsLayout() == true.

* mathml/cells-and-scripts-crash-expected.txt: Added.
* mathml/cells-and-scripts-crash.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225069 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/mathml/cells-and-scripts-crash-expected.txt [new file with mode: 0644]
LayoutTests/mathml/cells-and-scripts-crash.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp
Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp.orig [new file with mode: 0644]