Title: [252280] tags/Safari-609.1.10.1/Source/WebCore
Revision
252280
Author
[email protected]
Date
2019-11-08 16:51:40 -0800 (Fri, 08 Nov 2019)

Log Message

Cherry-pick r252022. rdar://problem/56550488

    REGRESSION (r248750): Drop-down menu for Walgreens 2FA unresponsive to touch
    https://bugs.webkit.org/show_bug.cgi?id=203821
    <rdar://problem/56550488>

    Reviewed by Zalan Bujtas.

    The dropdown in question in the Walgreens app uses UIWebView. In this report, tapping the dropdown menu (which
    installs DOMTimers upon touchstart) no longer dispatches a click event. This reproduces in WebKit1, but not in
    WebKit2.

    After r248750, we no longer transition from IndeterminateChange to NoChange before calling out to the client
    layer to report a deferred content observation change (in legacy WebKit, this is a call to the delegate method
    -webView:didObserveDeferredContentChange:forFrame:).

    In WebKit2, logic in WebPage::handleSyntheticClick handles indeterminate content changes after dispatching
    mousemove by starting a fixed 32ms content observation timer, after the end of which we transition from
    indeterminate to either NoChange or VisibilityChange, and call out to the client. This logic is absent in
    WebKitLegacy, where we directly report the current content observation state to the client.

    As such, the content change is still indeterminate when we finally call out to the client layer in the runloop
    after dispatching the mousemove event in EventHandler::mouseMoved(). Client code in UIKit does not expect this,
    and assumes that the given WKContentChange must either be NoChange or VisibilityChange; thus, it handles
    indeterminate change as VisibilityChange and does not dispatch a click.

    This legacy-WebKit-specific call to didFinishContentChangeObserving is intended to act as a failsafe to stop
    content observation after mousemove, if any active timers scheduled during touchstart have already finished
    executing. To fix this bug, instead of calling out to WebChromeClient::didFinishContentChangeObserving directly,
    add a new method to ContentChangeObserver to inform it that a mousemove event has been handled; here, we call
    notifyClientIfNeeded, which will transition the content change state from indeterminate to NoChange if needed
    before calling out to the client.

    No new test, because we don't have any mechanism for simulating user interaction in UIWebView (and inventing one
    at this stage would have diminishing returns at best).

    * page/ios/ContentChangeObserver.cpp:
    (WebCore::ContentChangeObserver::willNotProceedWithFixedObservationTimeWindow):
    (WebCore::ContentChangeObserver::adjustObservedState):
    * page/ios/ContentChangeObserver.h:
    * page/ios/EventHandlerIOS.mm:
    (WebCore::EventHandler::mouseMoved):

    Replace the call to WebChromeClient::didFinishContentChangeObserving with a ContentChangeObserver method that
    turns around and calls into notifyClientIfNeeded, via ContentChangeObserver::adjustObservedState.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252022 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: tags/Safari-609.1.10.1/Source/WebCore/ChangeLog (252279 => 252280)


--- tags/Safari-609.1.10.1/Source/WebCore/ChangeLog	2019-11-09 00:51:36 UTC (rev 252279)
+++ tags/Safari-609.1.10.1/Source/WebCore/ChangeLog	2019-11-09 00:51:40 UTC (rev 252280)
@@ -1,5 +1,102 @@
 2019-11-07  Alan Coon  <[email protected]>
 
+        Cherry-pick r252022. rdar://problem/56550488
+
+    REGRESSION (r248750): Drop-down menu for Walgreens 2FA unresponsive to touch
+    https://bugs.webkit.org/show_bug.cgi?id=203821
+    <rdar://problem/56550488>
+    
+    Reviewed by Zalan Bujtas.
+    
+    The dropdown in question in the Walgreens app uses UIWebView. In this report, tapping the dropdown menu (which
+    installs DOMTimers upon touchstart) no longer dispatches a click event. This reproduces in WebKit1, but not in
+    WebKit2.
+    
+    After r248750, we no longer transition from IndeterminateChange to NoChange before calling out to the client
+    layer to report a deferred content observation change (in legacy WebKit, this is a call to the delegate method
+    -webView:didObserveDeferredContentChange:forFrame:).
+    
+    In WebKit2, logic in WebPage::handleSyntheticClick handles indeterminate content changes after dispatching
+    mousemove by starting a fixed 32ms content observation timer, after the end of which we transition from
+    indeterminate to either NoChange or VisibilityChange, and call out to the client. This logic is absent in
+    WebKitLegacy, where we directly report the current content observation state to the client.
+    
+    As such, the content change is still indeterminate when we finally call out to the client layer in the runloop
+    after dispatching the mousemove event in EventHandler::mouseMoved(). Client code in UIKit does not expect this,
+    and assumes that the given WKContentChange must either be NoChange or VisibilityChange; thus, it handles
+    indeterminate change as VisibilityChange and does not dispatch a click.
+    
+    This legacy-WebKit-specific call to didFinishContentChangeObserving is intended to act as a failsafe to stop
+    content observation after mousemove, if any active timers scheduled during touchstart have already finished
+    executing. To fix this bug, instead of calling out to WebChromeClient::didFinishContentChangeObserving directly,
+    add a new method to ContentChangeObserver to inform it that a mousemove event has been handled; here, we call
+    notifyClientIfNeeded, which will transition the content change state from indeterminate to NoChange if needed
+    before calling out to the client.
+    
+    No new test, because we don't have any mechanism for simulating user interaction in UIWebView (and inventing one
+    at this stage would have diminishing returns at best).
+    
+    * page/ios/ContentChangeObserver.cpp:
+    (WebCore::ContentChangeObserver::willNotProceedWithFixedObservationTimeWindow):
+    (WebCore::ContentChangeObserver::adjustObservedState):
+    * page/ios/ContentChangeObserver.h:
+    * page/ios/EventHandlerIOS.mm:
+    (WebCore::EventHandler::mouseMoved):
+    
+    Replace the call to WebChromeClient::didFinishContentChangeObserving with a ContentChangeObserver method that
+    turns around and calls into notifyClientIfNeeded, via ContentChangeObserver::adjustObservedState.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252022 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-11-04  Wenson Hsieh  <[email protected]>
+
+            REGRESSION (r248750): Drop-down menu for Walgreens 2FA unresponsive to touch
+            https://bugs.webkit.org/show_bug.cgi?id=203821
+            <rdar://problem/56550488>
+
+            Reviewed by Zalan Bujtas.
+
+            The dropdown in question in the Walgreens app uses UIWebView. In this report, tapping the dropdown menu (which
+            installs DOMTimers upon touchstart) no longer dispatches a click event. This reproduces in WebKit1, but not in
+            WebKit2.
+
+            After r248750, we no longer transition from IndeterminateChange to NoChange before calling out to the client
+            layer to report a deferred content observation change (in legacy WebKit, this is a call to the delegate method
+            -webView:didObserveDeferredContentChange:forFrame:).
+
+            In WebKit2, logic in WebPage::handleSyntheticClick handles indeterminate content changes after dispatching
+            mousemove by starting a fixed 32ms content observation timer, after the end of which we transition from
+            indeterminate to either NoChange or VisibilityChange, and call out to the client. This logic is absent in
+            WebKitLegacy, where we directly report the current content observation state to the client.
+
+            As such, the content change is still indeterminate when we finally call out to the client layer in the runloop
+            after dispatching the mousemove event in EventHandler::mouseMoved(). Client code in UIKit does not expect this,
+            and assumes that the given WKContentChange must either be NoChange or VisibilityChange; thus, it handles
+            indeterminate change as VisibilityChange and does not dispatch a click.
+
+            This legacy-WebKit-specific call to didFinishContentChangeObserving is intended to act as a failsafe to stop
+            content observation after mousemove, if any active timers scheduled during touchstart have already finished
+            executing. To fix this bug, instead of calling out to WebChromeClient::didFinishContentChangeObserving directly,
+            add a new method to ContentChangeObserver to inform it that a mousemove event has been handled; here, we call
+            notifyClientIfNeeded, which will transition the content change state from indeterminate to NoChange if needed
+            before calling out to the client.
+
+            No new test, because we don't have any mechanism for simulating user interaction in UIWebView (and inventing one
+            at this stage would have diminishing returns at best).
+
+            * page/ios/ContentChangeObserver.cpp:
+            (WebCore::ContentChangeObserver::willNotProceedWithFixedObservationTimeWindow):
+            (WebCore::ContentChangeObserver::adjustObservedState):
+            * page/ios/ContentChangeObserver.h:
+            * page/ios/EventHandlerIOS.mm:
+            (WebCore::EventHandler::mouseMoved):
+
+            Replace the call to WebChromeClient::didFinishContentChangeObserving with a ContentChangeObserver method that
+            turns around and calls into notifyClientIfNeeded, via ContentChangeObserver::adjustObservedState.
+
+2019-11-07  Alan Coon  <[email protected]>
+
         Cherry-pick r251992. rdar://problem/56648063
 
     enumerateDevices() doesn't return correct list of devices after device was changed by user in a system preferences

Modified: tags/Safari-609.1.10.1/Source/WebCore/page/ios/ContentChangeObserver.cpp (252279 => 252280)


--- tags/Safari-609.1.10.1/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-11-09 00:51:36 UTC (rev 252279)
+++ tags/Safari-609.1.10.1/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-11-09 00:51:40 UTC (rev 252280)
@@ -470,6 +470,12 @@
     setMouseMovedEventIsBeingDispatched(false);
 }
 
+void ContentChangeObserver::willNotProceedWithFixedObservationTimeWindow()
+{
+    ASSERT(!isMouseMovedEventBeingDispatched());
+    adjustObservedState(Event::WillNotProceedWithFixedObservationTimeWindow);
+}
+
 void ContentChangeObserver::setShouldObserveNextStyleRecalc(bool shouldObserve)
 {
     if (shouldObserve)
@@ -561,6 +567,10 @@
             notifyClientIfNeeded();
             return;
         }
+        if (event == Event::WillNotProceedWithFixedObservationTimeWindow) {
+            notifyClientIfNeeded();
+            return;
+        }
     }
     // These events (DOM timer, transition and style recalc) could trigger style changes that are candidates to visibility checking.
     {

Modified: tags/Safari-609.1.10.1/Source/WebCore/page/ios/ContentChangeObserver.h (252279 => 252280)


--- tags/Safari-609.1.10.1/Source/WebCore/page/ios/ContentChangeObserver.h	2019-11-09 00:51:36 UTC (rev 252279)
+++ tags/Safari-609.1.10.1/Source/WebCore/page/ios/ContentChangeObserver.h	2019-11-09 00:51:40 UTC (rev 252280)
@@ -71,6 +71,8 @@
     void rendererWillBeDestroyed(const Element&);
     void willNotProceedWithClick();
 
+    void willNotProceedWithFixedObservationTimeWindow();
+
     void setHiddenTouchTarget(Element& targetElement) { m_hiddenTouchTargetElement = makeWeakPtr(targetElement); }
     void resetHiddenTouchTarget() { m_hiddenTouchTargetElement = { }; }
     Element* hiddenTouchTarget() const { return m_hiddenTouchTargetElement.get(); }
@@ -197,6 +199,7 @@
         CanceledTransition,
         StartedFixedObservationTimeWindow,
         EndedFixedObservationTimeWindow,
+        WillNotProceedWithFixedObservationTimeWindow,
         ElementDidBecomeVisible
     };
     void adjustObservedState(Event);

Modified: tags/Safari-609.1.10.1/Source/WebCore/page/ios/EventHandlerIOS.mm (252279 => 252280)


--- tags/Safari-609.1.10.1/Source/WebCore/page/ios/EventHandlerIOS.mm	2019-11-09 00:51:36 UTC (rev 252279)
+++ tags/Safari-609.1.10.1/Source/WebCore/page/ios/EventHandlerIOS.mm	2019-11-09 00:51:40 UTC (rev 252280)
@@ -503,7 +503,7 @@
         callOnMainThread([protectedFrame = makeRef(m_frame)] {
             // This is called by WebKitLegacy only.
             if (auto* document = protectedFrame->document())
-                document->page()->chrome().client().didFinishContentChangeObserving(*document->frame(), document->contentChangeObserver().observedContentChange());
+                document->contentChangeObserver().willNotProceedWithFixedObservationTimeWindow();
         });
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to