Title: [231022] trunk
Revision
231022
Author
[email protected]
Date
2018-04-25 14:23:27 -0700 (Wed, 25 Apr 2018)

Log Message

[Extra zoom mode] The search field on www.bing.com is missing label text
https://bugs.webkit.org/show_bug.cgi?id=184975
<rdar://problem/39723081>

Reviewed by Tim Horton.

Source/WebKit:

Adds support for displaying the "aria-label" attribute as the input view's label text in extra zoom mode. Also
adds support for grabbing the input label's text for testing.

Test: fast/forms/extrazoom/form-control-label-text.html

* Shared/AssistedNodeInformation.cpp:
(WebKit::AssistedNodeInformation::encode const):
(WebKit::AssistedNodeInformation::decode):
* Shared/AssistedNodeInformation.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView formInputLabel]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView formInputLabel]):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getAssistedNodeInformation):

Tools:

Adds UIScriptController.formInputLabel, which asynchronously requests the input label text for the currently
focused element in extra zoom mode.

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::formInputLabel const):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::formInputLabel const):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::formInputLabel const):

LayoutTests:

Adds a layout test to check that the label text of the focused form control in the input view can be sourced
from (1) the "placeholder" attribute, (2) the "title" attribute, (3) the "aria-label" attribute, or (4) an
associated label element.

* fast/forms/extrazoom/form-control-label-text-expected.txt: Added.
* fast/forms/extrazoom/form-control-label-text.html: Added.
* resources/ui-helper.js:
(window.UIHelper.formInputLabel):
(window.UIHelper):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (231021 => 231022)


--- trunk/LayoutTests/ChangeLog	2018-04-25 21:16:49 UTC (rev 231021)
+++ trunk/LayoutTests/ChangeLog	2018-04-25 21:23:27 UTC (rev 231022)
@@ -1,3 +1,21 @@
+2018-04-25  Wenson Hsieh  <[email protected]>
+
+        [Extra zoom mode] The search field on www.bing.com is missing label text
+        https://bugs.webkit.org/show_bug.cgi?id=184975
+        <rdar://problem/39723081>
+
+        Reviewed by Tim Horton.
+
+        Adds a layout test to check that the label text of the focused form control in the input view can be sourced
+        from (1) the "placeholder" attribute, (2) the "title" attribute, (3) the "aria-label" attribute, or (4) an
+        associated label element.
+
+        * fast/forms/extrazoom/form-control-label-text-expected.txt: Added.
+        * fast/forms/extrazoom/form-control-label-text.html: Added.
+        * resources/ui-helper.js:
+        (window.UIHelper.formInputLabel):
+        (window.UIHelper):
+
 2018-04-25  Megan Gardner  <[email protected]>
 
         Don't activate Selection Assistant unless it is actually needed.

Added: trunk/LayoutTests/fast/forms/extrazoom/form-control-label-text-expected.txt (0 => 231022)


--- trunk/LayoutTests/fast/forms/extrazoom/form-control-label-text-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/extrazoom/form-control-label-text-expected.txt	2018-04-25 21:23:27 UTC (rev 231022)
@@ -0,0 +1,9 @@
+PASS successfullyParsed is true
+
+TEST COMPLETE
+test label 4
+Label text should be missing: ""
+Label text should use the placeholder: "test label 1"
+Label text should use the title: "test label 2"
+Label text should use the accessibility label: "test label 3"
+Label text should use the associated label: "test label 4"

Added: trunk/LayoutTests/fast/forms/extrazoom/form-control-label-text.html (0 => 231022)


--- trunk/LayoutTests/fast/forms/extrazoom/form-control-label-text.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/extrazoom/form-control-label-text.html	2018-04-25 21:23:27 UTC (rev 231022)
@@ -0,0 +1,54 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<meta name="viewport" content="width=device-width">
+<head>
+<script src=""
+<script src=""
+<script>
+jsTestIsAsync = true;
+
+function getLabelTextAfterFocusingInput() {
+    return new Promise(async (resolve) => {
+        await UIHelper.activateAndWaitForInputSessionAt(75, 75);
+        const labelText = await UIHelper.formInputLabel();
+        field.blur();
+        await UIHelper.waitForKeyboardToHide();
+        resolve(labelText);
+    });
+}
+
+async function runTest() {
+    if (!window.testRunner) {
+        description(`This test requires WebKitTestRunner.`);
+        return;
+    }
+
+    missingLabel.textContent = await getLabelTextAfterFocusingInput();
+
+    field.setAttribute("placeholder", "test label 1");
+    labelFromPlaceholder.textContent = await getLabelTextAfterFocusingInput();
+
+    field.setAttribute("title", "test label 2");
+    labelFromTitle.textContent = await getLabelTextAfterFocusingInput();
+
+    field.setAttribute("aria-label", "test label 3");
+    labelFromAriaLabel.textContent = await getLabelTextAfterFocusingInput();
+
+    label.setAttribute("for", "field");
+    labelFromLabelElement.textContent = await getLabelTextAfterFocusingInput();
+
+    finishJSTest();
+}
+</script>
+</head>
+
+<body _onload_="runTest()">
+<input id="field" style="width: 320px; height: 568px;"></input>
+<label id="label">test label 4</label>
+<div>Label text should be missing: "<code id="missingLabel"></code>"</div>
+<div>Label text should use the placeholder: "<code id="labelFromPlaceholder"></code>"</div>
+<div>Label text should use the title: "<code id="labelFromTitle"></code>"</div>
+<div>Label text should use the accessibility label: "<code id="labelFromAriaLabel"></code>"</div>
+<div>Label text should use the associated label: "<code id="labelFromLabelElement"></code>"</div>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/resources/ui-helper.js (231021 => 231022)


--- trunk/LayoutTests/resources/ui-helper.js	2018-04-25 21:16:49 UTC (rev 231021)
+++ trunk/LayoutTests/resources/ui-helper.js	2018-04-25 21:23:27 UTC (rev 231022)
@@ -199,4 +199,13 @@
         const setValueScript = `(() => uiController.setTimePickerValue(${hours}, ${minutes}))()`;
         return new Promise(resolve => testRunner.runUIScript(setValueScript, resolve));
     }
+
+    static formInputLabel()
+    {
+        return new Promise(resolve => {
+            testRunner.runUIScript(`(() => {
+                uiController.uiScriptComplete(uiController.formInputLabel);
+            })()`, resolve);
+        });
+    }
 }

Modified: trunk/Source/WebKit/ChangeLog (231021 => 231022)


--- trunk/Source/WebKit/ChangeLog	2018-04-25 21:16:49 UTC (rev 231021)
+++ trunk/Source/WebKit/ChangeLog	2018-04-25 21:23:27 UTC (rev 231022)
@@ -1,3 +1,29 @@
+2018-04-25  Wenson Hsieh  <[email protected]>
+
+        [Extra zoom mode] The search field on www.bing.com is missing label text
+        https://bugs.webkit.org/show_bug.cgi?id=184975
+        <rdar://problem/39723081>
+
+        Reviewed by Tim Horton.
+
+        Adds support for displaying the "aria-label" attribute as the input view's label text in extra zoom mode. Also
+        adds support for grabbing the input label's text for testing.
+
+        Test: fast/forms/extrazoom/form-control-label-text.html
+
+        * Shared/AssistedNodeInformation.cpp:
+        (WebKit::AssistedNodeInformation::encode const):
+        (WebKit::AssistedNodeInformation::decode):
+        * Shared/AssistedNodeInformation.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView formInputLabel]):
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView formInputLabel]):
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::getAssistedNodeInformation):
+
 2018-04-25  Ryosuke Niwa  <[email protected]>
 
         PSON: Don't create a new process when navigating to a blob URL, data URL, and about:blank

Modified: trunk/Source/WebKit/Shared/AssistedNodeInformation.cpp (231021 => 231022)


--- trunk/Source/WebKit/Shared/AssistedNodeInformation.cpp	2018-04-25 21:16:49 UTC (rev 231021)
+++ trunk/Source/WebKit/Shared/AssistedNodeInformation.cpp	2018-04-25 21:23:27 UTC (rev 231022)
@@ -93,6 +93,7 @@
     encoder.encodeEnum(autofillFieldName);
     encoder << placeholder;
     encoder << label;
+    encoder << ariaLabel;
     encoder << assistedNodeIdentifier;
 }
 
@@ -188,6 +189,9 @@
     if (!decoder.decode(result.label))
         return false;
 
+    if (!decoder.decode(result.ariaLabel))
+        return false;
+
     if (!decoder.decode(result.assistedNodeIdentifier))
         return false;
 

Modified: trunk/Source/WebKit/Shared/AssistedNodeInformation.h (231021 => 231022)


--- trunk/Source/WebKit/Shared/AssistedNodeInformation.h	2018-04-25 21:16:49 UTC (rev 231021)
+++ trunk/Source/WebKit/Shared/AssistedNodeInformation.h	2018-04-25 21:23:27 UTC (rev 231022)
@@ -117,6 +117,7 @@
     WebCore::AutofillFieldName autofillFieldName { WebCore::AutofillFieldName::None };
     String placeholder;
     String label;
+    String ariaLabel;
 
     uint64_t assistedNodeIdentifier { 0 };
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (231021 => 231022)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-04-25 21:16:49 UTC (rev 231021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-04-25 21:23:27 UTC (rev 231022)
@@ -5921,6 +5921,11 @@
     return [_contentView selectFormPopoverTitle];
 }
 
+- (NSString *)formInputLabel
+{
+    return [_contentView formInputLabel];
+}
+
 - (void)didStartFormControlInteraction
 {
     // For subclasses to override.

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (231021 => 231022)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2018-04-25 21:16:49 UTC (rev 231021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2018-04-25 21:23:27 UTC (rev 231022)
@@ -382,6 +382,7 @@
 - (void)dismissFormAccessoryView WK_API_AVAILABLE(ios(10.3));
 - (void)selectFormAccessoryPickerRow:(int)rowIndex WK_API_AVAILABLE(ios(10.3));
 @property (nonatomic, readonly) NSString *selectFormPopoverTitle WK_API_AVAILABLE(ios(WK_IOS_TBA));
+@property (nonatomic, readonly) NSString *formInputLabel WK_API_AVAILABLE(ios(WK_IOS_TBA));
 - (void)setTimePickerValueToHour:(NSInteger)hour minute:(NSInteger)minute WK_API_AVAILABLE(ios(WK_IOS_TBA));
 
 - (void)applyAutocorrection:(NSString *)newString toString:(NSString *)oldString withCompletionHandler:(void (^)(void))completionHandler WK_API_AVAILABLE(ios(11.0));

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (231021 => 231022)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2018-04-25 21:16:49 UTC (rev 231021)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2018-04-25 21:23:27 UTC (rev 231022)
@@ -365,6 +365,7 @@
 - (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem;
 
 @property (nonatomic, readonly) NSString *selectFormPopoverTitle;
+@property (nonatomic, readonly) NSString *formInputLabel;
 
 @end
 

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (231021 => 231022)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-04-25 21:16:49 UTC (rev 231021)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-04-25 21:23:27 UTC (rev 231022)
@@ -5515,6 +5515,15 @@
     return [(WKFormSelectControl *)_inputPeripheral selectFormPopoverTitle];
 }
 
+- (NSString *)formInputLabel
+{
+#if ENABLE(EXTRA_ZOOM_MODE)
+    if (_presentedFullScreenInputViewController)
+        return [self inputLabelTextForViewController:(id)_presentedFullScreenInputViewController.get()];
+#endif
+    return nil;
+}
+
 - (void)setTimePickerValueToHour:(NSInteger)hour minute:(NSInteger)minute
 {
 #if ENABLE(EXTRA_ZOOM_MODE)

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (231021 => 231022)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2018-04-25 21:16:49 UTC (rev 231021)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2018-04-25 21:23:27 UTC (rev 231022)
@@ -2345,8 +2345,11 @@
         }
     }
 
-    if (is<HTMLElement>(m_assistedNode.get()))
-        information.title = downcast<HTMLElement>(*m_assistedNode).title();
+    if (is<Element>(m_assistedNode.get())) {
+        auto& element = downcast<Element>(*m_assistedNode);
+        information.title = element.title();
+        information.ariaLabel = element.attributeWithoutSynchronization(HTMLNames::aria_labelAttr);
+    }
 
     if (is<HTMLSelectElement>(*m_assistedNode)) {
         HTMLSelectElement& element = downcast<HTMLSelectElement>(*m_assistedNode);

Modified: trunk/Tools/ChangeLog (231021 => 231022)


--- trunk/Tools/ChangeLog	2018-04-25 21:16:49 UTC (rev 231021)
+++ trunk/Tools/ChangeLog	2018-04-25 21:23:27 UTC (rev 231022)
@@ -1,3 +1,23 @@
+2018-04-25  Wenson Hsieh  <[email protected]>
+
+        [Extra zoom mode] The search field on www.bing.com is missing label text
+        https://bugs.webkit.org/show_bug.cgi?id=184975
+        <rdar://problem/39723081>
+
+        Reviewed by Tim Horton.
+
+        Adds UIScriptController.formInputLabel, which asynchronously requests the input label text for the currently
+        focused element in extra zoom mode.
+
+        * DumpRenderTree/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptController::formInputLabel const):
+        * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+        * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
+        (WTR::UIScriptController::formInputLabel const):
+        * TestRunnerShared/UIScriptContext/UIScriptController.h:
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptController::formInputLabel const):
+
 2018-04-25  Michael Catanzaro  <[email protected]>
 
         [WPE] Should load injected bundle from builddir in developer builds

Modified: trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm (231021 => 231022)


--- trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm	2018-04-25 21:16:49 UTC (rev 231021)
+++ trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm	2018-04-25 21:23:27 UTC (rev 231022)
@@ -171,6 +171,11 @@
 {
     return nullptr;
 }
+
+JSRetainPtr<JSStringRef> UIScriptController::formInputLabel() const
+{
+    return nullptr;
+}
     
 JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfaceItem) const
 {

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (231021 => 231022)


--- trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl	2018-04-25 21:16:49 UTC (rev 231021)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl	2018-04-25 21:23:27 UTC (rev 231022)
@@ -189,6 +189,7 @@
     // <select> picker
     void selectFormAccessoryPickerRow(long rowIndex);
     readonly attribute DOMString selectFormPopoverTitle;
+    readonly attribute DOMString formInputLabel;
 
     void setTimePickerValue(long hour, long minute);
 

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp (231021 => 231022)


--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp	2018-04-25 21:16:49 UTC (rev 231021)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp	2018-04-25 21:23:27 UTC (rev 231022)
@@ -311,6 +311,11 @@
     return nullptr;
 }
 
+JSRetainPtr<JSStringRef> UIScriptController::formInputLabel() const
+{
+    return nullptr;
+}
+
 void UIScriptController::scrollToOffset(long x, long y)
 {
 }

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (231021 => 231022)


--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h	2018-04-25 21:16:49 UTC (rev 231021)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h	2018-04-25 21:23:27 UTC (rev 231022)
@@ -99,6 +99,7 @@
     void dismissFormAccessoryView();
     void selectFormAccessoryPickerRow(long);
     JSRetainPtr<JSStringRef> selectFormPopoverTitle() const;
+    JSRetainPtr<JSStringRef> formInputLabel() const;
     void setTimePickerValue(long hour, long minute);
     
     JSObjectRef contentsOfUserInterfaceItem(JSStringRef) const;

Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (231021 => 231022)


--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2018-04-25 21:16:49 UTC (rev 231021)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2018-04-25 21:23:27 UTC (rev 231022)
@@ -431,6 +431,12 @@
     return JSStringCreateWithCFString((CFStringRef)webView.selectFormPopoverTitle);
 }
 
+JSRetainPtr<JSStringRef> UIScriptController::formInputLabel() const
+{
+    TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
+    return JSStringCreateWithCFString((CFStringRef)webView.formInputLabel);
+}
+
 void UIScriptController::selectFormAccessoryPickerRow(long rowIndex)
 {
     TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to