Changeset 287810 in webkit
- Timestamp:
- Jan 8, 2022, 8:40:34 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 15 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/accessibility/ios-simulator/accessibility-make-first-responder-expected.txt (added)
-
LayoutTests/accessibility/ios-simulator/accessibility-make-first-responder.html (added)
-
LayoutTests/accessibility/ios-simulator/taking-focus-should-refocus-page-expected.txt (added)
-
LayoutTests/accessibility/ios-simulator/taking-focus-should-refocus-page.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/accessibility/AccessibilityObject.cpp (modified) (2 diffs)
-
Source/WebCore/testing/Internals.cpp (modified) (1 diff)
-
Source/WebCore/testing/Internals.h (modified) (1 diff)
-
Source/WebCore/testing/Internals.idl (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (modified) (1 diff)
-
Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (modified) (1 diff)
-
Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm (modified) (2 diffs)
-
Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h (modified) (1 diff)
-
Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r287805 r287810 1 2022-01-08 Tyler Wilcock <tyler_w@apple.com> 2 3 AX: AccessibilityObject::setFocused(true) should make the webpage focused, and make web content the first responder 4 https://bugs.webkit.org/show_bug.cgi?id=234885 5 6 Reviewed by Darin Adler. 7 8 Add tests verifying that focusing an element via an AX client: 9 10 1. Makes the page focused immediately 11 2. Makes web content the first responder 12 13 This allows a focus ring to be drawn, even when apps that embed 14 WKWebViews don't make web content the first responder themselves. 15 16 * accessibility/ios-simulator/accessibility-make-first-responder-expected.txt: Added. 17 * accessibility/ios-simulator/accessibility-make-first-responder.html: Added. 18 * accessibility/ios-simulator/taking-focus-should-refocus-page-expected.txt: Added. 19 * accessibility/ios-simulator/taking-focus-should-refocus-page.html: Added. 20 1 21 2022-01-07 Myles C. Maxfield <mmaxfield@apple.com> 2 22 -
trunk/Source/WebCore/ChangeLog
r287809 r287810 1 2022-01-08 Tyler Wilcock <tyler_w@apple.com> 2 3 AX: AccessibilityObject::setFocused(true) should make the webpage focused, and make web content the first responder 4 https://bugs.webkit.org/show_bug.cgi?id=234885 5 6 Reviewed by Darin Adler. 7 8 With this patch, focusing an element via an AX client on iOS makes 9 the page focused immediately. This allows a focus ring to be drawn, 10 even when apps that embed WKWebViews don't make web content the 11 first responder themselves (`[WKContentViewInteraction becomeFirstResponderForWebView]` 12 makes the page focused after a delay due to async IPC between the UI and web processes). 13 14 Tests: accessibility/ios-simulator/accessibility-make-first-responder.html 15 accessibility/ios-simulator/taking-focus-should-refocus-page.html 16 17 * accessibility/AccessibilityObject.cpp: 18 (WebCore::AccessibilityObject::setFocused): 19 Make the webpage focused if it isn't already focused. 20 21 * testing/Internals.cpp: 22 (WebCore::Internals::setPageIsFocused): 23 Added to simulate the scenario where the webpage doesn't gain focus 24 through becoming first responder. 25 * testing/Internals.h: 26 Add setPageIsFocused. 27 * testing/Internals.idl: 28 Add setPageIsFocused. 29 1 30 2022-01-08 Alan Bujtas <zalan@apple.com> 2 31 -
trunk/Source/WebCore/accessibility/AccessibilityObject.cpp
r287232 r287810 2772 2772 if (focus) { 2773 2773 // Ensure that the view is focused and active, otherwise, any attempt to set focus to an object inside it will fail. 2774 auto* document = this->document(); 2775 if (!document) 2776 return; 2777 2778 auto* frame = document->frame(); 2774 auto* frame = document() ? document()->frame() : nullptr; 2779 2775 if (frame && frame->selection().isFocusedAndActive()) 2780 2776 return; // Nothing to do, already focused and active. 2781 2777 2782 auto* page = document ->page();2778 auto* page = document() ? document()->page() : nullptr; 2783 2779 if (!page) 2784 2780 return; 2785 2781 2786 ChromeClient& chromeClient = page->chrome().client(); 2787 chromeClient.focus(); 2782 page->chrome().client().focus(); 2783 // Reset the page pointer in case ChromeClient::focus() caused a side effect that invalidated our old one. 2784 page = document() ? document()->page() : nullptr; 2785 if (!page) 2786 return; 2787 2788 #if PLATFORM(IOS_FAMILY) 2789 // Mark the page as focused so the focus ring can be drawn immediately. The page is also marked 2790 // as focused as part assistiveTechnologyMakeFirstResponder, but that requires some back-and-forth 2791 // IPC between the web and UI processes, during which we can miss the drawing of the focus ring for the 2792 // first focused element. Making the page focused is a requirement for making the page selection focused. 2793 // This is iOS only until there's a demonstrated need for this preemptive focus on other platforms. 2794 if (!page->focusController().isFocused()) 2795 page->focusController().setFocused(true); 2796 2797 // Reset the page pointer in case FocusController::setFocused(true) caused a side effect that invalidated our old one. 2798 page = document() ? document()->page() : nullptr; 2799 if (!page) 2800 return; 2801 #endif 2788 2802 2789 2803 #if PLATFORM(COCOA) … … 2794 2808 // Legacy WebKit1 case. 2795 2809 if (frameView->platformWidget()) 2796 chromeClient.makeFirstResponder((NSResponder *)frameView->platformWidget());2810 page->chrome().client().makeFirstResponder((NSResponder *)frameView->platformWidget()); 2797 2811 else 2798 chromeClient.assistiveTechnologyMakeFirstResponder();2812 page->chrome().client().assistiveTechnologyMakeFirstResponder(); 2799 2813 #endif 2800 2814 } -
trunk/Source/WebCore/testing/Internals.cpp
r287731 r287810 5361 5361 } 5362 5362 5363 void Internals::setPageIsFocused(bool isFocused) 5364 { 5365 updatePageActivityState(ActivityState::IsFocused, isFocused); 5366 } 5367 5363 5368 void Internals::setPageIsFocusedAndActive(bool isFocusedAndActive) 5364 5369 { -
trunk/Source/WebCore/testing/Internals.h
r287663 r287810 846 846 847 847 void setPageVisibility(bool isVisible); 848 void setPageIsFocused(bool); 848 849 void setPageIsFocusedAndActive(bool); 849 850 void setPageIsInWindow(bool); -
trunk/Source/WebCore/testing/Internals.idl
r287663 r287810 886 886 887 887 undefined setPageVisibility(boolean isVisible); 888 undefined setPageIsFocused(boolean isFocused); 888 889 undefined setPageIsFocusedAndActive(boolean isFocused); 889 890 undefined setPageIsInWindow(boolean isInWindow); -
trunk/Source/WebKit/ChangeLog
r287808 r287810 1 2022-01-08 Tyler Wilcock <tyler_w@apple.com> 2 3 AX: AccessibilityObject::setFocused(true) should make the webpage focused, and make web content the first responder 4 https://bugs.webkit.org/show_bug.cgi?id=234885 5 6 Reviewed by Darin Adler. 7 8 With this patch, focusing an element via an AX client on iOS makes web content 9 the first responder. This allows a focus ring to be drawn and for web content 10 to perform other important actions upon taking first respondership 11 (see `[WKContentViewInteraction becomeFirstResponderForWebView]`), even when apps 12 that embed WKWebViews don't make web content the first responder themselves. 13 14 * UIProcess/ios/PageClientImplIOS.mm: 15 (WebKit::PageClientImpl::assistiveTechnologyMakeFirstResponder): 16 * UIProcess/ios/WebPageProxyIOS.mm: 17 (WebKit::WebPageProxy::assistiveTechnologyMakeFirstResponder): 18 1 19 2022-01-07 Jean-Yves Avenard <jya@apple.com> 2 20 -
trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
r287021 r287810 392 392 void PageClientImpl::assistiveTechnologyMakeFirstResponder() 393 393 { 394 notImplemented();394 [m_contentView becomeFirstResponder]; 395 395 } 396 396 -
trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
r287808 r287810 742 742 void WebPageProxy::assistiveTechnologyMakeFirstResponder() 743 743 { 744 notImplemented();744 pageClient().assistiveTechnologyMakeFirstResponder(); 745 745 } 746 746 -
trunk/Tools/ChangeLog
r287790 r287810 1 2022-01-08 Tyler Wilcock <tyler_w@apple.com> 2 3 AX: AccessibilityObject::setFocused(true) should make the webpage focused, and make web content the first responder 4 https://bugs.webkit.org/show_bug.cgi?id=234885 5 6 Reviewed by Darin Adler. 7 8 Add testing functionality necessary to check that web content is the 9 first responder in the UI process. 10 11 * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: 12 * TestRunnerShared/UIScriptContext/UIScriptController.h: 13 (WTR::UIScriptController::isWebContentFirstResponder const): 14 Added. 15 16 * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm: 17 (WTR::AccessibilityUIElement::takeFocus): 18 Implement this method. 19 20 * WebKitTestRunner/ios/UIScriptControllerIOS.h: 21 * WebKitTestRunner/ios/UIScriptControllerIOS.mm: 22 (WTR::UIScriptControllerIOS::isWebContentFirstResponder const): 23 Added. 24 1 25 2022-01-07 Tim Horton <timothy_horton@apple.com> 2 26 -
trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
r280980 r287810 360 360 undefined makeWindowContentViewFirstResponder(); 361 361 readonly attribute boolean isWindowContentViewFirstResponder; 362 readonly attribute boolean isWebContentFirstResponder; 362 363 363 364 undefined setHardwareKeyboardAttached(boolean attached); -
trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
r280980 r287810 119 119 virtual void makeWindowContentViewFirstResponder() { notImplemented(); } 120 120 virtual bool isWindowContentViewFirstResponder() const { notImplemented(); return false; } 121 virtual bool isWebContentFirstResponder() const { notImplemented(); return false; } 121 122 122 123 virtual void removeViewFromWindow(JSValueRef) { notImplemented(); } -
trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm
r286116 r287810 71 71 - (CGFloat)_accessibilityMaxValue; 72 72 - (void)_accessibilitySetValue:(NSString *)value; 73 - (void)_accessibilitySetFocus:(BOOL)focus; 73 74 - (void)_accessibilityActivate; 74 75 - (UIAccessibilityTraits)_axSelectedTrait; … … 1182 1183 void AccessibilityUIElement::takeFocus() 1183 1184 { 1185 [m_element _accessibilitySetFocus:YES]; 1184 1186 } 1185 1187 -
trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h
r280980 r287810 169 169 WebCore::FloatRect rectForMenuAction(CFStringRef) const; 170 170 void singleTapAtPointWithModifiers(WebCore::FloatPoint location, Vector<String>&& modifierFlags, BlockPtr<void()>&&); 171 172 bool isWebContentFirstResponder() const override; 171 173 }; 172 174 -
trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
r282844 r287810 1327 1327 } 1328 1328 1329 bool UIScriptControllerIOS::isWebContentFirstResponder() const 1330 { 1331 return [webView() _contentViewIsFirstResponder]; 1332 } 1333 1329 1334 } 1330 1335
Note:
See TracChangeset
for help on using the changeset viewer.