[webkit-dev] Focus Crash Relating to MathML

Alex Milowski alex at milowski.org
Mon Oct 18 20:22:38 PDT 2010

Most of the MathML rendering objects have a display style property value
of inline-block.  Whenever these rendering objects are used, somehow the
parent "container" gets marked as having children in need of layout.  The
MathML math rendering object completes its layout and marks itself as
not needing layout.  In the end, the container (e.g. the anchor element)
render object has itself in a state where m_normalChildNeedsLayout is
true but no child is marked as needing layout.

I've gone through the MathML rendering objects and remove all uses
of markContaingBlocksForLayout() and setNeedsLayoutPrefWidthsRecalc()
which generally cause the container to be marked with a child needing
layout.  These calls were unnecessary and the resulting code should be
more efficient.

In situations where the MathML does not contain a rendering object
that is an inline-block, everything works fine.  For example:

<a href='#'>
  <math xmlns='http://www.w3.org/1998/Math/MathML'><mi>x</mi></math>

Keep in mind, in the above, the 'mi' element just uses RenderInline as it
has no special semantics as of yet.

In cases where specialized render objects (typically with display
inline-block) are used  (e.g. an operator), the assert fires:

<a href='#'>
  <math xmlns='http://www.w3.org/1998/Math/MathML'><mo>x</mo></math>

At this point, I don't think my code is directly causing the anchor to
get marked
with a child needing layout.  I do rely on RenderBlock::layout() within most
of the rendering objects to handle the actual layout after adjustments.

I've tried making sure that the parent or container schedule a re-layout but
that hasn't really helped.

You can see all these adjustments and optimizations in the patch for:


Any ideas of what to look at next would be appreciated.

--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