Open Bug 1259278 Opened 10 years ago Updated 1 year ago

Implement precise visibility tracking using the same display lists that we paint with

Categories

(Core :: Layout, task)

task

Tracking

()

REOPENED

People

(Reporter: seth, Unassigned)

References

Details

Attachments

(6 files)

Especially given that we only update approximate visibility at most once per second, we need to combine approximate visibility tracking with precise visibility tracking. We need both, because approximate visibility tracking is used for predictive image decoding and tracks an area which is larger than the viewport or displayport (this is why it is approximate), but the low sample rate for it makes it poorly suited for many things that we'd want to use visibility tracking for. Here's the initial plan: (1) Add a second frame visibility counter (stored in the same frame property; we should still be able to avoid allocation by being smart about the number of bits we use). This counter will be used for precise visibility. (2) Add a second set to the pres shell for precisely visible frames. (3) When we construct a display list for painting, increment the precise visibility count for frames in the display list, and decrement for frames that are no longer visible, using the same algorithm we use for approximate visibility. Note that display lists constructed for other purposes (e.g. canvas.drawWindow()) should not be factored in, and we should also probably ignore display lists intended for painting the low-resolution displayport we use when scrolling quickly. (4) Add a new Visibility::VISIBLE enum value, and rename Visibility::APPROXIMATELY_NONVISIBLE to Visibility::NONVISIBLE. (5) nsIFrame::GetVisibility() should return Visibility::VISIBLE if the precise visibility counter for the frame is greater than 0, else Visibility::APPROXIMATELY_VISIBLE if the approximate visibility counter is greater than 0, else Visibility::NONVISIBLE. (6) Update the other visibility-related methods to be precise visibility-aware. (7) Remove now-unnecessary code. One obvious candidate is nsIFrame::UpdateVisibilitySynchronously() and all callers. (8) Update the visibility visualization to paint precisely-visible regions a different color from approximately-visible regions. (Which requires sending them over to the compositor thread separately.) These changes shouldn't be that complex, and they should make the visibility API much more useful. CC'ing some folks familiar with this code.
Most of the patches are rebased versions of patches from bugs 1270389, 1272554 and 1270394 to keep them updated in a single bug.
Attachment #8783676 - Attachment description: Part 1 → Part 1: Add Visibility::IN_VIEWPORT to the frame visibility API
Attachment #8783677 - Attachment description: Part 2 → Part 2: Cache the current scroll parent and scrollports/displayports information
Attachment #8783678 - Attachment description: Part 3 → Part 3: Only consider a frame IN_DISPLAYPORT if it's within the critical displayport
Attachment #8783680 - Attachment description: Part 5 → Part 5: Add lambda versions of nsIDocument::EnumerateSubDocuments()
Attachment #8783681 - Attachment description: Part 6 → Part 6: Replace remove-only approximate visibility updates with just dropping everything outside of the viewport
Attachment #8783679 - Attachment description: Part 4 → Part 4: Fix switch block compiling errors on Android

The bug assignee didn't login in Bugzilla in the last 7 months, so the assignee is being reset.

Assignee: seth.bugzilla → nobody
Severity: normal → S3

No activity for years, closing. please reopen if you plan to finish it

Status: NEW → RESOLVED
Type: defect → task
Closed: 1 year ago
Resolution: --- → INACTIVE
Status: RESOLVED → REOPENED
Resolution: INACTIVE → ---
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: