I was just thinking... would it make sense to somehow flag content nodes that do not yet have a frame? Basically, we could have a bit that starts off 0, gets set to 1 when the content node gets a frame, and stays 1 thereafter (even if the frame goes away). The goal here is to minimize the amount of time required by GetPrimaryFrameFor calls on content that's in the process of being inserted into the DOM (at parse time). I bet Text nodes don't have any extra space for this, but Element nodes should have something sitting about that could hold this info....
Alternately, we could even have a pointer to the primary frame in presshell 0 on Element nodes (if we are willing to pay the memory cost). The pointer could be easily maintained from layout and used by GPFF to optimize itself:
if (content->GetFrame() && content->GetFrame()->PresContext() == mPresShell->PresContext()){ return content->GetFrame(); }
Or even just used by the Element nodes to avoid calling GPFF (since they always call it on PresShell 0).
Thoughts?
I think we'd need strong proof of a frame pointer in content nodes being worht the cost, but a bit for this we can afford. We've got mFlagsOrSlots in nsGenericElement, we can shave a bit off of GENERIC_ELEMENT_CONTENT_ID_MASK and use that for knowing if there might be a frame for this element or not. Does this matter much for XUL? If it does, I'm sure we can use a bit out of mBindingParent or somesuch...
-- jst _______________________________________________ mozilla-layout mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-layout
