Diff
Modified: trunk/Source/WebCore/ChangeLog (238810 => 238811)
--- trunk/Source/WebCore/ChangeLog 2018-12-03 20:05:59 UTC (rev 238810)
+++ trunk/Source/WebCore/ChangeLog 2018-12-03 20:18:38 UTC (rev 238811)
@@ -1,3 +1,23 @@
+2018-12-03 Zalan Bujtas <[email protected]>
+
+ [iOS] Add logging channel for hover related content observation
+ https://bugs.webkit.org/show_bug.cgi?id=192312
+
+ Reviewed by Simon Fraser.
+
+ * dom/Document.cpp:
+ (WebCore::Document::scheduleStyleRecalc):
+ (WebCore::Document::updateStyleIfNeeded):
+ (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
+ * page/DOMTimer.cpp:
+ (WebCore::DOMTimer::install):
+ (WebCore::DOMTimer::fired):
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::clearTimeout):
+ * page/Frame.cpp:
+ (WebCore::Frame::willDetachPage):
+ * platform/Logging.h:
+
2018-12-03 Michael Catanzaro <[email protected]>
[SOUP] Use SoupSession instead of SoupSessionAsync
Modified: trunk/Source/WebCore/dom/Document.cpp (238810 => 238811)
--- trunk/Source/WebCore/dom/Document.cpp 2018-12-03 20:05:59 UTC (rev 238810)
+++ trunk/Source/WebCore/dom/Document.cpp 2018-12-03 20:18:38 UTC (rev 238811)
@@ -1796,8 +1796,10 @@
ASSERT(childNeedsStyleRecalc() || m_pendingStyleRecalcShouldForce);
#if PLATFORM(IOS_FAMILY)
- if (WKIsObservingStyleRecalcScheduling())
+ if (WKIsObservingStyleRecalcScheduling()) {
+ LOG_WITH_STREAM(ContentObservation, stream << "Document(" << this << ")::scheduleStyleRecalc: register this style recalc schedule and observe when it fires.");
WKSetObservedContentChange(WKContentIndeterminateChange);
+ }
#endif
// FIXME: Why on earth is this here? This is clearly misplaced.
@@ -2037,6 +2039,7 @@
#if PLATFORM(IOS_FAMILY)
auto observingContentChange = WKShouldObserveNextStyleRecalc();
if (observingContentChange) {
+ LOG_WITH_STREAM(ContentObservation, stream << "Document(" << this << ")::scheduleStyleRecalc: start observing content change.");
WKSetShouldObserveNextStyleRecalc(false);
WKStartObservingContentChanges();
}
@@ -2048,12 +2051,16 @@
#if PLATFORM(IOS_FAMILY)
if (observingContentChange) {
+ LOG_WITH_STREAM(ContentObservation, stream << "Document(" << this << ")::scheduleStyleRecalc: stop observing content change.");
WKStopObservingContentChanges();
auto inDeterminedState = WKObservedContentChange() == WKContentVisibilityChange || !WebThreadCountOfObservedDOMTimers();
if (inDeterminedState) {
+ LOG_WITH_STREAM(ContentObservation, stream << "Document(" << this << ")::scheduleStyleRecalc: notify the pending synthetic click handler.");
if (auto* page = this->page())
page->chrome().client().observedContentChange(*frame());
+ } else {
+ LOG_WITH_STREAM(ContentObservation, stream << "Document(" << this << ")::scheduleStyleRecalc: can't decided it yet.");
}
}
#endif
@@ -2627,6 +2634,7 @@
{
#if PLATFORM(IOS_FAMILY)
if (WebThreadCountOfObservedDOMTimers() > 0) {
+ LOG_WITH_STREAM(ContentObservation, stream << "Document::platformSuspendOrStopActiveDOMObjects: remove registered timers.");
if (auto* frame = this->frame()) {
if (auto* page = frame->page())
page->chrome().client().clearContentChangeObservers(*frame);
Modified: trunk/Source/WebCore/page/DOMTimer.cpp (238810 => 238811)
--- trunk/Source/WebCore/page/DOMTimer.cpp 2018-12-03 20:05:59 UTC (rev 238810)
+++ trunk/Source/WebCore/page/DOMTimer.cpp 2018-12-03 20:18:38 UTC (rev 238811)
@@ -225,6 +225,7 @@
if (!didDeferTimeout && timeout <= 250_ms && singleShot) {
WKSetObservedContentChange(WKContentIndeterminateChange);
WebThreadAddObservedDOMTimer(timer);
+ LOG_WITH_STREAM(ContentObservation, stream << "DOMTimer::install: registed this timer: (" << timer << ") and observe when it fires.");
}
}
#endif
@@ -349,6 +350,7 @@
}
if (shouldBeginObservingChanges) {
+ LOG_WITH_STREAM(ContentObservation, stream << "DOMTimer::fired: start observing (" << timer << ") timer callback.");
WKStartObservingContentChanges();
WKStartObservingStyleRecalcScheduling();
WebThreadRemoveObservedDOMTimer(this);
@@ -364,6 +366,7 @@
#if PLATFORM(IOS_FAMILY)
if (shouldBeginObservingChanges) {
+ LOG_WITH_STREAM(ContentObservation, stream << "DOMTimer::fired: stop observing (" << timer << ") timer callback.");
WKStopObservingStyleRecalcScheduling();
WKStopObservingContentChanges();
@@ -371,11 +374,13 @@
// Check if the timer callback triggered either a sync or async style update.
auto inDeterminedState = observedContentChange == WKContentVisibilityChange || (isObversingLastTimer && observedContentChange == WKContentNoChange);
if (inDeterminedState) {
+ LOG(ContentObservation, "DOMTimer::fired: in determined state.");
auto& document = downcast<Document>(context);
if (auto* page = document.page())
page->chrome().client().observedContentChange(*document.frame());
} else if (observedContentChange == WKContentIndeterminateChange) {
// An async style recalc has been scheduled. Let's observe it.
+ LOG(ContentObservation, "DOMTimer::fired: wait until next style recalc fires.");
WKSetShouldObserveNextStyleRecalc(true);
}
}
Modified: trunk/Source/WebCore/page/DOMWindow.cpp (238810 => 238811)
--- trunk/Source/WebCore/page/DOMWindow.cpp 2018-12-03 20:05:59 UTC (rev 238810)
+++ trunk/Source/WebCore/page/DOMWindow.cpp 2018-12-03 20:18:38 UTC (rev 238811)
@@ -1679,6 +1679,7 @@
if (timeoutId > 0 && document) {
DOMTimer* timer = document->findTimeout(timeoutId);
if (timer && WebThreadContainsObservedDOMTimer(timer)) {
+ LOG_WITH_STREAM(ContentObservation, stream << "DOMWindow::clearTimeout: remove registered timer (" << timer << ")");
WebThreadRemoveObservedDOMTimer(timer);
if (!WebThreadCountOfObservedDOMTimers()) {
Modified: trunk/Source/WebCore/page/Frame.cpp (238810 => 238811)
--- trunk/Source/WebCore/page/Frame.cpp 2018-12-03 20:05:59 UTC (rev 238810)
+++ trunk/Source/WebCore/page/Frame.cpp 2018-12-03 20:18:38 UTC (rev 238811)
@@ -805,8 +805,10 @@
page()->scrollingCoordinator()->willDestroyScrollableArea(*m_view);
#if PLATFORM(IOS_FAMILY)
- if (WebThreadCountOfObservedDOMTimers() > 0 && m_page)
+ if (WebThreadCountOfObservedDOMTimers() > 0 && m_page) {
+ LOG(ContentObservation, "Frame::willDetachPage: remove registered timers.");
m_page->chrome().client().clearContentChangeObservers(*this);
+ }
#endif
script().clearScriptObjects();
Modified: trunk/Source/WebCore/platform/Logging.h (238810 => 238811)
--- trunk/Source/WebCore/platform/Logging.h 2018-12-03 20:05:59 UTC (rev 238810)
+++ trunk/Source/WebCore/platform/Logging.h 2018-12-03 20:18:38 UTC (rev 238811)
@@ -42,6 +42,7 @@
M(Archives) \
M(Compositing) \
M(ContentFiltering) \
+ M(ContentObservation) \
M(DatabaseTracker) \
M(DisplayLists) \
M(DOMTimers) \
Modified: trunk/Source/WebKit/ChangeLog (238810 => 238811)
--- trunk/Source/WebKit/ChangeLog 2018-12-03 20:05:59 UTC (rev 238810)
+++ trunk/Source/WebKit/ChangeLog 2018-12-03 20:18:38 UTC (rev 238811)
@@ -1,3 +1,14 @@
+2018-12-03 Zalan Bujtas <[email protected]>
+
+ [iOS] Add logging channel for hover related content observation
+ https://bugs.webkit.org/show_bug.cgi?id=192312
+
+ Reviewed by Simon Fraser.
+
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::handleSyntheticClick):
+ (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
+
2018-12-03 Tim Horton <[email protected]>
Enable swipe snapshot removal logging in release builds
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (238810 => 238811)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2018-12-03 20:05:59 UTC (rev 238810)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2018-12-03 20:18:38 UTC (rev 238811)
@@ -535,6 +535,7 @@
IntPoint roundedAdjustedPoint = roundedIntPoint(location);
Frame& mainframe = m_page->mainFrame();
+ LOG_WITH_STREAM(ContentObservation, stream << "handleSyntheticClick: node(" << nodeRespondingToClick << ") " << location);
WKStartObservingContentChanges();
WKStartObservingDOMTimerScheduling();
@@ -553,13 +554,16 @@
switch (WKObservedContentChange()) {
case WKContentVisibilityChange:
// The move event caused new contents to appear. Don't send the click event.
+ LOG(ContentObservation, "handleSyntheticClick: Observed meaningful visible change -> hover.");
return;
case WKContentIndeterminateChange:
// Wait for callback to completePendingSyntheticClickForContentChangeObserver() to decide whether to send the click event.
m_pendingSyntheticClickNode = nodeRespondingToClick;
m_pendingSyntheticClickLocation = location;
+ LOG(ContentObservation, "handleSyntheticClick: Observed some change, but can't decide it yet -> wait.");
return;
case WKContentNoChange:
+ LOG(ContentObservation, "handleSyntheticClick: No change was observed -> click.");
completeSyntheticClick(nodeRespondingToClick, location, WebCore::OneFingerTap);
return;
}
@@ -568,11 +572,15 @@
void WebPage::completePendingSyntheticClickForContentChangeObserver()
{
+ LOG_WITH_STREAM(ContentObservation, stream << "completePendingSyntheticClickForContentChangeObserver: pending target node(" << m_pendingSyntheticClickNode << ")");
if (!m_pendingSyntheticClickNode)
return;
// Only dispatch the click if the document didn't get changed by any timers started by the move event.
- if (WKObservedContentChange() == WKContentNoChange)
+ if (WKObservedContentChange() == WKContentNoChange) {
+ LOG(ContentObservation, "No chage was observed -> click.");
completeSyntheticClick(m_pendingSyntheticClickNode.get(), m_pendingSyntheticClickLocation, WebCore::OneFingerTap);
+ } else
+ LOG(ContentObservation, "Observed meaningful visible change -> hover.");
m_pendingSyntheticClickNode = nullptr;
m_pendingSyntheticClickLocation = FloatPoint();