Changeset 230527 in webkit
- Timestamp:
- Apr 11, 2018, 9:43:53 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 20 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r230525 r230527 1 2018-04-11 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [Extra zoom mode] Missing label when focusing a <select> with a title attribute but no associated <label> 4 https://bugs.webkit.org/show_bug.cgi?id=184352 5 <rdar://problem/39237683> 6 7 Reviewed by Andy Estes. 8 9 Add a new layout test to check that the title of select elements is propagated to the UI process upon focus. 10 This title is used for several purposes, one of them being the title of select menus in the table view 11 controller presented when tapping on a select on an iPad, so the test checks that the title of the select is 12 shown here. 13 14 Also moves a select-related helper into UIHelper from basic-gestures.js (since this doesn't involve user gesture 15 simulation in any way) and also introduces a new UIHelper method for querying the title of the select menu that 16 is currently being presented. 17 18 * fast/forms/ios/ipad/multiple-select-updates-renderer.html: 19 * fast/forms/ios/ipad/select-with-title-expected.txt: Added. 20 * fast/forms/ios/ipad/select-with-title.html: Copied from LayoutTests/fast/forms/ios/ipad/multiple-select-updates-renderer.html. 21 * resources/basic-gestures.js: 22 * resources/ui-helper.js: 23 (window.UIHelper.selectFormAccessoryPickerRow): 24 (window.UIHelper.selectFormPopoverTitle): 25 (window.UIHelper): 26 1 27 2018-04-10 Ryan Haddad <ryanhaddad@apple.com> 2 28 -
trunk/LayoutTests/fast/forms/ios/ipad/multiple-select-updates-renderer.html
r230055 r230527 15 15 </style> 16 16 <script src="../../../../resources/basic-gestures.js"></script> 17 <script src="../../../../resources/ui-helper.js"></script> 17 18 <script> 18 19 async function run() … … 22 23 23 24 await tapAtPoint(100, 100); 24 await selectFormAccessoryPickerRow(0);25 await UIHelper.selectFormAccessoryPickerRow(0); 25 26 doneEvaluatingUIScript = true; 26 27 checkDone(); -
trunk/LayoutTests/fast/forms/ios/ipad/select-with-title.html
r230526 r230527 14 14 } 15 15 </style> 16 <script src="../../../../resources/js-test.js"></script> 17 <script src="../../../../resources/ui-helper.js"></script> 16 18 <script src="../../../../resources/basic-gestures.js"></script> 17 19 <script> … … 22 24 23 25 await tapAtPoint(100, 100); 24 await selectFormAccessoryPickerRow(0);25 doneEvaluatingUIScript = true;26 popoverTitle = await UIHelper.selectFormPopoverTitle(); 27 await UIHelper.selectFormAccessoryPickerRow(1); 26 28 checkDone(); 27 29 } … … 29 31 function checkDone() 30 32 { 31 if (window.doneEvaluatingUIScript && window.valueChanged && window.testRunner) 33 doneCount = 1 + (window.doneCount ? doneCount : 0); 34 if (doneCount == 2 && window.testRunner) { 35 shouldBe("popoverTitle", "document.getElementById('select').title"); 32 36 testRunner.notifyDone(); 37 } 33 38 } 34 39 </script> 35 40 </head> 36 41 <body onload="run()"> 37 <select multiple id="select"><option>This is an option.</option></select> 42 <select title="This is a title" id="select"> 43 <option>1</option> 44 <option>2</option> 45 <option>3</option> 46 </select> 38 47 <pre id="output"></pre> 39 48 </body> 40 49 <script> 41 select.addEventListener("change", () => { 42 if (window.internals) { 43 const renderTreeAsText = internals.elementRenderTreeAsText(document.documentElement); 44 const expectedOptionValue = "This is an option."; 45 if (renderTreeAsText.indexOf(expectedOptionValue) != -1) 46 output.textContent = "PASS"; 47 else 48 output.textContent = `FAIL: expected '${expectedOptionValue}' in render tree dump:\n${renderTreeAsText}`; 49 } 50 51 select.blur(); 52 valueChanged = true; 53 checkDone(); 54 }); 50 select.addEventListener("blur", checkDone); 51 select.addEventListener("change", () => select.blur()); 55 52 56 53 if (window.testRunner) { -
trunk/LayoutTests/resources/basic-gestures.js
r230055 r230527 139 139 })();`, resolve); 140 140 }); 141 }142 143 function selectFormAccessoryPickerRow(rowIndex)144 {145 const selectRowScript = `(() => uiController.selectFormAccessoryPickerRow(${rowIndex}))()`;146 return new Promise(resolve => testRunner.runUIScript(selectRowScript, resolve));147 141 } 148 142 -
trunk/LayoutTests/resources/ui-helper.js
r224606 r230527 162 162 internals.withUserGesture(callback); 163 163 } 164 165 static selectFormAccessoryPickerRow(rowIndex) 166 { 167 const selectRowScript = `(() => uiController.selectFormAccessoryPickerRow(${rowIndex}))()`; 168 return new Promise(resolve => testRunner.runUIScript(selectRowScript, resolve)); 169 } 170 171 static selectFormPopoverTitle() 172 { 173 return new Promise(resolve => { 174 testRunner.runUIScript(`(() => { 175 uiController.uiScriptComplete(uiController.selectFormPopoverTitle); 176 })()`, resolve); 177 }); 178 } 164 179 } -
trunk/Source/WebKit/ChangeLog
r230526 r230527 1 2018-04-11 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [Extra zoom mode] Missing label when focusing a <select> with a title attribute but no associated <label> 4 https://bugs.webkit.org/show_bug.cgi?id=184352 5 <rdar://problem/39237683> 6 7 Reviewed by Andy Estes. 8 9 Currently, AssistedNodeInformation only sends the `title` of input elements to the UI process. This means that 10 any information requested in the UI process that is dependent on the `title` of the focused element is broken 11 in the case of select elements. An existing example of this is the title of the table view controller used to 12 present select menus on iPad. 13 14 To fix this, we simply send the `title` of the focused element across, as long as the focused element is an 15 HTMLElement. This ensures that there's label text when focusing unlabeled select elements with titles in extra 16 zoom mode, and also fixes a currenly broken codepath where we show the title of the select in the presented view 17 controller's title. 18 19 Test: fast/forms/ios/ipad/select-with-title.html 20 21 * UIProcess/API/Cocoa/WKWebView.mm: 22 (-[WKWebView selectFormPopoverTitle]): 23 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 24 25 Add new testing SPI to fetch the title of the UITableViewController presented for the currently focused select 26 element. 27 28 * UIProcess/ios/WKContentViewInteraction.h: 29 * UIProcess/ios/WKContentViewInteraction.mm: 30 (-[WKContentView selectFormPopoverTitle]): 31 * UIProcess/ios/forms/WKFormSelectControl.h: 32 * UIProcess/ios/forms/WKFormSelectControl.mm: 33 (-[WKFormSelectControl selectFormPopoverTitle]): 34 * UIProcess/ios/forms/WKFormSelectPopover.h: 35 * UIProcess/ios/forms/WKFormSelectPopover.mm: 36 (-[WKSelectPopover initWithView:hasGroups:]): 37 (-[WKSelectPopover tableViewController]): 38 * WebProcess/WebPage/ios/WebPageIOS.mm: 39 40 Always send the title across if the focused node is an HTMLElement. 41 42 (WebKit::WebPage::getAssistedNodeInformation): 43 1 44 2018-04-11 Ryan Haddad <ryanhaddad@apple.com> 2 45 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r230496 r230527 5872 5872 } 5873 5873 5874 - (NSString *)selectFormPopoverTitle 5875 { 5876 return [_contentView selectFormPopoverTitle]; 5877 } 5878 5874 5879 - (void)didStartFormControlInteraction 5875 5880 { -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
r230470 r230527 382 382 - (void)dismissFormAccessoryView WK_API_AVAILABLE(ios(10.3)); 383 383 - (void)selectFormAccessoryPickerRow:(int)rowIndex WK_API_AVAILABLE(ios(10.3)); 384 @property (nonatomic, readonly) NSString *selectFormPopoverTitle WK_API_AVAILABLE(ios(WK_IOS_TBA)); 384 385 385 386 - (void)applyAutocorrection:(NSString *)newString toString:(NSString *)oldString withCompletionHandler:(void (^)(void))completionHandler WK_API_AVAILABLE(ios(11.0)); -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
r230526 r230527 364 364 - (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem; 365 365 366 @property (nonatomic, readonly) NSString *selectFormPopoverTitle; 367 366 368 @end 367 369 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r230526 r230527 5440 5440 } 5441 5441 5442 - (NSString *)selectFormPopoverTitle 5443 { 5444 if (![_inputPeripheral isKindOfClass:[WKFormSelectControl self]]) 5445 return nil; 5446 5447 return [(WKFormSelectControl *)_inputPeripheral selectFormPopoverTitle]; 5448 } 5449 5442 5450 - (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem 5443 5451 { -
trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.h
r204535 r230527 42 42 @interface WKFormSelectControl(WKTesting) 43 43 - (void)selectRow:(NSInteger)rowIndex inComponent:(NSInteger)componentIndex extendingSelection:(BOOL)extendingSelection; 44 @property (nonatomic, readonly) NSString *selectFormPopoverTitle; 44 45 @end 45 46 -
trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.mm
r226335 r230527 112 112 } 113 113 114 - (NSString *)selectFormPopoverTitle 115 { 116 if (![_control isKindOfClass:[WKSelectPopover class]]) 117 return nil; 118 119 return [(WKSelectPopover *)_control.get() tableViewController].title; 120 } 121 114 122 @end 115 123 -
trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPopover.h
r204535 r230527 29 29 #import "WKFormPopover.h" 30 30 31 @class UITableViewController; 31 32 @class WKContentView; 32 33 … … 34 35 - (instancetype)initWithView:(WKContentView *)view hasGroups:(BOOL)hasGroups; 35 36 - (void)_userActionDismissedPopover:(id)sender; 37 @property (nonatomic, readonly) UITableViewController *tableViewController; 36 38 @end 37 39 -
trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPopover.mm
r223857 r230527 390 390 UIViewController *popoverViewController = _tableViewController.get(); 391 391 UINavigationController *navController = nil; 392 NSString *title = view.assistedNodeInformation.title; 393 BOOL needsNavigationController = !!title.length; 392 BOOL needsNavigationController = !view.assistedNodeInformation.title.isEmpty(); 394 393 if (needsNavigationController) { 395 394 navController = [[UINavigationController alloc] initWithRootViewController:_tableViewController.get()]; … … 443 442 } 444 443 444 - (UITableViewController *)tableViewController 445 { 446 return _tableViewController.get(); 447 } 448 445 449 @end 446 450 -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r230526 r230527 2787 2787 } 2788 2788 2789 if (is<HTMLElement>(m_assistedNode.get())) 2790 information.title = downcast<HTMLElement>(*m_assistedNode).title(); 2791 2789 2792 if (is<HTMLSelectElement>(*m_assistedNode)) { 2790 2793 HTMLSelectElement& element = downcast<HTMLSelectElement>(*m_assistedNode); … … 2867 2870 information.value = element.value(); 2868 2871 information.valueAsNumber = element.valueAsNumber(); 2869 information.title = element.title();2870 2872 information.autofillFieldName = WebCore::toAutofillFieldName(element.autofillData().fieldName); 2871 2873 } else if (m_assistedNode->hasEditableStyle()) { -
trunk/Tools/ChangeLog
r230510 r230527 1 2018-04-11 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [Extra zoom mode] Missing label when focusing a <select> with a title attribute but no associated <label> 4 https://bugs.webkit.org/show_bug.cgi?id=184352 5 <rdar://problem/39237683> 6 7 Reviewed by Andy Estes. 8 9 Add support for UIScriptController::selectFormPopoverTitle, which returns the title of the current select 10 popover's UITableViewController (for testing purposes). 11 12 * DumpRenderTree/ios/UIScriptControllerIOS.mm: 13 (WTR::UIScriptController::selectFormPopoverTitle const): 14 * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: 15 * TestRunnerShared/UIScriptContext/UIScriptController.cpp: 16 (WTR::UIScriptController::selectFormPopoverTitle const): 17 * TestRunnerShared/UIScriptContext/UIScriptController.h: 18 * WebKitTestRunner/ios/UIScriptControllerIOS.mm: 19 (WTR::UIScriptController::selectFormPopoverTitle const): 20 1 21 2018-04-10 Nan Wang <n_wang@apple.com> 2 22 -
trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm
r226750 r230527 159 159 { 160 160 } 161 162 JSRetainPtr<JSStringRef> UIScriptController::selectFormPopoverTitle() const 163 { 164 return nullptr; 165 } 161 166 162 167 JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfaceItem) const -
trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
r228857 r230527 188 188 // <select> picker 189 189 void selectFormAccessoryPickerRow(long rowIndex); 190 readonly attribute DOMString selectFormPopoverTitle; 190 191 191 192 void keyboardAccessoryBarNext(); -
trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp
r228857 r230527 299 299 } 300 300 301 JSRetainPtr<JSStringRef> UIScriptController::selectFormPopoverTitle() const 302 { 303 return nullptr; 304 } 305 301 306 void UIScriptController::scrollToOffset(long x, long y) 302 307 { -
trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
r228857 r230527 98 98 void dismissFormAccessoryView(); 99 99 void selectFormAccessoryPickerRow(long); 100 JSRetainPtr<JSStringRef> selectFormPopoverTitle() const; 100 101 101 102 JSObjectRef contentsOfUserInterfaceItem(JSStringRef) const; -
trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
r226750 r230527 419 419 } 420 420 421 JSRetainPtr<JSStringRef> UIScriptController::selectFormPopoverTitle() const 422 { 423 TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView(); 424 return JSStringCreateWithCFString((CFStringRef)webView.selectFormPopoverTitle); 425 } 426 421 427 void UIScriptController::selectFormAccessoryPickerRow(long rowIndex) 422 428 {
Note:
See TracChangeset
for help on using the changeset viewer.