Open Bug 1356519 Opened 8 years ago Updated 2 years ago

Retain clips and clip chain on frame tree

Categories

(Core :: Web Painting, enhancement, P5)

enhancement

Tracking

()

Tracking Status
firefox55 --- affected

People

(Reporter: sinker, Unassigned)

References

(Blocks 1 open bug)

Details

Clips and clip chains are recomputed and recreated every time building display list, but they are rarely/or usually minor changed. So, for most of time they are redundant. Retaining clip chains and clips would save time. For now, clip chains are maintained by |DisplayListClipState| owned by |DisplayListBuilder|. There are 4 use cases of clip chains. - Apply and get clips during the process of |BuildDisplayList()| & |BuildDisplayForChild()|. - Mark out-of-flow/or absolute frames during the process of |BuildDisplayList()|. - see Mark*ForDisplayList(). - Display items apply special clips - PresShell::ClipListToRange() - ClipItemsExceptCaret() in nsGfxScrollFrame - *Item::ApplyOpacity() - FuseClipChainUpTo() called by ProcessDisplayItems() |DisplayListClipState| is changed by following calls, - ClipContainingBlockDescendants(), - ClipContentDescendants(), - ClipContainingBlockDescendantsToContentBox(), and - ClearUpToASR() of DisplayListClipState(). They are called by |BuildDisplayListForChild()|, |BuildDisplayListForStackingContext()|, and |BuildDisplayList()| of frame types. The cliip chains are retrieved from |DisplayListClipState| through following calls, - nsDisplayItem::IntersectClip(), - DisplayListClipState::GetCurrentCombinedClipChain(), and - DisplayListClipState::GetClipChainForContainingBlockDescendants() with nsDisplayListBuilder::CopyWholeChain(). - nsDisplayItem::FuseClipChainUpTo() They are majorly called by nsFrame.cpp and nsDisplayList.cpp. IntersectClip() would be called by nsGfxScrollFrame and PresShell too. |FueClipChainUpTo()| is called by FrameLayerBuilder.cpp. All clip chains are allocated by |nsDisplayListBuilder::AllocateDisplayItemClipChain()|. With these information, we can retain clip chains and reuse them by frame keys and/or frame itself. Retained clip chains are invalidated every time the frame or one of its ancestor is restyled. (nsFrame::DidSetStyleContext()).
This bug would depend on ASR. We need a way to make them can be done separated. Or, assign two bugs to the same developer.
Priority: -- → P5
See Also: → 1713168
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.