12018-08-14 Ali Juma <ajuma@chromium.org>
2
3 [IntersectionObserver] Do not hold a strong reference to the root element
4 https://bugs.webkit.org/show_bug.cgi?id=188575
5
6 Reviewed by NOBODY (OOPS!).
7
8 Make IntersectionObserver have only a raw pointer to its root element rather than
9 a reference, so that an otherwise-unreachable root isn't kept alive. Add logic to
10 to clear this pointer when the root element gets deleted.
11
12 Test: intersection-observer/root-element-deleted.html
13
14 * dom/Element.cpp:
15 (WebCore::Element::~Element):
16 (WebCore::Element::disconnectFromIntersectionObservers):
17 (WebCore::Element::ensureIntersectionObserverData):
18 (WebCore::Element::intersectionObserverData):
19 * dom/Element.h:
20 * dom/ElementRareData.cpp:
21 * dom/ElementRareData.h:
22 (WebCore::ElementRareData::intersectionObserverData):
23 (WebCore::ElementRareData::setIntersectionObserverData):
24 * page/IntersectionObserver.cpp:
25 (WebCore::IntersectionObserver::create):
26 (WebCore::IntersectionObserver::IntersectionObserver):
27 (WebCore::IntersectionObserver::~IntersectionObserver):
28 (WebCore::IntersectionObserver::rootDestroyed):
29 * page/IntersectionObserver.h:
30 (WebCore::IntersectionObserver::root const):
31