зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1433336 - Collect only documents which are observerd by IntersectionObserver in nsRefreshDriver::Tick(). r=smaug
We don't need to collect whole descendants documents. This patch intentionally leaves animation events handling which is another caller of CollectDocuments in nsRefreshDriver since the animation part will be fixed in a different way in bug 1415780. MozReview-Commit-ID: INAJm1NHLuI --HG-- extra : rebase_source : 4e255cef604d4455d6efa5dc2ebddd5dc649ee65
This commit is contained in:
Родитель
911b60cb08
Коммит
471558b3c1
|
@ -620,6 +620,10 @@ public:
|
||||||
virtual void UpdateIntersectionObservations() override;
|
virtual void UpdateIntersectionObservations() override;
|
||||||
virtual void ScheduleIntersectionObserverNotification() override;
|
virtual void ScheduleIntersectionObserverNotification() override;
|
||||||
virtual void NotifyIntersectionObservers() override;
|
virtual void NotifyIntersectionObservers() override;
|
||||||
|
virtual bool HasIntersectionObservers() const override
|
||||||
|
{
|
||||||
|
return !mIntersectionObservers.IsEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
virtual void NotifyLayerManagerRecreated() override;
|
virtual void NotifyLayerManagerRecreated() override;
|
||||||
|
|
||||||
|
|
|
@ -3120,6 +3120,7 @@ public:
|
||||||
virtual void UpdateIntersectionObservations() = 0;
|
virtual void UpdateIntersectionObservations() = 0;
|
||||||
virtual void ScheduleIntersectionObserverNotification() = 0;
|
virtual void ScheduleIntersectionObserverNotification() = 0;
|
||||||
virtual void NotifyIntersectionObservers() = 0;
|
virtual void NotifyIntersectionObservers() = 0;
|
||||||
|
virtual bool HasIntersectionObservers() const = 0;
|
||||||
|
|
||||||
// Dispatch a runnable related to the document.
|
// Dispatch a runnable related to the document.
|
||||||
virtual nsresult Dispatch(mozilla::TaskCategory aCategory,
|
virtual nsresult Dispatch(mozilla::TaskCategory aCategory,
|
||||||
|
|
|
@ -1587,6 +1587,28 @@ CollectDocuments(nsIDocument* aDocument, void* aDocArray)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsRefreshDriver::UpdateIntersectionObservations()
|
||||||
|
{
|
||||||
|
AutoTArray<nsCOMPtr<nsIDocument>, 32> documents;
|
||||||
|
|
||||||
|
if (mPresContext->Document()->HasIntersectionObservers()) {
|
||||||
|
documents.AppendElement(mPresContext->Document());
|
||||||
|
}
|
||||||
|
|
||||||
|
mPresContext->Document()->CollectDescendantDocuments(
|
||||||
|
documents,
|
||||||
|
[](const nsIDocument* document) -> bool {
|
||||||
|
return document->HasIntersectionObservers();
|
||||||
|
});
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < documents.Length(); ++i) {
|
||||||
|
nsIDocument* doc = documents[i];
|
||||||
|
doc->UpdateIntersectionObservations();
|
||||||
|
doc->ScheduleIntersectionObserverNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsRefreshDriver::DispatchAnimationEvents()
|
nsRefreshDriver::DispatchAnimationEvents()
|
||||||
{
|
{
|
||||||
|
@ -1955,13 +1977,7 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AutoTArray<nsCOMPtr<nsIDocument>, 32> documents;
|
UpdateIntersectionObservations();
|
||||||
CollectDocuments(mPresContext->Document(), &documents);
|
|
||||||
for (uint32_t i = 0; i < documents.Length(); ++i) {
|
|
||||||
nsIDocument* doc = documents[i];
|
|
||||||
doc->UpdateIntersectionObservations();
|
|
||||||
doc->ScheduleIntersectionObserverNotification();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Perform notification to imgIRequests subscribed to listen
|
* Perform notification to imgIRequests subscribed to listen
|
||||||
|
|
|
@ -385,6 +385,7 @@ private:
|
||||||
void DispatchPendingEvents();
|
void DispatchPendingEvents();
|
||||||
void DispatchAnimationEvents();
|
void DispatchAnimationEvents();
|
||||||
void RunFrameRequestCallbacks(mozilla::TimeStamp aNowTime);
|
void RunFrameRequestCallbacks(mozilla::TimeStamp aNowTime);
|
||||||
|
void UpdateIntersectionObservations();
|
||||||
void Tick(int64_t aNowEpoch, mozilla::TimeStamp aNowTime);
|
void Tick(int64_t aNowEpoch, mozilla::TimeStamp aNowTime);
|
||||||
|
|
||||||
enum EnsureTimerStartedFlags {
|
enum EnsureTimerStartedFlags {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче