зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 63cafb0c2f0f (bug 1315837) for causing bug 1317415.
This commit is contained in:
Родитель
4a0456c98e
Коммит
12eaf5ca37
|
@ -159,23 +159,15 @@ DOMIntersectionObserver::Observe(Element& aTarget)
|
|||
void
|
||||
DOMIntersectionObserver::Unobserve(Element& aTarget)
|
||||
{
|
||||
if (UnlinkTarget(aTarget)) {
|
||||
aTarget.UnregisterIntersectionObserver(this);
|
||||
if (!mObservationTargets.Contains(&aTarget)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
DOMIntersectionObserver::UnlinkTarget(Element& aTarget)
|
||||
{
|
||||
if (!mObservationTargets.Contains(&aTarget)) {
|
||||
return false;
|
||||
}
|
||||
if (mObservationTargets.Count() == 1) {
|
||||
Disconnect();
|
||||
return false;
|
||||
}
|
||||
mObservationTargets.RemoveEntry(&aTarget);
|
||||
return true;
|
||||
if (mObservationTargets.Count() == 1) {
|
||||
Disconnect();
|
||||
return;
|
||||
}
|
||||
aTarget.UnregisterIntersectionObserver(this);
|
||||
mObservationTargets.RemoveEntry(&aTarget);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -200,10 +192,8 @@ DOMIntersectionObserver::Disconnect()
|
|||
target->UnregisterIntersectionObserver(this);
|
||||
}
|
||||
mObservationTargets.Clear();
|
||||
if (mOwner) {
|
||||
nsIDocument* document = mOwner->GetExtantDoc();
|
||||
document->RemoveIntersectionObserver(this);
|
||||
}
|
||||
nsIDocument* document = mOwner->GetExtantDoc();
|
||||
document->RemoveIntersectionObserver(this);
|
||||
mConnected = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -142,9 +142,7 @@ public:
|
|||
void Observe(Element& aTarget);
|
||||
void Unobserve(Element& aTarget);
|
||||
|
||||
bool UnlinkTarget(Element& aTarget);
|
||||
void Disconnect();
|
||||
|
||||
void TakeRecords(nsTArray<RefPtr<DOMIntersectionObserverEntry>>& aRetVal);
|
||||
|
||||
mozilla::dom::IntersectionCallback* IntersectionCallback() { return mCallback; }
|
||||
|
|
|
@ -297,15 +297,6 @@ nsNodeUtils::LastRelease(nsINode* aNode)
|
|||
NodeWillBeDestroyed, (aNode));
|
||||
}
|
||||
|
||||
if (aNode->IsElement()) {
|
||||
Element* elem = aNode->AsElement();
|
||||
FragmentOrElement::nsDOMSlots* domSlots =
|
||||
static_cast<FragmentOrElement::nsDOMSlots*>(slots);
|
||||
for (auto& reg : domSlots->mRegisteredIntersectionObservers) {
|
||||
reg.observer->UnlinkTarget(*elem);
|
||||
}
|
||||
}
|
||||
|
||||
delete slots;
|
||||
aNode->mSlots = nullptr;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче