Layout:IntersectionObserver

From MozillaWiki
Jump to: navigation, search

Lifetime (as in FF < 58)

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::UnlinkTarget for every observer in nsSlots::mRegisteredIntersectionObservers.

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 Property(nsGkAtoms::intersectionobserverlist).

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 Property(nsGkAtoms::intersectionobserverlist).

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

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

nsNodeUtils::LastRelease calls DOMIntersectionObserver::UnlinkElement for every observer in Property(nsGkAtoms::intersectionobserverlist).