[ContentChangeObserver] Introduce fixed duration content observation
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Mar 2019 03:21:14 +0000 (03:21 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Mar 2019 03:21:14 +0000 (03:21 +0000)
commit98b96e152fe5cd5566a383a0c1f14477acb69b14
tree3511f3083522fe8b472bef1b7e1530814a220e98
parent960d0201c7add5380d3536ac64d0055ff89f190c
[ContentChangeObserver] Introduce fixed duration content observation
https://bugs.webkit.org/show_bug.cgi?id=195295
<rdar://problem/48579913>

Reviewed by Simon Fraser.

Source/WebCore:

Some pages have a runloop-like scheduling setup where the content triggering change happens at a nested timer firing.
This patch helps finding cases like that using a 32ms long fixed window. Currently nested timers get dropped on the floor and
we stop observing for content changes before they even get fired.

Test: fast/events/touch/ios/content-observation/visibility-change-happens-on-timer-hops.html

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::ContentChangeObserver):
(WebCore::ContentChangeObserver::startContentObservationForDuration):
(WebCore::ContentChangeObserver::completeDurationBasedContentObservation):
(WebCore::ContentChangeObserver::didInstallDOMTimer):
(WebCore::ContentChangeObserver::didRemoveDOMTimer):
(WebCore::ContentChangeObserver::domTimerExecuteDidStart):
(WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
(WebCore::ContentChangeObserver::styleRecalcDidStart):
(WebCore::ContentChangeObserver::styleRecalcDidFinish):
(WebCore::ContentChangeObserver::cancelPendingActivities):
(WebCore::ContentChangeObserver::didSuspendActiveDOMObjects):
(WebCore::ContentChangeObserver::willDetachPage):
(WebCore::ContentChangeObserver::contentVisibilityDidChange):
(WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
(WebCore::ContentChangeObserver::adjustObservedState):
(WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
(WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
(WebCore::ContentChangeObserver::clearTimersAndReportContentChange): Deleted.
* page/ios/ContentChangeObserver.h:
(WebCore::ContentChangeObserver::clearObservedDOMTimers):
(WebCore::ContentChangeObserver::isObservingContentChanges const):
(WebCore::ContentChangeObserver::hasPendingActivity const):

Source/WebKit:

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleSyntheticClick):
(WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):

LayoutTests:

* fast/events/touch/ios/content-observation/visibility-change-happens-on-timer-hops-expected.txt: Added.
* fast/events/touch/ios/content-observation/visibility-change-happens-on-timer-hops.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242628 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-on-timer-hops-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-on-timer-hops.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/ios/ContentChangeObserver.cpp
Source/WebCore/page/ios/ContentChangeObserver.h
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm