Layout:IntersectionObserver: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Created page with "<big>'''Linking steps:'''</big> ''DOMIntersectionObserver::observe(Element& aTarget)'' adds ''aTarget'' to ''DOMIntersectionObserver::mObservationTargets'' and calls ''Elemen...")
 
(Add lifetime diagram image)
Line 1: Line 1:
<big><big>'''Lifetime'''</big></big>
[[File:Intersection observer lifetime.png|thumbnail]]
<big>'''Linking steps:'''</big>
<big>'''Linking steps:'''</big>



Revision as of 17:41, 25 October 2017

Lifetime

Intersection observer lifetime.png

Linking steps:

DOMIntersectionObserver::observe(Element& aTarget) adds aTarget to DOMIntersectionObserver::mObservationTargets and calls Element::RegisterIntersectionObsever on aTarget. If aTarget is the first item in DOMIntersectionObserver::mObservationTargets, nsDocument::AddIntersectionObserver is called and the observer gets added to nsDocument::mIntersectionObservers.

Element::RegisterIntersectionObserver(DOMIntersectionObserver* aObserver) adds aObserver to mSlots::mRegisteredIntersectionObservers.

Unlinking steps:

DOMIntersectionObserver::unobserve(Element& aTarget) removes aTarget from DOMIntersectionObserver::mObservationTargets and calls Element::UnregisterIntersectionObsever on aTarget. If aTarget is the last item in DOMIntersectionObserver::mObservationTargets, nsDocument::RemoveIntersectionObserver is called and the observer gets removed from nsDocument::mIntersectionObservers.

DOMIntersectionObserver::Disconnect() calls Element::UnregisterIntersectionObsever for every item in DOMIntersectionObserver::mObservationTargets.

Element::UnregisterIntersectionObserver(DOMIntersectionObserver* aObserver) removes aObserver from mSlots::mRegisteredIntersectionObservers.

DOMIntersectionObserver::~DOMIntersectionObserver calls DOMIntersectionObserver::Disconnect().

DOMIntersectionObserver::Unlink calls DOMIntersectionObserver::Disconnect().

nsNodeUtils::LastRelease calls DOMIntersectionObserver::UnlinkTarget for every observer in nsSlots::mRegisteredIntersectionObservers.

nsDomSlots::Unlink calls DOMIntersectionObserver::z for every observer in nsSlots::mRegisteredIntersectionObservers.