[webkit-dev] Handling Ignorable Text in a Renderer

Alex Milowski alex at milowski.org
Wed Aug 26 13:19:02 PDT 2009

On Wed, Aug 26, 2009 at 12:06 PM, Alex Milowski<alex at milowski.org> wrote:
> In certain MathML constructs (e.g. mfenced) there are a number of child
> elements that make up the construct and need to be rendered.  Any text
> between those child elements should be ignored.  In fact, non-whitespace
> text in the wrong place is most certainly incorrect but something
> that can be recovered from.
> I don't want to remove the text from the DOM nodes but I need to
> keep the RenderText instances from being created or displayed.  What
> is the correct way to do this?
> I've been trying to handle this in the renderer but it seems like that
> is really too late.  I though about changing the attach method to exclude
> such ignorable text.

Here's what works but it feels like a hack:

		RenderBlock* none = new (renderArena()) RenderBlock(document());
		RefPtr<RenderStyle> newStyle = RenderStyle::create();
		RenderBlock::addChild(none, beforeChild);

I basically create an inline block with zero width and height and then
set the overflow to hidden.

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