Layout:IntersectionObserver: Difference between revisions
Tschneider (talk | contribs) (Add lifetime diagram image) |
Tschneider (talk | contribs) (Fix typo) |
||
| Line 1: | Line 1: | ||
<big><big>'''Lifetime'''</big></big> | <big><big>'''Lifetime (as in FF < 58)'''</big></big> | ||
[[File:Intersection observer lifetime.png|thumbnail]] | [[File:Intersection observer lifetime.png|thumbnail]] | ||
| Line 24: | Line 24: | ||
''nsSlots::mRegisteredIntersectionObservers''. | ''nsSlots::mRegisteredIntersectionObservers''. | ||
''nsDomSlots::Unlink'' calls ''DOMIntersectionObserver:: | ''nsDomSlots::Unlink'' calls ''DOMIntersectionObserver::UnlinkTarget'' for every observer in | ||
''nsSlots::mRegisteredIntersectionObservers''. | ''nsSlots::mRegisteredIntersectionObservers''. | ||
Revision as of 17:49, 25 October 2017
Lifetime (as in FF < 58)
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::UnlinkTarget for every observer in nsSlots::mRegisteredIntersectionObservers.