Title: [212325] trunk
Revision
212325
Author
[email protected]
Date
2017-02-14 15:11:06 -0800 (Tue, 14 Feb 2017)

Log Message

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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (212324 => 212325)


--- trunk/LayoutTests/ChangeLog	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/LayoutTests/ChangeLog	2017-02-14 23:11:06 UTC (rev 212325)
@@ -1,3 +1,16 @@
+2017-02-14  Chris Dumez  <[email protected]>
+
+        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.
+
+        Add layout test coverage.
+
+        * fast/forms/validation-message-minimum-font-size-expected.txt: Added.
+        * fast/forms/validation-message-minimum-font-size.html: Added.
+
 2017-02-14  Ryan Haddad  <[email protected]>
 
         Remove debug flag from flaky test imported/w3c/web-platform-tests/dom/events/EventListener-invoke-legacy.html.

Added: trunk/LayoutTests/fast/forms/validation-message-minimum-font-size-expected.txt (0 => 212325)


--- trunk/LayoutTests/fast/forms/validation-message-minimum-font-size-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/validation-message-minimum-font-size-expected.txt	2017-02-14 23:11:06 UTC (rev 212325)
@@ -0,0 +1,12 @@
+Required text input: 
+Tests that the font used for validation bubble is aware of the minimumFontSize setting.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS validationBubbleContents.fontSize > 0 is true
+PASS validationBubbleContents.fontSize < 24 is true
+PASS validationBubbleContents.fontSize is 24
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/forms/validation-message-minimum-font-size.html (0 => 212325)


--- trunk/LayoutTests/fast/forms/validation-message-minimum-font-size.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/validation-message-minimum-font-size.html	2017-02-14 23:11:06 UTC (rev 212325)
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<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 getValidationBubbleContents()
+{
+    return `
+    (function() {
+        return JSON.stringify(uiController.contentsOfUserInterfaceItem('validationBubble'));
+    })();`
+}
+
+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();
+
+    testRunner.runUIScript(getValidationBubbleContents(), function(result) {
+        validationBubbleContents = JSON.parse(result).validationBubble;
+        shouldBeTrue("validationBubbleContents.fontSize > 0");
+        shouldBeTrue("validationBubbleContents.fontSize < 24");
+
+        testRunner.runUIScript(setMinimumFontSize(), function() {
+            submit.click();
+
+            testRunner.runUIScript(getValidationBubbleContents(), function(result) {
+                validationBubbleContents = JSON.parse(result).validationBubble;
+                shouldBe("validationBubbleContents.fontSize", "24");
+                finishJSTest();
+            });
+        });
+    });
+}
+</script>
+<script src=""
+</body>
+<html>

Modified: trunk/Source/WebCore/ChangeLog (212324 => 212325)


--- trunk/Source/WebCore/ChangeLog	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Source/WebCore/ChangeLog	2017-02-14 23:11:06 UTC (rev 212325)
@@ -1,3 +1,27 @@
+2017-02-14  Chris Dumez  <[email protected]>
+
+        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.
+
+        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.
+
 2017-02-14  Eric Carlson  <[email protected]>
 
         [MediaStream] add navigator.getUserMedia for compatibility with legacy content

Modified: trunk/Source/WebCore/platform/ValidationBubble.h (212324 => 212325)


--- trunk/Source/WebCore/platform/ValidationBubble.h	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Source/WebCore/platform/ValidationBubble.h	2017-02-14 23:11:06 UTC (rev 212325)
@@ -55,14 +55,19 @@
 
 class ValidationBubble : public RefCounted<ValidationBubble> {
 public:
-    static Ref<ValidationBubble> create(PlatformView* view, const String& message)
+    struct Settings {
+        double minimumFontSize { 0 };
+    };
+
+    static Ref<ValidationBubble> create(PlatformView* view, const String& message, const Settings& settings)
     {
-        return adoptRef(*new ValidationBubble(view, message));
+        return adoptRef(*new ValidationBubble(view, message, settings));
     }
 
     WEBCORE_EXPORT ~ValidationBubble();
 
     const String& message() const { return m_message; }
+    double fontSize() const { return m_fontSize; }
 
 #if PLATFORM(IOS)
     WEBCORE_EXPORT void setAnchorRect(const IntRect& anchorRect, UIViewController* presentingViewController = nullptr);
@@ -72,10 +77,11 @@
 #endif
 
 private:
-    WEBCORE_EXPORT ValidationBubble(PlatformView*, const String& message);
+    WEBCORE_EXPORT ValidationBubble(PlatformView*, const String& message, const Settings&);
 
     PlatformView* m_view;
     String m_message;
+    double m_fontSize { 0 };
 #if PLATFORM(MAC)
     RetainPtr<NSPopover> m_popover;
 #elif PLATFORM(IOS)

Modified: trunk/Source/WebCore/platform/ios/ValidationBubbleIOS.mm (212324 => 212325)


--- trunk/Source/WebCore/platform/ios/ValidationBubbleIOS.mm	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Source/WebCore/platform/ios/ValidationBubbleIOS.mm	2017-02-14 23:11:06 UTC (rev 212325)
@@ -97,7 +97,7 @@
 static const CGFloat verticalPadding = 9;
 static const CGFloat maxLabelWidth = 300;
 
-ValidationBubble::ValidationBubble(UIView* view, const String& message)
+ValidationBubble::ValidationBubble(UIView* view, const String& message, const Settings& settings)
     : m_view(view)
     , m_message(message)
 {
@@ -110,7 +110,8 @@
 
     RetainPtr<UILabel> label = adoptNS([[getUILabelClass() alloc] initWithFrame:CGRectZero]);
     [label setText:message];
-    [label setFont:[getUIFontClass() systemFontOfSize:14.0]];
+    m_fontSize = std::max(settings.minimumFontSize, 14.0);
+    [label setFont:[getUIFontClass() systemFontOfSize:m_fontSize]];
     [label setLineBreakMode:NSLineBreakByTruncatingTail];
     [label setNumberOfLines:4];
     [popoverView addSubview:label.get()];

Modified: trunk/Source/WebCore/platform/mac/ValidationBubbleMac.mm (212324 => 212325)


--- trunk/Source/WebCore/platform/mac/ValidationBubbleMac.mm	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Source/WebCore/platform/mac/ValidationBubbleMac.mm	2017-02-14 23:11:06 UTC (rev 212325)
@@ -50,7 +50,7 @@
 static const CGFloat verticalPadding = 5;
 static const CGFloat maxLabelWidth = 300;
 
-ValidationBubble::ValidationBubble(NSView* view, const String& message)
+ValidationBubble::ValidationBubble(NSView* view, const String& message, const Settings& settings)
     : m_view(view)
     , m_message(message)
 {
@@ -64,6 +64,8 @@
     [label setDrawsBackground:NO];
     [label setBordered:NO];
     [label setStringValue:message];
+    m_fontSize = std::max(settings.minimumFontSize, 13.0);
+    [label setFont:[NSFont systemFontOfSize:m_fontSize]];
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
     [label setMaximumNumberOfLines:4];
 #endif

Modified: trunk/Source/WebKit/mac/ChangeLog (212324 => 212325)


--- trunk/Source/WebKit/mac/ChangeLog	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Source/WebKit/mac/ChangeLog	2017-02-14 23:11:06 UTC (rev 212325)
@@ -1,3 +1,18 @@
+2017-02-14  Chris Dumez  <[email protected]>
+
+        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.
+
+        * 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.
+
 2017-02-14  Anders Carlsson  <[email protected]>
 
         Remove an unused delegate method

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (212324 => 212325)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2017-02-14 23:11:06 UTC (rev 212325)
@@ -4341,7 +4341,8 @@
     if ([userInterfaceItem isEqualToString:@"validationBubble"]) {
         auto* validationBubble = _private->formValidationBubble.get();
         String message = validationBubble ? validationBubble->message() : emptyString();
-        return @{ userInterfaceItem: @{ @"message": (NSString *)message } };
+        double fontSize = validationBubble ? validationBubble->fontSize() : 0;
+        return @{ userInterfaceItem: @{ @"message": (NSString *)message, @"fontSize": [NSNumber numberWithDouble:fontSize] } };
     }
 
     return nil;
@@ -9326,7 +9327,8 @@
 {
     // FIXME: We should enable this on iOS as well.
 #if PLATFORM(MAC)
-    _private->formValidationBubble = ValidationBubble::create(self, message);
+    double minimumFontSize = _private->page ? _private->page->settings().minimumFontSize() : 0;
+    _private->formValidationBubble = ValidationBubble::create(self, message, { minimumFontSize });
     _private->formValidationBubble->showRelativeTo(enclosingIntRect([self _convertRectFromRootView:anchorRect]));
 #else
     UNUSED_PARAM(message);

Modified: trunk/Source/WebKit2/ChangeLog (212324 => 212325)


--- trunk/Source/WebKit2/ChangeLog	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Source/WebKit2/ChangeLog	2017-02-14 23:11:06 UTC (rev 212325)
@@ -1,3 +1,28 @@
+2017-02-14  Chris Dumez  <[email protected]>
+
+        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.
+
+        * 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.
+
 2017-02-14  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r211879.

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (212324 => 212325)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2017-02-14 23:11:06 UTC (rev 212325)
@@ -4876,7 +4876,8 @@
     if ([userInterfaceItem isEqualToString:@"validationBubble"]) {
         auto* validationBubble = _page->validationBubble();
         String message = validationBubble ? validationBubble->message() : emptyString();
-        return @{ userInterfaceItem: @{ @"message": (NSString *)message } };
+        double fontSize = validationBubble ? validationBubble->fontSize() : 0;
+        return @{ userInterfaceItem: @{ @"message": (NSString *)message, @"fontSize": [NSNumber numberWithDouble:fontSize] } };
     }
 
 #if PLATFORM(IOS)

Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (212324 => 212325)


--- trunk/Source/WebKit2/UIProcess/PageClient.h	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h	2017-02-14 23:11:06 UTC (rev 212325)
@@ -32,6 +32,7 @@
 #include <WebCore/AlternativeTextClient.h>
 #include <WebCore/EditorClient.h>
 #include <WebCore/UserInterfaceLayoutDirection.h>
+#include <WebCore/ValidationBubble.h>
 #include <wtf/Forward.h>
 
 #if PLATFORM(COCOA)
@@ -48,7 +49,6 @@
 namespace WebCore {
 class Cursor;
 class TextIndicator;
-class ValidationBubble;
 class WebMediaSessionManager;
 enum class TextIndicatorWindowLifetime : uint8_t;
 enum class TextIndicatorWindowDismissalAnimation : uint8_t;
@@ -229,7 +229,7 @@
 #endif
 
 #if PLATFORM(COCOA)
-    virtual Ref<WebCore::ValidationBubble> createValidationBubble(const String& message) = 0;
+    virtual Ref<WebCore::ValidationBubble> createValidationBubble(const String& message, const WebCore::ValidationBubble::Settings&) = 0;
 #endif
 
 #if PLATFORM(COCOA)

Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (212324 => 212325)


--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h	2017-02-14 23:11:06 UTC (rev 212325)
@@ -97,7 +97,7 @@
 #if ENABLE(CONTEXT_MENUS)
     std::unique_ptr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy&, const ContextMenuContextData&, const UserData&) override;
 #endif
-    Ref<WebCore::ValidationBubble> createValidationBubble(const String& message) final;
+    Ref<WebCore::ValidationBubble> createValidationBubble(const String& message, const WebCore::ValidationBubble::Settings&) final;
 
     void setTextIndicator(Ref<WebCore::TextIndicator>, WebCore::TextIndicatorWindowLifetime) override;
     void clearTextIndicator(WebCore::TextIndicatorWindowDismissalAnimation) override;

Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (212324 => 212325)


--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm	2017-02-14 23:11:06 UTC (rev 212325)
@@ -757,9 +757,9 @@
     return ([UIView userInterfaceLayoutDirectionForSemanticContentAttribute:[m_webView semanticContentAttribute]] == UIUserInterfaceLayoutDirectionLeftToRight) ? WebCore::UserInterfaceLayoutDirection::LTR : WebCore::UserInterfaceLayoutDirection::RTL;
 }
 
-Ref<ValidationBubble> PageClientImpl::createValidationBubble(const String& message)
+Ref<ValidationBubble> PageClientImpl::createValidationBubble(const String& message, const ValidationBubble::Settings& settings)
 {
-    return ValidationBubble::create(m_contentView, message);
+    return ValidationBubble::create(m_contentView, message, settings);
 }
 
 #if ENABLE(DATA_INTERACTION)

Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (212324 => 212325)


--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm	2017-02-14 23:11:06 UTC (rev 212325)
@@ -1095,7 +1095,7 @@
 
 void WebPageProxy::showValidationMessage(const IntRect& anchorClientRect, const String& message)
 {
-    m_validationBubble = m_pageClient.createValidationBubble(message);
+    m_validationBubble = m_pageClient.createValidationBubble(message, { m_preferences->minimumFontSize() });
     m_validationBubble->setAnchorRect(anchorClientRect, uiClient().presentingViewController());
 
     // If we are currently doing a scrolling / zoom animation, then we'll delay showing the validation

Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (212324 => 212325)


--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2017-02-14 23:11:06 UTC (rev 212325)
@@ -131,7 +131,7 @@
     RefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&) override;
 #endif
 
-    Ref<WebCore::ValidationBubble> createValidationBubble(const String& message) final;
+    Ref<WebCore::ValidationBubble> createValidationBubble(const String& message, const WebCore::ValidationBubble::Settings&) final;
 
     void setTextIndicator(Ref<WebCore::TextIndicator>, WebCore::TextIndicatorWindowLifetime) override;
     void clearTextIndicator(WebCore::TextIndicatorWindowDismissalAnimation) override;

Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (212324 => 212325)


--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2017-02-14 23:11:06 UTC (rev 212325)
@@ -440,9 +440,9 @@
 }
 #endif
 
-Ref<ValidationBubble> PageClientImpl::createValidationBubble(const String& message)
+Ref<ValidationBubble> PageClientImpl::createValidationBubble(const String& message, const ValidationBubble::Settings& settings)
 {
-    return ValidationBubble::create(m_view, message);
+    return ValidationBubble::create(m_view, message, settings);
 }
 
 void PageClientImpl::setTextIndicator(Ref<TextIndicator> textIndicator, WebCore::TextIndicatorWindowLifetime lifetime)

Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (212324 => 212325)


--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm	2017-02-14 23:11:06 UTC (rev 212325)
@@ -597,7 +597,7 @@
 
 void WebPageProxy::showValidationMessage(const IntRect& anchorClientRect, const String& message)
 {
-    m_validationBubble = m_pageClient.createValidationBubble(message);
+    m_validationBubble = m_pageClient.createValidationBubble(message, { m_preferences->minimumFontSize() });
     m_validationBubble->showRelativeTo(anchorClientRect);
 }
 

Modified: trunk/Tools/ChangeLog (212324 => 212325)


--- trunk/Tools/ChangeLog	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Tools/ChangeLog	2017-02-14 23:11:06 UTC (rev 212325)
@@ -1,3 +1,33 @@
+2017-02-14  Chris Dumez  <[email protected]>
+
+        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.
+
+        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):
+
 2017-02-14  Florian Bruhin  <[email protected]>
 
         Use a set instead of a list for tests when parsing expectations

Modified: trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm (212324 => 212325)


--- trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm	2017-02-14 23:11:06 UTC (rev 212325)
@@ -159,6 +159,10 @@
     return nullptr;
 }
 
+void UIScriptController::overridePreference(JSStringRef preferenceRef, JSStringRef valueRef)
+{
+}
+
 static CGPoint contentOffsetBoundedInValidRange(UIScrollView *scrollView, CGPoint contentOffset)
 {
     UIEdgeInsets contentInsets = scrollView.contentInset;

Modified: trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm (212324 => 212325)


--- trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm	2017-02-14 23:11:06 UTC (rev 212325)
@@ -94,6 +94,15 @@
 #endif
 }
 
+void UIScriptController::overridePreference(JSStringRef preferenceRef, JSStringRef valueRef)
+{
+    WebPreferences *preferences = mainFrame.webView.preferences;
+
+    RetainPtr<CFStringRef> value = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, valueRef));
+    if (JSStringIsEqualToUTF8CString(preferenceRef, "WebKitMinimumFontSize"))
+        preferences.minimumFontSize = [(NSString *)value.get() doubleValue];
+}
+
 void UIScriptController::removeViewFromWindow(JSValueRef callback)
 {
     unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (212324 => 212325)


--- trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl	2017-02-14 23:11:06 UTC (rev 212325)
@@ -222,4 +222,5 @@
     void removeViewFromWindow(object callback);
     void addViewToWindow(object callback);
 
+    void overridePreference(DOMString preference, DOMString value);
 };

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp (212324 => 212325)


--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp	2017-02-14 23:11:06 UTC (rev 212325)
@@ -397,6 +397,10 @@
 {
 }
 
+void UIScriptController::overridePreference(JSStringRef, JSStringRef)
+{
+}
+
 #endif // !PLATFORM(COCOA)
 
 #if !PLATFORM(MAC)

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (212324 => 212325)


--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h	2017-02-14 23:11:06 UTC (rev 212325)
@@ -87,6 +87,7 @@
     void selectFormAccessoryPickerRow(long);
     
     JSObjectRef contentsOfUserInterfaceItem(JSStringRef) const;
+    void overridePreference(JSStringRef preference, JSStringRef value);
     
     void scrollToOffset(long x, long y);
 

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (212324 => 212325)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2017-02-14 23:11:06 UTC (rev 212325)
@@ -678,6 +678,7 @@
     static WKStringRef sansSerifFontFamily = WKStringCreateWithUTF8CString("Helvetica");
     static WKStringRef serifFontFamily = WKStringCreateWithUTF8CString("Times");
 
+    WKPreferencesSetMinimumFontSize(preferences, 0);
     WKPreferencesSetStandardFontFamily(preferences, standardFontFamily);
     WKPreferencesSetCursiveFontFamily(preferences, cursiveFontFamily);
     WKPreferencesSetFantasyFontFamily(preferences, fantasyFontFamily);

Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (212324 => 212325)


--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2017-02-14 23:11:06 UTC (rev 212325)
@@ -651,6 +651,17 @@
     webView.didEndScrollingCallback = nil;
 }
 
+void UIScriptController::overridePreference(JSStringRef preferenceRef, JSStringRef valueRef)
+{
+    TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
+    WKPreferences *preferences = webView.configuration.preferences;
+
+    String preference = toWTFString(toWK(preferenceRef));
+    String value = toWTFString(toWK(valueRef));
+    if (preference == "WebKitMinimumFontSize")
+        preferences.minimumFontSize = value.toDouble();
 }
 
+}
+
 #endif // PLATFORM(IOS)

Modified: trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm (212324 => 212325)


--- trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm	2017-02-14 22:51:34 UTC (rev 212324)
+++ trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm	2017-02-14 23:11:06 UTC (rev 212325)
@@ -131,6 +131,22 @@
 #endif
 }
 
+void UIScriptController::overridePreference(JSStringRef preferenceRef, JSStringRef valueRef)
+{
+#if WK_API_ENABLED
+    TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
+    WKPreferences *preferences = webView.configuration.preferences;
+
+    String preference = toWTFString(toWK(preferenceRef));
+    String value = toWTFString(toWK(valueRef));
+    if (preference == "WebKitMinimumFontSize")
+        preferences.minimumFontSize = value.toDouble();
+#else
+    UNUSED_PARAM(preferenceRef);
+    UNUSED_PARAM(valueRef);
+#endif
+}
+
 void UIScriptController::removeViewFromWindow(JSValueRef callback)
 {
 #if WK_API_ENABLED
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to