Changeset 243557 in webkit
- Timestamp:
- Mar 27, 2019, 12:41:22 PM (7 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
WebProcess/WebPage/ios/WebPageIOS.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r243553 r243557 1 2019-03-27 Zalan Bujtas <zalan@apple.com> 2 3 [ContentChangeObserver] Always dispatch the synthetic click asynchronously 4 https://bugs.webkit.org/show_bug.cgi?id=196278 5 <rdar://problem/49299968> 6 7 Reviewed by Simon Fraser. 8 9 This patch ensures that all completeSyntheticClick() calls happen in an asynchronous manner (unless the feature is turned off). 10 11 * WebProcess/WebPage/ios/WebPageIOS.mm: 12 (WebKit::dispatchSyntheticMouseMove): 13 (WebKit::WebPage::handleSyntheticClick): 14 1 15 2019-03-27 Tim Horton <timothy_horton@apple.com> 2 16 -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r243415 r243557 562 562 auto metaKey = modifiers.contains(WebEvent::Modifier::MetaKey); 563 563 auto mouseEvent = PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, NoButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, altKey, metaKey, WallTime::now(), WebCore::ForceAtClick, WebCore::NoTap); 564 // FIXME: Pass caps lock state. 564 565 mainFrame.eventHandler().dispatchSyntheticMouseMove(mouseEvent); 565 566 } … … 567 568 void WebPage::handleSyntheticClick(Node& nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebEvent::Modifier> modifiers) 568 569 { 570 if (!nodeRespondingToClick.document().settings().contentChangeObserverEnabled()) { 571 completeSyntheticClick(nodeRespondingToClick, location, modifiers, WebCore::OneFingerTap); 572 return; 573 } 574 569 575 auto& respondingDocument = nodeRespondingToClick.document(); 570 auto& mainFrame = m_page->mainFrame();571 // FIXME: Pass caps lock state.572 576 { 573 577 LOG_WITH_STREAM(ContentObservation, stream << "handleSyntheticClick: node(" << &nodeRespondingToClick << ") " << location); 574 578 ContentChangeObserver::MouseMovedScope observingScope(respondingDocument); 579 auto& mainFrame = m_page->mainFrame(); 575 580 dispatchSyntheticMouseMove(mainFrame, location, modifiers); 576 581 mainFrame.document()->updateStyleIfNeeded(); … … 580 585 return; 581 586 582 if (is<HTMLFormControlElement>(nodeRespondingToClick)) {583 LOG(ContentObservation, "handleSyntheticClick: Target node is a form control -> click.");584 completeSyntheticClick(nodeRespondingToClick, location, modifiers, WebCore::OneFingerTap);585 return;586 }587 587 auto& contentChangeObserver = respondingDocument.contentChangeObserver(); 588 588 auto observedContentChange = contentChangeObserver.observedContentChange(); 589 if (observedContentChange == WKContentVisibilityChange) { 590 // The move event caused new contents to appear. Don't send the click event, but just ensure that the mouse is on the most recent content. 591 dispatchSyntheticMouseMove(mainFrame, location, modifiers); 592 LOG(ContentObservation, "handleSyntheticClick: Observed meaningful visible change -> hover."); 593 return; 594 } 595 const Seconds observationDuration = 32_ms; 596 contentChangeObserver.startContentObservationForDuration(observationDuration); 597 if (contentChangeObserver.observedContentChange() == WKContentNoChange) { 598 ASSERT(!respondingDocument.settings().contentChangeObserverEnabled()); 599 completeSyntheticClick(nodeRespondingToClick, location, modifiers, WebCore::OneFingerTap); 600 return; 601 } 602 603 LOG(ContentObservation, "handleSyntheticClick: Can't decide it yet -> wait."); 604 // Wait for callback to completePendingSyntheticClickForContentChangeObserver() to decide whether to send the click event. 605 m_pendingSyntheticClickNode = &nodeRespondingToClick; 606 m_pendingSyntheticClickLocation = location; 607 m_pendingSyntheticClickModifiers = modifiers; 589 590 auto continueContentObservation = !(observedContentChange == WKContentVisibilityChange || is<HTMLFormControlElement>(nodeRespondingToClick)); 591 if (continueContentObservation) { 592 // Wait for callback to completePendingSyntheticClickForContentChangeObserver() to decide whether to send the click event. 593 const Seconds observationDuration = 32_ms; 594 contentChangeObserver.startContentObservationForDuration(observationDuration); 595 LOG(ContentObservation, "handleSyntheticClick: Can't decide it yet -> wait."); 596 m_pendingSyntheticClickNode = &nodeRespondingToClick; 597 m_pendingSyntheticClickLocation = location; 598 m_pendingSyntheticClickModifiers = modifiers; 599 return; 600 } 601 602 callOnMainThread([protectedThis = makeRefPtr(this), targetNode = Ref<Node>(nodeRespondingToClick), location, modifiers, observedContentChange] { 603 if (protectedThis->m_isClosed || !protectedThis->corePage()) 604 return; 605 606 if (observedContentChange == WKContentVisibilityChange) { 607 // The move event caused new contents to appear. Don't send synthetic click event, but just ensure that the mouse is on the most recent content. 608 dispatchSyntheticMouseMove(protectedThis->corePage()->mainFrame(), location, modifiers); 609 LOG(ContentObservation, "handleSyntheticClick: Observed meaningful visible change -> hover."); 610 return; 611 } 612 LOG(ContentObservation, "handleSyntheticClick: calling completeSyntheticClick -> click."); 613 protectedThis->completeSyntheticClick(targetNode, location, modifiers, WebCore::OneFingerTap); 614 }); 608 615 } 609 616
Note:
See TracChangeset
for help on using the changeset viewer.