WebKit Bugzilla
Attachment 370992 Details for
Bug 198382
: REGRESSION (r245396): Page load time performance regression
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198382-20190530192938.patch (text/plain), 4.93 KB, created by
Ali Juma
on 2019-05-30 16:29:39 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Ali Juma
Created:
2019-05-30 16:29:39 PDT
Size:
4.93 KB
patch
obsolete
>Subversion Revision: 245569 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 48edb2b1c23095081c423b679d51a45fb19f1dc9..ac6bbdd0819d7c136bac129bcd108dcebe90f2ff 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,26 @@ >+2019-05-30 Ali Juma <ajuma@chromium.org> >+ >+ REGRESSION (r245396): Page load time performance regression >+ https://bugs.webkit.org/show_bug.cgi?id=198382 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Delay the scheduling of a rendering update by 500ms when a new >+ IntersectionObserver target is added during page load. This addresses >+ a page load time regression from r245396, which immediately scheduled a >+ rendering update when a target is added. Note that even with this change, >+ if anything else triggers a rendering update before the 500ms delay expires, >+ intersection observations will be updated during that rendering update. >+ >+ Covered by intersection-observer/initial-observation.html >+ >+ * dom/Document.cpp: >+ (WebCore::Document::updateIntersectionObservations): >+ (WebCore::Document::scheduleInitialIntersectionObservationUpdate): >+ * dom/Document.h: >+ * page/IntersectionObserver.cpp: >+ (WebCore::IntersectionObserver::observe): >+ > 2019-05-21 Antti Koivisto <antti@apple.com> > > RTL/overflow scroll tests fail with async overflow enabled >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index 92605852d261272f53fbd52638f111cabd9c64c6..f2e36630f7930bad6debefb1f060258127f0122c 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -331,6 +331,10 @@ static const unsigned cMaxWriteRecursionDepth = 21; > bool Document::hasEverCreatedAnAXObjectCache = false; > static const Seconds maxIntervalForUserGestureForwardingAfterMediaFinishesPlaying { 1_s }; > >+#if ENABLE(INTERSECTION_OBSERVER) >+static const Seconds intersectionObserversInitialUpdateDelay { 500_ms }; >+#endif >+ > // DOM Level 2 says (letters added): > // > // a) Name start characters must have one of the categories Ll, Lu, Lo, Lt, Nl. >@@ -515,6 +519,7 @@ Document::Document(Frame* frame, const URL& url, unsigned documentClasses, unsig > #endif > #if ENABLE(INTERSECTION_OBSERVER) > , m_intersectionObserversNotifyTimer(*this, &Document::notifyIntersectionObserversTimerFired) >+ , m_intersectionObserversInitialUpdateTimer(*this, &Document::scheduleRenderingUpdate) > #endif > , m_loadEventDelayTimer(*this, &Document::loadEventDelayTimerFired) > #if PLATFORM(IOS_FAMILY) && ENABLE(DEVICE_ORIENTATION) >@@ -7387,6 +7392,8 @@ void Document::updateIntersectionObservations() > if (!frameView) > return; > >+ m_intersectionObserversInitialUpdateTimer.stop(); >+ > bool needsLayout = frameView->layoutContext().isLayoutPending() || (renderView() && renderView()->needsLayout()); > if (needsLayout || hasPendingStyleRecalc()) > return; >@@ -7475,6 +7482,14 @@ void Document::notifyIntersectionObserversTimerFired() > } > m_intersectionObserversWithPendingNotifications.clear(); > } >+ >+void Document::scheduleInitialIntersectionObservationUpdate() >+{ >+ if (m_readyState == Complete) >+ scheduleRenderingUpdate(); >+ else if (!m_intersectionObserversInitialUpdateTimer.isActive()) >+ m_intersectionObserversInitialUpdateTimer.startOneShot(intersectionObserversInitialUpdateDelay); >+} > #endif > > #if ENABLE(RESIZE_OBSERVER) >diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h >index d061a0bd491d1c054548076221546e17448b44aa..66a60bfda7a78bef4df77441825e4c8e2813861e 100644 >--- a/Source/WebCore/dom/Document.h >+++ b/Source/WebCore/dom/Document.h >@@ -1386,6 +1386,7 @@ public: > void removeIntersectionObserver(IntersectionObserver&); > unsigned numberOfIntersectionObservers() const { return m_intersectionObservers.size(); } > void updateIntersectionObservations(); >+ void scheduleInitialIntersectionObservationUpdate(); > #endif > > #if ENABLE(RESIZE_OBSERVER) >@@ -1812,6 +1813,7 @@ private: > Vector<WeakPtr<IntersectionObserver>> m_intersectionObservers; > Vector<WeakPtr<IntersectionObserver>> m_intersectionObserversWithPendingNotifications; > Timer m_intersectionObserversNotifyTimer; >+ Timer m_intersectionObserversInitialUpdateTimer; > #endif > > #if ENABLE(RESIZE_OBSERVER) >diff --git a/Source/WebCore/page/IntersectionObserver.cpp b/Source/WebCore/page/IntersectionObserver.cpp >index 669b86f54b925dd281f05ba18c58573f30b1a680..2b2799c8003a7f1b963aaed6dd998c1cac955754 100644 >--- a/Source/WebCore/page/IntersectionObserver.cpp >+++ b/Source/WebCore/page/IntersectionObserver.cpp >@@ -158,7 +158,7 @@ void IntersectionObserver::observe(Element& target) > auto* document = trackingDocument(); > if (!hadObservationTargets) > document->addIntersectionObserver(*this); >- document->scheduleRenderingUpdate(); >+ document->scheduleInitialIntersectionObservationUpdate(); > } > > void IntersectionObserver::unobserve(Element& target)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198382
:
370968
|
370992
|
371610
|
371631
|
371745