Changeset 286552 in webkit
- Timestamp:
- Dec 6, 2021, 11:00:25 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 6 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)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r286549 r286552 1 2021-12-06 Matt Gilligan <matthew_gilligan@apple.com> 2 3 [iOS] Allow WKWebView clients to override undoManager 4 https://bugs.webkit.org/show_bug.cgi?id=233297 5 <rdar://problem/85526549> 6 7 Reviewed by Wenson Hsieh. 8 9 Move WKContentView's undoManager up the responder chain to WKWebView so web view 10 subclasses can customize the undo manager used when WKContentView is first responder. 11 12 Test: KeyboardInputTests.OverrideUndoManager 13 14 * UIProcess/API/ios/WKWebViewIOS.mm: 15 (-[WKWebView undoManager]): 16 Return the undo manager provided by _contentView when it is current. 17 18 * UIProcess/ios/WKContentView.h: 19 * UIProcess/ios/WKContentView.mm: 20 (-[WKContentView undoManagerForWebView]): 21 Provide the view's undo manager via this property so that -undoManager will look up the 22 responder chain to WKWebView. 23 24 (-[WKContentView undoManager]): Deleted. 25 1 26 2021-12-06 Lauro Moura <lmoura@igalia.com> 2 27 -
trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
r285424 r286552 319 319 } 320 320 321 - (NSUndoManager *)undoManager 322 { 323 if (self._currentContentView == _contentView) 324 return [_contentView undoManagerForWebView]; 325 326 return [super undoManager]; 327 } 328 321 329 FOR_EACH_WKCONTENTVIEW_ACTION(FORWARD_ACTION_TO_WKCONTENTVIEW) 322 330 -
trunk/Source/WebKit/UIProcess/ios/WKContentView.h
r280875 r286552 72 72 @property (nonatomic) BOOL sizeChangedSinceLastVisibleContentRectUpdate; 73 73 @property (nonatomic, readonly) UIInterfaceOrientation interfaceOrientation; 74 @property (nonatomic, readonly) NSUndoManager *undoManagerForWebView; 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
r281610 r286552 563 563 } 564 564 565 - (NSUndoManager *)undoManager 565 - (NSUndoManager *)undoManagerForWebView 566 566 { 567 567 if (self.focusedElementInformation.shouldSynthesizeKeyEventsForEditing && self.hasHiddenContentEditable) { -
trunk/Tools/ChangeLog
r286547 r286552 1 2021-12-06 Matt Gilligan <matthew_gilligan@apple.com> 2 3 [iOS] Allow WKWebView clients to override undoManager 4 https://bugs.webkit.org/show_bug.cgi?id=233297 5 <rdar://problem/85526549> 6 7 Reviewed by Wenson Hsieh. 8 9 * TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm: 10 (-[CustomUndoManagerWebView undoManager]): 11 (TestWebKitAPI::TEST): 12 1 13 2021-12-06 Wenson Hsieh <wenson_hsieh@apple.com> 2 14 -
trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm
r273759 r286552 43 43 44 44 @interface WKContentView () 45 @property (nonatomic, readonly) NSUndoManager *undoManagerForWebView; 45 46 - (BOOL)_shouldSimulateKeyboardInputOnTextInsertion; 46 47 @end … … 184 185 { 185 186 return _customInputAccessoryView.get(); 187 } 188 189 @end 190 191 @interface CustomUndoManagerWebView : TestWKWebView 192 @property (nonatomic, strong) NSUndoManager *customUndoManager; 193 @end 194 195 @implementation CustomUndoManagerWebView 196 197 - (NSUndoManager *)undoManager 198 { 199 return _customUndoManager ?: super.undoManager; 186 200 } 187 201 … … 802 816 } 803 817 818 TEST(KeyboardInputTests, OverrideUndoManager) 819 { 820 auto webView = adoptNS([[CustomUndoManagerWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); 821 auto contentView = [webView wkContentView]; 822 EXPECT_EQ(contentView.undoManager, contentView.undoManagerForWebView); 823 824 auto undoManager = adoptNS([[NSUndoManager alloc] init]); 825 [webView setCustomUndoManager:undoManager.get()]; 826 EXPECT_EQ(contentView.undoManager, undoManager); 827 } 828 804 829 } // namespace TestWebKitAPI 805 830
Note:
See TracChangeset
for help on using the changeset viewer.