[webkit-dev] RenderObject is-a boolean methods

Alex Milowski alex at milowski.org
Mon Jan 4 11:35:40 PST 2010


There are a number of "isSomething" methods used by different parts of
the rendering tree code to determine the type of a render object.  To add
something similar for MathML, I'll need to add my own methods here.

I've chosen to add a single method:

    virtual bool isRenderMathMLBlock() const { return false; }

and then add my own isRenderMathML{whatever} to my own class
named RenderMathMLBlock so that I don't need to keep touching
the RenderObject class.

Does that sound like the right approach or is there some other preferred
design pattern floating around out there?

I suppose these boolean methods are possibly faster than some kind
of extensible type coding system but it does seem like it drives endless
changes to these typing methods.  Of course, there aren't that many
new rendering objects introduced and so those changes can be kept
to a minimum.   ...just a thought.

-- 
--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
considered."

Bertrand Russell in a footnote of Principles of Mathematics


More information about the webkit-dev mailing list