[webkit-dev] Troubles with Anonymous Blocks

Alex Milowski alex at milowski.org
Mon Feb 8 13:28:32 PST 2010

I've been struggling with odd issues with anonymous blocks that I don't quite
understand.  For example, to build a fraction in MathML I wrap the numerator
and denominator in an anonymous block:

       RenderBlock* row = new (renderArena()) RenderBlock(document());

I then set border, padding, and text-align style properties on the style for
that anonymous block.  These settings seem to have stopped working
in the latest round of work.

If I change the construction of the row wrapper to:

       RenderBlock* row = new (renderArena()) RenderBlock(node());

which is backed by the 'mfrac' element, all the border/etc. style properties

When I trace through with the debugger, the border properties seem to
disappear from the style object when the node is the document node
and the block is anonymous.

Any ideas on what is happening?

I see that there is little code that uses an anonymous blocks directly
as I do.  Is there are a preferred way to do this?

My intended design for fractions was:

1. The mfrac is a inline-block with block flows for its children

2. The numerator and denominator are blocks that stack vertically.

3. The denominator has a border property for the fraction line

4. These wrapper blocks for the numerator and denominator can
    have arbitrarily complicated flows of their own.

Currently, if I use the second construct above and use node() as
the backing node for the block wrappers for the numerator and
denominator, it almost works.  There seem to be situations where
the border is drawn short of the overall width--which is a another
problem I'm struggling with but may be unrelated to this issue.

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