<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[209252] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/209252">209252</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-12-02 12:05:07 -0800 (Fri, 02 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Mac][WK1] Implement new HTML interactive form validation user interface
https://bugs.webkit.org/show_bug.cgi?id=164483
Reviewed by Simon Fraser.
Source/WebKit:
Add new files to xcode project.
* WebKit.xcodeproj/project.pbxproj:
Source/WebKit/mac:
Implement new HTML interactive form validation user interface on Mac
WK1 and enable it by default.
* WebCoreSupport/WebValidationMessageClient.h: Added.
* WebCoreSupport/WebValidationMessageClient.mm: Added.
(WebValidationMessageClient::WebValidationMessageClient):
(WebValidationMessageClient::~WebValidationMessageClient):
(WebValidationMessageClient::showValidationMessage):
(WebValidationMessageClient::hideValidationMessage):
(WebValidationMessageClient::isValidationMessageVisible):
* WebView/WebHTMLView.mm:
(-[WebHTMLView _frameOrBoundsChanged]):
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _willStartScrollingOrZooming]):
(-[WebView _contentsOfUserInterfaceItem:]):
(-[WebView _scaleWebView:atOrigin:]):
(-[WebView _didScrollDocumentInFrameView:]):
(-[WebView _setZoomMultiplier:isTextOnly:]):
(-[WebView showFormValidationMessage:withAnchorRect:]):
(-[WebView hideFormValidationMessage]):
* WebView/WebViewData.h:
* WebView/WebViewData.mm:
(-[WebViewPrivate init]):
* WebView/WebViewInternal.h:
* WebView/WebViewPrivate.h:
Tools:
Add support for UIScriptController's contentsOfUserInterfaceItem("validationBubble")
on Mac DRT as this is needed by the HTML form validation layout tests.
* DumpRenderTree/mac/UIScriptControllerMac.mm:
(WTR::UIScriptController::contentsOfUserInterfaceItem):
LayoutTests:
Unskip tests for HTML form validation that are now passing on Mac WK1.
* platform/mac-wk1/TestExpectations:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk1TestExpectations">trunk/LayoutTests/platform/mac-wk1/TestExpectations</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitWebKitxcodeprojprojectpbxproj">trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebHTMLViewmm">trunk/Source/WebKit/mac/WebView/WebHTMLView.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewDatah">trunk/Source/WebKit/mac/WebView/WebViewData.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewDatamm">trunk/Source/WebKit/mac/WebView/WebViewData.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewInternalh">trunk/Source/WebKit/mac/WebView/WebViewInternal.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewPrivateh">trunk/Source/WebKit/mac/WebView/WebViewPrivate.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreemacUIScriptControllerMacmm">trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebValidationMessageClienth">trunk/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebValidationMessageClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (209251 => 209252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-12-02 19:55:09 UTC (rev 209251)
+++ trunk/LayoutTests/ChangeLog        2016-12-02 20:05:07 UTC (rev 209252)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-12-02 Chris Dumez <cdumez@apple.com>
+
+ [Mac][WK1] Implement new HTML interactive form validation user interface
+ https://bugs.webkit.org/show_bug.cgi?id=164483
+
+ Reviewed by Simon Fraser.
+
+ Unskip tests for HTML form validation that are now passing on Mac WK1.
+
+ * platform/mac-wk1/TestExpectations:
+
</ins><span class="cx"> 2016-12-02 Ryan Haddad <ryanhaddad@apple.com>
</span><span class="cx">
</span><span class="cx"> Marking media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html as flaky on mac-wk1.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (209251 => 209252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/TestExpectations        2016-12-02 19:55:09 UTC (rev 209251)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations        2016-12-02 20:05:07 UTC (rev 209252)
</span><span class="lines">@@ -93,6 +93,17 @@
</span><span class="cx"> http/tests/media/media-stream
</span><span class="cx"> http/tests/ssl/media-stream
</span><span class="cx">
</span><ins>+# These tests test the Shadow DOM based HTML form validation UI but Mac WK1 is using native dialogs instead.
+fast/forms/validation-message-on-listbox.html
+fast/forms/validation-message-on-menulist.html
+fast/forms/validation-message-on-radio.html
+fast/forms/validation-message-on-checkbox.html
+fast/forms/validation-message-on-range.html
+fast/forms/validation-message-clone.html
+fast/forms/validation-message-in-relative-body.html
+fast/forms/validation-message-appearance.html
+fast/forms/validation-message-on-textarea.html
+
</ins><span class="cx"> # Disable snapshotting tests on WK1 only
</span><span class="cx"> plugins/snapshotting
</span><span class="cx">
</span><span class="lines">@@ -243,10 +254,6 @@
</span><span class="cx"> # rdar://problem/26478296
</span><span class="cx"> [ Sierra+ ] svg/hixie/text/003.html [ Failure ]
</span><span class="cx">
</span><del>-# We do not support the new HTML validation UI on WebKit1 yet (rdar://problem/28944652).
-fast/forms/validation-custom-message.html [ Skip ]
-fast/forms/validation-messages.html [ Skip ]
-
</del><span class="cx"> [ Yosemite ] http/tests/media/hls/video-controller-getStartDate.html [ Pass Timeout ]
</span><span class="cx">
</span><span class="cx"> webkit.org/b/159893 [ Debug ] imported/w3c/web-platform-tests/XMLHttpRequest/event-readystatechange-loaded.htm [ Pass Failure ]
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (209251 => 209252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog        2016-12-02 19:55:09 UTC (rev 209251)
+++ trunk/Source/WebKit/ChangeLog        2016-12-02 20:05:07 UTC (rev 209252)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-12-02 Chris Dumez <cdumez@apple.com>
+
+ [Mac][WK1] Implement new HTML interactive form validation user interface
+ https://bugs.webkit.org/show_bug.cgi?id=164483
+
+ Reviewed by Simon Fraser.
+
+ Add new files to xcode project.
+
+ * WebKit.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2016-11-17 Yusuke Suzuki <utatane.tea@gmail.com>
</span><span class="cx">
</span><span class="cx"> [JSC] WTF::TemporaryChange with WTF::SetForScope
</span></span></pre></div>
<a id="trunkSourceWebKitWebKitxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (209251 => 209252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj        2016-12-02 19:55:09 UTC (rev 209251)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj        2016-12-02 20:05:07 UTC (rev 209252)
</span><span class="lines">@@ -122,6 +122,8 @@
</span><span class="cx">                 3ABB3C7B1309C3B500E93D94 /* WebStorageTrackerClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3ABB3C791309C3B500E93D94 /* WebStorageTrackerClient.mm */; };
</span><span class="cx">                 3AE15D5012DBDED4009323C8 /* WebStorageManagerInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AE15D4F12DBDED4009323C8 /* WebStorageManagerInternal.h */; };
</span><span class="cx">                 44BB8B141241A022001E3A22 /* WebArchiveInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 44BB8B131241A022001E3A22 /* WebArchiveInternal.h */; };
</span><ins>+                4618DFF81DEF760A0033C3AA /* WebValidationMessageClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4618DFF61DEF760A0033C3AA /* WebValidationMessageClient.h */; };
+                4618DFF91DEF760A0033C3AA /* WebValidationMessageClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4618DFF71DEF760A0033C3AA /* WebValidationMessageClient.mm */; };
</ins><span class="cx">                 4BF99F900AE050BC00815C2B /* WebEditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF99F8E0AE050BC00815C2B /* WebEditorClient.h */; settings = {ATTRIBUTES = (); }; };
</span><span class="cx">                 4BF99F910AE050BC00815C2B /* WebEditorClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BF99F8F0AE050BC00815C2B /* WebEditorClient.mm */; };
</span><span class="cx">                 511F3FD50CECC88F00852565 /* WebDatabaseManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */; };
</span><span class="lines">@@ -942,6 +944,8 @@
</span><span class="cx">                 3AE15D4F12DBDED4009323C8 /* WebStorageManagerInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebStorageManagerInternal.h; sourceTree = "<group>"; };
</span><span class="cx">                 449098B90F8F82DF0076A327 /* FeatureDefines.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FeatureDefines.xcconfig; sourceTree = "<group>"; };
</span><span class="cx">                 44BB8B131241A022001E3A22 /* WebArchiveInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebArchiveInternal.h; sourceTree = "<group>"; };
</span><ins>+                4618DFF61DEF760A0033C3AA /* WebValidationMessageClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebValidationMessageClient.h; sourceTree = "<group>"; };
+                4618DFF71DEF760A0033C3AA /* WebValidationMessageClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebValidationMessageClient.mm; sourceTree = "<group>"; };
</ins><span class="cx">                 4BF99F8E0AE050BC00815C2B /* WebEditorClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebEditorClient.h; sourceTree = "<group>"; };
</span><span class="cx">                 4BF99F8F0AE050BC00815C2B /* WebEditorClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebEditorClient.mm; sourceTree = "<group>"; };
</span><span class="cx">                 511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseManager.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -2633,6 +2637,8 @@
</span><span class="cx">                                 93EB178C09F88D460091F8FF /* WebSystemInterface.mm */,
</span><span class="cx">                                 070F549917F1E42B00169E04 /* WebUserMediaClient.h */,
</span><span class="cx">                                 070F549A17F1E42B00169E04 /* WebUserMediaClient.mm */,
</span><ins>+                                4618DFF61DEF760A0033C3AA /* WebValidationMessageClient.h */,
+                                4618DFF71DEF760A0033C3AA /* WebValidationMessageClient.mm */,
</ins><span class="cx">                                 1430C12A1B2C5DF700DEA01D /* WebViewGroup.cpp */,
</span><span class="cx">                                 1430C12B1B2C5DF700DEA01D /* WebViewGroup.h */,
</span><span class="cx">                                 1AC7176D1A26568A002E3115 /* WebVisitedLinkStore.h */,
</span><span class="lines">@@ -3166,6 +3172,7 @@
</span><span class="cx">                                 E4AEF97C1C0DF4BC00B01727 /* WebResourceLoadScheduler.h in Headers */,
</span><span class="cx">                                 939810890824BF01008DF038 /* WebResourcePrivate.h in Headers */,
</span><span class="cx">                                 7E6FEF0808985A7200C44C3F /* WebScriptDebugDelegate.h in Headers */,
</span><ins>+                                4618DFF81DEF760A0033C3AA /* WebValidationMessageClient.h in Headers */,
</ins><span class="cx">                                 C0167BF80D7F5DD00028696E /* WebScriptDebugger.h in Headers */,
</span><span class="cx">                                 C0B1F7E810AC8E3100C925D9 /* WebScriptWorld.h in Headers */,
</span><span class="cx">                                 C0B1F7EA10AC8E3100C925D9 /* WebScriptWorldInternal.h in Headers */,
</span><span class="lines">@@ -3427,6 +3434,7 @@
</span><span class="cx">                                 93D4368C1D57ABEE00AB85EA /* DOMDocument.mm in Sources */,
</span><span class="cx">                                 93D4368E1D57ABEE00AB85EA /* DOMDocumentFragment.mm in Sources */,
</span><span class="cx">                                 93D436941D57ABEE00AB85EA /* DOMDocumentType.mm in Sources */,
</span><ins>+                                4618DFF91DEF760A0033C3AA /* WebValidationMessageClient.mm in Sources */,
</ins><span class="cx">                                 93D436971D57ABEE00AB85EA /* DOMDOMImplementation.mm in Sources */,
</span><span class="cx">                                 93D4369A1D57ABEE00AB85EA /* DOMDOMTokenList.mm in Sources */,
</span><span class="cx">                                 93D4369D1D57ABEE00AB85EA /* DOMElement.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (209251 => 209252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2016-12-02 19:55:09 UTC (rev 209251)
+++ trunk/Source/WebKit/mac/ChangeLog        2016-12-02 20:05:07 UTC (rev 209252)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2016-12-02 Chris Dumez <cdumez@apple.com>
+
+ [Mac][WK1] Implement new HTML interactive form validation user interface
+ https://bugs.webkit.org/show_bug.cgi?id=164483
+
+ Reviewed by Simon Fraser.
+
+ Implement new HTML interactive form validation user interface on Mac
+ WK1 and enable it by default.
+
+ * WebCoreSupport/WebValidationMessageClient.h: Added.
+ * WebCoreSupport/WebValidationMessageClient.mm: Added.
+ (WebValidationMessageClient::WebValidationMessageClient):
+ (WebValidationMessageClient::~WebValidationMessageClient):
+ (WebValidationMessageClient::showValidationMessage):
+ (WebValidationMessageClient::hideValidationMessage):
+ (WebValidationMessageClient::isValidationMessageVisible):
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView _frameOrBoundsChanged]):
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:]):
+ (-[WebView _willStartScrollingOrZooming]):
+ (-[WebView _contentsOfUserInterfaceItem:]):
+ (-[WebView _scaleWebView:atOrigin:]):
+ (-[WebView _didScrollDocumentInFrameView:]):
+ (-[WebView _setZoomMultiplier:isTextOnly:]):
+ (-[WebView showFormValidationMessage:withAnchorRect:]):
+ (-[WebView hideFormValidationMessage]):
+ * WebView/WebViewData.h:
+ * WebView/WebViewData.mm:
+ (-[WebViewPrivate init]):
+ * WebView/WebViewInternal.h:
+ * WebView/WebViewPrivate.h:
+
</ins><span class="cx"> 2016-12-01 Jiewen Tan <jiewen_tan@apple.com>
</span><span class="cx">
</span><span class="cx"> Add a runtime flag for SubtleCrypto
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebValidationMessageClienth"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.h (0 => 209252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.h         (rev 0)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.h        2016-12-02 20:05:07 UTC (rev 209252)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#import <WebCore/ValidationMessageClient.h>
+
+namespace WebCore {
+class Element;
+}
+
+@class WebView;
+
+class WebValidationMessageClient final : public WebCore::ValidationMessageClient {
+public:
+ explicit WebValidationMessageClient(WebView*);
+ ~WebValidationMessageClient();
+
+ // ValidationMessageClient API.
+ void showValidationMessage(const WebCore::Element& anchor, const String& message) final;
+ void hideValidationMessage(const WebCore::Element& anchor) final;
+ bool isValidationMessageVisible(const WebCore::Element& anchor) final;
+
+private:
+ WebView* m_view;
+ const WebCore::Element* m_currentAnchor { nullptr };
+};
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebValidationMessageClientmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.mm (0 => 209252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.mm         (rev 0)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.mm        2016-12-02 20:05:07 UTC (rev 209252)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebValidationMessageClient.h"
+
+#import "WebView.h"
+#import "WebViewInternal.h"
+#import <WebCore/Element.h>
+
+using namespace WebCore;
+
+WebValidationMessageClient::WebValidationMessageClient(WebView* view)
+ : m_view(view)
+{
+}
+
+WebValidationMessageClient::~WebValidationMessageClient()
+{
+ if (m_currentAnchor)
+ hideValidationMessage(*m_currentAnchor);
+}
+
+void WebValidationMessageClient::showValidationMessage(const Element& anchor, const String& message)
+{
+ if (m_currentAnchor)
+ hideValidationMessage(*m_currentAnchor);
+
+ m_currentAnchor = &anchor;
+ [m_view showFormValidationMessage:message withAnchorRect:anchor.clientRect()];
+}
+
+void WebValidationMessageClient::hideValidationMessage(const Element& anchor)
+{
+ if (!isValidationMessageVisible(anchor))
+ return;
+
+ m_currentAnchor = nullptr;
+ [m_view hideFormValidationMessage];
+}
+
+bool WebValidationMessageClient::isValidationMessageVisible(const Element& anchor)
+{
+ return m_currentAnchor == &anchor;
+}
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebHTMLViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (209251 => 209252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2016-12-02 19:55:09 UTC (rev 209251)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2016-12-02 20:05:07 UTC (rev 209252)
</span><span class="lines">@@ -1689,7 +1689,7 @@
</span><span class="cx"> [_private->completionController endRevertingChange:NO moveLeft:NO];
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- [[webView _UIDelegateForwarder] webView:webView didScrollDocumentInFrameView:[self _frameView]];
</del><ins>+ [webView _didScrollDocumentInFrameView:[self _frameView]];
</ins><span class="cx"> }
</span><span class="cx"> _private->lastScrollPosition = origin;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (209251 => 209252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2016-12-02 19:55:09 UTC (rev 209251)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2016-12-02 20:05:07 UTC (rev 209252)
</span><span class="lines">@@ -111,6 +111,7 @@
</span><span class="cx"> #import "WebUIDelegate.h"
</span><span class="cx"> #import "WebUIDelegatePrivate.h"
</span><span class="cx"> #import "WebUserMediaClient.h"
</span><ins>+#import "WebValidationMessageClient.h"
</ins><span class="cx"> #import "WebViewGroup.h"
</span><span class="cx"> #import "WebVisitedLinkStore.h"
</span><span class="cx"> #import <CoreFoundation/CFSet.h>
</span><span class="lines">@@ -194,6 +195,7 @@
</span><span class="cx"> #import <WebCore/UserContentController.h>
</span><span class="cx"> #import <WebCore/UserScript.h>
</span><span class="cx"> #import <WebCore/UserStyleSheet.h>
</span><ins>+#import <WebCore/ValidationBubble.h>
</ins><span class="cx"> #import <WebCore/WebCoreObjCExtras.h>
</span><span class="cx"> #import <WebCore/WebCoreView.h>
</span><span class="cx"> #import <WebCore/Widget.h>
</span><span class="lines">@@ -1311,6 +1313,8 @@
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> pageConfiguration.chromeClient = new WebChromeClient(self);
</span><span class="cx"> pageConfiguration.contextMenuClient = new WebContextMenuClient(self);
</span><ins>+ // FIXME: We should enable this on iOS as well.
+ pageConfiguration.validationMessageClient = std::make_unique<WebValidationMessageClient>(self);
</ins><span class="cx"> #if ENABLE(DRAG_SUPPORT)
</span><span class="cx"> pageConfiguration.dragClient = new WebDragClient(self);
</span><span class="cx"> #endif
</span><span class="lines">@@ -1961,6 +1965,8 @@
</span><span class="cx"> return;
</span><span class="cx"> _private->mainViewIsScrollingOrZooming = YES;
</span><span class="cx">
</span><ins>+ [self hideFormValidationMessage];
+
</ins><span class="cx"> // This suspends active DOM objects like timers, but not media.
</span><span class="cx"> [[self mainFrame] setTimeoutsPaused:YES];
</span><span class="cx">
</span><span class="lines">@@ -4308,6 +4314,17 @@
</span><span class="cx"> _private->validationMessageTimerMagnification = newValue;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem
+{
+ if ([userInterfaceItem isEqualToString:@"validationBubble"]) {
+ auto* validationBubble = _private->formValidationBubble.get();
+ String message = validationBubble ? validationBubble->message() : emptyString();
+ return @{ userInterfaceItem: @{ @"message": (NSString *)message } };
+ }
+
+ return nil;
+}
+
</ins><span class="cx"> - (BOOL)_isSoftwareRenderable
</span><span class="cx"> {
</span><span class="cx"> Frame* coreFrame = [self _mainCoreFrame];
</span><span class="lines">@@ -4627,6 +4644,8 @@
</span><span class="cx">
</span><span class="cx"> - (void)_scaleWebView:(float)scale atOrigin:(NSPoint)origin
</span><span class="cx"> {
</span><ins>+ [self hideFormValidationMessage];
+
</ins><span class="cx"> _private->page->setPageScaleFactor(scale, IntPoint(origin));
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4927,6 +4946,12 @@
</span><span class="cx"> ResourceRequest::setHTTPPipeliningEnabled(enabled);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (void)_didScrollDocumentInFrameView:(WebFrameView *)frameView
+{
+ [self hideFormValidationMessage];
+ [[self _UIDelegateForwarder] webView:self didScrollDocumentInFrameView:frameView];
+}
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> - (WebFixedPositionContent*)_fixedPositionContent
</span><span class="cx"> {
</span><span class="lines">@@ -6136,6 +6161,8 @@
</span><span class="cx"> _private->zoomMultiplier = multiplier;
</span><span class="cx"> _private->zoomsTextOnly = isTextOnly;
</span><span class="cx">
</span><ins>+ [self hideFormValidationMessage];
+
</ins><span class="cx"> // FIXME: It might be nice to rework this code so that _private->zoomMultiplier doesn't exist
</span><span class="cx"> // and instead the zoom factors stored in Frame are used.
</span><span class="cx"> Frame* coreFrame = [self _mainCoreFrame];
</span><span class="lines">@@ -9235,8 +9262,26 @@
</span><span class="cx"> {
</span><span class="cx"> [self _clearTextIndicatorWithAnimation:TextIndicatorWindowDismissalAnimation::FadeOut];
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif // PLATFORM(MAC)
</span><span class="cx">
</span><ins>+- (void)showFormValidationMessage:(NSString *)message withAnchorRect:(NSRect)anchorRect
+{
+ // FIXME: We should enable this on iOS as well.
+#if PLATFORM(MAC)
+ _private->formValidationBubble = std::make_unique<ValidationBubble>(self, message);
+ _private->formValidationBubble->showRelativeTo(enclosingIntRect([self _convertRectFromRootView:anchorRect]));
+#else
+ UNUSED_PARAM(message);
+ UNUSED_PARAM(anchorRect);
+#endif
+}
+
+- (void)hideFormValidationMessage
+{
+ _private->formValidationBubble = nullptr;
+}
+
</ins><span class="cx"> #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
</span><span class="cx"> - (WebMediaPlaybackTargetPicker *) _devicePicker
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebViewData.h (209251 => 209252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebViewData.h        2016-12-02 19:55:09 UTC (rev 209251)
+++ trunk/Source/WebKit/mac/WebView/WebViewData.h        2016-12-02 20:05:07 UTC (rev 209252)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx"> class HistoryItem;
</span><span class="cx"> class Page;
</span><span class="cx"> class TextIndicatorWindow;
</span><ins>+class ValidationBubble;
</ins><span class="cx"> #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
</span><span class="cx"> class WebPlaybackSessionInterfaceMac;
</span><span class="cx"> class WebPlaybackSessionModelMediaElement;
</span><span class="lines">@@ -205,6 +206,8 @@
</span><span class="cx"> RetainPtr<NSEvent> pressureEvent;
</span><span class="cx"> #endif // PLATFORM(MAC)
</span><span class="cx">
</span><ins>+ std::unique_ptr<WebCore::ValidationBubble> formValidationBubble;
+
</ins><span class="cx"> BOOL shouldMaintainInactiveSelection;
</span><span class="cx">
</span><span class="cx"> BOOL allowsUndo;
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewDatamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebViewData.mm (209251 => 209252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebViewData.mm        2016-12-02 19:55:09 UTC (rev 209251)
+++ trunk/Source/WebKit/mac/WebView/WebViewData.mm        2016-12-02 20:05:07 UTC (rev 209252)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #import <WebCore/WebCoreObjCExtras.h>
</span><span class="cx"> #import <WebCore/HistoryItem.h>
</span><span class="cx"> #import <WebCore/TextIndicatorWindow.h>
</span><ins>+#import <WebCore/ValidationBubble.h>
</ins><span class="cx"> #import <runtime/InitializeThreading.h>
</span><span class="cx"> #import <wtf/MainThread.h>
</span><span class="cx"> #import <wtf/RunLoop.h>
</span><span class="lines">@@ -143,7 +144,7 @@
</span><span class="cx"> zoomMultiplier = 1;
</span><span class="cx"> zoomsTextOnly = NO;
</span><span class="cx">
</span><del>- interactiveFormValidationEnabled = NO;
</del><ins>+ interactiveFormValidationEnabled = YES;
</ins><span class="cx"> // The default value should be synchronized with WebCore/page/Settings.cpp.
</span><span class="cx"> validationMessageTimerMagnification = 50;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebViewInternal.h (209251 => 209252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebViewInternal.h        2016-12-02 19:55:09 UTC (rev 209251)
+++ trunk/Source/WebKit/mac/WebView/WebViewInternal.h        2016-12-02 20:05:07 UTC (rev 209252)
</span><span class="lines">@@ -300,4 +300,7 @@
</span><span class="cx"> - (void)_dismissTextTouchBarPopoverItemWithIdentifier:(NSString *)identifier;
</span><span class="cx"> - (NSCandidateListTouchBarItem *)candidateList;
</span><span class="cx">
</span><ins>+- (void)showFormValidationMessage:(NSString *)message withAnchorRect:(NSRect)anchorRect;
+- (void)hideFormValidationMessage;
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (209251 => 209252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h        2016-12-02 19:55:09 UTC (rev 209251)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h        2016-12-02 20:05:07 UTC (rev 209252)
</span><span class="lines">@@ -486,6 +486,8 @@
</span><span class="cx"> // SPI for DumpRenderTree
</span><span class="cx"> - (void)_updateActiveState;
</span><span class="cx">
</span><ins>+- (void)_didScrollDocumentInFrameView:(WebFrameView *)frameView;
+
</ins><span class="cx"> /*!
</span><span class="cx"> @method _registerViewClass:representationClass:forURLScheme:
</span><span class="cx"> @discussion Register classes that implement WebDocumentView and WebDocumentRepresentation respectively.
</span><span class="lines">@@ -742,6 +744,7 @@
</span><span class="cx"> - (void)setInteractiveFormValidationEnabled:(BOOL)enabled;
</span><span class="cx"> - (int)validationMessageTimerMagnification;
</span><span class="cx"> - (void)setValidationMessageTimerMagnification:(int)newValue;
</span><ins>+- (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem;
</ins><span class="cx">
</span><span class="cx"> // Returns YES if NSView -displayRectIgnoringOpacity:inContext: will produce a faithful representation of the content.
</span><span class="cx"> - (BOOL)_isSoftwareRenderable;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (209251 => 209252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-12-02 19:55:09 UTC (rev 209251)
+++ trunk/Tools/ChangeLog        2016-12-02 20:05:07 UTC (rev 209252)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-12-02 Chris Dumez <cdumez@apple.com>
+
+ [Mac][WK1] Implement new HTML interactive form validation user interface
+ https://bugs.webkit.org/show_bug.cgi?id=164483
+
+ Reviewed by Simon Fraser.
+
+ Add support for UIScriptController's contentsOfUserInterfaceItem("validationBubble")
+ on Mac DRT as this is needed by the HTML form validation layout tests.
+
+ * DumpRenderTree/mac/UIScriptControllerMac.mm:
+ (WTR::UIScriptController::contentsOfUserInterfaceItem):
+
</ins><span class="cx"> 2016-12-02 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><span class="cx"> IndexedDB.IndexedDBMultiProcess and IndexedDB.WebProcessKillIDBCleanup sometimes timeout.
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacUIScriptControllerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm (209251 => 209252)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm        2016-12-02 19:55:09 UTC (rev 209251)
+++ trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm        2016-12-02 20:05:07 UTC (rev 209252)
</span><span class="lines">@@ -28,6 +28,9 @@
</span><span class="cx">
</span><span class="cx"> #import "DumpRenderTree.h"
</span><span class="cx"> #import "UIScriptContext.h"
</span><ins>+#import <JavaScriptCore/JSContext.h>
+#import <JavaScriptCore/JSStringRefCF.h>
+#import <JavaScriptCore/JSValue.h>
</ins><span class="cx"> #import <WebKit/WebKit.h>
</span><span class="cx"> #import <WebKit/WebViewPrivate.h>
</span><span class="cx">
</span><span class="lines">@@ -75,7 +78,15 @@
</span><span class="cx">
</span><span class="cx"> JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfaceItem) const
</span><span class="cx"> {
</span><ins>+#if JSC_OBJC_API_ENABLED
+ WebView *webView = [mainFrame webView];
+ RetainPtr<CFStringRef> interfaceItemCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, interfaceItem));
+ NSDictionary *contentDictionary = [webView _contentsOfUserInterfaceItem:(NSString *)interfaceItemCF.get()];
+ return JSValueToObject(m_context->jsContext(), [JSValue valueWithObject:contentDictionary inContext:[JSContext contextWithJSGlobalContextRef:m_context->jsContext()]].JSValueRef, nullptr);
+#else
+ UNUSED_PARAM(interfaceItem);
</ins><span class="cx"> return nullptr;
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>