Diff
Modified: branches/safari-606.1.17-branch/Source/WebKit/ChangeLog (231943 => 231944)
--- branches/safari-606.1.17-branch/Source/WebKit/ChangeLog 2018-05-18 05:39:01 UTC (rev 231943)
+++ branches/safari-606.1.17-branch/Source/WebKit/ChangeLog 2018-05-18 05:51:40 UTC (rev 231944)
@@ -1,5 +1,54 @@
2018-05-17 Babak Shafiei <bshaf...@apple.com>
+ Cherry-pick r231591. rdar://problem/39290394
+
+ [Cocoa] Some fields are not identified as [WKWebProcessPlugInNodeHandle isTextField]
+ https://bugs.webkit.org/show_bug.cgi?id=185260
+ <rdar://problem/39290394>
+
+ Source/WebKit:
+
+ INPUT element are not considered to be text fields when
+ calling -[WKWebProcessPlugInNodeHandle isTextField]
+ when they are of type number.
+
+ Patch by Richard Houle <rho...@apple.com> on 2018-05-09
+ Reviewed by Tim Horton.
+
+ * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
+ (WebKit::InjectedBundleNodeHandle::isTextField const):
+
+ Tools:
+
+ Patch by Richard Houle <rho...@apple.com> on 2018-05-09
+ Reviewed by Tim Horton.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKitCocoa/InjectedBundleNodeHandleIsTextField.mm: Added.
+ (-[InjectedBundleNodeHandleIsTextField isTextFieldForHTMLInputType:document:jsContext:]):
+ (-[InjectedBundleNodeHandleIsTextField webProcessPlugIn:didCreateBrowserContextController:]):
+ * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
+ (-[InjectedBundleNodeHandleIsTextFieldDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2018-05-09 Richard Houle <rho...@apple.com>
+
+ [Cocoa] Some fields are not identified as [WKWebProcessPlugInNodeHandle isTextField]
+ https://bugs.webkit.org/show_bug.cgi?id=185260
+ <rdar://problem/39290394>
+
+ INPUT element are not considered to be text fields when
+ calling -[WKWebProcessPlugInNodeHandle isTextField]
+ when they are of type number.
+
+ Reviewed by Tim Horton.
+
+ * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
+ (WebKit::InjectedBundleNodeHandle::isTextField const):
+
+2018-05-17 Babak Shafiei <bshaf...@apple.com>
+
Cherry-pick r231937. rdar://problem/40265269
AX: [macOS] Expose the primary screen height through AX API
Modified: branches/safari-606.1.17-branch/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp (231943 => 231944)
--- branches/safari-606.1.17-branch/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp 2018-05-18 05:39:01 UTC (rev 231943)
+++ branches/safari-606.1.17-branch/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp 2018-05-18 05:51:40 UTC (rev 231944)
@@ -334,7 +334,7 @@
if (!is<HTMLInputElement>(m_node))
return false;
- return downcast<HTMLInputElement>(m_node.get()).isText();
+ return downcast<HTMLInputElement>(m_node.get()).isTextField();
}
RefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::htmlTableCellElementCellAbove()
Modified: branches/safari-606.1.17-branch/Tools/ChangeLog (231943 => 231944)
--- branches/safari-606.1.17-branch/Tools/ChangeLog 2018-05-18 05:39:01 UTC (rev 231943)
+++ branches/safari-606.1.17-branch/Tools/ChangeLog 2018-05-18 05:51:40 UTC (rev 231944)
@@ -1,5 +1,54 @@
2018-05-17 Babak Shafiei <bshaf...@apple.com>
+ Cherry-pick r231591. rdar://problem/39290394
+
+ [Cocoa] Some fields are not identified as [WKWebProcessPlugInNodeHandle isTextField]
+ https://bugs.webkit.org/show_bug.cgi?id=185260
+ <rdar://problem/39290394>
+
+ Source/WebKit:
+
+ INPUT element are not considered to be text fields when
+ calling -[WKWebProcessPlugInNodeHandle isTextField]
+ when they are of type number.
+
+ Patch by Richard Houle <rho...@apple.com> on 2018-05-09
+ Reviewed by Tim Horton.
+
+ * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
+ (WebKit::InjectedBundleNodeHandle::isTextField const):
+
+ Tools:
+
+ Patch by Richard Houle <rho...@apple.com> on 2018-05-09
+ Reviewed by Tim Horton.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKitCocoa/InjectedBundleNodeHandleIsTextField.mm: Added.
+ (-[InjectedBundleNodeHandleIsTextField isTextFieldForHTMLInputType:document:jsContext:]):
+ (-[InjectedBundleNodeHandleIsTextField webProcessPlugIn:didCreateBrowserContextController:]):
+ * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
+ (-[InjectedBundleNodeHandleIsTextFieldDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2018-05-09 Richard Houle <rho...@apple.com>
+
+ [Cocoa] Some fields are not identified as [WKWebProcessPlugInNodeHandle isTextField]
+ https://bugs.webkit.org/show_bug.cgi?id=185260
+ <rdar://problem/39290394>
+
+ Reviewed by Tim Horton.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKitCocoa/InjectedBundleNodeHandleIsTextField.mm: Added.
+ (-[InjectedBundleNodeHandleIsTextField isTextFieldForHTMLInputType:document:jsContext:]):
+ (-[InjectedBundleNodeHandleIsTextField webProcessPlugIn:didCreateBrowserContextController:]):
+ * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
+ (-[InjectedBundleNodeHandleIsTextFieldDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
+
+2018-05-17 Babak Shafiei <bshaf...@apple.com>
+
Cherry-pick r231937. rdar://problem/40265269
AX: [macOS] Expose the primary screen height through AX API
Modified: branches/safari-606.1.17-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (231943 => 231944)
--- branches/safari-606.1.17-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2018-05-18 05:39:01 UTC (rev 231943)
+++ branches/safari-606.1.17-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2018-05-18 05:51:40 UTC (rev 231944)
@@ -293,6 +293,7 @@
7673499D1930C5BB00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7673499A1930182E00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp */; };
76E182DD1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */; };
76E182DF154767E600F1FADD /* auto-submitting-form.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 76E182DE15475A8300F1FADD /* auto-submitting-form.html */; };
+ 79C5D431209D768300F1E7CA /* InjectedBundleNodeHandleIsTextField.mm in Sources */ = {isa = PBXBuildFile; fileRef = 79C5D430209D768300F1E7CA /* InjectedBundleNodeHandleIsTextField.mm */; };
7A010BCB1D877C0500EDE72A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A010BCA1D877C0500EDE72A /* CoreGraphics.framework */; };
7A010BCD1D877C0D00EDE72A /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A010BCC1D877C0D00EDE72A /* QuartzCore.framework */; };
7A0509411FB9F06400B33FB8 /* JSONValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A0509401FB9F04400B33FB8 /* JSONValue.cpp */; };
@@ -1510,6 +1511,7 @@
76E182D91547550100F1FADD /* WillSendSubmitEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillSendSubmitEvent.cpp; sourceTree = "<group>"; };
76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillSendSubmitEvent_Bundle.cpp; sourceTree = "<group>"; };
76E182DE15475A8300F1FADD /* auto-submitting-form.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "auto-submitting-form.html"; sourceTree = "<group>"; };
+ 79C5D430209D768300F1E7CA /* InjectedBundleNodeHandleIsTextField.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InjectedBundleNodeHandleIsTextField.mm; sourceTree = "<group>"; };
7A010BCA1D877C0500EDE72A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
7A010BCC1D877C0D00EDE72A /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
7A0509401FB9F04400B33FB8 /* JSONValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONValue.cpp; sourceTree = "<group>"; };
@@ -2191,6 +2193,7 @@
57599E201F07191700A3FB8C /* IndexedDBStructuredCloneBackwardCompatibility.mm */,
5198A23F1EA7E595008910B7 /* InitialWarmedProcessUsed.mm */,
2DB0232E1E4E871800707123 /* InteractionDeadlockAfterCrash.mm */,
+ 79C5D430209D768300F1E7CA /* InjectedBundleNodeHandleIsTextField.mm */,
5C69BDD41F82A7EB000F4F4B /* _javascript_DuringNavigation.mm */,
C25CCA051E51380B0026CB8A /* LineBreaking.mm */,
37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */,
@@ -3862,6 +3865,7 @@
A13EBBB01B87436F00097110 /* BundleParametersPlugIn.mm in Sources */,
37A709AF1E3EA97E00CA5969 /* BundleRangeHandlePlugIn.mm in Sources */,
1C2B81831C891F0900A5529F /* CancelFontSubresourcePlugIn.mm in Sources */,
+ 79C5D431209D768300F1E7CA /* InjectedBundleNodeHandleIsTextField.mm in Sources */,
5CB18BA81F5645E300EE23C4 /* ClickAutoFillButton.mm in Sources */,
A14FC58B1B89927100D107EB /* ContentFilteringPlugIn.mm in Sources */,
CEA7F57D2089624B0078EF6E /* DidResignInputElementStrongPasswordAppearance.mm in Sources */,
Added: branches/safari-606.1.17-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/InjectedBundleNodeHandleIsTextField.mm (0 => 231944)
--- branches/safari-606.1.17-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/InjectedBundleNodeHandleIsTextField.mm (rev 0)
+++ branches/safari-606.1.17-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/InjectedBundleNodeHandleIsTextField.mm 2018-05-18 05:51:40 UTC (rev 231944)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2018 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 "config.h"
+
+#if WK_API_ENABLED
+
+#import <WebKit/WKDOMDocument.h>
+#import <WebKit/WKDOMElement.h>
+#import <WebKit/WKDOMNodePrivate.h>
+#import <WebKit/WKWebProcessPlugIn.h>
+#import <WebKit/WKWebProcessPlugInBrowserContextControllerPrivate.h>
+#import <WebKit/WKWebProcessPlugInFrame.h>
+#import <WebKit/WKWebProcessPlugInNodeHandlePrivate.h>
+#import <WebKit/WKWebProcessPlugInScriptWorld.h>
+
+@interface InjectedBundleNodeHandleIsTextField : NSObject <WKWebProcessPlugIn>
+@end
+
+@implementation InjectedBundleNodeHandleIsTextField
+
+- (void)verifyTextFieldForHTMLInputType:(NSString *)htmlInputType document:(WKDOMDocument *)document jsContext:(JSContext *)jsContext expectedResult:(BOOL)expectedResult failedInputTypes:(NSMutableArray <NSString *> *)failedInputTypes
+{
+ WKDOMElement *inputElement = [document createElement:@"input"];
+ [inputElement setAttribute:@"type" value:htmlInputType];
+ [[document body] appendChild:inputElement];
+
+ auto *jsValue = [jsContext evaluateScript:@"document.querySelector('input')"];
+ auto* nodeHandle = [WKWebProcessPlugInNodeHandle nodeHandleWithJSValue:jsValue inContext:jsContext];
+ if ([nodeHandle isTextField] != expectedResult)
+ [failedInputTypes addObject:htmlInputType];
+
+ [[document body] removeChild:inputElement];
+}
+
+- (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController didCreateBrowserContextController:(WKWebProcessPlugInBrowserContextController *)browserContextController
+{
+ WKDOMDocument *document = [browserContextController mainFrameDocument];
+ auto *jsContext = [[browserContextController mainFrame] jsContextForWorld:[WKWebProcessPlugInScriptWorld normalWorld]];
+
+ NSMutableArray <NSString *> *failedInputTypes = [NSMutableArray array];
+
+ [self verifyTextFieldForHTMLInputType:@"date" document:document jsContext:jsContext expectedResult:YES failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"datetime" document:document jsContext:jsContext expectedResult:YES failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"datetime-local" document:document jsContext:jsContext expectedResult:YES failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"email" document:document jsContext:jsContext expectedResult:YES failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"month" document:document jsContext:jsContext expectedResult:YES failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"number" document:document jsContext:jsContext expectedResult:YES failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"password" document:document jsContext:jsContext expectedResult:YES failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"search" document:document jsContext:jsContext expectedResult:YES failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"tel" document:document jsContext:jsContext expectedResult:YES failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"text" document:document jsContext:jsContext expectedResult:YES failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"time" document:document jsContext:jsContext expectedResult:YES failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"url" document:document jsContext:jsContext expectedResult:YES failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"week" document:document jsContext:jsContext expectedResult:YES failedInputTypes:failedInputTypes];
+
+ [self verifyTextFieldForHTMLInputType:@"button" document:document jsContext:jsContext expectedResult:NO failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"color" document:document jsContext:jsContext expectedResult:NO failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"file" document:document jsContext:jsContext expectedResult:NO failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"hidden" document:document jsContext:jsContext expectedResult:NO failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"image" document:document jsContext:jsContext expectedResult:NO failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"radio" document:document jsContext:jsContext expectedResult:NO failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"range" document:document jsContext:jsContext expectedResult:NO failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"reset" document:document jsContext:jsContext expectedResult:NO failedInputTypes:failedInputTypes];
+ [self verifyTextFieldForHTMLInputType:@"submit" document:document jsContext:jsContext expectedResult:NO failedInputTypes:failedInputTypes];
+
+ if (!failedInputTypes.count) {
+ [[[browserContextController mainFrame] jsContextForWorld:[WKWebProcessPlugInScriptWorld normalWorld]] evaluateScript:@"alert('isTextField success')"];
+ return;
+ }
+
+ [[[browserContextController mainFrame] jsContextForWorld:[WKWebProcessPlugInScriptWorld normalWorld]] evaluateScript:[NSString stringWithFormat:@"alert('isTextField failed for %@')", [failedInputTypes componentsJoinedByString:@", "]]];
+}
+
+@end
+
+#endif // WK_API_ENABLED
Modified: branches/safari-606.1.17-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm (231943 => 231944)
--- branches/safari-606.1.17-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm 2018-05-18 05:39:01 UTC (rev 231943)
+++ branches/safari-606.1.17-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm 2018-05-18 05:51:40 UTC (rev 231944)
@@ -627,6 +627,30 @@
TestWebKitAPI::Util::run(&done);
}
+@interface InjectedBundleNodeHandleIsTextFieldDelegate : NSObject <WKUIDelegatePrivate>
+@end
+
+@implementation InjectedBundleNodeHandleIsTextFieldDelegate
+
+- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)())completionHandler
+{
+ completionHandler();
+ ASSERT_STREQ(message.UTF8String, "isTextField success");
+ done = true;
+}
+
+@end
+
+TEST(WebKit, InjectedBundleNodeHandleIsTextField)
+{
+ WKWebViewConfiguration *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"InjectedBundleNodeHandleIsTextField"];
+
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration]);
+ auto delegate = adoptNS([[InjectedBundleNodeHandleIsTextFieldDelegate alloc] init]);
+ [webView setUIDelegate:delegate.get()];
+ TestWebKitAPI::Util::run(&done);
+}
+
@interface PinnedStateObserver : NSObject
@end