Title: [238038] trunk
Revision
238038
Author
cdu...@apple.com
Date
2018-11-09 09:37:52 -0800 (Fri, 09 Nov 2018)

Log Message

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:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238037 => 238038)


--- trunk/LayoutTests/ChangeLog	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/ChangeLog	2018-11-09 17:37:52 UTC (rev 238038)
@@ -1,3 +1,46 @@
+2018-11-09  Chris Dumez  <cdu...@apple.com>
+
+        HTML form validation bubble disappears
+        https://bugs.webkit.org/show_bug.cgi?id=191418
+
+        Reviewed by Simon Fraser.
+
+        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:
+
 2018-11-09  Jer Noble  <jer.no...@apple.com>
 
         [Cocoa] Fix failing imported/w3c/web-platform-tests/media-source/mediasource-changetype-play.html test

Modified: trunk/LayoutTests/accessibility/ios-simulator/form-control-validation-message-expected.txt (238037 => 238038)


--- trunk/LayoutTests/accessibility/ios-simulator/form-control-validation-message-expected.txt	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/accessibility/ios-simulator/form-control-validation-message-expected.txt	2018-11-09 17:37:52 UTC (rev 238038)
@@ -1,12 +1,11 @@
-Required text input: 
 This tests that we are exposing form validation message through hint on iOS.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS input.helpText is 'AXHint: '
-PASS input.helpText is 'AXHint: Fill out this field'
+PASS input.helpText is "AXHint: "
+PASS input.helpText is "AXHint: Fill out this field"
 PASS successfullyParsed is true
 
 TEST COMPLETE
-
+Required text input: 

Modified: trunk/LayoutTests/accessibility/ios-simulator/form-control-validation-message.html (238037 => 238038)


--- trunk/LayoutTests/accessibility/ios-simulator/form-control-validation-message.html	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/accessibility/ios-simulator/form-control-validation-message.html	2018-11-09 17:37:52 UTC (rev 238038)
@@ -1,10 +1,9 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script>
-var successfullyParsed = false;
 </script>
-<script src=""
+<script src=""
 </head>
 <body id="body">
 
@@ -12,26 +11,22 @@
   Required text input: <input id="input" type="text" required=""><input id="submit" type="submit" id="firstSubmitButton">
 </form>
 
-<p id="description"></p>
-<div id="console"></div>
-
 <script>
-
     description("This tests that we are exposing form validation message through hint on iOS.");
+    jsTestIsAsync = true;
 
     if (window.accessibilityController) {
 
         var input = accessibilityController.accessibleElementById("input");
         
-        shouldBe("input.helpText", "'AXHint: '");
+        shouldBeEqualToString("input.helpText", "AXHint: ");
         document.getElementById("submit").click();
-        shouldBe("input.helpText", "'AXHint: Fill out this field'");
+        setTimeout(function() {
+            shouldBeEqualToString("input.helpText", "AXHint: Fill out this field");
+            finishJSTest();
+        }, 0);
     }
-
-    successfullyParsed = true;
 </script>
-
-<script src=""
 </body>
 </html>
 

Added: trunk/LayoutTests/fast/forms/form-validation.js (0 => 238038)


--- trunk/LayoutTests/fast/forms/form-validation.js	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/form-validation.js	2018-11-09 17:37:52 UTC (rev 238038)
@@ -0,0 +1,28 @@
+function getValidationBubbleContents()
+{
+    return `
+    (function() {
+        return JSON.stringify(uiController.contentsOfUserInterfaceItem('validationBubble'));
+    })();`
+}
+
+function getValidationBubble()
+{
+    return new Promise((resolve) => {
+        setTimeout(() => {
+            setTimeout(() => {
+                testRunner.runUIScript(getValidationBubbleContents(), function(result) {
+                    resolve(JSON.parse(result).validationBubble);
+                });
+            }, 0);
+        }, 0);
+    });
+}
+
+function getValidationMessage()
+{
+    return getValidationBubble().then((validationBubble) => {
+        return validationBubble.message;
+    });
+}
+

Modified: trunk/LayoutTests/fast/forms/ios/validation-bubble-dismiss-on-tap-expected.txt (238037 => 238038)


--- trunk/LayoutTests/fast/forms/ios/validation-bubble-dismiss-on-tap-expected.txt	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/ios/validation-bubble-dismiss-on-tap-expected.txt	2018-11-09 17:37:52 UTC (rev 238038)
@@ -3,8 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS validationBubbleContents.message is "Select this checkbox"
-PASS validationBubbleContents.message is ""
+PASS message is ""
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/forms/ios/validation-bubble-dismiss-on-tap.html (238037 => 238038)


--- trunk/LayoutTests/fast/forms/ios/validation-bubble-dismiss-on-tap.html	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/ios/validation-bubble-dismiss-on-tap.html	2018-11-09 17:37:52 UTC (rev 238038)
@@ -3,18 +3,11 @@
 <html>
 <head>
     <meta name="viewport" content="width=device-width">
-    <script src=""
+    <script src=""
+    <script src=""
     <script>
     jsTestIsAsync = true;
 
-    function getValidationBubbleContents()
-    {
-        return `
-        (function() {
-            return JSON.stringify(uiController.contentsOfUserInterfaceItem('validationBubble'));
-        })();`
-    }
-
     function getTapAtPointUIScript(x, y)
     {
         return `
@@ -34,14 +27,14 @@
 
         document.getElementById("testSubmitButton").click();
 
-        testRunner.runUIScript(getValidationBubbleContents(), function(result) {
-            validationBubbleContents = JSON.parse(result).validationBubble;
-            shouldBeEqualToString("validationBubbleContents.message", "Select this checkbox");
+        getValidationMessage().then((_message) => {
+            if (_message !==  "Select this checkbox")
+                testFailed("Unexpected validation message: " + _message);
 
             testRunner.runUIScript(getTapAtPointUIScript(0, 0), function() {
-                testRunner.runUIScript(getValidationBubbleContents(), function(result) {
-                    validationBubbleContents = JSON.parse(result).validationBubble;
-                    shouldBeEqualToString("validationBubbleContents.message", ""); // Not visible.
+                getValidationMessage().then((_message) => {
+                    message = _message;
+                    shouldBeEqualToString("message", ""); // Not visible.
                     finishJSTest();
                 });
             });
@@ -54,7 +47,6 @@
 <body>
 <form>
 <input type="checkbox" id="testInput" required><input type="submit" id="testSubmitButton">
-<script src=""
 </form>
 </body>
 </html>

Copied: trunk/LayoutTests/fast/forms/navigation-dismisses-validation-bubbles-expected.txt (from rev 238037, trunk/LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles-expected.txt) (0 => 238038)


--- trunk/LayoutTests/fast/forms/navigation-dismisses-validation-bubbles-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/navigation-dismisses-validation-bubbles-expected.txt	2018-11-09 17:37:52 UTC (rev 238038)
@@ -0,0 +1 @@
+PASS: The HTML validation bubble is no longer visible after navigating

Copied: trunk/LayoutTests/fast/forms/navigation-dismisses-validation-bubbles.html (from rev 238037, trunk/LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles.html) (0 => 238038)


--- trunk/LayoutTests/fast/forms/navigation-dismisses-validation-bubbles.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/navigation-dismisses-validation-bubbles.html	2018-11-09 17:37:52 UTC (rev 238038)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<body>
+<form>
+<input id="testInput" type="text" required>
+<input id="testSubmit" type="submit">
+</form>
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+document.getElementById("testSubmit")._onclick_ = function() {
+    setTimeout(function() {
+        window.location = "resources/check-validation-bubble-not-visible.html";
+    }, 0);
+}
+
+_onload_ = function() {
+    document.getElementById("testSubmit").click();
+};
+</script>
+</body>
+</html>

Copied: trunk/LayoutTests/fast/forms/resources/check-validation-bubble-not-visible.html (from rev 238037, trunk/LayoutTests/http/tests/navigation/resources/check-validation-bubble-not-visible.html) (0 => 238038)


--- trunk/LayoutTests/fast/forms/resources/check-validation-bubble-not-visible.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/resources/check-validation-bubble-not-visible.html	2018-11-09 17:37:52 UTC (rev 238038)
@@ -0,0 +1,17 @@
+<script src=""
+<script>
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+getValidationMessage().then((message) => {
+    if (message === "")
+        document.body.innerHTML = "PASS: The HTML validation bubble is no longer visible after navigating";
+    else
+        document.body.innerHTML = "FAIL: The HTML validation bubble is still visible after navigating";
+
+    if (window.testRunner)
+        testRunner.notifyDone();
+});
+</script>

Added: trunk/LayoutTests/fast/forms/scroll-into-view-and-show-validation-message-expected.txt (0 => 238038)


--- trunk/LayoutTests/fast/forms/scroll-into-view-and-show-validation-message-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/scroll-into-view-and-show-validation-message-expected.txt	2018-11-09 17:37:52 UTC (rev 238038)
@@ -0,0 +1,11 @@
+Tests that the validation bubble is shown even if the invalid field needs to be scrolled into view.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS message is "Fill out this field"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Submit
+

Added: trunk/LayoutTests/fast/forms/scroll-into-view-and-show-validation-message.html (0 => 238038)


--- trunk/LayoutTests/fast/forms/scroll-into-view-and-show-validation-message.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/scroll-into-view-and-show-validation-message.html	2018-11-09 17:37:52 UTC (rev 238038)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script src=""
+<form>
+  <button id="button">Submit</button>
+  <div style="height:800px; background:red"></div>
+  <input type=text required>
+</form>
+<script>
+description("Tests that the validation bubble is shown even if the invalid field needs to be scrolled into view.");
+jsTestIsAsync = true;
+
+_onload_ = function() {
+    button.click();
+
+    getValidationMessage().then((_message) => {
+        if (_message !== "Fill out this field")
+            testFailed("Unexpected message: " + _message);
+
+        // Make sure the message stays visible.
+        setTimeout(() => {
+            getValidationMessage().then((_message) => {
+                message = _message;
+                shouldBeEqualToString("message", "Fill out this field");
+                finishJSTest();
+            });
+        }, 10);
+    });
+}
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-detached-expected.txt (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-detached-expected.txt	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-detached-expected.txt	2018-11-09 17:37:52 UTC (rev 238038)
@@ -3,8 +3,7 @@
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
-PASS validationBubbleContents.message is "Fill out this field"
-PASS validationBubbleContents.message is ""
+PASS message is ""
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-detached.html (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-detached.html	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-detached.html	2018-11-09 17:37:52 UTC (rev 238038)
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html>
 <body>
-<script src=""
+<script src=""
+<script src=""
 <form>
   Required text input: <input type="text" id="required_text_input" required><input id="required_text_input_submit" type="submit">
 </form>
@@ -11,22 +12,14 @@
 description("Tests that the HTML form validation bubble disappears when its associated element is detached.");
 jsTestIsAsync = true;
 
-function getValidationBubbleContents()
-{
-    return `
-    (function() {
-        return JSON.stringify(uiController.contentsOfUserInterfaceItem('validationBubble'));
-    })();`
-}
-
 _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;
-        shouldBeEqualToString("validationBubbleContents.message", "Fill out this field");
+    getValidationMessage().then((_message) => {
+        if (_message !== "Fill out this field")
+            testFailed("Unexpected validation message: " + _message);
 
         // Detach input element.
         input.remove();
@@ -33,14 +26,13 @@
         // Force layout.
         input.offsetTop;
 
-        testRunner.runUIScript(getValidationBubbleContents(), function(result) {
-            validationBubbleContents = JSON.parse(result).validationBubble;
-            shouldBeEqualToString("validationBubbleContents.message", ""); // No longer visible.
+        getValidationMessage().then((_message) => {
+            message = _message;
+            shouldBeEqualToString("message", ""); // No longer visible.
             finishJSTest();
         });
     });
 }
 </script>
-<script src=""
 </body>
 <html>

Modified: trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-moved-expected.txt (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-moved-expected.txt	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-moved-expected.txt	2018-11-09 17:37:52 UTC (rev 238038)
@@ -4,8 +4,7 @@
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
-PASS validationBubbleContents.message is "Fill out this field"
-PASS validationBubbleContents.message is ""
+PASS message is ""
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-moved.html (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-moved.html	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-moved.html	2018-11-09 17:37:52 UTC (rev 238038)
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html>
 <body>
-<script src=""
+<script src=""
+<script src=""
 <form>
   Required text input: <input type="text" id="required_text_input" required><input id="required_text_input_submit" type="submit">
 </form>
@@ -11,22 +12,14 @@
 description("Tests that the HTML form validation bubble disappears when its associated element is no longer visible.");
 jsTestIsAsync = true;
 
-function getValidationBubbleContents()
-{
-    return `
-    (function() {
-        return JSON.stringify(uiController.contentsOfUserInterfaceItem('validationBubble'));
-    })();`
-}
-
 _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;
-        shouldBeEqualToString("validationBubbleContents.message", "Fill out this field");
+    getValidationMessage().then((_message) => {
+        if (_message !== "Fill out this field")
+            testFailed("Unexpected validation message: " + _message);
 
         // Move input element.
         document.body.prepend(document.createElement("br"));
@@ -33,14 +26,13 @@
         // Force layout.
         input.offsetTop;
 
-        testRunner.runUIScript(getValidationBubbleContents(), function(result) {
-            validationBubbleContents = JSON.parse(result).validationBubble;
-            shouldBeEqualToString("validationBubbleContents.message", ""); // No longer visible.
+        getValidationMessage().then((_message) => {
+            message = _message;
+            shouldBeEqualToString("message", ""); // No longer visible.
             finishJSTest();
         });
     });
 }
 </script>
-<script src=""
 </body>
 <html>

Modified: trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-no-longer-visible-expected.txt (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-no-longer-visible-expected.txt	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-no-longer-visible-expected.txt	2018-11-09 17:37:52 UTC (rev 238038)
@@ -3,8 +3,7 @@
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
-PASS validationBubbleContents.message is "Fill out this field"
-PASS validationBubbleContents.message is ""
+PASS message is ""
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-no-longer-visible.html (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-no-longer-visible.html	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-no-longer-visible.html	2018-11-09 17:37:52 UTC (rev 238038)
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html>
 <body>
-<script src=""
+<script src=""
+<script src=""
 <form>
   Required text input: <input type="text" id="required_text_input" required><input id="required_text_input_submit" type="submit">
 </form>
@@ -11,22 +12,14 @@
 description("Tests that the HTML form validation bubble disappears when its associated element is no longer visible.");
 jsTestIsAsync = true;
 
-function getValidationBubbleContents()
-{
-    return `
-    (function() {
-        return JSON.stringify(uiController.contentsOfUserInterfaceItem('validationBubble'));
-    })();`
-}
-
 _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;
-        shouldBeEqualToString("validationBubbleContents.message", "Fill out this field");
+    getValidationMessage().then((_message) => {
+        if (_message !== "Fill out this field")
+            testFailed("Unexpected validation message: " + _message);
 
         // Hide input element.
         input.setAttribute("style", "display: none");
@@ -33,14 +26,13 @@
         // Force layout.
         input.offsetTop;
 
-        testRunner.runUIScript(getValidationBubbleContents(), function(result) {
-            validationBubbleContents = JSON.parse(result).validationBubble;
-            shouldBeEqualToString("validationBubbleContents.message", ""); // No longer visible.
+        getValidationMessage().then((_message) => {
+            message = _message;
+            shouldBeEqualToString("message", ""); // No longer visible.
             finishJSTest();
         });
     });
 }
 </script>
-<script src=""
 </body>
 <html>

Modified: trunk/LayoutTests/fast/forms/validation-bubble-escape-key-dismiss-expected.txt (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-bubble-escape-key-dismiss-expected.txt	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-bubble-escape-key-dismiss-expected.txt	2018-11-09 17:37:52 UTC (rev 238038)
@@ -3,8 +3,7 @@
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
-PASS validationBubbleContents.message is "Fill out this field"
-PASS validationBubbleContents.message is ""
+PASS message is ""
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/forms/validation-bubble-escape-key-dismiss.html (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-bubble-escape-key-dismiss.html	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-bubble-escape-key-dismiss.html	2018-11-09 17:37:52 UTC (rev 238038)
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html>
 <body>
-<script src=""
+<script src=""
+<script src=""
 <form>
   Required text input: <input type="text" id="required_text_input" required><input id="required_text_input_submit" type="submit">
 </form>
@@ -11,34 +12,25 @@
 description("Tests that the HTML form validation bubble gets dismissed when pressing the Escape key.");
 jsTestIsAsync = true;
 
-function getValidationBubbleContents()
-{
-    return `
-    (function() {
-        return JSON.stringify(uiController.contentsOfUserInterfaceItem('validationBubble'));
-    })();`
-}
-
 _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;
-        shouldBeEqualToString("validationBubbleContents.message", "Fill out this field");
+    getValidationMessage().then((_message) => {
+        if (_message !== "Fill out this field")
+            testFailed("Unexpected validation message: " + _message);
 
         // Press Escape key.
         eventSender.keyDown("escape");
 
-        testRunner.runUIScript(getValidationBubbleContents(), function(result) {
-            validationBubbleContents = JSON.parse(result).validationBubble;
-            shouldBeEqualToString("validationBubbleContents.message", ""); // No longer visible.
+        getValidationMessage().then((_message) => {
+            message = _message;
+            shouldBeEqualToString("message", ""); // No longer visible.
             finishJSTest();
         });
     });
 }
 </script>
-<script src=""
 </body>
 <html>

Modified: trunk/LayoutTests/fast/forms/validation-custom-message-expected.txt (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-custom-message-expected.txt	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-custom-message-expected.txt	2018-11-09 17:37:52 UTC (rev 238038)
@@ -3,8 +3,8 @@
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
-PASS validationBubbleContents.message is "This is a custom validity message."
-PASS validationBubbleContents.message is "Fill out this field"
+PASS message is "This is a custom validity message."
+PASS message is "Fill out this field"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/forms/validation-custom-message.html (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-custom-message.html	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-custom-message.html	2018-11-09 17:37:52 UTC (rev 238038)
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html>
 <body>
-<script src=""
+<script src=""
+<script src=""
 <form>
   Required text input: <input type="text" id="required_text_input" required><input id="required_text_input_submit" type="submit">
 </form>
@@ -11,14 +12,6 @@
 description("Tests that the custom validation message set by _javascript_ is displayed on UI side.");
 jsTestIsAsync = true;
 
-function getValidationBubbleContents()
-{
-    return `
-    (function() {
-        return JSON.stringify(uiController.contentsOfUserInterfaceItem('validationBubble'));
-    })();`
-}
-
 _onload_ = function() {
     input = document.getElementById("required_text_input");
     input.setCustomValidity("This is a custom validity message.");
@@ -25,22 +18,21 @@
     submit = document.getElementById("required_text_input_submit");
     submit.click();
 
-    testRunner.runUIScript(getValidationBubbleContents(), function(result) {
-        validationBubbleContents = JSON.parse(result).validationBubble;
-        shouldBeEqualToString("validationBubbleContents.message", "This is a custom validity message.");
+    getValidationMessage().then((_message) => {
+        message = _message;
+        shouldBeEqualToString("message", "This is a custom validity message.");
 
         // Reset the validity message to the default one.
         input.setCustomValidity("");
         submit.click();
 
-        testRunner.runUIScript(getValidationBubbleContents(), function(result) {
-            validationBubbleContents = JSON.parse(result).validationBubble;
-            shouldBeEqualToString("validationBubbleContents.message", "Fill out this field");
+        getValidationMessage().then((_message) => {    
+            message = _message;
+            shouldBeEqualToString("message", "Fill out this field");
             finishJSTest();
         });
     });
 }
 </script>
-<script src=""
 </body>
 <html>

Modified: trunk/LayoutTests/fast/forms/validation-message-detached-iframe-expected.txt (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-message-detached-iframe-expected.txt	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-message-detached-iframe-expected.txt	2018-11-09 17:37:52 UTC (rev 238038)
@@ -2,7 +2,7 @@
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
-PASS validationBubbleContents.message is ""
+PASS message is ""
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/forms/validation-message-detached-iframe.html (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-message-detached-iframe.html	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-message-detached-iframe.html	2018-11-09 17:37:52 UTC (rev 238038)
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html>
 <body>
-<script src=""
+<script src=""
+<script src=""
 <iframe id="testFrame" src=""
 <div id="description"></div>
 <div id="console"></div>
@@ -9,14 +10,6 @@
 description("Tests that the form validation message goes away when its element's iframe gets detached.");
 jsTestIsAsync = true;
 
-function getValidationBubbleContents()
-{
-    return `
-    (function() {
-        return JSON.stringify(uiController.contentsOfUserInterfaceItem('validationBubble'));
-    })();`
-}
-
 _onload_ = function() {
     var testFrame = document.getElementById("testFrame");
     testFrame.contentDocument.getElementById("required_text_input_submit").click();
@@ -25,13 +18,12 @@
     testFrame = null;
     gc();
 
-    testRunner.runUIScript(getValidationBubbleContents(), function(result) {
-        validationBubbleContents = JSON.parse(result).validationBubble;
-        shouldBeEqualToString("validationBubbleContents.message", "");
+    getValidationMessage().then((_message) => {
+        message = _message;
+        shouldBeEqualToString("message", "");
         finishJSTest();
     });
 }
 </script>
-<script src=""
 </body>
 <html>

Modified: trunk/LayoutTests/fast/forms/validation-message-detached-iframe2-expected.txt (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-message-detached-iframe2-expected.txt	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-message-detached-iframe2-expected.txt	2018-11-09 17:37:52 UTC (rev 238038)
@@ -2,7 +2,7 @@
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
-PASS validationBubbleContents.message is ""
+PASS message is ""
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/forms/validation-message-detached-iframe2.html (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-message-detached-iframe2.html	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-message-detached-iframe2.html	2018-11-09 17:37:52 UTC (rev 238038)
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html>
 <body>
-<script src=""
+<script src=""
+<script src=""
 <iframe id="testFrame1" srcdoc="<iframe id='testFrame2' src=''></iframe>"></iframe>
 <div id="description"></div>
 <div id="console"></div>
@@ -9,14 +10,6 @@
 description("Tests that the form validation message goes away when its element's iframe gets detached.");
 jsTestIsAsync = true;
 
-function getValidationBubbleContents()
-{
-    return `
-    (function() {
-        return JSON.stringify(uiController.contentsOfUserInterfaceItem('validationBubble'));
-    })();`
-}
-
 _onload_ = function() {
     var testFrame1 = document.getElementById("testFrame1");
     testFrame1.contentDocument.getElementById("testFrame2").contentDocument.getElementById("required_text_input_submit").click();
@@ -25,14 +18,14 @@
     testFrame1 = null;
     gc();
 
-    testRunner.runUIScript(getValidationBubbleContents(), function(result) {
-        validationBubbleContents = JSON.parse(result).validationBubble;
+    getValidationMessage().then((_message) => {
+        message = _message;
+
         gc();
-        shouldBeEqualToString("validationBubbleContents.message", "");
+        shouldBeEqualToString("message", "");
         finishJSTest();
     });
 }
 </script>
-<script src=""
 </body>
 <html>

Modified: trunk/LayoutTests/fast/forms/validation-message-minimum-font-size-expected.txt (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-message-minimum-font-size-expected.txt	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-message-minimum-font-size-expected.txt	2018-11-09 17:37:52 UTC (rev 238038)
@@ -3,9 +3,9 @@
 
 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 validationBubble.fontSize > 0 is true
+PASS validationBubble.fontSize < 24 is true
+PASS validationBubble.fontSize is 24
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/forms/validation-message-minimum-font-size.html (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-message-minimum-font-size.html	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-message-minimum-font-size.html	2018-11-09 17:37:52 UTC (rev 238038)
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html>
 <body>
-<script src=""
+<script src=""
+<script src=""
 <form>
   Required text input: <input type="text" id="required_text_input" required><input id="required_text_input_submit" type="submit">
 </form>
@@ -11,14 +12,6 @@
 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 `
@@ -33,17 +26,17 @@
     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");
+    getValidationBubble().then((_validationBubble) => {
+        validationBubble = _validationBubble;
+        shouldBeTrue("validationBubble.fontSize > 0");
+        shouldBeTrue("validationBubble.fontSize < 24");
 
         testRunner.runUIScript(setMinimumFontSize(), function() {
             submit.click();
 
-            testRunner.runUIScript(getValidationBubbleContents(), function(result) {
-                validationBubbleContents = JSON.parse(result).validationBubble;
-                shouldBe("validationBubbleContents.fontSize", "24");
+            getValidationBubble().then((_validationBubble) => {
+                 validationBubble = _validationBubble;
+                shouldBe("validationBubble.fontSize", "24");
                 finishJSTest();
             });
         });
@@ -50,6 +43,5 @@
     });
 }
 </script>
-<script src=""
 </body>
 <html>

Modified: trunk/LayoutTests/fast/forms/validation-messages-expected.txt (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-messages-expected.txt	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-messages-expected.txt	2018-11-09 17:37:52 UTC (rev 238038)
@@ -14,17 +14,17 @@
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
-PASS validationBubbleContents.message is "Fill out this field"
-PASS validationBubbleContents.message is "Select this checkbox"
-PASS validationBubbleContents.message is "Select one of these options"
-PASS validationBubbleContents.message is "Select a file"
-PASS validationBubbleContents.message is "Enter an email address"
-PASS validationBubbleContents.message is "Enter a URL"
-PASS validationBubbleContents.message is "Match the requested format"
-PASS validationBubbleContents.message is "Use at least 100 characters"
-PASS validationBubbleContents.message is "Value must be greater than or equal to 5"
-PASS validationBubbleContents.message is "Value must be less than or equal to 5"
-PASS validationBubbleContents.message is "Enter a valid value"
+PASS message is "Fill out this field"
+PASS message is "Select this checkbox"
+PASS message is "Select one of these options"
+PASS message is "Select a file"
+PASS message is "Enter an email address"
+PASS message is "Enter a URL"
+PASS message is "Match the requested format"
+PASS message is "Use at least 100 characters"
+PASS message is "Value must be greater than or equal to 5"
+PASS message is "Value must be less than or equal to 5"
+PASS message is "Enter a valid value"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/forms/validation-messages.html (238037 => 238038)


--- trunk/LayoutTests/fast/forms/validation-messages.html	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/fast/forms/validation-messages.html	2018-11-09 17:37:52 UTC (rev 238038)
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html>
 <body>
-<script src=""
+<script src=""
+<script src=""
 <form>
   Required text input: <input type="text" required><input id="required_text_input_submit" type="submit">
 </form>
@@ -43,14 +44,6 @@
 description("Tests the HTML form validation messages being shown on UI side.");
 jsTestIsAsync = true;
 
-function getValidationBubbleContents()
-{
-    return `
-    (function() {
-        uiController.uiScriptComplete(JSON.stringify(uiController.contentsOfUserInterfaceItem('validationBubble')));
-    })();`
-}
-
 var tests = [
     ['required_text_input_submit', 'Fill out this field'],
     ['required_checkbox_submit', 'Select this checkbox'],
@@ -79,9 +72,9 @@
     expectedMessage = currentTest[1];
 
     submitButton.click();
-    testRunner.runUIScript(getValidationBubbleContents(), function(result) {
-        validationBubbleContents = JSON.parse(result).validationBubble;
-        shouldBeEqualToString("validationBubbleContents.message", "" + expectedMessage);
+    getValidationMessage().then((_message) => {
+        message = _message;
+        shouldBeEqualToString("message", "" + expectedMessage);
         runNextTest();
     });
 }
@@ -100,6 +93,5 @@
     }, 0);
 }
 </script>
-<script src=""
 </body>
 <html>

Deleted: trunk/LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles-expected.txt (238037 => 238038)


--- trunk/LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles-expected.txt	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles-expected.txt	2018-11-09 17:37:52 UTC (rev 238038)
@@ -1 +0,0 @@
-PASS: The HTML validation bubble is no longer visible after navigating

Deleted: trunk/LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles.html (238037 => 238038)


--- trunk/LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles.html	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles.html	2018-11-09 17:37:52 UTC (rev 238038)
@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<html>
-<body>
-<form>
-<input id="testInput" type="text" required>
-<input id="testSubmit" type="submit">
-</form>
-<script>
-if (window.testRunner)
-    testRunner.waitUntilDone();
-
-document.getElementById("testSubmit")._onclick_ = function() {
-    setTimeout(function() {
-        window.location = "resources/check-validation-bubble-not-visible.html";
-    }, 0);
-}
-
-_onload_ = function() {
-    document.getElementById("testSubmit").click();
-};
-</script>
-</body>
-</html>

Deleted: trunk/LayoutTests/http/tests/navigation/resources/check-validation-bubble-not-visible.html (238037 => 238038)


--- trunk/LayoutTests/http/tests/navigation/resources/check-validation-bubble-not-visible.html	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/http/tests/navigation/resources/check-validation-bubble-not-visible.html	2018-11-09 17:37:52 UTC (rev 238038)
@@ -1,24 +0,0 @@
-<script>
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
-
-function getValidationBubbleContents()
-{
-    return `
-    (function() {
-        return JSON.stringify(uiController.contentsOfUserInterfaceItem('validationBubble'));
-    })();`
-}
-testRunner.runUIScript(getValidationBubbleContents(), function(result) {
-    validationBubbleContents = JSON.parse(result).validationBubble;
-    if (validationBubbleContents.message === "")
-        document.body.innerHTML = "PASS: The HTML validation bubble is no longer visible after navigating";
-    else
-        document.body.innerHTML = "FAIL: The HTML validation bubble is still visible after navigating";
-
-    if (window.testRunner)
-        testRunner.notifyDone();
-});
-</script>

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (238037 => 238038)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2018-11-09 17:37:52 UTC (rev 238038)
@@ -980,6 +980,8 @@
 webkit.org/b/168050 fast/zooming/uiscript-zooming.html [ Skip ]
 
 # Skip tests expecting native HTML form validation popover
+webkit.org/b/167579 fast/forms/scroll-into-view-and-show-validation-message.html [ Skip ]
+webkit.org/b/167579 fast/forms/navigation-dismisses-validation-bubbles.html [ Skip ]
 webkit.org/b/167579 fast/forms/validation-bubble-disappears-when-input-detached.html [ Skip ]
 webkit.org/b/167579 fast/forms/validation-bubble-disappears-when-input-moved.html [ Skip ]
 webkit.org/b/167579 fast/forms/validation-bubble-disappears-when-input-no-longer-visible.html [ Skip ]
@@ -987,7 +989,6 @@
 webkit.org/b/167579 fast/forms/validation-message-detached-iframe.html [ Skip ]
 webkit.org/b/167579 fast/forms/validation-message-detached-iframe2.html [ Skip ]
 webkit.org/b/167579 fast/forms/validation-messages.html [ Skip ]
-webkit.org/b/167579 http/tests/navigation/navigation-dismisses-validation-bubbles.html [ Skip ]
 webkit.org/b/167579 fast/forms/validation-bubble-escape-key-dismiss.html [ Skip ]
 webkit.org/b/167579 fast/forms/validation-message-minimum-font-size.html [ Skip ]
 

Modified: trunk/LayoutTests/platform/ios-wk1/TestExpectations (238037 => 238038)


--- trunk/LayoutTests/platform/ios-wk1/TestExpectations	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/platform/ios-wk1/TestExpectations	2018-11-09 17:37:52 UTC (rev 238038)
@@ -1935,6 +1935,8 @@
 fast/dom/beforeload/video-before-load.html [ Skip ]
 fast/dom/FileList-iterator.html [ Skip ]
 fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html [ Skip ]
+fast/forms/scroll-into-view-and-show-validation-message.html [ Skip ]
+fast/forms/navigation-dismisses-validation-bubbles.html [ Skip ]
 fast/forms/validation-bubble-disappears-when-input-detached.html [ Skip ]
 fast/forms/validation-bubble-disappears-when-input-moved.html [ Skip ]
 fast/forms/validation-bubble-disappears-when-input-no-longer-visible.html [ Skip ]
@@ -1950,7 +1952,6 @@
 http/tests/download/anchor-download-attribute-content-disposition.html [ Skip ]
 http/tests/download/anchor-download-no-extension.html [ Skip ]
 http/tests/misc/empty-urls.html [ Skip ]
-http/tests/navigation/navigation-dismisses-validation-bubbles.html [ Skip ]
 http/tests/security/canvas-remote-read-remote-video-allowed-anonymous.html [ Skip ]
 http/tests/security/canvas-remote-read-remote-video-allowed-with-credentials.html [ Skip ]
 http/tests/security/canvas-remote-read-remote-video-blocked-no-crossorigin.html [ Skip ]

Modified: trunk/LayoutTests/platform/ios-wk2/fast/forms/validation-messages-expected.txt (238037 => 238038)


--- trunk/LayoutTests/platform/ios-wk2/fast/forms/validation-messages-expected.txt	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/platform/ios-wk2/fast/forms/validation-messages-expected.txt	2018-11-09 17:37:52 UTC (rev 238038)
@@ -14,18 +14,19 @@
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
-PASS validationBubbleContents.message is "Fill out this field"
-PASS validationBubbleContents.message is "Select this checkbox"
-PASS validationBubbleContents.message is "Select one of these options"
-PASS validationBubbleContents.message is "Select a file"
-PASS validationBubbleContents.message is "Enter an email address"
-PASS validationBubbleContents.message is "Enter a URL"
-PASS validationBubbleContents.message is "Match the requested format"
-FAIL validationBubbleContents.message should be Use at least 100 characters. Was Fill out this field.
-PASS validationBubbleContents.message is "Value must be greater than or equal to 5"
-PASS validationBubbleContents.message is "Value must be less than or equal to 5"
-PASS validationBubbleContents.message is "Enter a valid value"
+PASS message is "Fill out this field"
+PASS message is "Select this checkbox"
+PASS message is "Select one of these options"
+PASS message is "Select a file"
+PASS message is "Enter an email address"
+PASS message is "Enter a URL"
+PASS message is "Match the requested format"
+FAIL message should be Use at least 100 characters. Was Fill out this field.
+PASS message is "Value must be greater than or equal to 5"
+PASS message is "Value must be less than or equal to 5"
+PASS message is "Enter a valid value"
 PASS successfullyParsed is true
+Some tests failed.
 
 TEST COMPLETE
 

Modified: trunk/LayoutTests/platform/win/TestExpectations (238037 => 238038)


--- trunk/LayoutTests/platform/win/TestExpectations	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/LayoutTests/platform/win/TestExpectations	2018-11-09 17:37:52 UTC (rev 238038)
@@ -3424,6 +3424,8 @@
 fast/canvas/canvas-createPattern-video-modify.html [ Skip ]
 fast/events/before-input-prevent-insert-replacement.html [ Skip ]
 fast/events/input-event-insert-replacement.html [ Skip ]
+fast/forms/scroll-into-view-and-show-validation-message.html [ Skip ]
+fast/forms/navigation-dismisses-validation-bubbles.html [ Skip ]
 fast/forms/validation-bubble-disappears-when-input-detached.html [ Skip ]
 fast/forms/validation-bubble-disappears-when-input-moved.html [ Skip ]
 fast/forms/validation-bubble-disappears-when-input-no-longer-visible.html [ Skip ]
@@ -3433,7 +3435,6 @@
 fast/shadow-dom/pointerlockelement-in-shadow-tree.html [ Skip ]
 fast/shadow-dom/pointerlockelement-in-slot.html [ Skip ]
 http/tests/misc/detach-during-notifyDone.html [ Skip ]
-http/tests/navigation/navigation-dismisses-validation-bubbles.html [ Skip ]
 http/tests/navigation/ping-attribute/area-cross-origin-from-https.html [ Skip ]
 http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-cross-origin-https.html [ Skip ]
 http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-same-origin-https.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (238037 => 238038)


--- trunk/Source/WebCore/ChangeLog	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/Source/WebCore/ChangeLog	2018-11-09 17:37:52 UTC (rev 238038)
@@ -1,3 +1,21 @@
+2018-11-09  Chris Dumez  <cdu...@apple.com>
+
+        HTML form validation bubble disappears
+        https://bugs.webkit.org/show_bug.cgi?id=191418
+
+        Reviewed by Simon Fraser.
+
+        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):
+
 2018-11-09  Brent Fulgham  <bfulg...@apple.com>
 
         [Windows][DirectX] Be more rigors about BeginFigure/EndFigure and Close operations. 

Modified: trunk/Source/WebCore/html/HTMLFormControlElement.cpp (238037 => 238038)


--- trunk/Source/WebCore/html/HTMLFormControlElement.cpp	2018-11-09 17:32:32 UTC (rev 238037)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.cpp	2018-11-09 17:37:52 UTC (rev 238038)
@@ -516,7 +516,13 @@
 {
     // Calling focus() will scroll the element into view.
     focus();
-    updateVisibleValidationMessage();
+
+    // focus() will scroll the element into view and this scroll may happen asynchronously.
+    // Because scrolling the view hides the validation message, we need to show the validation
+    // message asynchronously as well.
+    callOnMainThread([this, protectedThis = makeRef(*this)] {
+        updateVisibleValidationMessage();
+    });
 }
 
 inline bool HTMLFormControlElement::isValidFormControlElement() const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to