RenderObject::canvas micro optimization

Leo Savernik l.savernik at aon.at
Sun May 9 23:17:02 CEST 2004


Hello,

RenderObject::canvas is defined as follows (pseudo-code):

RenderObject o = this;
while (o->parent()) o = o->parent();
return static_cast<RenderCanvas *>(o);

which is O(depth of tree)

However, Safari determines the canvas in some places with
RenderCanvas *r = static_cast<RenderCanvas *>(this->document()->renderer())

which is O(1).

Shouldn't this code become RenderObject::canvas' new implementation so that 
all callers of RenderObject::canvas can take advantage of it?

mfg
	Leo


More information about the Khtml-devel mailing list