Diff
Modified: trunk/LayoutTests/ChangeLog (263978 => 263979)
--- trunk/LayoutTests/ChangeLog 2020-07-06 19:03:45 UTC (rev 263978)
+++ trunk/LayoutTests/ChangeLog 2020-07-06 19:45:54 UTC (rev 263979)
@@ -1,3 +1,21 @@
+2020-07-06 Wenson Hsieh <[email protected]>
+
+ [iPadOS] Unable to change focus between Google Docs windows by tapping
+ https://bugs.webkit.org/show_bug.cgi?id=213985
+ <rdar://problem/57083267>
+
+ Reviewed by Darin Adler.
+
+ Add a new layout test to verify that tapping to focus a plain textarea causes the web view's window to become
+ the key window, as well as tapping to focus a hidden contenteditable area, over a touch handler that prevents
+ default.
+
+ * editing/selection/ios/become-key-window-when-focusing-editable-area-expected.txt: Added.
+ * editing/selection/ios/become-key-window-when-focusing-editable-area.html: Added.
+ * resources/ui-helper.js:
+ (window.UIHelper.setWindowIsKey):
+ (window.UIHelper.windowIsKey):
+
2020-07-06 Zalan Bujtas <[email protected]>
[Win] Unreviewed mozilla test gardening after r263855.
Added: trunk/LayoutTests/editing/selection/ios/become-key-window-when-focusing-editable-area-expected.txt (0 => 263979)
--- trunk/LayoutTests/editing/selection/ios/become-key-window-when-focusing-editable-area-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/selection/ios/become-key-window-when-focusing-editable-area-expected.txt 2020-07-06 19:45:54 UTC (rev 263979)
@@ -0,0 +1,11 @@
+This test verifies that focusing editable elements updates the key window. This test requires WebKitTestRunner.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Became key window after tapping on TEXTAREA
+PASS Became key window after tapping on BUTTON
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/editing/selection/ios/become-key-window-when-focusing-editable-area.html (0 => 263979)
--- trunk/LayoutTests/editing/selection/ios/become-key-window-when-focusing-editable-area.html (rev 0)
+++ trunk/LayoutTests/editing/selection/ios/become-key-window-when-focusing-editable-area.html 2020-07-06 19:45:54 UTC (rev 263979)
@@ -0,0 +1,64 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+<script src="" type="text/_javascript_"></script>
+<script src="" type="text/_javascript_"></script>
+<head>
+ <style>
+ #tiny-editor {
+ width: 0.5px;
+ height: 0.5px;
+ position: absolute;
+ top: 0;
+ left: 0;
+ overflow: hidden;
+ outline: none;
+ }
+
+ textarea, button {
+ width: 280px;
+ height: 50px;
+ display: block;
+ font-size: 20px;
+ }
+ </style>
+ <script>
+ jsTestIsAsync = true;
+
+ addEventListener("load", async () => {
+ description("This test verifies that focusing editable elements updates the key window. This test requires WebKitTestRunner.");
+
+ const textarea = document.querySelector("textarea");
+ const button = document.querySelector("button");
+
+ button.addEventListener("touchstart", (event) => {
+ document.querySelector("#tiny-editor").focus();
+ event.preventDefault();
+ });
+
+ if (!window.testRunner)
+ return;
+
+ for (let element of [textarea, button]) {
+ await UIHelper.setWindowIsKey(false);
+ await UIHelper.activateElementAndWaitForInputSession(element);
+ while (true) {
+ result = await UIHelper.windowIsKey();
+ if (result)
+ break;
+ }
+ testPassed(`Became key window after tapping on ${element.tagName}`);
+ document.activeElement.blur();
+ await UIHelper.waitForKeyboardToHide();
+ element.remove();
+ }
+ finishJSTest();
+ });
+ </script>
+</head>
+<body>
+ <div id="tiny-editor" contenteditable></div>
+ <textarea>First, click here</textarea>
+ <button>Then, click here</button>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/LayoutTests/resources/ui-helper.js (263978 => 263979)
--- trunk/LayoutTests/resources/ui-helper.js 2020-07-06 19:03:45 UTC (rev 263978)
+++ trunk/LayoutTests/resources/ui-helper.js 2020-07-06 19:45:54 UTC (rev 263979)
@@ -1188,6 +1188,20 @@
});
}
+ static setWindowIsKey(isKey)
+ {
+ const script = `uiController.windowIsKey = ${isKey}`;
+ return new Promise(resolve => testRunner.runUIScript(script, resolve));
+ }
+
+ static windowIsKey()
+ {
+ const script = "uiController.uiScriptComplete(uiController.windowIsKey)";
+ return new Promise(resolve => testRunner.runUIScript(script, (result) => {
+ resolve(result === "true");
+ }));
+ }
+
static waitForDoubleTapDelay()
{
const uiScript = `uiController.doAfterDoubleTapDelay(() => uiController.uiScriptComplete(""))`;
Modified: trunk/Source/WebKit/ChangeLog (263978 => 263979)
--- trunk/Source/WebKit/ChangeLog 2020-07-06 19:03:45 UTC (rev 263978)
+++ trunk/Source/WebKit/ChangeLog 2020-07-06 19:45:54 UTC (rev 263979)
@@ -1,3 +1,51 @@
+2020-07-06 Wenson Hsieh <[email protected]>
+
+ [iPadOS] Unable to change focus between Google Docs windows by tapping
+ https://bugs.webkit.org/show_bug.cgi?id=213985
+ <rdar://problem/57083267>
+
+ Reviewed by Darin Adler.
+
+ When putting two Google Docs windows side-by-side on iPad, it's currently not possible to change the window to
+ which keyboard input is routed. In native views (e.g. two side-by-side Notes windows), this is normally handled
+ by `UITextMultiTapRecognizer`, which is part of the `UITextSelectionInteraction`; tapping to place the text
+ selection calls into `-[UITextInteractionAssistant setFirstResponderIfNecessaryActivatingSelection:]`, which
+ updates the key window if needed. This doesn't apply to Google Docs because they instead use touch events to
+ drive their own "text interaction"-like behaviors instead of relying on system gesture recognizers, which we
+ suppress due to the fact that the selection is within a hidden contenteditable.
+
+ But even in non-hidden editable areas, the initial tap to focus an editable element still doesn't automatically
+ make the window key, since the editable text interaction gestures are still inactive when tapping to focus an
+ editable element. This means two taps are currently required to change the key window when focusing two Safari
+ windows side-by-side: the first tap to focus the element (via the synthetic click gesture), and the second tap
+ to trigger the editable text interaction tap gesture that is used to set the selection.
+
+ To fix both of these issues, make some minor adjustments to call `-makeKeyWindow` from WebKit when focusing
+ editable elements. See below for more details.
+
+ Test: editing/selection/ios/become-key-window-when-focusing-editable-area.html
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _webTouchEventsRecognized:]):
+
+ For the case in Google Docs where a hidden editable element is used and tapping in the page does not result in
+ the element being refocused, we additionally need to make sure that we make our window key anyways. Limit this
+ hack to tap gestures, and only when there is a hidden focused editable element to emulate platform behavior of
+ updating the key window based on the text tap gesture.
+
+ (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
+
+ Make the content view's window key when focusing an editable element.
+
+ (-[WKContentView hasHiddenContentEditable]):
+
+ Consider the selection to be inside a hidden editable area if the `WebKit::FocusedElementIsTooSmall` flag is set
+ as well. While this doesn't affect Google Docs, it does affect some other custom editors, such as Quip.
+
+ (-[WKContentView mouseGestureRecognizerChanged:]):
+
+ Additionally make the current window key when clicking in a hidden editable area with a trackpad on iOS.
+
2020-07-06 Sam Weinig <[email protected]>
Compile-time enable (but leave disabled at runtime by default) date/time input types on macOS to allow testing of cross platform (e.g. DOM) aspects of the controls
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (263978 => 263979)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-07-06 19:03:45 UTC (rev 263978)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-07-06 19:45:54 UTC (rev 263979)
@@ -1496,6 +1496,9 @@
if (!_page->isScrollingOrZooming())
[self _resetPanningPreventionFlags];
+
+ if (nativeWebTouchEvent.isPotentialTap() && self.hasHiddenContentEditable && self._hasFocusedElement && !self.window.keyWindow)
+ [self.window makeKeyWindow];
}
#endif
}
@@ -5977,8 +5980,11 @@
[self reloadInputViews];
#endif
- if (isSelectable)
+ if (isSelectable) {
[self _showKeyboard];
+ if (!self.window.keyWindow)
+ [self.window makeKeyWindow];
+ }
// The custom fixed position rect behavior is affected by -isFocusingElement, so if that changes we need to recompute rects.
if (editableChanged)
@@ -6621,7 +6627,7 @@
- (BOOL)hasHiddenContentEditable
{
- return _suppressSelectionAssistantReasons.contains(WebKit::EditableRootIsTransparentOrFullyClipped);
+ return _suppressSelectionAssistantReasons.containsAny({ WebKit::EditableRootIsTransparentOrFullyClipped, WebKit::FocusedElementIsTooSmall });
}
- (BOOL)_shouldSuppressSelectionCommands
@@ -8554,6 +8560,9 @@
if (event->type() == WebKit::WebEvent::MouseDown)
_layerTreeTransactionIdAtLastInteractionStart = downcast<WebKit::RemoteLayerTreeDrawingAreaProxy>(*_page->drawingArea()).lastCommittedLayerTreeTransactionID();
+ if (event->type() == WebKit::WebEvent::MouseUp && self.hasHiddenContentEditable && self._hasFocusedElement && !self.window.keyWindow)
+ [self.window makeKeyWindow];
+
_page->handleMouseEvent(*event);
}
Modified: trunk/Tools/ChangeLog (263978 => 263979)
--- trunk/Tools/ChangeLog 2020-07-06 19:03:45 UTC (rev 263978)
+++ trunk/Tools/ChangeLog 2020-07-06 19:45:54 UTC (rev 263979)
@@ -1,3 +1,47 @@
+2020-07-06 Wenson Hsieh <[email protected]>
+
+ [iPadOS] Unable to change focus between Google Docs windows by tapping
+ https://bugs.webkit.org/show_bug.cgi?id=213985
+ <rdar://problem/57083267>
+
+ Reviewed by Darin Adler.
+
+ Add WebKitTestRunner support for being able to verify that a web view's window has become the key window.
+
+ * DumpRenderTree/CMakeLists.txt:
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+ * DumpRenderTree/UIScriptController.cpp: Added.
+ (WTR::UIScriptController::setWindowIsKey):
+ (WTR::UIScriptController::windowIsKey const):
+ * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+ * TestRunnerShared/UIScriptContext/UIScriptController.h:
+ * TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp: Renamed from Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp.
+
+ Rename `UIScriptController.cpp` (in TestRunnerShared) to `UIScriptControllerShared.cpp`, and introduce new
+ DumpRenderTree and WebKitTestRunner versions of `UIScriptController.cpp` to house DumpRenderTree and
+ WebKitTestRunner-specific UIScriptController method implementations.
+
+ For now, these are just `windowIsKey` and `setWindowIsKey` below, which plumb into their respective platform-
+ agnostic `PlatformWebView` methods in WebKitTestRunner.
+
+ * WebKitTestRunner/UIScriptController.cpp: Added.
+ (WTR::UIScriptController::windowIsKey const):
+ (WTR::UIScriptController::setWindowIsKey):
+ * WebKitTestRunner/CMakeLists.txt:
+ * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
+ * WebKitTestRunner/ios/PlatformWebViewIOS.mm:
+ (-[WebKitTestRunnerWindow becomeKeyWindow]):
+ (-[WebKitTestRunnerWindow resignKeyWindow]):
+
+ Update these two methods to update `m_windowIsKey` when the test runner's `UIWindow` becomes the key window (or
+ stops being the key window). This is invoked when `-[UIWindow makeKeyWindow]` is called (e.g. from within WebKit
+ code when tapping on an editable element).
+
+ (WTR::PlatformWebView::setWindowIsKey):
+
+ Avoid infinitely looping when setting windowIsKey to `true`, due to `-becomeKeyWindow` calling back into
+ `setWindowIsKey`.
+
2020-07-06 Zhifei Fang <[email protected]>
[result database] Empty search will return too many tests to display
Modified: trunk/Tools/DumpRenderTree/CMakeLists.txt (263978 => 263979)
--- trunk/Tools/DumpRenderTree/CMakeLists.txt 2020-07-06 19:03:45 UTC (rev 263978)
+++ trunk/Tools/DumpRenderTree/CMakeLists.txt 2020-07-06 19:45:54 UTC (rev 263979)
@@ -9,7 +9,7 @@
${WebKitTestRunner_SHARED_DIR}/Bindings/JSWrapper.cpp
${WebKitTestRunner_UISCRIPTCONTEXT_DIR}/UIScriptContext.cpp
- ${WebKitTestRunner_UISCRIPTCONTEXT_DIR}/UIScriptController.cpp
+ ${WebKitTestRunner_UISCRIPTCONTEXT_DIR}/UIScriptControllerShared.cpp
AccessibilityController.cpp
AccessibilityTextMarker.cpp
@@ -21,6 +21,7 @@
PixelDumpSupport.cpp
TestOptions.cpp
TestRunner.cpp
+ UIScriptController.cpp
WorkQueue.cpp
)
Modified: trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj (263978 => 263979)
--- trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj 2020-07-06 19:03:45 UTC (rev 263978)
+++ trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj 2020-07-06 19:45:54 UTC (rev 263979)
@@ -48,7 +48,6 @@
/* Begin PBXBuildFile section */
00F048541A0C3C9A000244DB /* URLRedirect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00F048531A0C3C9A000244DB /* URLRedirect.cpp */; };
0F18E6EC1D6B9C070027E547 /* UIScriptContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F18E6E81D6B9C070027E547 /* UIScriptContext.cpp */; };
- 0F18E6ED1D6B9C070027E547 /* UIScriptController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F18E6EA1D6B9C070027E547 /* UIScriptController.cpp */; };
0F18E7061D6BA0230027E547 /* JSUIScriptController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F18E7041D6BA0230027E547 /* JSUIScriptController.cpp */; };
0F18E70D1D6BAC8C0027E547 /* UIScriptControllerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F18E70C1D6BAC8C0027E547 /* UIScriptControllerIOS.mm */; };
0F18E70F1D6BACB60027E547 /* UIScriptControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F18E70E1D6BACB60027E547 /* UIScriptControllerMac.mm */; };
@@ -157,6 +156,8 @@
C23EA2081BC9F05100C980B7 /* FontWithFeatures.otf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = C23EA2061BC9EABA00C980B7 /* FontWithFeatures.otf */; };
C23EA2091BC9F05100C980B7 /* FontWithFeatures.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = C23EA2071BC9EABA00C980B7 /* FontWithFeatures.ttf */; };
E1B7816511AF31B7007E1BC2 /* MockGeolocationProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1B7808711AF1669007E1BC2 /* MockGeolocationProvider.mm */; };
+ F445C68624B2789D00790440 /* UIScriptControllerShared.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F445C68524B2788F00790440 /* UIScriptControllerShared.cpp */; };
+ F445C68924B278EC00790440 /* UIScriptController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F445C68824B278EC00790440 /* UIScriptController.cpp */; };
F44A531D21B89A4D00DBB99C /* ClassMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A531A21B89A4400DBB99C /* ClassMethodSwizzler.mm */; };
F44A531E21B89A5000DBB99C /* InstanceMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A531C21B89A4500DBB99C /* InstanceMethodSwizzler.mm */; };
F484C223237B27D600BF77D0 /* UIScriptControllerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = F484C222237B27D600BF77D0 /* UIScriptControllerCocoa.mm */; };
@@ -246,7 +247,6 @@
00F048531A0C3C9A000244DB /* URLRedirect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLRedirect.cpp; sourceTree = "<group>"; };
0F18E6E81D6B9C070027E547 /* UIScriptContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UIScriptContext.cpp; path = ../TestRunnerShared/UIScriptContext/UIScriptContext.cpp; sourceTree = "<group>"; };
0F18E6E91D6B9C070027E547 /* UIScriptContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIScriptContext.h; path = ../TestRunnerShared/UIScriptContext/UIScriptContext.h; sourceTree = "<group>"; };
- 0F18E6EA1D6B9C070027E547 /* UIScriptController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UIScriptController.cpp; path = ../TestRunnerShared/UIScriptContext/UIScriptController.cpp; sourceTree = "<group>"; };
0F18E6EB1D6B9C070027E547 /* UIScriptController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIScriptController.h; path = ../TestRunnerShared/UIScriptContext/UIScriptController.h; sourceTree = "<group>"; };
0F18E6F01D6B9C240027E547 /* UIScriptController.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = UIScriptController.idl; path = ../TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl; sourceTree = "<group>"; };
0F18E6F11D6B9C640027E547 /* DerivedSources.make */ = {isa = PBXFileReference; lastKnownFileType = text; path = DerivedSources.make; sourceTree = "<group>"; };
@@ -428,6 +428,8 @@
C23EA2071BC9EABA00C980B7 /* FontWithFeatures.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = FontWithFeatures.ttf; path = fonts/FontWithFeatures.ttf; sourceTree = "<group>"; };
E1B7808511AF1643007E1BC2 /* MockGeolocationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MockGeolocationProvider.h; path = mac/MockGeolocationProvider.h; sourceTree = "<group>"; };
E1B7808711AF1669007E1BC2 /* MockGeolocationProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MockGeolocationProvider.mm; path = mac/MockGeolocationProvider.mm; sourceTree = "<group>"; };
+ F445C68524B2788F00790440 /* UIScriptControllerShared.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UIScriptControllerShared.cpp; path = ../TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp; sourceTree = "<group>"; };
+ F445C68824B278EC00790440 /* UIScriptController.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UIScriptController.cpp; sourceTree = "<group>"; };
F44A531921B89A4400DBB99C /* InstanceMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InstanceMethodSwizzler.h; sourceTree = "<group>"; };
F44A531A21B89A4400DBB99C /* ClassMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ClassMethodSwizzler.mm; sourceTree = "<group>"; };
F44A531B21B89A4400DBB99C /* ClassMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClassMethodSwizzler.h; sourceTree = "<group>"; };
@@ -533,8 +535,9 @@
0F6A0E001D6E0F8A00F1C9A8 /* mac */,
0F18E6E81D6B9C070027E547 /* UIScriptContext.cpp */,
0F18E6E91D6B9C070027E547 /* UIScriptContext.h */,
- 0F18E6EA1D6B9C070027E547 /* UIScriptController.cpp */,
+ F445C68824B278EC00790440 /* UIScriptController.cpp */,
0F18E6EB1D6B9C070027E547 /* UIScriptController.h */,
+ F445C68524B2788F00790440 /* UIScriptControllerShared.cpp */,
);
name = UIScriptContext;
sourceTree = "<group>";
@@ -1230,10 +1233,11 @@
BCA18B490C9B02C400114369 /* TextInputControllerMac.m in Sources */,
BCA18B6A0C9B08C200114369 /* UIDelegate.mm in Sources */,
0F18E6EC1D6B9C070027E547 /* UIScriptContext.cpp in Sources */,
- 0F18E6ED1D6B9C070027E547 /* UIScriptController.cpp in Sources */,
+ F445C68924B278EC00790440 /* UIScriptController.cpp in Sources */,
F484C223237B27D600BF77D0 /* UIScriptControllerCocoa.mm in Sources */,
0F18E70D1D6BAC8C0027E547 /* UIScriptControllerIOS.mm in Sources */,
0F18E70F1D6BACB60027E547 /* UIScriptControllerMac.mm in Sources */,
+ F445C68624B2789D00790440 /* UIScriptControllerShared.cpp in Sources */,
BC9D90240C97472E0099A4A3 /* WorkQueue.cpp in Sources */,
BCA18B260C9B015C00114369 /* WorkQueueItemMac.mm in Sources */,
);
Added: trunk/Tools/DumpRenderTree/UIScriptController.cpp (0 => 263979)
--- trunk/Tools/DumpRenderTree/UIScriptController.cpp (rev 0)
+++ trunk/Tools/DumpRenderTree/UIScriptController.cpp 2020-07-06 19:45:54 UTC (rev 263979)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include "config.h"
+#include "UIScriptController.h"
+
+namespace WTR {
+
+void UIScriptController::setWindowIsKey(bool)
+{
+ notImplemented();
+}
+
+bool UIScriptController::windowIsKey() const
+{
+ notImplemented();
+ return false;
+}
+
+} // namespace WTR
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (263978 => 263979)
--- trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl 2020-07-06 19:03:45 UTC (rev 263978)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl 2020-07-06 19:45:54 UTC (rev 263979)
@@ -241,6 +241,8 @@
readonly attribute boolean isShowingKeyboard;
readonly attribute boolean hasInputSession;
+ attribute boolean windowIsKey;
+
attribute object didShowMenuCallback;
attribute object didHideMenuCallback;
readonly attribute boolean isDismissingMenu;
Deleted: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp (263978 => 263979)
--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp 2020-07-06 19:03:45 UTC (rev 263978)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp 2020-07-06 19:45:54 UTC (rev 263979)
@@ -1,242 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "config.h"
-#include "UIScriptController.h"
-
-#include "JSUIScriptController.h"
-#include "UIScriptContext.h"
-#include <_javascript_Core/JSValueRef.h>
-#include <_javascript_Core/OpaqueJSString.h>
-
-namespace WTR {
-
-DeviceOrientation* toDeviceOrientation(JSContextRef context, JSValueRef value)
-{
- static DeviceOrientation values[] = {
- DeviceOrientation::Portrait,
- DeviceOrientation::PortraitUpsideDown,
- DeviceOrientation::LandscapeLeft,
- DeviceOrientation::LandscapeRight
- };
-
- auto option = adopt(JSValueToStringCopy(context, value, nullptr));
- if (option.get()->string() == "portrait")
- return &values[0];
-
- if (option.get()->string() == "portrait-upsidedown")
- return &values[1];
-
- if (option.get()->string() == "landscape-left")
- return &values[2];
-
- if (option.get()->string() == "landscape-right")
- return &values[3];
-
- return nullptr;
-}
-
-#if !PLATFORM(GTK) && !PLATFORM(COCOA) && !PLATFORM(WIN) && !PLATFORM(WPE)
-Ref<UIScriptController> UIScriptController::create(UIScriptContext& context)
-{
- return adoptRef(*new UIScriptController(context));
-}
-#endif
-
-UIScriptController::UIScriptController(UIScriptContext& context)
- : m_context(&context)
-{
-}
-
-void UIScriptController::contextDestroyed()
-{
- m_context = nullptr;
-}
-
-void UIScriptController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
-{
- setProperty(context, windowObject, "uiController", this, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
-}
-
-JSClassRef UIScriptController::wrapperClass()
-{
- return JSUIScriptController::uIScriptControllerClass();
-}
-
-void UIScriptController::setDidStartFormControlInteractionCallback(JSValueRef callback)
-{
- m_context->registerCallback(callback, CallbackTypeDidStartFormControlInteraction);
-}
-
-JSValueRef UIScriptController::didStartFormControlInteractionCallback() const
-{
- return m_context->callbackWithID(CallbackTypeDidStartFormControlInteraction);
-}
-
-void UIScriptController::setDidEndFormControlInteractionCallback(JSValueRef callback)
-{
- m_context->registerCallback(callback, CallbackTypeDidEndFormControlInteraction);
-}
-
-JSValueRef UIScriptController::didEndFormControlInteractionCallback() const
-{
- return m_context->callbackWithID(CallbackTypeDidEndFormControlInteraction);
-}
-
-void UIScriptController::setDidShowContextMenuCallback(JSValueRef callback)
-{
- m_context->registerCallback(callback, CallbackTypeDidShowContextMenu);
-}
-
-JSValueRef UIScriptController::didShowContextMenuCallback() const
-{
- return m_context->callbackWithID(CallbackTypeDidShowContextMenu);
-}
-
-void UIScriptController::setDidDismissContextMenuCallback(JSValueRef callback)
-{
- m_context->registerCallback(callback, CallbackTypeDidDismissContextMenu);
-}
-
-JSValueRef UIScriptController::didDismissContextMenuCallback() const
-{
- return m_context->callbackWithID(CallbackTypeDidDismissContextMenu);
-}
-
-void UIScriptController::setWillBeginZoomingCallback(JSValueRef callback)
-{
- m_context->registerCallback(callback, CallbackTypeWillBeginZooming);
-}
-
-JSValueRef UIScriptController::willBeginZoomingCallback() const
-{
- return m_context->callbackWithID(CallbackTypeWillBeginZooming);
-}
-
-void UIScriptController::setDidEndZoomingCallback(JSValueRef callback)
-{
- m_context->registerCallback(callback, CallbackTypeDidEndZooming);
-}
-
-JSValueRef UIScriptController::didEndZoomingCallback() const
-{
- return m_context->callbackWithID(CallbackTypeDidEndZooming);
-}
-
-void UIScriptController::setWillCreateNewPageCallback(JSValueRef callback)
-{
- m_context->registerCallback(callback, CallbackTypeWillCreateNewPage);
-}
-
-JSValueRef UIScriptController::willCreateNewPageCallback() const
-{
- return m_context->callbackWithID(CallbackTypeWillCreateNewPage);
-}
-
-void UIScriptController::setDidEndScrollingCallback(JSValueRef callback)
-{
- m_context->registerCallback(callback, CallbackTypeDidEndScrolling);
-}
-
-JSValueRef UIScriptController::didEndScrollingCallback() const
-{
- return m_context->callbackWithID(CallbackTypeDidEndScrolling);
-}
-
-void UIScriptController::setDidShowKeyboardCallback(JSValueRef callback)
-{
- m_context->registerCallback(callback, CallbackTypeDidShowKeyboard);
-}
-
-JSValueRef UIScriptController::didShowKeyboardCallback() const
-{
- return m_context->callbackWithID(CallbackTypeDidShowKeyboard);
-}
-
-void UIScriptController::setDidHideKeyboardCallback(JSValueRef callback)
-{
- m_context->registerCallback(callback, CallbackTypeDidHideKeyboard);
-}
-
-JSValueRef UIScriptController::didHideKeyboardCallback() const
-{
- return m_context->callbackWithID(CallbackTypeDidHideKeyboard);
-}
-
-void UIScriptController::setDidShowMenuCallback(JSValueRef callback)
-{
- m_context->registerCallback(callback, CallbackTypeDidShowMenu);
-}
-
-JSValueRef UIScriptController::didShowMenuCallback() const
-{
- return m_context->callbackWithID(CallbackTypeDidShowMenu);
-}
-
-void UIScriptController::setDidHideMenuCallback(JSValueRef callback)
-{
- m_context->registerCallback(callback, CallbackTypeDidHideMenu);
-}
-
-JSValueRef UIScriptController::didHideMenuCallback() const
-{
- return m_context->callbackWithID(CallbackTypeDidHideMenu);
-}
-
-void UIScriptController::setWillPresentPopoverCallback(JSValueRef callback)
-{
- m_context->registerCallback(callback, CallbackTypeWillPresentPopover);
-}
-
-JSValueRef UIScriptController::willPresentPopoverCallback() const
-{
- return m_context->callbackWithID(CallbackTypeWillPresentPopover);
-}
-
-void UIScriptController::setDidDismissPopoverCallback(JSValueRef callback)
-{
- m_context->registerCallback(callback, CallbackTypeDidDismissPopover);
-}
-
-JSValueRef UIScriptController::didDismissPopoverCallback() const
-{
- return m_context->callbackWithID(CallbackTypeDidDismissPopover);
-}
-
-void UIScriptController::uiScriptComplete(JSStringRef result)
-{
- m_context->requestUIScriptCompletion(result);
- clearAllCallbacks();
-}
-
-void UIScriptController::dismissMenu()
-{
-}
-
-void UIScriptController::chooseMenuAction(JSStringRef, JSValueRef)
-{
-}
-
-}
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (263978 => 263979)
--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h 2020-07-06 19:03:45 UTC (rev 263978)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h 2020-07-06 19:45:54 UTC (rev 263979)
@@ -188,6 +188,9 @@
virtual void replaceTextAtRange(JSStringRef, int location, int length) { notImplemented(); }
virtual void removeAllDynamicDictionaries() { notImplemented(); }
+ virtual bool windowIsKey() const;
+ virtual void setWindowIsKey(bool);
+
// Stylus
virtual void stylusDownAtPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback) { notImplemented(); }
Copied: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp (from rev 263978, trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp) (0 => 263979)
--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp (rev 0)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp 2020-07-06 19:45:54 UTC (rev 263979)
@@ -0,0 +1,242 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#include "config.h"
+#include "UIScriptController.h"
+
+#include "JSUIScriptController.h"
+#include "UIScriptContext.h"
+#include <_javascript_Core/JSValueRef.h>
+#include <_javascript_Core/OpaqueJSString.h>
+
+namespace WTR {
+
+DeviceOrientation* toDeviceOrientation(JSContextRef context, JSValueRef value)
+{
+ static DeviceOrientation values[] = {
+ DeviceOrientation::Portrait,
+ DeviceOrientation::PortraitUpsideDown,
+ DeviceOrientation::LandscapeLeft,
+ DeviceOrientation::LandscapeRight
+ };
+
+ auto option = adopt(JSValueToStringCopy(context, value, nullptr));
+ if (option->string() == "portrait")
+ return &values[0];
+
+ if (option->string() == "portrait-upsidedown")
+ return &values[1];
+
+ if (option->string() == "landscape-left")
+ return &values[2];
+
+ if (option->string() == "landscape-right")
+ return &values[3];
+
+ return nullptr;
+}
+
+#if !PLATFORM(GTK) && !PLATFORM(COCOA) && !PLATFORM(WIN) && !PLATFORM(WPE)
+Ref<UIScriptController> UIScriptController::create(UIScriptContext& context)
+{
+ return adoptRef(*new UIScriptController(context));
+}
+#endif
+
+UIScriptController::UIScriptController(UIScriptContext& context)
+ : m_context(&context)
+{
+}
+
+void UIScriptController::contextDestroyed()
+{
+ m_context = nullptr;
+}
+
+void UIScriptController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
+{
+ setProperty(context, windowObject, "uiController", this, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
+}
+
+JSClassRef UIScriptController::wrapperClass()
+{
+ return JSUIScriptController::uIScriptControllerClass();
+}
+
+void UIScriptController::setDidStartFormControlInteractionCallback(JSValueRef callback)
+{
+ m_context->registerCallback(callback, CallbackTypeDidStartFormControlInteraction);
+}
+
+JSValueRef UIScriptController::didStartFormControlInteractionCallback() const
+{
+ return m_context->callbackWithID(CallbackTypeDidStartFormControlInteraction);
+}
+
+void UIScriptController::setDidEndFormControlInteractionCallback(JSValueRef callback)
+{
+ m_context->registerCallback(callback, CallbackTypeDidEndFormControlInteraction);
+}
+
+JSValueRef UIScriptController::didEndFormControlInteractionCallback() const
+{
+ return m_context->callbackWithID(CallbackTypeDidEndFormControlInteraction);
+}
+
+void UIScriptController::setDidShowContextMenuCallback(JSValueRef callback)
+{
+ m_context->registerCallback(callback, CallbackTypeDidShowContextMenu);
+}
+
+JSValueRef UIScriptController::didShowContextMenuCallback() const
+{
+ return m_context->callbackWithID(CallbackTypeDidShowContextMenu);
+}
+
+void UIScriptController::setDidDismissContextMenuCallback(JSValueRef callback)
+{
+ m_context->registerCallback(callback, CallbackTypeDidDismissContextMenu);
+}
+
+JSValueRef UIScriptController::didDismissContextMenuCallback() const
+{
+ return m_context->callbackWithID(CallbackTypeDidDismissContextMenu);
+}
+
+void UIScriptController::setWillBeginZoomingCallback(JSValueRef callback)
+{
+ m_context->registerCallback(callback, CallbackTypeWillBeginZooming);
+}
+
+JSValueRef UIScriptController::willBeginZoomingCallback() const
+{
+ return m_context->callbackWithID(CallbackTypeWillBeginZooming);
+}
+
+void UIScriptController::setDidEndZoomingCallback(JSValueRef callback)
+{
+ m_context->registerCallback(callback, CallbackTypeDidEndZooming);
+}
+
+JSValueRef UIScriptController::didEndZoomingCallback() const
+{
+ return m_context->callbackWithID(CallbackTypeDidEndZooming);
+}
+
+void UIScriptController::setWillCreateNewPageCallback(JSValueRef callback)
+{
+ m_context->registerCallback(callback, CallbackTypeWillCreateNewPage);
+}
+
+JSValueRef UIScriptController::willCreateNewPageCallback() const
+{
+ return m_context->callbackWithID(CallbackTypeWillCreateNewPage);
+}
+
+void UIScriptController::setDidEndScrollingCallback(JSValueRef callback)
+{
+ m_context->registerCallback(callback, CallbackTypeDidEndScrolling);
+}
+
+JSValueRef UIScriptController::didEndScrollingCallback() const
+{
+ return m_context->callbackWithID(CallbackTypeDidEndScrolling);
+}
+
+void UIScriptController::setDidShowKeyboardCallback(JSValueRef callback)
+{
+ m_context->registerCallback(callback, CallbackTypeDidShowKeyboard);
+}
+
+JSValueRef UIScriptController::didShowKeyboardCallback() const
+{
+ return m_context->callbackWithID(CallbackTypeDidShowKeyboard);
+}
+
+void UIScriptController::setDidHideKeyboardCallback(JSValueRef callback)
+{
+ m_context->registerCallback(callback, CallbackTypeDidHideKeyboard);
+}
+
+JSValueRef UIScriptController::didHideKeyboardCallback() const
+{
+ return m_context->callbackWithID(CallbackTypeDidHideKeyboard);
+}
+
+void UIScriptController::setDidShowMenuCallback(JSValueRef callback)
+{
+ m_context->registerCallback(callback, CallbackTypeDidShowMenu);
+}
+
+JSValueRef UIScriptController::didShowMenuCallback() const
+{
+ return m_context->callbackWithID(CallbackTypeDidShowMenu);
+}
+
+void UIScriptController::setDidHideMenuCallback(JSValueRef callback)
+{
+ m_context->registerCallback(callback, CallbackTypeDidHideMenu);
+}
+
+JSValueRef UIScriptController::didHideMenuCallback() const
+{
+ return m_context->callbackWithID(CallbackTypeDidHideMenu);
+}
+
+void UIScriptController::setWillPresentPopoverCallback(JSValueRef callback)
+{
+ m_context->registerCallback(callback, CallbackTypeWillPresentPopover);
+}
+
+JSValueRef UIScriptController::willPresentPopoverCallback() const
+{
+ return m_context->callbackWithID(CallbackTypeWillPresentPopover);
+}
+
+void UIScriptController::setDidDismissPopoverCallback(JSValueRef callback)
+{
+ m_context->registerCallback(callback, CallbackTypeDidDismissPopover);
+}
+
+JSValueRef UIScriptController::didDismissPopoverCallback() const
+{
+ return m_context->callbackWithID(CallbackTypeDidDismissPopover);
+}
+
+void UIScriptController::uiScriptComplete(JSStringRef result)
+{
+ m_context->requestUIScriptCompletion(result);
+ clearAllCallbacks();
+}
+
+void UIScriptController::dismissMenu()
+{
+}
+
+void UIScriptController::chooseMenuAction(JSStringRef, JSValueRef)
+{
+}
+
+}
Modified: trunk/Tools/WebKitTestRunner/CMakeLists.txt (263978 => 263979)
--- trunk/Tools/WebKitTestRunner/CMakeLists.txt 2020-07-06 19:03:45 UTC (rev 263978)
+++ trunk/Tools/WebKitTestRunner/CMakeLists.txt 2020-07-06 19:45:54 UTC (rev 263979)
@@ -10,7 +10,7 @@
${WebKitTestRunner_BINDINGS_DIR}/JSWrapper.cpp
${WebKitTestRunner_UISCRIPTCONTEXT_DIR}/UIScriptContext.cpp
- ${WebKitTestRunner_UISCRIPTCONTEXT_DIR}/UIScriptController.cpp
+ ${WebKitTestRunner_UISCRIPTCONTEXT_DIR}/UIScriptControllerShared.cpp
CyclicRedundancyCheck.cpp
GeolocationProviderMock.cpp
@@ -19,6 +19,7 @@
TestController.cpp
TestInvocation.cpp
TestOptions.cpp
+ UIScriptController.cpp
WebNotificationProvider.cpp
WorkQueueManager.cpp
)
Added: trunk/Tools/WebKitTestRunner/UIScriptController.cpp (0 => 263979)
--- trunk/Tools/WebKitTestRunner/UIScriptController.cpp (rev 0)
+++ trunk/Tools/WebKitTestRunner/UIScriptController.cpp 2020-07-06 19:45:54 UTC (rev 263979)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include "config.h"
+#include "UIScriptController.h"
+
+#include "PlatformWebView.h"
+#include "TestController.h"
+
+namespace WTR {
+
+bool UIScriptController::windowIsKey() const
+{
+ return TestController::singleton().mainWebView()->windowIsKey();
+}
+
+void UIScriptController::setWindowIsKey(bool isKey)
+{
+ TestController::singleton().mainWebView()->setWindowIsKey(isKey);
+}
+
+} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj (263978 => 263979)
--- trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj 2020-07-06 19:03:45 UTC (rev 263978)
+++ trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj 2020-07-06 19:45:54 UTC (rev 263979)
@@ -45,7 +45,7 @@
/* Begin PBXBuildFile section */
0F18E6E51D6B9B9E0027E547 /* UIScriptContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F18E6DD1D6B9AAF0027E547 /* UIScriptContext.cpp */; };
- 0F18E6E61D6B9BA20027E547 /* UIScriptController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F18E6DF1D6B9AAF0027E547 /* UIScriptController.cpp */; };
+ 0F18E6E61D6B9BA20027E547 /* UIScriptControllerShared.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F18E6DF1D6B9AAF0027E547 /* UIScriptControllerShared.cpp */; };
0F18E7181D6BC4560027E547 /* JSWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F18E7151D6BC4560027E547 /* JSWrapper.cpp */; };
0F4B08731D5BE88D00EC1B78 /* Launch.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0F4B08721D5BE88D00EC1B78 /* Launch.storyboard */; };
0F5169CC1445222D00E0A9D7 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F5169CA1445222D00E0A9D7 /* WebKit.framework */; };
@@ -152,6 +152,7 @@
E132AA3D17CE776F00611DF0 /* WebKitTestRunnerEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = E132AA3B17CE776F00611DF0 /* WebKitTestRunnerEvent.mm */; };
E1C642C317CBCC7300D66A3C /* PoseAsClass.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1C642C117CBCC7300D66A3C /* PoseAsClass.mm */; };
E1C642C617CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1C642C417CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.mm */; };
+ F445C68A24B27ACC00790440 /* UIScriptController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F445C68324B277E300790440 /* UIScriptController.cpp */; };
F44A531721B899E200DBB99C /* ClassMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A531421B899DA00DBB99C /* ClassMethodSwizzler.mm */; };
F44A531821B899E500DBB99C /* InstanceMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A531621B899DA00DBB99C /* InstanceMethodSwizzler.mm */; };
F46240B1217013E500917B16 /* UIScriptControllerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = F46240AF2170128300917B16 /* UIScriptControllerCocoa.mm */; };
@@ -221,7 +222,7 @@
/* Begin PBXFileReference section */
0F18E6DD1D6B9AAF0027E547 /* UIScriptContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UIScriptContext.cpp; path = ../TestRunnerShared/UIScriptContext/UIScriptContext.cpp; sourceTree = "<group>"; };
0F18E6DE1D6B9AAF0027E547 /* UIScriptContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIScriptContext.h; path = ../TestRunnerShared/UIScriptContext/UIScriptContext.h; sourceTree = "<group>"; };
- 0F18E6DF1D6B9AAF0027E547 /* UIScriptController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UIScriptController.cpp; path = ../TestRunnerShared/UIScriptContext/UIScriptController.cpp; sourceTree = "<group>"; };
+ 0F18E6DF1D6B9AAF0027E547 /* UIScriptControllerShared.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UIScriptControllerShared.cpp; path = ../TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp; sourceTree = "<group>"; };
0F18E6E01D6B9AAF0027E547 /* UIScriptController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIScriptController.h; path = ../TestRunnerShared/UIScriptContext/UIScriptController.h; sourceTree = "<group>"; };
0F18E6E31D6B9ABF0027E547 /* UIScriptController.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = UIScriptController.idl; path = ../TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl; sourceTree = "<group>"; };
0F18E7141D6BC4560027E547 /* JSWrappable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSWrappable.h; path = ../TestRunnerShared/Bindings/JSWrappable.h; sourceTree = "<group>"; };
@@ -410,6 +411,7 @@
E1C642C217CBCC7300D66A3C /* PoseAsClass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PoseAsClass.h; sourceTree = "<group>"; };
E1C642C417CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKitTestRunnerPasteboard.mm; sourceTree = "<group>"; };
E1C642C517CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitTestRunnerPasteboard.h; sourceTree = "<group>"; };
+ F445C68324B277E300790440 /* UIScriptController.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UIScriptController.cpp; sourceTree = "<group>"; };
F44A531321B899DA00DBB99C /* InstanceMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstanceMethodSwizzler.h; path = ../TestRunnerShared/cocoa/InstanceMethodSwizzler.h; sourceTree = "<group>"; };
F44A531421B899DA00DBB99C /* ClassMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ClassMethodSwizzler.mm; path = ../TestRunnerShared/cocoa/ClassMethodSwizzler.mm; sourceTree = "<group>"; };
F44A531521B899DA00DBB99C /* ClassMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClassMethodSwizzler.h; path = ../TestRunnerShared/cocoa/ClassMethodSwizzler.h; sourceTree = "<group>"; };
@@ -503,6 +505,7 @@
BCD7D2F611921278006DB7EE /* TestInvocation.h */,
0F622CE81BBB3A1A00838AD3 /* TestOptions.cpp */,
1A3326051B75396500F89F62 /* TestOptions.h */,
+ F445C68324B277E300790440 /* UIScriptController.cpp */,
BC251A1711D16774002EBC01 /* WebKitTestRunnerPrefix.h */,
3164C8EF15D1ADA100EF1FE0 /* WebNotificationProvider.cpp */,
3110BE0F15BA011400D216AC /* WebNotificationProvider.h */,
@@ -557,8 +560,8 @@
2DB6187F1D7D598800978D19 /* spi */,
0F18E6DD1D6B9AAF0027E547 /* UIScriptContext.cpp */,
0F18E6DE1D6B9AAF0027E547 /* UIScriptContext.h */,
- 0F18E6DF1D6B9AAF0027E547 /* UIScriptController.cpp */,
0F18E6E01D6B9AAF0027E547 /* UIScriptController.h */,
+ 0F18E6DF1D6B9AAF0027E547 /* UIScriptControllerShared.cpp */,
);
name = UIScriptContext;
sourceTree = "<group>";
@@ -1199,9 +1202,10 @@
0F87B6171BACC4C0004EC572 /* TestRunnerWKWebView.mm in Sources */,
41C5378E21F13414008B1FAD /* TestWebsiteDataStoreDelegate.mm in Sources */,
0F18E6E51D6B9B9E0027E547 /* UIScriptContext.cpp in Sources */,
- 0F18E6E61D6B9BA20027E547 /* UIScriptController.cpp in Sources */,
+ F445C68A24B27ACC00790440 /* UIScriptController.cpp in Sources */,
F46240B1217013E500917B16 /* UIScriptControllerCocoa.mm in Sources */,
0F73B55C1BA89042004B3EF4 /* UIScriptControllerIOS.mm in Sources */,
+ 0F18E6E61D6B9BA20027E547 /* UIScriptControllerShared.cpp in Sources */,
A18510431B9AE14500744AEB /* WebNotificationProvider.cpp in Sources */,
A18510441B9AE14A00744AEB /* WorkQueueManager.cpp in Sources */,
);
Modified: trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm (263978 => 263979)
--- trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm 2020-07-06 19:03:45 UTC (rev 263978)
+++ trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm 2020-07-06 19:45:54 UTC (rev 263979)
@@ -67,6 +67,22 @@
return self;
}
+- (void)becomeKeyWindow
+{
+ [super becomeKeyWindow];
+
+ if (_platformWebView)
+ _platformWebView->setWindowIsKey(true);
+}
+
+- (void)resignKeyWindow
+{
+ [super resignKeyWindow];
+
+ if (_platformWebView)
+ _platformWebView->setWindowIsKey(false);
+}
+
- (void)dealloc
{
allWindows.removeFirst(self);
@@ -212,7 +228,7 @@
void PlatformWebView::setWindowIsKey(bool isKey)
{
m_windowIsKey = isKey;
- if (isKey)
+ if (isKey && !m_window.keyWindow)
[m_window makeKeyWindow];
}