Title: [268902] trunk
Revision
268902
Author
[email protected]
Date
2020-10-22 18:38:25 -0700 (Thu, 22 Oct 2020)

Log Message

REGRESSION(r268476): [ macOS ] tiled-drawing/scrolling/non-fast-region/handlers-in-iframes.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=218031
<rdar://problem/70532268>

Reviewed by Tim Horton.
Source/WebCore:

The test exercises wheel event regions in non-composited iframes. These were not reliably updated
when all wheel event handlers were removed, because Frame::invalidateContentEventRegionsIfNeeded()
early-returned if there were no handlers (but we need to update the regions in this case). Clean
up the logic here, and pass in a "reason" so we know that we should do work when there are no
handlers.

Document::wheelEventHandlersChanged() also needs to invalidate style, since flags in style
are used for wheel event region building, and it needs to call invalidateContentEventRegionsIfNeeded().

* dom/Document.cpp:
(WebCore::Document::wheelEventHandlersChanged):
(WebCore::Document::didAddWheelEventHandler):
(WebCore::Document::didRemoveWheelEventHandler):
* dom/Document.h:
* page/Frame.cpp:
(WebCore::Frame::invalidateContentEventRegionsIfNeeded):
* page/Frame.h:
* page/FrameView.cpp:
(WebCore::FrameView::didLayout):

LayoutTests:

* platform/mac/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (268901 => 268902)


--- trunk/LayoutTests/ChangeLog	2020-10-23 01:32:09 UTC (rev 268901)
+++ trunk/LayoutTests/ChangeLog	2020-10-23 01:38:25 UTC (rev 268902)
@@ -1,3 +1,13 @@
+2020-10-22  Simon Fraser  <[email protected]>
+
+        REGRESSION(r268476): [ macOS ] tiled-drawing/scrolling/non-fast-region/handlers-in-iframes.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=218031
+        <rdar://problem/70532268>
+
+        Reviewed by Tim Horton.
+        
+        * platform/mac/TestExpectations:
+
 2020-10-22  Aditya Keerthi  <[email protected]>
 
         [Contact Picker API] Add skeleton implementation of ContactsManager.select()

Modified: trunk/LayoutTests/platform/mac/TestExpectations (268901 => 268902)


--- trunk/LayoutTests/platform/mac/TestExpectations	2020-10-23 01:32:09 UTC (rev 268901)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2020-10-23 01:38:25 UTC (rev 268902)
@@ -2256,8 +2256,6 @@
 
 webkit.org/b/217994 imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-output-channel-count.https.html [ Pass Failure ]
 
-webkit.org/b/218031 tiled-drawing/scrolling/non-fast-region/handlers-in-iframes.html [ Pass Failure ]
-
 # rdar://70546330 REGRESSION (r267531): [ Big Sur iOS 14 ] imported/w3c/web-platform-tests/mathml/relations/css-styling/padding-border-margin/border-002.html is a constant failure
 [ BigSur+ ] imported/w3c/web-platform-tests/mathml/relations/css-styling/padding-border-margin/border-002.html [ Failure ]
 
@@ -2265,4 +2263,4 @@
 [ BigSur+ ] imported/w3c/web-platform-tests/mathml/relations/html5-tree/dynamic-childlist-001.html [ Failure ]
 
 # rdar://70556068 REGRESSION: [ Big Sur ] fast/text/international/complex-character-based-fallback.html is a constant failure
-[ BigSur+ ] fast/text/international/complex-character-based-fallback.html [ Pass Failure ]
\ No newline at end of file
+[ BigSur+ ] fast/text/international/complex-character-based-fallback.html [ Pass Failure ]

Modified: trunk/Source/WebCore/ChangeLog (268901 => 268902)


--- trunk/Source/WebCore/ChangeLog	2020-10-23 01:32:09 UTC (rev 268901)
+++ trunk/Source/WebCore/ChangeLog	2020-10-23 01:38:25 UTC (rev 268902)
@@ -1,3 +1,31 @@
+2020-10-22  Simon Fraser  <[email protected]>
+
+        REGRESSION(r268476): [ macOS ] tiled-drawing/scrolling/non-fast-region/handlers-in-iframes.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=218031
+        <rdar://problem/70532268>
+
+        Reviewed by Tim Horton.
+
+        The test exercises wheel event regions in non-composited iframes. These were not reliably updated
+        when all wheel event handlers were removed, because Frame::invalidateContentEventRegionsIfNeeded()
+        early-returned if there were no handlers (but we need to update the regions in this case). Clean
+        up the logic here, and pass in a "reason" so we know that we should do work when there are no
+        handlers.
+
+        Document::wheelEventHandlersChanged() also needs to invalidate style, since flags in style
+        are used for wheel event region building, and it needs to call invalidateContentEventRegionsIfNeeded().
+
+        * dom/Document.cpp:
+        (WebCore::Document::wheelEventHandlersChanged):
+        (WebCore::Document::didAddWheelEventHandler):
+        (WebCore::Document::didRemoveWheelEventHandler):
+        * dom/Document.h:
+        * page/Frame.cpp:
+        (WebCore::Frame::invalidateContentEventRegionsIfNeeded):
+        * page/Frame.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::didLayout):
+
 2020-10-22  Aditya Keerthi  <[email protected]>
 
         [Contact Picker API] Add skeleton implementation of ContactsManager.select()

Modified: trunk/Source/WebCore/dom/Document.cpp (268901 => 268902)


--- trunk/Source/WebCore/dom/Document.cpp	2020-10-23 01:32:09 UTC (rev 268901)
+++ trunk/Source/WebCore/dom/Document.cpp	2020-10-23 01:38:25 UTC (rev 268902)
@@ -6643,7 +6643,7 @@
     m_idleCallbackController->removeIdleCallback(id);
 }
 
-void Document::wheelEventHandlersChanged()
+void Document::wheelEventHandlersChanged(Node* node)
 {
     Page* page = this->page();
     if (!page)
@@ -6654,6 +6654,17 @@
             scrollingCoordinator->frameViewEventTrackingRegionsChanged(*frameView);
     }
 
+#if ENABLE(WHEEL_EVENT_REGIONS)
+    if (is<Element>(node)) {
+        // Style is affected via eventListenerRegionTypes().
+        downcast<Element>(*node).invalidateStyle();
+    }
+
+    m_frame->invalidateContentEventRegionsIfNeeded(Frame::InvalidateContentEventRegionsReason::EventHandlerChange);
+#else
+    UNUSED_PARAM(node);
+#endif
+
     bool haveHandlers = m_wheelEventTargets && !m_wheelEventTargets->isEmpty();
     page->chrome().client().wheelEventHandlersChanged(haveHandlers);
 }
@@ -6664,9 +6675,8 @@
         m_wheelEventTargets = makeUnique<EventTargetSet>();
 
     m_wheelEventTargets->add(&node);
+    wheelEventHandlersChanged(&node);
 
-    wheelEventHandlersChanged();
-
     if (Frame* frame = this->frame())
         DebugPageOverlays::didChangeEventHandlers(*frame);
 }
@@ -6699,7 +6709,7 @@
     if (!removeHandlerFromSet(*m_wheelEventTargets, node, removal))
         return;
 
-    wheelEventHandlersChanged();
+    wheelEventHandlersChanged(&node);
 
     if (Frame* frame = this->frame())
         DebugPageOverlays::didChangeEventHandlers(*frame);

Modified: trunk/Source/WebCore/dom/Document.h (268901 => 268902)


--- trunk/Source/WebCore/dom/Document.h	2020-10-23 01:32:09 UTC (rev 268901)
+++ trunk/Source/WebCore/dom/Document.h	2020-10-23 01:38:25 UTC (rev 268902)
@@ -1674,7 +1674,7 @@
 
     void didAssociateFormControlsTimerFired();
 
-    void wheelEventHandlersChanged();
+    void wheelEventHandlersChanged(Node* = nullptr);
 
     HttpEquivPolicy httpEquivPolicy() const;
     AXObjectCache* existingAXObjectCacheSlow() const;

Modified: trunk/Source/WebCore/page/Frame.cpp (268901 => 268902)


--- trunk/Source/WebCore/page/Frame.cpp	2020-10-23 01:32:09 UTC (rev 268901)
+++ trunk/Source/WebCore/page/Frame.cpp	2020-10-23 01:38:25 UTC (rev 268902)
@@ -300,26 +300,33 @@
     m_documentIsBeingReplaced = false;
 }
 
-void Frame::invalidateContentEventRegionsIfNeeded()
+void Frame::invalidateContentEventRegionsIfNeeded(InvalidateContentEventRegionsReason reason)
 {
     if (!m_page || !m_doc || !m_doc->renderView())
         return;
-    bool hasWheelEventHandlers = false;
-    bool hasTouchActionElements = false;
-    bool hasEditableElements = false;
+
+    bool needsUpdateForWheelEventHandlers = false;
+    bool needsUpdateForTouchActionElements = false;
+    bool needsUpdateForEditableElements = false;
 #if ENABLE(WHEEL_EVENT_REGIONS)
-    hasWheelEventHandlers = m_doc->hasWheelEventHandlers();
+    needsUpdateForWheelEventHandlers = m_doc->hasWheelEventHandlers() || reason == InvalidateContentEventRegionsReason::EventHandlerChange;
+#else
+    UNUSED_PARAM(reason);
 #endif
 #if ENABLE(TOUCH_ACTION_REGIONS)
-    hasTouchActionElements = m_doc->mayHaveElementsWithNonAutoTouchAction();
+    // Document::mayHaveElementsWithNonAutoTouchAction never changes from true to false currently.
+    needsUpdateForTouchActionElements = m_doc->mayHaveElementsWithNonAutoTouchAction();
 #endif
 #if ENABLE(EDITABLE_REGION)
-    hasEditableElements = m_doc->mayHaveEditableElements() && m_page->shouldBuildEditableRegion();
+    // Document::mayHaveEditableElements never changes from true to false currently.
+    needsUpdateForEditableElements = m_doc->mayHaveEditableElements() && m_page->shouldBuildEditableRegion();
 #endif
-    if (!hasTouchActionElements && !hasEditableElements && !hasWheelEventHandlers)
+    if (!needsUpdateForTouchActionElements && !needsUpdateForEditableElements && !needsUpdateForWheelEventHandlers)
         return;
+
     if (!m_doc->renderView()->compositor().viewNeedsToInvalidateEventRegionOfEnclosingCompositingLayerForRepaint())
         return;
+
     if (m_ownerElement)
         m_ownerElement->document().invalidateEventRegionsForFrame(*m_ownerElement);
 }

Modified: trunk/Source/WebCore/page/Frame.h (268901 => 268902)


--- trunk/Source/WebCore/page/Frame.h	2020-10-23 01:32:09 UTC (rev 268901)
+++ trunk/Source/WebCore/page/Frame.h	2020-10-23 01:38:25 UTC (rev 268902)
@@ -307,13 +307,12 @@
     void didPrewarmLocalStorage();
     bool mayPrewarmLocalStorage() const;
 
-    void invalidateContentEventRegionsIfNeeded();
+    enum class InvalidateContentEventRegionsReason { Layout, EventHandlerChange };
+    void invalidateContentEventRegionsIfNeeded(InvalidateContentEventRegionsReason);
 
     WEBCORE_EXPORT FloatSize screenSize() const;
     void setOverrideScreenSize(FloatSize&&);
 
-// ========
-
     void selfOnlyRef();
     void selfOnlyDeref();
 

Modified: trunk/Source/WebCore/page/FrameView.cpp (268901 => 268902)


--- trunk/Source/WebCore/page/FrameView.cpp	2020-10-23 01:32:09 UTC (rev 268901)
+++ trunk/Source/WebCore/page/FrameView.cpp	2020-10-23 01:38:25 UTC (rev 268902)
@@ -1271,7 +1271,7 @@
         cache->postNotification(layoutRoot.get(), AXObjectCache::AXLayoutComplete);
 #endif
 
-    frame().invalidateContentEventRegionsIfNeeded();
+    frame().invalidateContentEventRegionsIfNeeded(Frame::InvalidateContentEventRegionsReason::Layout);
     document->invalidateRenderingDependentRegions();
 
     updateCanBlitOnScrollRecursively();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to