Changeset 275297 in webkit
- Timestamp:
- Mar 31, 2021, 11:33:39 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/WKContentView.h (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/WKContentView.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (modified) (4 diffs)
-
Tools/TestWebKitAPI/Tests/ios/UIFocusTests.mm (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r275294 r275297 1 2021-03-31 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 WKContentView should support UIKit protocol methods for becoming focused 4 https://bugs.webkit.org/show_bug.cgi?id=224003 5 <rdar://problem/75313658> 6 7 Reviewed by Megan Gardner. 8 9 Implement a few protocol methods on `UIFocusEnvironment`. See below for more details. 10 11 Test: UIFocusTests.OverrideCanBecomeFocused 12 13 * UIProcess/API/ios/WKWebViewIOS.mm: 14 (-[WKWebView canBecomeFocused]): 15 * UIProcess/ios/WKContentView.h: 16 * UIProcess/ios/WKContentView.mm: 17 (-[WKContentView canBecomeFocused]): 18 (-[WKContentView canBecomeFocusedForWebView]): 19 20 Implement `-canBecomeFocused`, and return `YES` by default. If `-canBecomeFocused` is overridden on `WKWebView`, 21 then defer to that overridden method instead. 22 23 (-[WKContentView didUpdateFocusInContext:withAnimationCoordinator:]): 24 25 Handle the focus environment change by advancing to the next or previous focusable element, depending on the 26 focus context's heading direction. 27 28 * UIProcess/ios/WKContentViewInteraction.mm: 29 (-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]): 30 31 Add a null check so that callers that don't need to know when the focus change is complete are able to pass in a 32 `nil` completion handler. 33 1 34 2021-03-31 Youenn Fablet <youenn@apple.com> 2 35 -
trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
r275046 r275297 2519 2519 } 2520 2520 2521 - (BOOL)canBecomeFocused 2522 { 2523 if (self.usesStandardContentView) 2524 return [_contentView canBecomeFocusedForWebView]; 2525 2526 return [_customContentView canBecomeFocused]; 2527 } 2528 2521 2529 @end 2522 2530 -
trunk/Source/WebKit/UIProcess/ios/WKContentView.h
r271771 r275297 72 72 @property (nonatomic) BOOL sizeChangedSinceLastVisibleContentRectUpdate; 73 73 @property (nonatomic, readonly) UIInterfaceOrientation interfaceOrientation; 74 @property (nonatomic, readonly) BOOL canBecomeFocusedForWebView; 74 75 75 76 - (instancetype)initWithFrame:(CGRect)frame processPool:(NakedRef<WebKit::WebProcessPool>)processPool configuration:(Ref<API::PageConfiguration>&&)configuration webView:(WKWebView *)webView; -
trunk/Source/WebKit/UIProcess/ios/WKContentView.mm
r274822 r275297 532 532 } 533 533 534 - (BOOL)canBecomeFocused 535 { 536 return [_webView canBecomeFocused]; 537 } 538 539 - (BOOL)canBecomeFocusedForWebView 540 { 541 return YES; 542 } 543 544 - (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator 545 { 546 [self _becomeFirstResponderWithSelectionMovingForward:context.focusHeading == UIFocusHeadingNext completionHandler:nil]; 547 } 548 534 549 #pragma mark Internal 535 550 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r275270 r275297 4549 4549 constexpr bool isKeyboardEventValid = false; 4550 4550 _page->setInitialFocus(selectingForward, isKeyboardEventValid, { }, [protectedSelf = retainPtr(self), completionHandler = makeBlockPtr(completionHandler)] { 4551 completionHandler([protectedSelf becomeFirstResponder]); 4551 if (completionHandler) 4552 completionHandler([protectedSelf becomeFirstResponder]); 4552 4553 }); 4553 4554 } -
trunk/Tools/ChangeLog
r275290 r275297 1 2021-03-31 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 WKContentView should support UIKit protocol methods for becoming focused 4 https://bugs.webkit.org/show_bug.cgi?id=224003 5 <rdar://problem/75313658> 6 7 Reviewed by Megan Gardner. 8 9 Add a test to verify that the vaue of `-[WKContentView canBecomeFocused]` can be overridden by subclassing 10 `-[WKWebView canBecomeFocused]`. 11 12 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 13 * TestWebKitAPI/Tests/ios/UIFocusTests.mm: Added. 14 (-[UIFocusTestWKWebView canBecomeFocused]): 15 1 16 2021-03-31 Alex Christensen <achristensen@webkit.org> 2 17 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r275267 r275297 1188 1188 F460F65B261119580064F2B6 /* InjectedBundleHitTestPlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = F460F659261117E70064F2B6 /* InjectedBundleHitTestPlugIn.mm */; }; 1189 1189 F460F669261263370064F2B6 /* simple-responsive-page.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F460F668261262C70064F2B6 /* simple-responsive-page.html */; }; 1190 F460F6752614DE2F0064F2B6 /* UIFocusTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F460F6742614DE2F0064F2B6 /* UIFocusTests.mm */; }; 1190 1191 F46128B7211C8ED500D9FADB /* DragAndDropSimulatorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = F46128B6211C8ED500D9FADB /* DragAndDropSimulatorMac.mm */; }; 1191 1192 F46128CB211D475100D9FADB /* TestDraggingInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = F46128CA211D475100D9FADB /* TestDraggingInfo.mm */; }; … … 2995 2996 F460F65A2611183F0064F2B6 /* InjectedBundleHitTestProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InjectedBundleHitTestProtocol.h; sourceTree = "<group>"; }; 2996 2997 F460F668261262C70064F2B6 /* simple-responsive-page.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "simple-responsive-page.html"; sourceTree = "<group>"; }; 2998 F460F6742614DE2F0064F2B6 /* UIFocusTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UIFocusTests.mm; sourceTree = "<group>"; }; 2997 2999 F46128B4211C861A00D9FADB /* DragAndDropSimulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DragAndDropSimulator.h; path = cocoa/DragAndDropSimulator.h; sourceTree = "<group>"; }; 2998 3000 F46128B6211C8ED500D9FADB /* DragAndDropSimulatorMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DragAndDropSimulatorMac.mm; sourceTree = "<group>"; }; … … 3775 3777 F45E15752112CE6200307E82 /* TestInputDelegate.mm */, 3776 3778 F45033F4206BEC95009351CE /* TextAutosizingBoost.mm */, 3779 F460F6742614DE2F0064F2B6 /* UIFocusTests.mm */, 3777 3780 F46849BD1EEF58E400B937FE /* UIPasteboardTests.mm */, 3778 3781 F402F56B23ECC2FB00865549 /* UIWKInteractionViewProtocol.mm */, … … 5681 5684 57152B7821DD4E8D000C37CA /* U2fCommandConstructorTest.cpp in Sources */, 5682 5685 5CB40B4E1F4B98D3007DC7B9 /* UIDelegate.mm in Sources */, 5686 F460F6752614DE2F0064F2B6 /* UIFocusTests.mm in Sources */, 5683 5687 F46849BE1EEF58E400B937FE /* UIPasteboardTests.mm in Sources */, 5684 5688 F402F56C23ECC2FB00865549 /* UIWKInteractionViewProtocol.mm in Sources */,
Note:
See TracChangeset
for help on using the changeset viewer.