mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 23:08:39 +09:00
parent
311d45691c
commit
42d9f2ffb3
8 changed files with 46 additions and 26 deletions
|
|
@ -1736,8 +1736,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
|
|||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOnDemandBuiltInUASheets)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPreloadingImages)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIntersectionObservers)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSubImportLinks)
|
||||
|
||||
for (uint32_t i = 0; i < tmp->mFrameRequestCallbacks.Length(); ++i) {
|
||||
|
|
@ -12375,15 +12373,15 @@ nsDocument::ReportUseCounters()
|
|||
void
|
||||
nsDocument::AddIntersectionObserver(DOMIntersectionObserver* aObserver)
|
||||
{
|
||||
NS_ASSERTION(mIntersectionObservers.IndexOf(aObserver) == nsTArray<int>::NoIndex,
|
||||
"Intersection observer already in the list");
|
||||
mIntersectionObservers.AppendElement(aObserver);
|
||||
MOZ_ASSERT(!mIntersectionObservers.Contains(aObserver),
|
||||
"Intersection observer already in the list");
|
||||
mIntersectionObservers.PutEntry(aObserver);
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::RemoveIntersectionObserver(DOMIntersectionObserver* aObserver)
|
||||
{
|
||||
mIntersectionObservers.RemoveElement(aObserver);
|
||||
mIntersectionObservers.RemoveEntry(aObserver);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -12396,7 +12394,8 @@ nsDocument::UpdateIntersectionObservations()
|
|||
time = perf->Now();
|
||||
}
|
||||
}
|
||||
for (const auto& observer : mIntersectionObservers) {
|
||||
for (auto iter = mIntersectionObservers.Iter(); !iter.Done(); iter.Next()) {
|
||||
DOMIntersectionObserver* observer = iter.Get()->GetKey();
|
||||
observer->Update(this, time);
|
||||
}
|
||||
}
|
||||
|
|
@ -12404,6 +12403,10 @@ nsDocument::UpdateIntersectionObservations()
|
|||
void
|
||||
nsDocument::ScheduleIntersectionObserverNotification()
|
||||
{
|
||||
if (mIntersectionObservers.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> notification = NewRunnableMethod(this,
|
||||
&nsDocument::NotifyIntersectionObservers);
|
||||
NS_DispatchToCurrentThread(notification);
|
||||
|
|
@ -12412,7 +12415,11 @@ nsDocument::ScheduleIntersectionObserverNotification()
|
|||
void
|
||||
nsDocument::NotifyIntersectionObservers()
|
||||
{
|
||||
nsTArray<RefPtr<DOMIntersectionObserver>> observers(mIntersectionObservers);
|
||||
nsTArray<RefPtr<DOMIntersectionObserver>> observers(mIntersectionObservers.Count());
|
||||
for (auto iter = mIntersectionObservers.Iter(); !iter.Done(); iter.Next()) {
|
||||
DOMIntersectionObserver* observer = iter.Get()->GetKey();
|
||||
observers.AppendElement(observer);
|
||||
}
|
||||
for (const auto& observer : observers) {
|
||||
observer->Notify();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue