Open Bug 1223753 Opened 9 years ago Updated 1 year ago

Implement basic visibility tracking for -moz-element

Categories

(Core :: Layout: Images, Video, and HTML Frames, defect)

defect

Tracking

()

People

(Reporter: seth, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 4 obsolete files)

Right now frame visibility doesn't take -moz-element into account, but it's not that hard. We can do so by having nsSVGIDRenderingObserver mark the subtree of the primary frame of the element it's observer visible. (Until it stops observing that element, in which case it can decrement the visible counts of the frames in the subtree.)

Right now the frame walking is extremely simple and doesn't cross into subdocuments or try to do anything clever about scrollframes. We can extend this further in followups; I just want to get the basic, common cases working first.
Here's the patch.
Attachment #8685974 - Flags: review?(tnikkel)
OK, this needed to be reworked, because the frames associated with a content
node are not necessarily available at the time that nsSVGIDRenderingObserver
starts observing it. To make this work, I've instead added a list of content
nodes to the pres shell. If a content node is in the list, every frame in its
subtree is considered visible. We can then rely on the normal frame visibility
update mechanism to the keep the frame visibility list correct.

What's really nice is that this eliminates the limitations of the previous
approach, because we're reusing the existing frame walker. For example, we now
traverse subdocuments correctly.
Attachment #8686379 - Flags: review?(tnikkel)
Attachment #8685974 - Attachment is obsolete: true
Attachment #8685974 - Flags: review?(tnikkel)
This patch actually implements visibility tracking that "sees through"
nsSVGIDRenderingObserver, and therefore through -moz-element. The idea is the
same as in the previous version of the patch, but now we make use of
Increment/DecrementVisibleCountOfContentSubtree().
Attachment #8686380 - Flags: review?(tnikkel)
OK, so investigation of the failing test above made me realize that there is a
simpler and better way to implement this. Rather than forcing all frames in a
subtree to be visible, just call MarkFramesInSubtreeVisible() and pass the
visual overflow rect of the primary frame of the content we care about. The old
version of the patch was buggy, and this should fix that, but even better, it
means that for e.g. scrollframes we will only mark visible the frames that are
actually visible through the scrollframe, and not every single frame that may be
scrolled way out of view.

It also makes the patch even shorter and simpler, which is nice. =)
Attachment #8686744 - Flags: review?(tnikkel)
Attachment #8686379 - Attachment is obsolete: true
Attachment #8686379 - Flags: review?(tnikkel)
Alright, moving the list of content nodes that we're forcing to be visible to the document turned out to be the trick. The pres shell doesn't have the right lifetime; the same document can have many pres shells over time.

The try job above is green. I'll upload the final version of the patches now.
This updated version of part one, as implied by the comment above, has one major
change: the list of content nodes that we're forcing to be considered visible
has moved to nsIDocument/nsDocument. That gives the list the same lifetime as
the content nodes themselves (unless the content is removed from the document,
of course, but we handle that in part 2 in the ElementChanged() callback). With
this change, these patches are now green on try.

I've made a couple of cosmetic changes as well, adding more comments and
renaming the methods to (hopefully) clarify what they do a bit more.
Attachment #8687037 - Flags: review?(tnikkel)
Attachment #8686744 - Attachment is obsolete: true
Attachment #8686744 - Flags: review?(tnikkel)
This version of part 2 is basically just rebased against the updated version of
part 1; the idea remains the same.
Attachment #8687038 - Flags: review?(tnikkel)
Attachment #8686380 - Attachment is obsolete: true
Attachment #8686380 - Flags: review?(tnikkel)
See Also: → 1242256
Attachment #8687038 - Flags: review?(tnikkel)
Attachment #8687037 - Flags: review?(tnikkel)
Product: Core → Core Graveyard
Product: Core Graveyard → Core

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
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: