[webkit-dev] Focus Crash Relating to MathML

Alex Milowski alex at milowski.org
Tue Oct 19 12:07:28 PDT 2010

On Tue, Oct 19, 2010 at 11:29 AM, David Hyatt <hyatt at apple.com> wrote:
> (1) Make sure any layout methods you call do setNeedsLayout(false) at the end of them.
> (2) Look for any early returns in any of your layout methods, since maybe you did an early return causing the setNeedsLayout(false) to be missed.
> (3) Make sure you aren't dirtying a child for a re-layout without immediately doing that re-layout, e.g., don't call setChildNeedsLayout(true, false) on some child and then bail without doing a layout.

While this is helpful, the current code (in the patch) follows these
principles (except when RenderBlock::layout() is called last and so
setNeedsLayout(false) is already done).  The problem I have is an
*ancestor* is marked as having a child needing layout during the
layout process.  When then MathML layout finishes, the MathML
rendering objects do not need layout but the parent is marked with
m_normalChildNeedsLayout set to true.

This only becomes a problem when the parent of the RenderMathMLMath
rendering object is a RenderInline instance as the a RenderBlock will
call setNeedsLayout(false) on itself at the very end of layout.  To
me, although I have yet to confirm this, it seems like
setNeedsLayout(false) is called during the layout of the inline flow
from RenderBlock::layoutInlineChildren() on the RenderInline instance
and then the RenderInline is marked with a child needing layout.
Unfortunately, none of the above suggestions are going to fix that.

I think the call to destroyLeftoverChildren() is also something we
should reconsider.  In my very simple example, this is what is causing
the RenderInline instance to be marked with a child needing layout as
it causes a traversal through the ancestors.  I know why it is there
but it doesn't necessarily seem like the right way (or place) to
reorganize the operator stacking.

--Alex Milowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language

Bertrand Russell in a footnote of Principles of Mathematics

More information about the webkit-dev mailing list