Title: [211727] branches/safari-603-branch

Diff

Modified: branches/safari-603-branch/LayoutTests/ChangeLog (211726 => 211727)


--- branches/safari-603-branch/LayoutTests/ChangeLog	2017-02-06 16:54:31 UTC (rev 211726)
+++ branches/safari-603-branch/LayoutTests/ChangeLog	2017-02-06 17:07:24 UTC (rev 211727)
@@ -1,3 +1,21 @@
+2017-02-06  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r211653. rdar://problem/29872943
+
+    2017-02-03  Chris Dumez  <cdu...@apple.com>
+
+            Dismiss HTML form validation popover when pressing Escape key
+            https://bugs.webkit.org/show_bug.cgi?id=167716
+            <rdar://problem/29872943>
+
+            Reviewed by Simon Fraser.
+
+            Add layout test coverage.
+
+            * fast/forms/validation-bubble-escape-key-dismiss-expected.txt: Added.
+            * fast/forms/validation-bubble-escape-key-dismiss.html: Added.
+            * platform/ios-simulator/TestExpectations:
+
 2017-02-05  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r211523. rdar://problem/29453068

Added: branches/safari-603-branch/LayoutTests/fast/forms/validation-bubble-escape-key-dismiss-expected.txt (0 => 211727)


--- branches/safari-603-branch/LayoutTests/fast/forms/validation-bubble-escape-key-dismiss-expected.txt	                        (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/forms/validation-bubble-escape-key-dismiss-expected.txt	2017-02-06 17:07:24 UTC (rev 211727)
@@ -0,0 +1,11 @@
+Required text input: 
+Tests that the HTML form validation bubble gets dismissed when pressing the Escape key.
+
+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 successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-603-branch/LayoutTests/fast/forms/validation-bubble-escape-key-dismiss.html (0 => 211727)


--- branches/safari-603-branch/LayoutTests/fast/forms/validation-bubble-escape-key-dismiss.html	                        (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/forms/validation-bubble-escape-key-dismiss.html	2017-02-06 17:07:24 UTC (rev 211727)
@@ -0,0 +1,44 @@
+<!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 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");
+
+        // Press Escape key.
+        eventSender.keyDown("escape");
+
+        testRunner.runUIScript(getValidationBubbleContents(), function(result) {
+            validationBubbleContents = JSON.parse(result).validationBubble;
+            shouldBeEqualToString("validationBubbleContents.message", ""); // No longer visible.
+            finishJSTest();
+        });
+    });
+}
+</script>
+<script src=""
+</body>
+<html>

Modified: branches/safari-603-branch/LayoutTests/platform/ios-simulator/TestExpectations (211726 => 211727)


--- branches/safari-603-branch/LayoutTests/platform/ios-simulator/TestExpectations	2017-02-06 16:54:31 UTC (rev 211726)
+++ branches/safari-603-branch/LayoutTests/platform/ios-simulator/TestExpectations	2017-02-06 17:07:24 UTC (rev 211727)
@@ -350,6 +350,7 @@
 
 # This test relies on EventSender.keydown(), which is not supported on iOS
 webkit.org/b/155233 fast/events/max-tabindex-focus.html [ Skip ]
+fast/forms/validation-bubble-escape-key-dismiss.html [ Skip ]
 fast/forms/validation-message-maxLength.html [ Skip ]
 fast/shadow-dom/shadow-host-removal-crash.html [ Skip ]
 fast/shadow-dom/input-element-in-shadow.html [ Skip ]

Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (211726 => 211727)


--- branches/safari-603-branch/Source/WebCore/ChangeLog	2017-02-06 16:54:31 UTC (rev 211726)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog	2017-02-06 17:07:24 UTC (rev 211727)
@@ -1,3 +1,24 @@
+2017-02-06  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r211653. rdar://problem/29872943
+
+    2017-02-03  Chris Dumez  <cdu...@apple.com>
+
+            Dismiss HTML form validation popover when pressing Escape key
+            https://bugs.webkit.org/show_bug.cgi?id=167716
+            <rdar://problem/29872943>
+
+            Reviewed by Simon Fraser.
+
+            Dismiss any visible HTML form validation popover when pressing
+            the Escape key.
+
+            Test: fast/forms/validation-bubble-escape-key-dismiss.html
+
+            * page/EventHandler.cpp:
+            (WebCore::EventHandler::keyEvent):
+            * page/ValidationMessageClient.h:
+
 2017-02-05  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r211504. rdar://problem/30301117

Modified: branches/safari-603-branch/Source/WebCore/page/EventHandler.cpp (211726 => 211727)


--- branches/safari-603-branch/Source/WebCore/page/EventHandler.cpp	2017-02-06 16:54:31 UTC (rev 211726)
+++ branches/safari-603-branch/Source/WebCore/page/EventHandler.cpp	2017-02-06 17:07:24 UTC (rev 211727)
@@ -92,6 +92,7 @@
 #include "TextIterator.h"
 #include "UserGestureIndicator.h"
 #include "UserTypingGestureIndicator.h"
+#include "ValidationMessageClient.h"
 #include "VisibleUnits.h"
 #include "WheelEvent.h"
 #include "WindowsKeyboardCodes.h"
@@ -3114,6 +3115,13 @@
     }
 #endif
 
+    if (initialKeyEvent.type() == PlatformEvent::KeyDown && initialKeyEvent.windowsVirtualKeyCode() == VK_ESCAPE) {
+        if (auto* page = m_frame.page()) {
+            if (auto* validationMessageClient = page->validationMessageClient())
+                validationMessageClient->hideAnyValidationMessage();
+        }
+    }
+
 #if ENABLE(FULLSCREEN_API)
     if (m_frame.document()->webkitIsFullScreen()) {
         if (initialKeyEvent.type() == PlatformEvent::KeyDown && initialKeyEvent.windowsVirtualKeyCode() == VK_ESCAPE) {

Modified: branches/safari-603-branch/Source/WebCore/page/ValidationMessageClient.h (211726 => 211727)


--- branches/safari-603-branch/Source/WebCore/page/ValidationMessageClient.h	2017-02-06 16:54:31 UTC (rev 211726)
+++ branches/safari-603-branch/Source/WebCore/page/ValidationMessageClient.h	2017-02-06 17:07:24 UTC (rev 211727)
@@ -45,6 +45,9 @@
     // anchor is already visible.
     virtual void hideValidationMessage(const Element& anchor) = 0;
 
+    // Hide any validation message currently displayed.
+    virtual void hideAnyValidationMessage() = 0;
+
     // Returns true if the validation message for the specified anchor element
     // is visible.
     virtual bool isValidationMessageVisible(const Element& anchor) = 0;

Modified: branches/safari-603-branch/Source/WebKit/mac/ChangeLog (211726 => 211727)


--- branches/safari-603-branch/Source/WebKit/mac/ChangeLog	2017-02-06 16:54:31 UTC (rev 211726)
+++ branches/safari-603-branch/Source/WebKit/mac/ChangeLog	2017-02-06 17:07:24 UTC (rev 211727)
@@ -1,3 +1,21 @@
+2017-02-06  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r211653. rdar://problem/29872943
+
+    2017-02-03  Chris Dumez  <cdu...@apple.com>
+
+            Dismiss HTML form validation popover when pressing Escape key
+            https://bugs.webkit.org/show_bug.cgi?id=167716
+            <rdar://problem/29872943>
+
+            Reviewed by Simon Fraser.
+
+            Override ValidationMessageClient::hideAnyValidationMessage().
+
+            * WebCoreSupport/WebValidationMessageClient.h:
+            * WebCoreSupport/WebValidationMessageClient.mm:
+            (WebValidationMessageClient::hideAnyValidationMessage):
+
 2017-02-05  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r211569. rdar://problem/30229990

Modified: branches/safari-603-branch/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.h (211726 => 211727)


--- branches/safari-603-branch/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.h	2017-02-06 16:54:31 UTC (rev 211726)
+++ branches/safari-603-branch/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.h	2017-02-06 17:07:24 UTC (rev 211727)
@@ -43,6 +43,7 @@
     void documentDetached(WebCore::Document&) final;
     void showValidationMessage(const WebCore::Element& anchor, const String& message) final;
     void hideValidationMessage(const WebCore::Element& anchor) final;
+    void hideAnyValidationMessage() final;
     bool isValidationMessageVisible(const WebCore::Element& anchor) final;
     void updateValidationBubbleStateIfNeeded() final;
 

Modified: branches/safari-603-branch/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.mm (211726 => 211727)


--- branches/safari-603-branch/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.mm	2017-02-06 16:54:31 UTC (rev 211726)
+++ branches/safari-603-branch/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.mm	2017-02-06 17:07:24 UTC (rev 211727)
@@ -70,6 +70,16 @@
     [m_view hideFormValidationMessage];
 }
 
+void WebValidationMessageClient::hideAnyValidationMessage()
+{
+    if (!m_currentAnchor)
+        return;
+
+    m_currentAnchor = nullptr;
+    m_currentAnchorRect = { };
+    [m_view hideFormValidationMessage];
+}
+
 bool WebValidationMessageClient::isValidationMessageVisible(const Element& anchor)
 {
     return m_currentAnchor == &anchor;

Modified: branches/safari-603-branch/Source/WebKit2/ChangeLog (211726 => 211727)


--- branches/safari-603-branch/Source/WebKit2/ChangeLog	2017-02-06 16:54:31 UTC (rev 211726)
+++ branches/safari-603-branch/Source/WebKit2/ChangeLog	2017-02-06 17:07:24 UTC (rev 211727)
@@ -1,3 +1,21 @@
+2017-02-06  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r211653. rdar://problem/29872943
+
+    2017-02-03  Chris Dumez  <cdu...@apple.com>
+
+            Dismiss HTML form validation popover when pressing Escape key
+            https://bugs.webkit.org/show_bug.cgi?id=167716
+            <rdar://problem/29872943>
+
+            Reviewed by Simon Fraser.
+
+            Override ValidationMessageClient::hideAnyValidationMessage().
+
+            * WebProcess/WebCoreSupport/WebValidationMessageClient.cpp:
+            (WebKit::WebValidationMessageClient::hideAnyValidationMessage):
+            * WebProcess/WebCoreSupport/WebValidationMessageClient.h:
+
 2017-02-05  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r211482. rdar://problem/29711409

Modified: branches/safari-603-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp (211726 => 211727)


--- branches/safari-603-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp	2017-02-06 16:54:31 UTC (rev 211726)
+++ branches/safari-603-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp	2017-02-06 17:07:24 UTC (rev 211727)
@@ -74,6 +74,16 @@
     m_page.send(Messages::WebPageProxy::HideValidationMessage());
 }
 
+void WebValidationMessageClient::hideAnyValidationMessage()
+{
+    if (!m_currentAnchor)
+        return;
+
+    m_currentAnchor = nullptr;
+    m_currentAnchorRect = { };
+    m_page.send(Messages::WebPageProxy::HideValidationMessage());
+}
+
 bool WebValidationMessageClient::isValidationMessageVisible(const Element& anchor)
 {
     return m_currentAnchor == &anchor;

Modified: branches/safari-603-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.h (211726 => 211727)


--- branches/safari-603-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.h	2017-02-06 16:54:31 UTC (rev 211726)
+++ branches/safari-603-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.h	2017-02-06 17:07:24 UTC (rev 211727)
@@ -41,6 +41,7 @@
     void documentDetached(WebCore::Document&) final;
     void showValidationMessage(const WebCore::Element& anchor, const String& message) final;
     void hideValidationMessage(const WebCore::Element& anchor) final;
+    void hideAnyValidationMessage() final;
     bool isValidationMessageVisible(const WebCore::Element& anchor) final;
     void updateValidationBubbleStateIfNeeded() final;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to