DescriptionIntersectionObserver: use nullptr for implicit root.
If the observer is tracking intersections with the top-level frame
viewport (AKA the "implicit root"), it's not necessary to store a
pointer to the root node on the IntersectionObserver. Doing so
makes bookkeeping more difficult when DOM modifications happen.
It's also strictly incompatible with OOPIF.
Methods like mapToVisualRectInAncestorSpace and localToAbsolute already
set a precedent by allowing a nullptr "ancestor" argument to indicate
"map all the way to the top frame". Changing IntersectionObserver to
let nullptr signify the implict root keeps with this convention.
The new trackingDocument() method serves two purposes: it fixes a bug
where only IntersectionObservers registered on the top-level FrameView
run the observation steps (test added); and it is a necessary wart
until OOPIF support lands (https://codereview.chromium.org/2431473003).
Because IntersectionObserver::m_root is a weak pointer, we must track
explicitly whether the IO is tracking the implicit root, to distinguish
that from an IO whose root has been garbage collected; hence the
new m_rootIsImplicit field.
R=ojan@chromium.org,kenrb@chromium.org
BUG=
Committed: https://crrev.com/3520351e84d8d16b06d3f09a109f1296ec620c23
Cr-Commit-Position: refs/heads/master@{#438055}
Patch Set 1 #Patch Set 2 : rebase #Patch Set 3 : similarity=30 to detect renames #
Total comments: 16
Patch Set 4 : comments #
Total comments: 4
Patch Set 5 : Use 7 bits for m_initialState #Patch Set 6 : comments #Patch Set 7 : Delete unused rootLayoutObject method #Patch Set 8 : More bike-shedding over m_initialState #Patch Set 9 : rebase #Messages
Total messages: 30 (7 generated)
|