Changeset 278515 in webkit
- Timestamp:
- Jun 4, 2021, 5:57:43 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r278512 r278515 1 2021-06-04 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] Meaningful click heuristic should account for media state changes 4 https://bugs.webkit.org/show_bug.cgi?id=226655 5 rdar://78330664 6 7 Reviewed by Tim Horton and Devin Rousso. 8 9 Add a layout test to verify that tapping to play or pause a video triggers "meaningful" synthetic clicks. 10 11 * fast/events/ios/meaningful-click-when-playing-media-expected.txt: Added. 12 * fast/events/ios/meaningful-click-when-playing-media.html: Added. 13 1 14 2021-06-04 Devin Rousso <drousso@apple.com> 2 15 -
trunk/Source/WebKit/ChangeLog
r278514 r278515 1 2021-06-04 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] Meaningful click heuristic should account for media state changes 4 https://bugs.webkit.org/show_bug.cgi?id=226655 5 rdar://78330664 6 7 Reviewed by Tim Horton and Devin Rousso. 8 9 Teach the "meaningful click" heuristic about changes to media element state flags. See comments below for more 10 details. 11 12 Test: fast/events/ios/meaningful-click-when-playing-media.html 13 14 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 15 (WebKit::WebChromeClient::isPlayingMediaDidChange): 16 * WebProcess/WebPage/WebPage.cpp: 17 (WebKit::WebPage::isPlayingMediaDidChange): 18 19 Refactor some logic here so that the WebChromeClient calls into WebPage, which then sends an IPC message to the 20 UI process and additionally calls into a private method for platform-specific logic (see WebPageIOS.mm). 21 22 * WebProcess/WebPage/WebPage.h: 23 24 Replace `m_didHandleOrPreventMouseDownOrMouseUpEventDuringSyntheticClick` with another flag, 25 `m_currentSyntheticClickMayNotBeMeaningful`, that is initially set to `true` at the beginning of 26 `WebPage::completeSyntheticClick`, and consulted after the events have been dispatched to see if anything has 27 set it to `false` (currently, this includes only playing media state changes and handled click events by the 28 page). If the flag is set to `false`, we then consider the click to have been "meaningful", with respect to the 29 `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` UI delegate method. 30 31 (WebKit::WebPage::platformIsPlayingMediaDidChange): 32 * WebProcess/WebPage/ios/WebPageIOS.mm: 33 (WebKit::WebPage::completeSyntheticClick): 34 (WebKit::WebPage::didHandleOrPreventMouseDownOrMouseUpEvent): 35 (WebKit::WebPage::platformIsPlayingMediaDidChange): 36 37 Make these set `m_currentSyntheticClickMayNotBeMeaningful` to `false`. 38 1 39 2021-06-04 Ryosuke Niwa <rniwa@webkit.org> 2 40 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
r278482 r278515 1236 1236 void WebChromeClient::isPlayingMediaDidChange(MediaProducer::MediaStateFlags state) 1237 1237 { 1238 m_page. send(Messages::WebPageProxy::IsPlayingMediaDidChange(state));1238 m_page.isPlayingMediaDidChange(state); 1239 1239 } 1240 1240 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r278394 r278515 7361 7361 } 7362 7362 7363 void WebPage::isPlayingMediaDidChange(WebCore::MediaProducer::MediaStateFlags state) 7364 { 7365 platformIsPlayingMediaDidChange(); 7366 send(Messages::WebPageProxy::IsPlayingMediaDidChange(state)); 7367 } 7363 7368 7364 7369 #if ENABLE(MEDIA_USAGE) -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r278394 r278515 1402 1402 #endif 1403 1403 1404 void isPlayingMediaDidChange(WebCore::MediaProducer::MediaStateFlags); 1405 1404 1406 #if ENABLE(IMAGE_EXTRACTION) 1405 1407 void requestImageExtraction(WebCore::Element&, CompletionHandler<void(RefPtr<WebCore::Element>&&)>&&); … … 1898 1900 void consumeNetworkExtensionSandboxExtensions(const SandboxExtension::HandleArray&); 1899 1901 1902 void platformIsPlayingMediaDidChange(); 1903 1900 1904 WebCore::PageIdentifier m_identifier; 1901 1905 … … 2186 2190 WebCore::FloatPoint m_potentialTapLocation; 2187 2191 RefPtr<WebCore::SecurityOrigin> m_potentialTapSecurityOrigin; 2188 bool m_didHandleOrPreventMouseDownOrMouseUpEventDuringSyntheticClick { false }; 2189 2192 2193 bool m_currentSyntheticClickMayNotBeMeaningful { true }; 2190 2194 bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad { false }; 2191 2195 bool m_hasRestoredExposedContentRectAfterDidCommitLoad { false }; … … 2359 2363 inline void WebPage::didHandleOrPreventMouseDownOrMouseUpEvent() { } 2360 2364 inline void WebPage::prepareToRunModalJavaScriptDialog() { } 2365 inline void WebPage::platformIsPlayingMediaDidChange() { } 2361 2366 #endif 2362 2367 -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r278459 r278515 875 875 bool metaKey = modifiers.contains(WebEvent::Modifier::MetaKey); 876 876 877 m_ didHandleOrPreventMouseDownOrMouseUpEventDuringSyntheticClick = false;877 m_currentSyntheticClickMayNotBeMeaningful = true; 878 878 879 879 tapWasHandled |= mainframe.eventHandler().handleMousePressEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MousePressed, 1, shiftKey, ctrlKey, altKey, metaKey, WallTime::now(), WebCore::ForceAtClick, syntheticClickType, pointerId)); … … 904 904 905 905 bool shouldDispatchDidNotHandleTapAsMeaningfulClickAtPoint = ([&] { 906 if ( m_didHandleOrPreventMouseDownOrMouseUpEventDuringSyntheticClick)906 if (!m_currentSyntheticClickMayNotBeMeaningful) 907 907 return false; 908 908 … … 925 925 send(Messages::WebPageProxy::DidNotHandleTapAsClick(roundedIntPoint(location))); 926 926 927 m_didHandleOrPreventMouseDownOrMouseUpEventDuringSyntheticClick = false;928 929 927 send(Messages::WebPageProxy::DidCompleteSyntheticClick()); 930 928 } … … 948 946 void WebPage::didHandleOrPreventMouseDownOrMouseUpEvent() 949 947 { 950 m_ didHandleOrPreventMouseDownOrMouseUpEventDuringSyntheticClick = true;948 m_currentSyntheticClickMayNotBeMeaningful = false; 951 949 } 952 950 … … 4695 4693 } 4696 4694 4695 void WebPage::platformIsPlayingMediaDidChange() 4696 { 4697 m_currentSyntheticClickMayNotBeMeaningful = false; 4698 } 4699 4697 4700 } // namespace WebKit 4698 4701
Note:
See TracChangeset
for help on using the changeset viewer.