[webkit-dev] RenderObject is-a boolean methods

Eric Seidel eric at webkit.org
Mon Jan 4 13:02:33 PST 2010


My understanding is that RenderObject::isRenderMathMLBlock() is the
right approach, yes.  Although if MathML base renderer (like
RenderBoxModelObject or RenderSVGModelObject), then an
isMathMLModelObject() would be even better.  Then you only add one
method to RenderObject and the rest can go on your base renderer.

Hyatt will likely have further thoughts.

-eric

On Mon, Jan 4, 2010 at 11:35 AM, Alex Milowski <alex at milowski.org> wrote:
> 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
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>


More information about the webkit-dev mailing list