Gecko:Frame Destruction

From MozillaWiki
Jump to: navigation, search

Gecko frame destruction invariants

  • nsIFrame::RemoveFrame deletes a frame, all its descendants, and all their continuations
  • Before a placeholder frame is destroyed, its out-of-flow frame is removed. Sometimes the placeholder has a dangling reference to the out-of-flow, though!

To remove the frames for an element, we

  1. Find the primary frame P
  2. DeletingFrameSubtree: For all in-flow frames under P or its continuations, if the frame is a placeholder whose out-of-flow is not under the placeholder's P continuation ancestor, remove the mapping from the out-of-flow to the placeholder and remove the frame subtree via RemoveFrame. RemoveFrame breaks the mapping from placeholders to outOfFlows for floats, but not for abs-pos frames.
  3. RemoveFrame implementations usually start by removing the next continuation if there is one via DeleteNextInFlowChild, and then removing the frame and calling Destroy on it, which recursively destroys children.
  4. nsBlockFrame::RemoveFrame for in-flow frames finds the first frame to remove in the line list, then removes the frames in flow order.