Title: [258528] trunk/Source/WebCore
Revision
258528
Author
[email protected]
Date
2020-03-16 16:34:37 -0700 (Mon, 16 Mar 2020)

Log Message

Update touch event regions once per frame
https://bugs.webkit.org/show_bug.cgi?id=209153

Reviewed by Zalan Bujtas.

Call document->updateTouchEventRegions() once at the end of Page::updateRendering() instead
of relying on a timer.

Also rename the functions called from Internal to make it clear they are testing-only.

Page::scrollingStateTreeAsText() needs to eagerly update event regions because they are input
to the scrolling tree.

* dom/Document.cpp:
(WebCore::Document::Document):
* page/Page.cpp:
(WebCore::Page::scrollingStateTreeAsText):
(WebCore::Page::touchEventRectsForEventForTesting):
(WebCore::Page::passiveTouchEventListenerRectsForTesting):
(WebCore::Page::doAfterUpdateRendering):
(WebCore::Page::touchEventRectsForEvent): Deleted.
(WebCore::Page::passiveTouchEventListenerRects): Deleted.
* page/Page.h:
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame const):
* testing/Internals.cpp:
(WebCore::Internals::touchEventRectsForEvent):
(WebCore::Internals::passiveTouchEventListenerRects):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (258527 => 258528)


--- trunk/Source/WebCore/ChangeLog	2020-03-16 23:16:55 UTC (rev 258527)
+++ trunk/Source/WebCore/ChangeLog	2020-03-16 23:34:37 UTC (rev 258528)
@@ -1,3 +1,34 @@
+2020-03-16  Simon Fraser  <[email protected]>
+
+        Update touch event regions once per frame
+        https://bugs.webkit.org/show_bug.cgi?id=209153
+
+        Reviewed by Zalan Bujtas.
+
+        Call document->updateTouchEventRegions() once at the end of Page::updateRendering() instead
+        of relying on a timer.
+
+        Also rename the functions called from Internal to make it clear they are testing-only.
+
+        Page::scrollingStateTreeAsText() needs to eagerly update event regions because they are input
+        to the scrolling tree.
+
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        * page/Page.cpp:
+        (WebCore::Page::scrollingStateTreeAsText):
+        (WebCore::Page::touchEventRectsForEventForTesting):
+        (WebCore::Page::passiveTouchEventListenerRectsForTesting):
+        (WebCore::Page::doAfterUpdateRendering):
+        (WebCore::Page::touchEventRectsForEvent): Deleted.
+        (WebCore::Page::passiveTouchEventListenerRects): Deleted.
+        * page/Page.h:
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame const):
+        * testing/Internals.cpp:
+        (WebCore::Internals::touchEventRectsForEvent):
+        (WebCore::Internals::passiveTouchEventListenerRects):
+
 2020-03-15  Darin Adler  <[email protected]>
 
         Move most of TextIterator off of live ranges

Modified: trunk/Source/WebCore/dom/Document.cpp (258527 => 258528)


--- trunk/Source/WebCore/dom/Document.cpp	2020-03-16 23:16:55 UTC (rev 258527)
+++ trunk/Source/WebCore/dom/Document.cpp	2020-03-16 23:34:37 UTC (rev 258528)
@@ -536,9 +536,6 @@
     : ContainerNode(*this, CreateDocument)
     , TreeScope(*this)
     , FrameDestructionObserver(frame)
-#if ENABLE(IOS_TOUCH_EVENTS)
-    , m_touchEventsChangedTimer(*this, &Document::touchEventsChangedTimerFired)
-#endif
     , m_settings(frame ? Ref<Settings>(frame->settings()) : Settings::create(nullptr))
     , m_quirks(makeUniqueRef<Quirks>(*this))
     , m_cachedResourceLoader(m_frame ? Ref<CachedResourceLoader>(m_frame->loader().activeDocumentLoader()->cachedResourceLoader()) : CachedResourceLoader::create(nullptr))

Modified: trunk/Source/WebCore/page/Page.cpp (258527 => 258528)


--- trunk/Source/WebCore/page/Page.cpp	2020-03-16 23:16:55 UTC (rev 258527)
+++ trunk/Source/WebCore/page/Page.cpp	2020-03-16 23:34:37 UTC (rev 258528)
@@ -434,8 +434,12 @@
 
 String Page::scrollingStateTreeAsText()
 {
-    if (Document* document = m_mainFrame->document())
+    if (Document* document = m_mainFrame->document()) {
         document->updateLayout();
+#if ENABLE(IOS_TOUCH_EVENTS)
+        document->updateTouchEventRegions();
+#endif
+    }
 
     if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
         return scrollingCoordinator->scrollingStateTreeAsText();
@@ -473,7 +477,7 @@
     return DOMRectList::create(quads);
 }
 
-Ref<DOMRectList> Page::touchEventRectsForEvent(const String& eventName)
+Ref<DOMRectList> Page::touchEventRectsForEventForTesting(const String& eventName)
 {
     if (Document* document = m_mainFrame->document()) {
         document->updateLayout();
@@ -496,7 +500,7 @@
     return DOMRectList::create(quads);
 }
 
-Ref<DOMRectList> Page::passiveTouchEventListenerRects()
+Ref<DOMRectList> Page::passiveTouchEventListenerRectsForTesting()
 {
     if (Document* document = m_mainFrame->document()) {
         document->updateLayout();
@@ -1380,6 +1384,12 @@
     });
 #endif
 
+#if ENABLE(IOS_TOUCH_EVENTS)
+    // updateTouchEventRegions() needs to be called only on the top document.
+    if (RefPtr<Document> document = mainFrame().document())
+        document->updateTouchEventRegions();
+#endif
+
 #if ASSERT_ENABLED
     for (Frame* child = mainFrame().tree().firstRenderedChild(); child; child = child->tree().traverseNextRendered()) {
         auto* frameView = child->view();

Modified: trunk/Source/WebCore/page/Page.h (258527 => 258528)


--- trunk/Source/WebCore/page/Page.h	2020-03-16 23:16:55 UTC (rev 258527)
+++ trunk/Source/WebCore/page/Page.h	2020-03-16 23:34:37 UTC (rev 258528)
@@ -268,8 +268,8 @@
     WEBCORE_EXPORT String synchronousScrollingReasonsAsText();
     WEBCORE_EXPORT Ref<DOMRectList> nonFastScrollableRects();
 
-    WEBCORE_EXPORT Ref<DOMRectList> touchEventRectsForEvent(const String& eventName);
-    WEBCORE_EXPORT Ref<DOMRectList> passiveTouchEventListenerRects();
+    WEBCORE_EXPORT Ref<DOMRectList> touchEventRectsForEventForTesting(const String& eventName);
+    WEBCORE_EXPORT Ref<DOMRectList> passiveTouchEventListenerRectsForTesting();
 
     Settings& settings() const { return *m_settings; }
     ProgressTracker& progress() const { return *m_progress; }

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (258527 => 258528)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2020-03-16 23:16:55 UTC (rev 258527)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2020-03-16 23:34:37 UTC (rev 258528)
@@ -111,7 +111,7 @@
     ASSERT(frame.isMainFrame());
     auto* document = frame.document();
     if (!document)
-        return EventTrackingRegions();
+        return { };
     return document->eventTrackingRegions();
 #else
     auto* frameView = frame.view();

Modified: trunk/Source/WebCore/testing/Internals.cpp (258527 => 258528)


--- trunk/Source/WebCore/testing/Internals.cpp	2020-03-16 23:16:55 UTC (rev 258527)
+++ trunk/Source/WebCore/testing/Internals.cpp	2020-03-16 23:34:37 UTC (rev 258528)
@@ -2150,7 +2150,7 @@
     if (!document || !document->page())
         return Exception { InvalidAccessError };
 
-    return document->page()->touchEventRectsForEvent(eventName);
+    return document->page()->touchEventRectsForEventForTesting(eventName);
 }
 
 ExceptionOr<Ref<DOMRectList>> Internals::passiveTouchEventListenerRects()
@@ -2159,7 +2159,7 @@
     if (!document || !document->page())
         return Exception { InvalidAccessError };
 
-    return document->page()->passiveTouchEventListenerRects();
+    return document->page()->passiveTouchEventListenerRectsForTesting();
 }
 
 // FIXME: Remove the document argument. It is almost always the same as
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to