On 19/09/09 2:39 PM, Boris Zbarsky wrote:
On 9/18/09 5:17 PM, Robert O'Callahan wrote:
One question: when an element is removed from the document, should we
remove the element from mPendingRestyles immediately? Right now it looks
like the element is kept alive until we next process restyles, which
could cause an arbitrary amount of memory overhead.
I think we should do that, yes. That won't help if the element's
_parent_ is removed, but it should help the common "bounce an element in
and out of the DOM" case.
The "restyle by traversing the DOM tree" approach would completely solve
this problem.
Another question: does mPendingRestyles have any advantages over the
Webkit approach?
This is a really really good question. ;) I don't know. They have very
different pathological behaviors. I would not be averse to trying the
webkit approach, in general, and seeing what things look like.
Right now it seems to me the only disadvantage of traversing the DOM
tree is that you have to examine every child of an element that has only
a small number of children that need restyling. But generally speaking
when we reflow or repaint we will examine all those children's frames
anyway, so avoiding looking at those child nodes doesn't seem like a
major win.
And I guess it wouldn't work with the way we currently do
native anonymous content. But does it matter?
I suspect no; we shouldn't really be directly restyling native anon
content, I would think... That's not to say someone like editor doesn't
do it, of course.
A text input's anonymous DIV can be restyled. So can generated content.
But I think it would be very reasonable to provide a way to access the
native anonymous children of a node (perhaps via an extension of
ChildIterator).
Currently we walk mPendingRestyles and copy the elements into a list.
While we're doing that, we could populate an auxiliary hashtable that
maps an element to a set of its children which may need frame creation.
Sorted in content order or something?
No, I was thinking of deferring sorting until we actually perform the
restyling.
But I think I like the idea of flags in the DOM tree much better.
Rob
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout