Skip to content
Permalink
Browse files
[ContentChangeObserver] Make observed state reset explicit.
https://bugs.webkit.org/show_bug.cgi?id=195185
<rdar://problem/48488342>

Reviewed by Simon Fraser.

Use setObservedContentChange only for setting the observed change while observing.

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::startObservingContentChanges):
(WebCore::ContentChangeObserver::resetObservedContentChange):
(WebCore::ContentChangeObserver::removeObservedDOMTimer):
* page/ios/ContentChangeObserver.h:

Canonical link: https://commits.webkit.org/209510@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242227 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbujtas committed Feb 28, 2019
1 parent d3d9e48 commit 3755232d75175008b3e4296e1cd1ce5edba103df
Showing 3 changed files with 25 additions and 3 deletions.
@@ -1,3 +1,19 @@
2019-02-28 Zalan Bujtas <zalan@apple.com>

[ContentChangeObserver] Make observed state reset explicit.
https://bugs.webkit.org/show_bug.cgi?id=195185
<rdar://problem/48488342>

Reviewed by Simon Fraser.

Use setObservedContentChange only for setting the observed change while observing.

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::startObservingContentChanges):
(WebCore::ContentChangeObserver::resetObservedContentChange):
(WebCore::ContentChangeObserver::removeObservedDOMTimer):
* page/ios/ContentChangeObserver.h:

2019-02-28 Commit Queue <commit-queue@webkit.org>

Unreviewed, rolling out r242210.
@@ -150,7 +150,7 @@ void ContentChangeObserver::willDetachPage()
void ContentChangeObserver::startObservingContentChanges()
{
startObservingDOMTimerScheduling();
setObservedContentChange(WKContentNoChange);
resetObservedContentChange();
m_observingContentChanges = true;
}

@@ -221,6 +221,11 @@ void ContentChangeObserver::clearObservedDOMTimers()
m_DOMTimerList.clear();
}

void ContentChangeObserver::resetObservedContentChange()
{
WKSetObservedContentChange(WKContentNoChange);
}

void ContentChangeObserver::setObservedContentChange(WKContentChange change)
{
if (observedContentChange() == WKContentVisibilityChange)
@@ -244,9 +249,9 @@ void ContentChangeObserver::addObservedDOMTimer(const DOMTimer& timer)
void ContentChangeObserver::removeObservedDOMTimer(const DOMTimer& timer)
{
m_DOMTimerList.remove(&timer);
// Force reset the content change flag when the last observed content modifier is removed. We should not be in indeterminate state anymore.
// Force reset the content change flag when the last observed content modifier is removed. We should not be in an indeterminate state anymore.
if (!countOfObservedDOMTimers() && observedContentChange() == WKContentIndeterminateChange)
setObservedContentChange(WKContentNoChange);
resetObservedContentChange();
}

static Visibility elementImplicitVisibility(const Element& element)
@@ -87,6 +87,7 @@ class ContentChangeObserver {
bool isObservingStyleRecalcScheduling();

void setObservedContentChange(WKContentChange);
void resetObservedContentChange();

unsigned countOfObservedDOMTimers();
void clearObservedDOMTimers();

0 comments on commit 3755232

Please sign in to comment.