Changeset 277316 in webkit
- Timestamp:
- May 10, 2021, 9:31:16 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 10 edited
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/PAL/ChangeLog (modified) (1 diff)
-
Source/WebCore/PAL/pal/spi/mac/NSImmediateActionGestureRecognizerSPI.h (modified) (1 diff)
-
Source/WebCore/page/EventHandler.cpp (modified) (1 diff)
-
Source/WebCore/rendering/HitTestRequest.h (modified) (3 diffs)
-
Source/WebCore/rendering/HitTestResult.cpp (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm (modified) (2 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (modified) (6 diffs)
-
Tools/TestWebKitAPI/Tests/mac/ImmediateActionTests.mm (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r277313 r277316 1 2021-05-10 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [macOS] Allow immediate action gestures to begin when force clicking text inside image overlays 4 https://bugs.webkit.org/show_bug.cgi?id=225600 5 <rdar://problem/77792365> 6 7 Reviewed by Tim Horton. 8 9 Allow immediate action hit-testing to descend into image overlay content. Currently, this uses the 10 `DisallowsUserAgentShadowContent` hit-testing option, causing us to ignore image overlays (which exist inside 11 the UA shadow root). To fix this, we introduce a `DisallowsUserAgentShadowContentExceptForImageOverlays` option 12 that behaves like the existing `DisallowsUserAgentShadowContent` option, with the exception that we allow hit- 13 testing to pierce the UA shadow root to find nodes inside image overlays. 14 15 Tests: ImmediateActionTests.ImmediateActionOverText 16 ImmediateActionTests.ImmediateActionOverBody 17 ImmediateActionTests.ImmediateActionOverImageOverlay 18 19 * page/EventHandler.cpp: 20 (WebCore::EventHandler::hitTestResultAtPoint const): 21 * rendering/HitTestRequest.h: 22 23 Add support for the new hit-test option, which allows hit-testing to descend into image overlays (and is 24 intended to be mutually exclusive with the existing `DisallowsUserAgentShadowContent` option). Specifying both 25 options will lead to an assertion on debug builds, and `DisallowsUserAgentShadowContent` takes precedence on 26 release builds. 27 28 (WebCore::HitTestRequest::disallowsUserAgentShadowContentExceptForImageOverlays const): 29 * rendering/HitTestResult.cpp: 30 (WebCore::HitTestResult::addNodeToListBasedTestResultCommon): 31 1 32 2021-05-10 Sam Weinig <weinig@apple.com> 2 33 -
trunk/Source/WebCore/PAL/ChangeLog
r276828 r277316 1 2021-05-10 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [macOS] Allow immediate action gestures to begin when force clicking text inside image overlays 4 https://bugs.webkit.org/show_bug.cgi?id=225600 5 <rdar://problem/77792365> 6 7 Reviewed by Tim Horton. 8 9 * pal/spi/mac/NSImmediateActionGestureRecognizerSPI.h: 10 1 11 2021-04-29 Jean-Yves Avenard <jya@apple.com> 2 12 -
trunk/Source/WebCore/PAL/pal/spi/mac/NSImmediateActionGestureRecognizerSPI.h
r220979 r277316 57 57 @interface NSImmediateActionGestureRecognizer : NSGestureRecognizer 58 58 59 @property (weak) id <NSImmediateActionGestureRecognizerDelegate> delegate; 59 60 @property (strong) id<NSImmediateActionAnimationController> animationController; 60 61 @property (readonly) CGFloat animationProgress; -
trunk/Source/WebCore/page/EventHandler.cpp
r277295 r277316 1191 1191 m_frame.document()->updateHoverActiveState(request, result.targetElement()); 1192 1192 1193 if (request.disallowsUserAgentShadowContent()) 1193 auto innerNode = makeRefPtr(result.innerNode()); 1194 if (request.disallowsUserAgentShadowContent() 1195 || (request.disallowsUserAgentShadowContentExceptForImageOverlays() && innerNode && !HTMLElement::isInsideImageOverlay(*innerNode))) 1194 1196 result.setToNonUserAgentShadowAncestor(); 1195 1197 -
trunk/Source/WebCore/rendering/HitTestRequest.h
r277295 r277316 40 40 TouchEvent = 1 << 7, 41 41 DisallowUserAgentShadowContent = 1 << 8, 42 AllowFrameScrollbars = 1 << 9, 43 AllowChildFrameContent = 1 << 10, 44 AllowVisibleChildFrameContentOnly = 1 << 11, 45 ChildFrameHitTest = 1 << 12, 46 AccessibilityHitTest = 1 << 13, 42 DisallowUserAgentShadowContentExceptForImageOverlays = 1 << 9, 43 AllowFrameScrollbars = 1 << 10, 44 AllowChildFrameContent = 1 << 11, 45 AllowVisibleChildFrameContentOnly = 1 << 12, 46 ChildFrameHitTest = 1 << 13, 47 AccessibilityHitTest = 1 << 14, 47 48 // Collect a list of nodes instead of just one. Used for elementsFromPoint and rect-based tests. 48 CollectMultipleElements = 1 << 1 4,49 CollectMultipleElements = 1 << 15, 49 50 // When using list-based testing, continue hit testing even after a hit has been found. 50 IncludeAllElementsUnderPoint = 1 << 1 5,51 IncludeAllElementsUnderPoint = 1 << 16, 51 52 }; 52 53 … … 54 55 : m_type { type } 55 56 { 57 ASSERT(!type.containsAll({ Type::DisallowUserAgentShadowContentExceptForImageOverlays, Type::DisallowUserAgentShadowContent })); 56 58 ASSERT_IMPLIES(type.contains(Type::IncludeAllElementsUnderPoint), type.contains(Type::CollectMultipleElements)); 57 59 } … … 67 69 bool mouseEvent() const { return !touchEvent(); } 68 70 bool disallowsUserAgentShadowContent() const { return m_type.contains(Type::DisallowUserAgentShadowContent); } 71 bool disallowsUserAgentShadowContentExceptForImageOverlays() const { return m_type.contains(Type::DisallowUserAgentShadowContentExceptForImageOverlays); } 69 72 bool allowsFrameScrollbars() const { return m_type.contains(Type::AllowFrameScrollbars); } 70 73 bool allowsChildFrameContent() const { return m_type.contains(Type::AllowChildFrameContent); } -
trunk/Source/WebCore/rendering/HitTestResult.cpp
r275072 r277316 657 657 return HitTestProgress::Continue; 658 658 659 if (request.disallowsUserAgentShadowContent() && node->isInUserAgentShadowTree()) 659 if ((request.disallowsUserAgentShadowContent() && node->isInUserAgentShadowTree()) 660 || (request.disallowsUserAgentShadowContentExceptForImageOverlays() && !HTMLElement::isInsideImageOverlay(*node) && node->isInUserAgentShadowTree())) 660 661 node = node->document().ancestorNodeInThisScope(node); 661 662 -
trunk/Source/WebKit/ChangeLog
r277313 r277316 1 2021-05-10 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [macOS] Allow immediate action gestures to begin when force clicking text inside image overlays 4 https://bugs.webkit.org/show_bug.cgi?id=225600 5 <rdar://problem/77792365> 6 7 Reviewed by Tim Horton. 8 9 Adopt the new hit-test option. See WebCore/ChangeLog for more details. 10 11 * WebProcess/WebPage/mac/WebPageMac.mm: 12 (WebKit::WebPage::performImmediateActionHitTestAtLocation): 13 (WebKit::WebPage::lookupTextAtLocation): 14 1 15 2021-05-10 Sam Weinig <weinig@apple.com> 2 16 -
trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm
r277295 r277316 859 859 } 860 860 861 IntPoint locationInContentCoordinates = mainFrame.view()->rootViewToContents(roundedIntPoint(locationInViewCoordinates)); 862 constexpr OptionSet<HitTestRequest::Type> hitType { HitTestRequest::Type::ReadOnly, HitTestRequest::Type::Active, HitTestRequest::Type::DisallowUserAgentShadowContent, HitTestRequest::Type::AllowChildFrameContent }; 863 HitTestResult hitTestResult = mainFrame.eventHandler().hitTestResultAtPoint(locationInContentCoordinates, hitType); 861 auto locationInContentCoordinates = mainFrame.view()->rootViewToContents(roundedIntPoint(locationInViewCoordinates)); 862 auto hitTestResult = mainFrame.eventHandler().hitTestResultAtPoint(locationInContentCoordinates, { 863 HitTestRequest::Type::ReadOnly, 864 HitTestRequest::Type::Active, 865 HitTestRequest::Type::DisallowUserAgentShadowContentExceptForImageOverlays, 866 HitTestRequest::Type::AllowChildFrameContent, 867 }); 864 868 865 869 bool immediateActionHitTestPreventsDefault = false; … … 959 963 return WTF::nullopt; 960 964 961 auto point = roundedIntPoint(locationInViewCoordinates); 962 constexpr OptionSet<HitTestRequest::Type> hitType { HitTestRequest::Type::ReadOnly, HitTestRequest::Type::Active, HitTestRequest::Type::DisallowUserAgentShadowContent, HitTestRequest::Type::AllowChildFrameContent }; 963 auto result = mainFrame.eventHandler().hitTestResultAtPoint(m_page->mainFrame().view()->windowToContents(point), hitType); 964 return DictionaryLookup::rangeAtHitTestResult(result); 965 return DictionaryLookup::rangeAtHitTestResult(mainFrame.eventHandler().hitTestResultAtPoint(m_page->mainFrame().view()->windowToContents(roundedIntPoint(locationInViewCoordinates)), { 966 HitTestRequest::Type::ReadOnly, 967 HitTestRequest::Type::Active, 968 HitTestRequest::Type::DisallowUserAgentShadowContentExceptForImageOverlays, 969 HitTestRequest::Type::AllowChildFrameContent, 970 })); 965 971 } 966 972 -
trunk/Tools/ChangeLog
r277301 r277316 1 2021-05-10 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [macOS] Allow immediate action gestures to begin when force clicking text inside image overlays 4 https://bugs.webkit.org/show_bug.cgi?id=225600 5 <rdar://problem/77792365> 6 7 Reviewed by Tim Horton. 8 9 Add new API tests to exercise these changes by grabbing the immediate action `NSGestureRecognizer` from 10 `WKWebView` and calling into its delegate. This patch adds two basic immediate action tests by simulating the 11 immediate action over text and the body element, and includes a third test that installs an image overlay using 12 an injected `internals` object, and verifies that the immediate action in an image overlay matches that of 13 regular text on the page. 14 15 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 16 * TestWebKitAPI/Tests/mac/ImmediateActionTests.mm: Added. 17 (swizzledImmediateActionLocationInView): 18 (-[WKWebViewForTestingImmediateActions _immediateActionAnimationControllerForHitTestResult:withType:userData:]): 19 (-[WKWebViewForTestingImmediateActions immediateActionGesture]): 20 (-[WKWebViewForTestingImmediateActions simulateImmediateAction:]): 21 (TestWebKitAPI::TEST): 22 1 23 2021-05-10 Kate Cheney <katherine_cheney@apple.com> 2 24 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r277271 r277316 869 869 93F56DA91E5F919D003EDE84 /* WKWebViewSnapshot.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93F56DA81E5F9181003EDE84 /* WKWebViewSnapshot.mm */; }; 870 870 93F7E86F14DC8E5C00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F7E86E14DC8E5B00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp */; }; 871 93FCDB34263631560046DD7D /* SortedArrayMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93FCDB33263631560046DD7D /* SortedArrayMap.cpp */; }; 871 872 95095F20262FFFA50000D920 /* SampledPageTopColor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95095F1F262FFFA50000D920 /* SampledPageTopColor.mm */; }; 872 93FCDB34263631560046DD7D /* SortedArrayMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93FCDB33263631560046DD7D /* SortedArrayMap.cpp */; };873 873 950E4CC1252E75240071659F /* iOSStylusSupport.mm in Sources */ = {isa = PBXBuildFile; fileRef = 950E4CC0252E75230071659F /* iOSStylusSupport.mm */; }; 874 874 953ABB3525C0D682004C8B73 /* PageExtendedBackgroundColor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 953ABB3425C0D681004C8B73 /* PageExtendedBackgroundColor.mm */; }; … … 1180 1180 F4451C761EB8FD890020C5DA /* two-paragraph-contenteditable.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4451C751EB8FD7C0020C5DA /* two-paragraph-contenteditable.html */; }; 1181 1181 F44A531121B8990300DBB99C /* InstanceMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A531021B8976900DBB99C /* InstanceMethodSwizzler.mm */; }; 1182 F44A9AF72649BBDD00E7CB16 /* ImmediateActionTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A9AF62649BBDD00E7CB16 /* ImmediateActionTests.mm */; }; 1182 1183 F44C79FF20F9E8710014478C /* ParserYieldTokenTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44C79FE20F9E8710014478C /* ParserYieldTokenTests.mm */; }; 1183 1184 F44C7A0020F9EEBF0014478C /* ParserYieldTokenPlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44C79FB20F9E50C0014478C /* ParserYieldTokenPlugIn.mm */; }; … … 2566 2567 93F7E86B14DC8E4D00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NewFirstVisuallyNonEmptyLayoutFrames.cpp; sourceTree = "<group>"; }; 2567 2568 93F7E86E14DC8E5B00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp; sourceTree = "<group>"; }; 2569 93FCDB33263631560046DD7D /* SortedArrayMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SortedArrayMap.cpp; sourceTree = "<group>"; }; 2568 2570 95095F1F262FFFA50000D920 /* SampledPageTopColor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SampledPageTopColor.mm; sourceTree = "<group>"; }; 2569 93FCDB33263631560046DD7D /* SortedArrayMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SortedArrayMap.cpp; sourceTree = "<group>"; };2570 2571 950E4CC0252E75230071659F /* iOSStylusSupport.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = iOSStylusSupport.mm; sourceTree = "<group>"; }; 2571 2572 953ABB3425C0D681004C8B73 /* PageExtendedBackgroundColor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageExtendedBackgroundColor.mm; sourceTree = "<group>"; }; … … 2998 2999 F44A530F21B8976900DBB99C /* ClassMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClassMethodSwizzler.h; path = ../TestRunnerShared/cocoa/ClassMethodSwizzler.h; sourceTree = "<group>"; }; 2999 3000 F44A531021B8976900DBB99C /* InstanceMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = InstanceMethodSwizzler.mm; path = ../TestRunnerShared/cocoa/InstanceMethodSwizzler.mm; sourceTree = "<group>"; }; 3001 F44A9AF52649BBDD00E7CB16 /* ImmediateActionTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImmediateActionTests.h; sourceTree = "<group>"; }; 3002 F44A9AF62649BBDD00E7CB16 /* ImmediateActionTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ImmediateActionTests.mm; sourceTree = "<group>"; }; 3000 3003 F44C79FB20F9E50C0014478C /* ParserYieldTokenPlugIn.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ParserYieldTokenPlugIn.mm; sourceTree = "<group>"; }; 3001 3004 F44C79FD20F9E8710014478C /* ParserYieldTokenTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ParserYieldTokenTests.h; sourceTree = "<group>"; }; … … 4681 4684 9B4F8FA3159D52B1002D9F94 /* HTMLCollectionNamedItem.mm */, 4682 4685 9B26FC6B159D061000CC3765 /* HTMLFormCollectionNamedItem.mm */, 4686 F44A9AF52649BBDD00E7CB16 /* ImmediateActionTests.h */, 4687 F44A9AF62649BBDD00E7CB16 /* ImmediateActionTests.mm */, 4683 4688 C507E8A614C6545B005D6B3B /* InspectorBar.mm */, 4684 4689 57F10D921C7E7B3800ECDF30 /* IsNavigationActionTrusted.mm */, … … 5468 5473 5110FCFA1E01CDB8006F8D0B /* IDBIndexUpgradeToV2.mm in Sources */, 5469 5474 93BCBC8323CC6F2A00CA2221 /* IDBObjectStoreInfoUpgradeToV2.mm in Sources */, 5475 F44A9AF72649BBDD00E7CB16 /* ImmediateActionTests.mm in Sources */, 5470 5476 49AEEF6D2407359D00C87E4C /* InAppBrowserPrivacy.mm in Sources */, 5471 5477 51A587861D273AA9004BA9AF /* IndexedDBDatabaseProcessKill.mm in Sources */,
Note:
See TracChangeset
for help on using the changeset viewer.