nsDisplayClip is a pain. We can simplify our code and probably improve performance (see bug 579260) by storing clip objects on each nsDisplayItem which contain the complete clip for that display item. We already do this in FrameLayerBuilder when we paint, so we should just move that earlier in the pipeline. We can keep this simple and minimize space overhead by keeping a stack of clip objects in the nsDisplayListBuilder. When we push a new clip object, the clip object would be allocated in the display list arena, so each nsDisplayItem* only needs a pointer to the clip object. We can set up the clip objects in the ComputeVisibility pass. So we'll still have nsDisplayClip during display list construction, to set up clipping, but during ComputeVisibilty they will all be eliminated.
Actually we should avoid constructing nsDisplayClip(RoundedRect) items completely by just updating the clip on the item in the implementations of WrapItem.
2 years ago