[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    khtml changes for faster dhtml support
From:       Lars Knoll <lars () trolltech ! com>
Date:       2001-12-29 22:46:25
[Download RAW message or body]

Hi,

I submitted some bigger changes to the way dhtml is done in khtml today.
The main reason for this was the very poor performance of the old solution
(which was basically a "redo everything" type of solution). The code tries
to be a bit more intelligent now.

As I leave for one week of holidays now (and will thus be unavailable), I
thought I better write a mail about what I've done, as I expect some
regressions due to the changes.

What we do is to look at a change, and determine if (and how much) the
RenderStyle object for a Node has changed. If it is unchanged, we do
nothing. If only non inherited properties have changed, there is no need
to recalculate style objects of child Nodes, and only in the third case
where some inherited property has changed the style object for child nodes
is recalculated.

I removed the list of changed nodes in the document, and keep a track from
the document to all changed nodes by using a hasChangedChild flag in the
NodeImpl object. This has the advantage, that new styles always get
reapplied from the outermost element, saving double calculations in some
cases.

I completely removed the applyChanges(...) methods, and replaced them by a
recalcStyle( StyleChange ) method to be able to keep track of what has
changed.

I started adding improvements to the rendering tree aswell (only doing
relayouts when really needed), but this is more work in progress, and I
will continue/finish this work when I am back from holidays. For those
interested:

I'm trying to figure out the work that needs to be done by comparing old
and new RenderStyle object, and figuring out if we don't need to do
anything, need a repaint (of this object or the containing block) or a
relayout (again of this object or the containing block). The method to
determine this is RenderStyle::diff. RenderObject::setStyle() can then use
this information to determine the amount of work that needs to be done.

I implemented the first little steps in this direction, but there is lot
of work that still needs to be done. But already now the speed improvement
for some dhtml changes is huge (as eg. setting the background color on the
body of a large document).

Have fun,
Lars


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic