The Invalidation Problem
Gecko:Invalidation_Handling describes some rules about what should be invalidated, and when. This page is about a separate problem: *how* to implement invalidation, when views have been removed.
- Invalidation must be fast, because we sometimes invalidate a lot.
- We'd like to accumulate invalidation in regions, not just take the bounding rect of everything.
- We need to handle cases like foreignObject where the area to be invalidated must be transformed in interesting ways.
- nsIFrame::Invalidate calls nsIFrame::InvalidateInternal, which is virtual
- the standard nsIFrame implementation just computes the offset from this frame to its parent, adds it to rect (or region/offset pair), and calls its parent
- nsHTML/XULScrollFrame::InvalidateInternal clips the invalidation before they pass it up
- nsSVGForeignObjectFrame transforms the invalidation and pass it through the SVG invalidation mechanism
- Invalidation goes all the way up to the root frame of the root document, where we invalidate widgets. Eventually there will only be one top-level widget to invalidate.
That's nice and simple, and it doesn't seem to be a problem for performance at the moment, with invalidation batching in place.