Changeset 246835 in webkit


Ignore:
Timestamp:
Jun 26, 2019 7:44:25 AM (5 years ago)
Author:
Alan Bujtas
Message:

[ContentChangeObserver] Dispatch synthetic mouse event asynchronously in completePendingSyntheticClickForContentChangeObserver
https://bugs.webkit.org/show_bug.cgi?id=199220
<rdar://problem/51787961>

Reviewed by Simon Fraser.

Source/WebKit:

WebPage::completePendingSyntheticClickForContentChangeObserver should not dispatch mouse events synchronously.
Mouse events, through style updates could destroy the element that initiated this change.
WebPage::handleSyntheticClick() already implements this pattern.

  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):

LayoutTests:

  • fast/events/touch/ios/content-observation/animation-end-with-visiblity-change-crash-expected.txt: Added.
  • fast/events/touch/ios/content-observation/animation-end-with-visiblity-change-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r246830 r246835  
     12019-06-26  Zalan Bujtas  <zalan@apple.com>
     2
     3        [ContentChangeObserver] Dispatch synthetic mouse event asynchronously in completePendingSyntheticClickForContentChangeObserver
     4        https://bugs.webkit.org/show_bug.cgi?id=199220
     5        <rdar://problem/51787961>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * fast/events/touch/ios/content-observation/animation-end-with-visiblity-change-crash-expected.txt: Added.
     10        * fast/events/touch/ios/content-observation/animation-end-with-visiblity-change-crash.html: Added.
     11
    1122019-06-25  Russell Epstein  <russell_e@apple.com>
    213
  • trunk/Source/WebKit/ChangeLog

    r246829 r246835  
     12019-06-26  Zalan Bujtas  <zalan@apple.com>
     2
     3        [ContentChangeObserver] Dispatch synthetic mouse event asynchronously in completePendingSyntheticClickForContentChangeObserver
     4        https://bugs.webkit.org/show_bug.cgi?id=199220
     5        <rdar://problem/51787961>
     6
     7        Reviewed by Simon Fraser.
     8
     9        WebPage::completePendingSyntheticClickForContentChangeObserver should not dispatch mouse events synchronously.
     10        Mouse events, through style updates could destroy the element that initiated this change.
     11        WebPage::handleSyntheticClick() already implements this pattern.
     12
     13        * WebProcess/WebPage/ios/WebPageIOS.mm:
     14        (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
     15
    1162019-06-25  Jiewen Tan  <jiewen_tan@apple.com>
    217
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r246757 r246835  
    715715        return;
    716716    auto observedContentChange = m_pendingSyntheticClickNode->document().contentChangeObserver().observedContentChange();
    717     // Only dispatch the click if the document didn't get changed by any timers started by the move event.
    718     if (observedContentChange == WKContentNoChange) {
    719         LOG(ContentObservation, "No chage was observed -> click.");
    720         completeSyntheticClick(*m_pendingSyntheticClickNode, m_pendingSyntheticClickLocation, m_pendingSyntheticClickModifiers, WebCore::OneFingerTap, m_pendingSyntheticClickPointerId);
    721     } else {
     717    callOnMainThread([protectedThis = makeRefPtr(this), targetNode = Ref<Node>(*m_pendingSyntheticClickNode), originalDocument = makeWeakPtr(m_pendingSyntheticClickNode->document()), observedContentChange, location = m_pendingSyntheticClickLocation, modifiers = m_pendingSyntheticClickModifiers, pointerId = m_pendingSyntheticClickPointerId] {
     718        if (protectedThis->m_isClosed || !protectedThis->corePage())
     719            return;
     720        if (!originalDocument || &targetNode->document() != originalDocument)
     721            return;
     722
     723        // Only dispatch the click if the document didn't get changed by any timers started by the move event.
     724        if (observedContentChange == WKContentNoChange) {
     725            LOG(ContentObservation, "No chage was observed -> click.");
     726            protectedThis->completeSyntheticClick(targetNode, location, modifiers, WebCore::OneFingerTap, pointerId);
     727            return;
     728        }
    722729        // Ensure that the mouse is on the most recent content.
    723         dispatchSyntheticMouseMove(m_page->mainFrame(), m_pendingSyntheticClickLocation, m_pendingSyntheticClickModifiers, m_pendingSyntheticClickPointerId);
    724730        LOG(ContentObservation, "Observed meaningful visible change -> hover.");
    725     }
    726 
     731        dispatchSyntheticMouseMove(protectedThis->corePage()->mainFrame(), location, modifiers, pointerId);
     732    });
    727733    m_pendingSyntheticClickNode = nullptr;
    728     m_pendingSyntheticClickLocation = FloatPoint();
     734    m_pendingSyntheticClickLocation = { };
    729735    m_pendingSyntheticClickModifiers = { };
    730736    m_pendingSyntheticClickPointerId = 0;
Note: See TracChangeset for help on using the changeset viewer.