Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1397)

Issue 2553343004: IntersectionObserver: use nullptr for implicit root. (Closed)

Created:
4 years ago by szager1
Modified:
4 years ago
Reviewers:
kenrb, skobes, ojan
CC:
chromium-reviews, sof, eae+blinkwatch, blink-reviews-dom_chromium.org, dglazkov+blink, blink-reviews, rwlbuis
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

IntersectionObserver: 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+196 lines, -231 lines) Patch
A third_party/WebKit/LayoutTests/intersection-observer/observer-in-iframe.html View 1 chunk +2 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/resources/intersection-observer-in-iframe.html View 1 chunk +49 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/BUILD.gn View 1 2 3 4 5 6 7 8 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Document.h View 1 3 chunks +0 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Document.cpp View 1 2 3 4 5 6 7 8 3 chunks +0 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Element.h View 2 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Element.cpp View 1 3 chunks +3 lines, -3 lines 0 comments Download
A + third_party/WebKit/Source/core/dom/ElementIntersectionObserverData.h View 3 chunks +8 lines, -6 lines 0 comments Download
A + third_party/WebKit/Source/core/dom/ElementIntersectionObserverData.cpp View 1 2 3 chunks +29 lines, -13 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ElementRareData.h View 3 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/dom/IntersectionObservation.cpp View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/dom/IntersectionObserver.h View 1 2 3 4 5 6 7 4 chunks +30 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/core/dom/IntersectionObserver.cpp View 1 2 3 4 5 6 10 chunks +61 lines, -69 lines 0 comments Download
M third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp View 1 2 3 4 5 6 7 8 2 chunks +2 lines, -1 line 0 comments Download
D third_party/WebKit/Source/core/dom/NodeIntersectionObserverData.h View 1 chunk +0 lines, -44 lines 0 comments Download
D third_party/WebKit/Source/core/dom/NodeIntersectionObserverData.cpp View 1 chunk +0 lines, -62 lines 0 comments Download

Messages

Total messages: 30 (7 generated)
szager1
4 years ago (2016-12-07 01:57:00 UTC) #1
szager1
+skobes
4 years ago (2016-12-07 23:02:47 UTC) #4
skobes
https://codereview.chromium.org/2553343004/diff/40001/third_party/WebKit/Source/core/dom/IntersectionObserver.h File third_party/WebKit/Source/core/dom/IntersectionObserver.h (right): https://codereview.chromium.org/2553343004/diff/40001/third_party/WebKit/Source/core/dom/IntersectionObserver.h#newcode66 third_party/WebKit/Source/core/dom/IntersectionObserver.h:66: bool rootIsImplicit() const { return m_rootIsImplicit; } Add comments ...
4 years ago (2016-12-08 01:08:56 UTC) #5
szager1
https://codereview.chromium.org/2553343004/diff/40001/third_party/WebKit/Source/core/dom/IntersectionObserver.h File third_party/WebKit/Source/core/dom/IntersectionObserver.h (right): https://codereview.chromium.org/2553343004/diff/40001/third_party/WebKit/Source/core/dom/IntersectionObserver.h#newcode66 third_party/WebKit/Source/core/dom/IntersectionObserver.h:66: bool rootIsImplicit() const { return m_rootIsImplicit; } On 2016/12/08 ...
4 years ago (2016-12-08 19:39:59 UTC) #6
skobes
https://codereview.chromium.org/2553343004/diff/40001/third_party/WebKit/Source/core/dom/IntersectionObserver.h File third_party/WebKit/Source/core/dom/IntersectionObserver.h (right): https://codereview.chromium.org/2553343004/diff/40001/third_party/WebKit/Source/core/dom/IntersectionObserver.h#newcode103 third_party/WebKit/Source/core/dom/IntersectionObserver.h:103: WeakMember<Element> m_root; On 2016/12/08 19:39:58, szager1 wrote: > On ...
4 years ago (2016-12-08 20:02:43 UTC) #7
szager1
https://codereview.chromium.org/2553343004/diff/40001/third_party/WebKit/Source/core/dom/IntersectionObserver.h File third_party/WebKit/Source/core/dom/IntersectionObserver.h (right): https://codereview.chromium.org/2553343004/diff/40001/third_party/WebKit/Source/core/dom/IntersectionObserver.h#newcode103 third_party/WebKit/Source/core/dom/IntersectionObserver.h:103: WeakMember<Element> m_root; On 2016/12/08 20:02:43, skobes wrote: > On ...
4 years ago (2016-12-08 20:12:11 UTC) #8
skobes
https://codereview.chromium.org/2553343004/diff/40001/third_party/WebKit/Source/core/dom/IntersectionObserver.h File third_party/WebKit/Source/core/dom/IntersectionObserver.h (right): https://codereview.chromium.org/2553343004/diff/40001/third_party/WebKit/Source/core/dom/IntersectionObserver.h#newcode112 third_party/WebKit/Source/core/dom/IntersectionObserver.h:112: unsigned m_initialState : 1; On 2016/12/08 20:12:11, szager1 wrote: ...
4 years ago (2016-12-08 21:12:21 UTC) #9
szager1
https://codereview.chromium.org/2553343004/diff/40001/third_party/WebKit/Source/core/dom/IntersectionObserver.h File third_party/WebKit/Source/core/dom/IntersectionObserver.h (right): https://codereview.chromium.org/2553343004/diff/40001/third_party/WebKit/Source/core/dom/IntersectionObserver.h#newcode112 third_party/WebKit/Source/core/dom/IntersectionObserver.h:112: unsigned m_initialState : 1; On 2016/12/08 21:12:21, skobes wrote: ...
4 years ago (2016-12-08 21:30:58 UTC) #10
skobes
On 2016/12/08 21:30:58, szager1 wrote: > https://codereview.chromium.org/2553343004/diff/40001/third_party/WebKit/Source/core/dom/IntersectionObserver.h > File third_party/WebKit/Source/core/dom/IntersectionObserver.h (right): > > https://codereview.chromium.org/2553343004/diff/40001/third_party/WebKit/Source/core/dom/IntersectionObserver.h#newcode112 > ...
4 years ago (2016-12-08 21:59:22 UTC) #11
szager1
On 2016/12/08 21:59:22, skobes wrote: > On 2016/12/08 21:30:58, szager1 wrote: > > > https://codereview.chromium.org/2553343004/diff/40001/third_party/WebKit/Source/core/dom/IntersectionObserver.h ...
4 years ago (2016-12-08 22:10:25 UTC) #12
skobes
On 2016/12/08 22:10:25, szager1 wrote: > On 2016/12/08 21:59:22, skobes wrote: > > On 2016/12/08 ...
4 years ago (2016-12-09 01:44:29 UTC) #13
kenrb
https://codereview.chromium.org/2553343004/diff/60001/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp File third_party/WebKit/Source/core/dom/IntersectionObservation.cpp (right): https://codereview.chromium.org/2553343004/diff/60001/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp#newcode31 third_party/WebKit/Source/core/dom/IntersectionObservation.cpp:31: m_shouldReportRootBounds); There is something I don't quite understand here. ...
4 years ago (2016-12-09 21:01:43 UTC) #14
szager1
On 2016/12/09 01:44:29, skobes wrote: > On 2016/12/08 22:10:25, szager1 wrote: > > On 2016/12/08 ...
4 years ago (2016-12-09 21:04:01 UTC) #15
skobes
On 2016/12/09 21:04:01, szager1 wrote: > unsigned m_initialState : 7; I can live with it, ...
4 years ago (2016-12-09 22:22:20 UTC) #16
szager1
On 2016/12/09 22:22:20, skobes wrote: > On 2016/12/09 21:04:01, szager1 wrote: > > unsigned m_initialState ...
4 years ago (2016-12-10 01:50:07 UTC) #17
skobes
lgtm once kenrb's concern is addressed
4 years ago (2016-12-10 02:03:14 UTC) #18
szager1
https://codereview.chromium.org/2553343004/diff/60001/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp File third_party/WebKit/Source/core/dom/IntersectionObservation.cpp (right): https://codereview.chromium.org/2553343004/diff/60001/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp#newcode31 third_party/WebKit/Source/core/dom/IntersectionObservation.cpp:31: m_shouldReportRootBounds); On 2016/12/09 21:01:43, kenrb wrote: > There is ...
4 years ago (2016-12-10 20:51:18 UTC) #19
kenrb
Thanks, lgtm. I'll update the OOPIF IntersectionObserver CL as soon as this lands.
4 years ago (2016-12-11 02:59:42 UTC) #20
Z_DONOTUSE
On 2016/12/09 at 22:22:20, skobes wrote: > On 2016/12/09 21:04:01, szager1 wrote: > > unsigned ...
4 years ago (2016-12-11 03:15:15 UTC) #21
szager1
On 2016/12/11 03:15:15, Z_DONOTUSE wrote: > On 2016/12/09 at 22:22:20, skobes wrote: > > On ...
4 years ago (2016-12-11 08:45:21 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2553343004/160001
4 years ago (2016-12-13 00:37:04 UTC) #25
commit-bot: I haz the power
Committed patchset #9 (id:160001)
4 years ago (2016-12-13 04:18:04 UTC) #28
commit-bot: I haz the power
4 years ago (2016-12-13 04:21:10 UTC) #30
Message was sent while issue was closed.
Patchset 9 (id:??) landed as
https://crrev.com/3520351e84d8d16b06d3f09a109f1296ec620c23
Cr-Commit-Position: refs/heads/master@{#438055}

Powered by Google App Engine
This is Rietveld 408576698