haikuwebkit/LayoutTests/fast/forms/validation-message-minimum-...

48 lines
1.4 KiB
HTML
Raw Permalink Normal View History

HTML Form Validation bubble should take minimum font size setting into consideration https://bugs.webkit.org/show_bug.cgi?id=168271 <rdar://problem/29869869> Reviewed by Simon Fraser. Source/WebCore: HTML Form Validation bubble should take minimum font size setting into consideration for better accessibility. Test: fast/forms/validation-message-minimum-font-size.html * platform/ValidationBubble.h: (WebCore::ValidationBubble::create): (WebCore::ValidationBubble::fontSize): * platform/ios/ValidationBubbleIOS.mm: (WebCore::ValidationBubble::ValidationBubble): * platform/mac/ValidationBubbleMac.mm: (WebCore::ValidationBubble::ValidationBubble): Update the ValidationBubble constructor to take in Settings. For now, there is a single setting that is the minimum font size and that is taken into account when setting the font size of the validation bubble text. Source/WebKit/mac: * WebView/WebView.mm: (-[WebView _contentsOfUserInterfaceItem:]): Return font size used in the validation bubble. (-[WebView showFormValidationMessage:withAnchorRect:]): Pass minimum font size setting when constructing the validation bubble. Source/WebKit2: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _contentsOfUserInterfaceItem:]): Return font size used in the validation bubble. * UIProcess/PageClient.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::createValidationBubble): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::showValidationMessage): * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::createValidationBubble): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::showValidationMessage): Pass minimum font size setting when constructing the form validation bubble. Tools: Extend UIScriptController's contentsOfUserInterfaceItem() to also return the font size of the validation bubble. Add an overridePreference() method to UIScriptController. This is currently used to override the value of the minimumFontSize setting. testRunner's overridePreference() is not usable on WK2 because it does not update the value of the preference on the UIProcess side. * DumpRenderTree/ios/UIScriptControllerIOS.mm: (WTR::UIScriptController::overridePreference): * DumpRenderTree/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::overridePreference): * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: * TestRunnerShared/UIScriptContext/UIScriptController.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetPreferencesToConsistentValues): * WebKitTestRunner/ios/UIScriptControllerIOS.mm: (WTR::UIScriptController::overridePreference): * WebKitTestRunner/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::contentsOfUserInterfaceItem): (WTR::UIScriptController::overridePreference): LayoutTests: Add layout test coverage. * fast/forms/validation-message-minimum-font-size-expected.txt: Added. * fast/forms/validation-message-minimum-font-size.html: Added. Canonical link: https://commits.webkit.org/185357@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212325 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-14 23:11:06 +00:00
<!DOCTYPE html>
<html>
<body>
HTML form validation bubble disappears https://bugs.webkit.org/show_bug.cgi?id=191418 Reviewed by Simon Fraser. Source/WebCore: If we validate a form and find an invalid form control, we'll scroll it into view and show the validation bubble. However, scrolling the element into view may be an asynchronous operation, in which case it would discard the validation bubble prematurely because scrolling hides the validation bubble. To address the issue, we now show the validation message asynchronously after focusing the element (and potentially scrolling it into view). Test: fast/forms/scroll-into-view-and-show-validation-message.html * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::focusAndShowValidationMessage): LayoutTests: Add API test coverage and update existing tests to use form-validation.js and avoid code duplication. * fast/forms/form-validation.js: Added. (getValidationBubbleContents): (getValidationBubble.return.new.Promise.): (getValidationBubble): * fast/forms/ios/validation-bubble-dismiss-on-tap-expected.txt: * fast/forms/ios/validation-bubble-dismiss-on-tap.html: * fast/forms/navigation-dismisses-validation-bubbles-expected.txt: Renamed from LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles-expected.txt. * fast/forms/navigation-dismisses-validation-bubbles.html: Renamed from LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles.html. * fast/forms/resources/check-validation-bubble-not-visible.html: Renamed from LayoutTests/http/tests/navigation/resources/check-validation-bubble-not-visible.html. * fast/forms/scroll-into-view-and-show-validation-message-expected.txt: Added. * fast/forms/scroll-into-view-and-show-validation-message.html: Added. * fast/forms/validation-bubble-disappears-when-input-detached-expected.txt: * fast/forms/validation-bubble-disappears-when-input-detached.html: * fast/forms/validation-bubble-disappears-when-input-moved-expected.txt: * fast/forms/validation-bubble-disappears-when-input-moved.html: * fast/forms/validation-bubble-disappears-when-input-no-longer-visible-expected.txt: * fast/forms/validation-bubble-disappears-when-input-no-longer-visible.html: * fast/forms/validation-bubble-escape-key-dismiss-expected.txt: * fast/forms/validation-bubble-escape-key-dismiss.html: * fast/forms/validation-custom-message-expected.txt: * fast/forms/validation-custom-message.html: * fast/forms/validation-message-detached-iframe-expected.txt: * fast/forms/validation-message-detached-iframe.html: * fast/forms/validation-message-detached-iframe2-expected.txt: * fast/forms/validation-message-detached-iframe2.html: * fast/forms/validation-message-minimum-font-size-expected.txt: * fast/forms/validation-message-minimum-font-size.html: * fast/forms/validation-messages-expected.txt: * fast/forms/validation-messages.html: * platform/gtk/TestExpectations: * platform/ios-wk1/TestExpectations: * platform/win/TestExpectations: Canonical link: https://commits.webkit.org/206252@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238038 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-09 17:37:52 +00:00
<script src="../../resources/js-test.js"></script>
<script src="form-validation.js"></script>
HTML Form Validation bubble should take minimum font size setting into consideration https://bugs.webkit.org/show_bug.cgi?id=168271 <rdar://problem/29869869> Reviewed by Simon Fraser. Source/WebCore: HTML Form Validation bubble should take minimum font size setting into consideration for better accessibility. Test: fast/forms/validation-message-minimum-font-size.html * platform/ValidationBubble.h: (WebCore::ValidationBubble::create): (WebCore::ValidationBubble::fontSize): * platform/ios/ValidationBubbleIOS.mm: (WebCore::ValidationBubble::ValidationBubble): * platform/mac/ValidationBubbleMac.mm: (WebCore::ValidationBubble::ValidationBubble): Update the ValidationBubble constructor to take in Settings. For now, there is a single setting that is the minimum font size and that is taken into account when setting the font size of the validation bubble text. Source/WebKit/mac: * WebView/WebView.mm: (-[WebView _contentsOfUserInterfaceItem:]): Return font size used in the validation bubble. (-[WebView showFormValidationMessage:withAnchorRect:]): Pass minimum font size setting when constructing the validation bubble. Source/WebKit2: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _contentsOfUserInterfaceItem:]): Return font size used in the validation bubble. * UIProcess/PageClient.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::createValidationBubble): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::showValidationMessage): * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::createValidationBubble): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::showValidationMessage): Pass minimum font size setting when constructing the form validation bubble. Tools: Extend UIScriptController's contentsOfUserInterfaceItem() to also return the font size of the validation bubble. Add an overridePreference() method to UIScriptController. This is currently used to override the value of the minimumFontSize setting. testRunner's overridePreference() is not usable on WK2 because it does not update the value of the preference on the UIProcess side. * DumpRenderTree/ios/UIScriptControllerIOS.mm: (WTR::UIScriptController::overridePreference): * DumpRenderTree/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::overridePreference): * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: * TestRunnerShared/UIScriptContext/UIScriptController.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetPreferencesToConsistentValues): * WebKitTestRunner/ios/UIScriptControllerIOS.mm: (WTR::UIScriptController::overridePreference): * WebKitTestRunner/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::contentsOfUserInterfaceItem): (WTR::UIScriptController::overridePreference): LayoutTests: Add layout test coverage. * fast/forms/validation-message-minimum-font-size-expected.txt: Added. * fast/forms/validation-message-minimum-font-size.html: Added. Canonical link: https://commits.webkit.org/185357@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212325 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-14 23:11:06 +00:00
<form>
Required text input: <input type="text" id="required_text_input" required><input id="required_text_input_submit" type="submit">
</form>
<div id="description"></div>
<div id="console"></div>
<script>
description("Tests that the font used for validation bubble is aware of the minimumFontSize setting.");
jsTestIsAsync = true;
function setMinimumFontSize()
{
return `
(function() {
uiController.overridePreference('WebKitMinimumFontSize', '24');
uiController.uiScriptComplete("Done");
})();`
}
onload = function() {
input = document.getElementById("required_text_input");
submit = document.getElementById("required_text_input_submit");
submit.click();
HTML form validation bubble disappears https://bugs.webkit.org/show_bug.cgi?id=191418 Reviewed by Simon Fraser. Source/WebCore: If we validate a form and find an invalid form control, we'll scroll it into view and show the validation bubble. However, scrolling the element into view may be an asynchronous operation, in which case it would discard the validation bubble prematurely because scrolling hides the validation bubble. To address the issue, we now show the validation message asynchronously after focusing the element (and potentially scrolling it into view). Test: fast/forms/scroll-into-view-and-show-validation-message.html * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::focusAndShowValidationMessage): LayoutTests: Add API test coverage and update existing tests to use form-validation.js and avoid code duplication. * fast/forms/form-validation.js: Added. (getValidationBubbleContents): (getValidationBubble.return.new.Promise.): (getValidationBubble): * fast/forms/ios/validation-bubble-dismiss-on-tap-expected.txt: * fast/forms/ios/validation-bubble-dismiss-on-tap.html: * fast/forms/navigation-dismisses-validation-bubbles-expected.txt: Renamed from LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles-expected.txt. * fast/forms/navigation-dismisses-validation-bubbles.html: Renamed from LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles.html. * fast/forms/resources/check-validation-bubble-not-visible.html: Renamed from LayoutTests/http/tests/navigation/resources/check-validation-bubble-not-visible.html. * fast/forms/scroll-into-view-and-show-validation-message-expected.txt: Added. * fast/forms/scroll-into-view-and-show-validation-message.html: Added. * fast/forms/validation-bubble-disappears-when-input-detached-expected.txt: * fast/forms/validation-bubble-disappears-when-input-detached.html: * fast/forms/validation-bubble-disappears-when-input-moved-expected.txt: * fast/forms/validation-bubble-disappears-when-input-moved.html: * fast/forms/validation-bubble-disappears-when-input-no-longer-visible-expected.txt: * fast/forms/validation-bubble-disappears-when-input-no-longer-visible.html: * fast/forms/validation-bubble-escape-key-dismiss-expected.txt: * fast/forms/validation-bubble-escape-key-dismiss.html: * fast/forms/validation-custom-message-expected.txt: * fast/forms/validation-custom-message.html: * fast/forms/validation-message-detached-iframe-expected.txt: * fast/forms/validation-message-detached-iframe.html: * fast/forms/validation-message-detached-iframe2-expected.txt: * fast/forms/validation-message-detached-iframe2.html: * fast/forms/validation-message-minimum-font-size-expected.txt: * fast/forms/validation-message-minimum-font-size.html: * fast/forms/validation-messages-expected.txt: * fast/forms/validation-messages.html: * platform/gtk/TestExpectations: * platform/ios-wk1/TestExpectations: * platform/win/TestExpectations: Canonical link: https://commits.webkit.org/206252@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238038 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-09 17:37:52 +00:00
getValidationBubble().then((_validationBubble) => {
validationBubble = _validationBubble;
shouldBeTrue("validationBubble.fontSize > 0");
shouldBeTrue("validationBubble.fontSize < 24");
HTML Form Validation bubble should take minimum font size setting into consideration https://bugs.webkit.org/show_bug.cgi?id=168271 <rdar://problem/29869869> Reviewed by Simon Fraser. Source/WebCore: HTML Form Validation bubble should take minimum font size setting into consideration for better accessibility. Test: fast/forms/validation-message-minimum-font-size.html * platform/ValidationBubble.h: (WebCore::ValidationBubble::create): (WebCore::ValidationBubble::fontSize): * platform/ios/ValidationBubbleIOS.mm: (WebCore::ValidationBubble::ValidationBubble): * platform/mac/ValidationBubbleMac.mm: (WebCore::ValidationBubble::ValidationBubble): Update the ValidationBubble constructor to take in Settings. For now, there is a single setting that is the minimum font size and that is taken into account when setting the font size of the validation bubble text. Source/WebKit/mac: * WebView/WebView.mm: (-[WebView _contentsOfUserInterfaceItem:]): Return font size used in the validation bubble. (-[WebView showFormValidationMessage:withAnchorRect:]): Pass minimum font size setting when constructing the validation bubble. Source/WebKit2: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _contentsOfUserInterfaceItem:]): Return font size used in the validation bubble. * UIProcess/PageClient.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::createValidationBubble): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::showValidationMessage): * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::createValidationBubble): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::showValidationMessage): Pass minimum font size setting when constructing the form validation bubble. Tools: Extend UIScriptController's contentsOfUserInterfaceItem() to also return the font size of the validation bubble. Add an overridePreference() method to UIScriptController. This is currently used to override the value of the minimumFontSize setting. testRunner's overridePreference() is not usable on WK2 because it does not update the value of the preference on the UIProcess side. * DumpRenderTree/ios/UIScriptControllerIOS.mm: (WTR::UIScriptController::overridePreference): * DumpRenderTree/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::overridePreference): * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: * TestRunnerShared/UIScriptContext/UIScriptController.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetPreferencesToConsistentValues): * WebKitTestRunner/ios/UIScriptControllerIOS.mm: (WTR::UIScriptController::overridePreference): * WebKitTestRunner/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::contentsOfUserInterfaceItem): (WTR::UIScriptController::overridePreference): LayoutTests: Add layout test coverage. * fast/forms/validation-message-minimum-font-size-expected.txt: Added. * fast/forms/validation-message-minimum-font-size.html: Added. Canonical link: https://commits.webkit.org/185357@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212325 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-14 23:11:06 +00:00
testRunner.runUIScript(setMinimumFontSize(), function() {
submit.click();
HTML form validation bubble disappears https://bugs.webkit.org/show_bug.cgi?id=191418 Reviewed by Simon Fraser. Source/WebCore: If we validate a form and find an invalid form control, we'll scroll it into view and show the validation bubble. However, scrolling the element into view may be an asynchronous operation, in which case it would discard the validation bubble prematurely because scrolling hides the validation bubble. To address the issue, we now show the validation message asynchronously after focusing the element (and potentially scrolling it into view). Test: fast/forms/scroll-into-view-and-show-validation-message.html * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::focusAndShowValidationMessage): LayoutTests: Add API test coverage and update existing tests to use form-validation.js and avoid code duplication. * fast/forms/form-validation.js: Added. (getValidationBubbleContents): (getValidationBubble.return.new.Promise.): (getValidationBubble): * fast/forms/ios/validation-bubble-dismiss-on-tap-expected.txt: * fast/forms/ios/validation-bubble-dismiss-on-tap.html: * fast/forms/navigation-dismisses-validation-bubbles-expected.txt: Renamed from LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles-expected.txt. * fast/forms/navigation-dismisses-validation-bubbles.html: Renamed from LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles.html. * fast/forms/resources/check-validation-bubble-not-visible.html: Renamed from LayoutTests/http/tests/navigation/resources/check-validation-bubble-not-visible.html. * fast/forms/scroll-into-view-and-show-validation-message-expected.txt: Added. * fast/forms/scroll-into-view-and-show-validation-message.html: Added. * fast/forms/validation-bubble-disappears-when-input-detached-expected.txt: * fast/forms/validation-bubble-disappears-when-input-detached.html: * fast/forms/validation-bubble-disappears-when-input-moved-expected.txt: * fast/forms/validation-bubble-disappears-when-input-moved.html: * fast/forms/validation-bubble-disappears-when-input-no-longer-visible-expected.txt: * fast/forms/validation-bubble-disappears-when-input-no-longer-visible.html: * fast/forms/validation-bubble-escape-key-dismiss-expected.txt: * fast/forms/validation-bubble-escape-key-dismiss.html: * fast/forms/validation-custom-message-expected.txt: * fast/forms/validation-custom-message.html: * fast/forms/validation-message-detached-iframe-expected.txt: * fast/forms/validation-message-detached-iframe.html: * fast/forms/validation-message-detached-iframe2-expected.txt: * fast/forms/validation-message-detached-iframe2.html: * fast/forms/validation-message-minimum-font-size-expected.txt: * fast/forms/validation-message-minimum-font-size.html: * fast/forms/validation-messages-expected.txt: * fast/forms/validation-messages.html: * platform/gtk/TestExpectations: * platform/ios-wk1/TestExpectations: * platform/win/TestExpectations: Canonical link: https://commits.webkit.org/206252@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238038 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-09 17:37:52 +00:00
getValidationBubble().then((_validationBubble) => {
validationBubble = _validationBubble;
shouldBe("validationBubble.fontSize", "24");
HTML Form Validation bubble should take minimum font size setting into consideration https://bugs.webkit.org/show_bug.cgi?id=168271 <rdar://problem/29869869> Reviewed by Simon Fraser. Source/WebCore: HTML Form Validation bubble should take minimum font size setting into consideration for better accessibility. Test: fast/forms/validation-message-minimum-font-size.html * platform/ValidationBubble.h: (WebCore::ValidationBubble::create): (WebCore::ValidationBubble::fontSize): * platform/ios/ValidationBubbleIOS.mm: (WebCore::ValidationBubble::ValidationBubble): * platform/mac/ValidationBubbleMac.mm: (WebCore::ValidationBubble::ValidationBubble): Update the ValidationBubble constructor to take in Settings. For now, there is a single setting that is the minimum font size and that is taken into account when setting the font size of the validation bubble text. Source/WebKit/mac: * WebView/WebView.mm: (-[WebView _contentsOfUserInterfaceItem:]): Return font size used in the validation bubble. (-[WebView showFormValidationMessage:withAnchorRect:]): Pass minimum font size setting when constructing the validation bubble. Source/WebKit2: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _contentsOfUserInterfaceItem:]): Return font size used in the validation bubble. * UIProcess/PageClient.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::createValidationBubble): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::showValidationMessage): * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::createValidationBubble): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::showValidationMessage): Pass minimum font size setting when constructing the form validation bubble. Tools: Extend UIScriptController's contentsOfUserInterfaceItem() to also return the font size of the validation bubble. Add an overridePreference() method to UIScriptController. This is currently used to override the value of the minimumFontSize setting. testRunner's overridePreference() is not usable on WK2 because it does not update the value of the preference on the UIProcess side. * DumpRenderTree/ios/UIScriptControllerIOS.mm: (WTR::UIScriptController::overridePreference): * DumpRenderTree/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::overridePreference): * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: * TestRunnerShared/UIScriptContext/UIScriptController.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetPreferencesToConsistentValues): * WebKitTestRunner/ios/UIScriptControllerIOS.mm: (WTR::UIScriptController::overridePreference): * WebKitTestRunner/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::contentsOfUserInterfaceItem): (WTR::UIScriptController::overridePreference): LayoutTests: Add layout test coverage. * fast/forms/validation-message-minimum-font-size-expected.txt: Added. * fast/forms/validation-message-minimum-font-size.html: Added. Canonical link: https://commits.webkit.org/185357@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212325 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-14 23:11:06 +00:00
finishJSTest();
});
});
});
}
</script>
</body>
<html>