WebKit Bugzilla
Attachment 361351 Details for
Bug 194271
: Allow pages to trigger programmatic paste from script on iOS
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Part 2
bug-194271-20190206174536.patch (text/plain), 33.45 KB, created by
Wenson Hsieh
on 2019-02-06 17:45:37 PST
(
hide
)
Description:
Part 2
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-02-06 17:45:37 PST
Size:
33.45 KB
patch
obsolete
>Subversion Revision: 240926 >diff --git a/Source/WebCore/PAL/ChangeLog b/Source/WebCore/PAL/ChangeLog >index 8837457bb2529647ae830efc8efa84d1e6392ac3..3693f34a973f3eda44115c3438f17683b6445b9e 100644 >--- a/Source/WebCore/PAL/ChangeLog >+++ b/Source/WebCore/PAL/ChangeLog >@@ -1,3 +1,15 @@ >+2019-02-06 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Allow pages to trigger programmatic paste from script on iOS >+ https://bugs.webkit.org/show_bug.cgi?id=194271 >+ <rdar://problem/47808810> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add some SPI declarations so that we can query for the shared UICalloutBar's arrow direction. >+ >+ * pal/spi/ios/UIKitSPI.h: >+ > 2018-12-16 Darin Adler <darin@apple.com> > > Convert additional String::format clients to alternative approaches >diff --git a/Source/WebCore/PAL/pal/spi/ios/UIKitSPI.h b/Source/WebCore/PAL/pal/spi/ios/UIKitSPI.h >index e1d46ac955352a4037784cc12c871e61a0737cb7..f4d7e10d917e8a24ed1a46c1ec958e5ca00e9afa 100644 >--- a/Source/WebCore/PAL/pal/spi/ios/UIKitSPI.h >+++ b/Source/WebCore/PAL/pal/spi/ios/UIKitSPI.h >@@ -134,6 +134,11 @@ typedef enum { > + (UIViewController *)viewControllerForView:(UIView *)view; > @end > >+@interface UICalloutBar : UIView >++ (UICalloutBar *)sharedCalloutBar; >+@property (nonatomic, readonly) UIMenuControllerArrowDirection targetDirection; >+@end >+ > NS_ASSUME_NONNULL_END > > #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 1c2a54e926a8d87f796d90989a822af00b3b34df..f842fe50af0fa40517b7c3c4ca014fbd7869787b 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,57 @@ >+2019-02-06 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Allow pages to trigger programmatic paste from script on iOS >+ https://bugs.webkit.org/show_bug.cgi?id=194271 >+ <rdar://problem/47808810> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * DumpRenderTree/ios/UIScriptControllerIOS.mm: >+ (WTR::UIScriptController::platformSetDidShowMenuCallback): >+ (WTR::UIScriptController::platformSetDidHideMenuCallback): >+ (WTR::UIScriptController::menuControlsRect const): >+ >+ Add new mechanisms to make it possible to interact with and query the state of the callout menu on iOS. This >+ includes determining the rect (in content view coordinates) of the menu's controls, and callbacks to register >+ for when the menu is shown or hidden. >+ >+ * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: >+ * TestRunnerShared/UIScriptContext/UIScriptContext.h: >+ * TestRunnerShared/UIScriptContext/UIScriptController.cpp: >+ (WTR::UIScriptController::setDidShowMenuCallback): >+ (WTR::UIScriptController::didShowMenuCallback const): >+ (WTR::UIScriptController::setDidHideMenuCallback): >+ (WTR::UIScriptController::didHideMenuCallback const): >+ (WTR::UIScriptController::platformSetDidShowMenuCallback): >+ (WTR::UIScriptController::platformSetDidHideMenuCallback): >+ (WTR::UIScriptController::menuControlsRect const): >+ * TestRunnerShared/UIScriptContext/UIScriptController.h: >+ * WebKitTestRunner/TestController.cpp: >+ (WTR::TestController::resetPreferencesToConsistentValues): >+ (WTR::updateTestOptionsFromTestHeader): >+ * WebKitTestRunner/TestOptions.h: >+ >+ Add a new test option to determine whether DOM paste is enabled. DOM paste is currently enabled everywhere by >+ default, but these new programmatic paste tests require it to be disabled in order for confirmation UI to show. >+ >+ (WTR::TestOptions::hasSameInitializationOptions const): >+ * WebKitTestRunner/cocoa/TestRunnerWKWebView.h: >+ * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm: >+ (-[TestRunnerWKWebView initWithFrame:configuration:]): >+ (-[TestRunnerWKWebView dealloc]): >+ (-[TestRunnerWKWebView _didShowMenu]): >+ (-[TestRunnerWKWebView _didHideMenu]): >+ * WebKitTestRunner/ios/TestControllerIOS.mm: >+ (WTR::TestController::platformResetStateToConsistentValues): >+ >+ Additionally ensure that any callout menu presented by a previous layout test is dismissed before running the >+ next test. >+ >+ * WebKitTestRunner/ios/UIScriptControllerIOS.mm: >+ (WTR::UIScriptController::platformSetDidShowMenuCallback): >+ (WTR::UIScriptController::platformSetDidHideMenuCallback): >+ (WTR::UIScriptController::menuControlsRect const): >+ > 2019-02-03 Fujii Hironori <Hironori.Fujii@sony.com> > > [Win] WebKitTestRunners is failing to create the IndexedDB directory. >diff --git a/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm b/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >index db11ad641562d1d3a3164294b65446df8f53a39c..2356322d6ea3ace8af6fd262d0571521b4efbf73 100644 >--- a/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >+++ b/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >@@ -311,6 +311,19 @@ void UIScriptController::platformSetDidHideKeyboardCallback() > { > } > >+void UIScriptController::platformSetDidShowMenuCallback() >+{ >+} >+ >+void UIScriptController::platformSetDidHideMenuCallback() >+{ >+} >+ >+JSObjectRef UIScriptController::menuControlsRect() const >+{ >+ return nullptr; >+} >+ > void UIScriptController::platformSetDidEndScrollingCallback() > { > } >diff --git a/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl b/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >index e54467ff448a0a7c37070e9b7d0f18825c943143..1284b58692e8305efce54d3e0baeb3518a909d43 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >+++ b/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >@@ -221,6 +221,10 @@ interface UIScriptController { > attribute object didHideKeyboardCallback; > readonly attribute boolean isShowingKeyboard; > >+ attribute object didShowMenuCallback; >+ attribute object didHideMenuCallback; >+ readonly attribute object menuControlsRect; >+ > attribute object willBeginZoomingCallback; > attribute object didEndZoomingCallback; > >diff --git a/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.h b/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.h >index 4ec18293a0331155ff9cb2354ac555ba1408dbbc..8040647a23f237618a3ebd65d76227e8c4a2b6df 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.h >+++ b/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.h >@@ -54,6 +54,8 @@ typedef enum { > CallbackTypeDidEndZooming, > CallbackTypeDidShowKeyboard, > CallbackTypeDidHideKeyboard, >+ CallbackTypeDidShowMenu, >+ CallbackTypeDidHideMenu, > CallbackTypeDidEndScrolling, > CallbackTypeDidStartFormControlInteraction, > CallbackTypeDidEndFormControlInteraction, >diff --git a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >index 4b45d56fdc2cb2ca4dae0f66dd1f527eefe7c39e..ba6c398af783ce055cf5bddf51b89a4ad90565e4 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >+++ b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >@@ -205,6 +205,28 @@ JSValueRef UIScriptController::didHideKeyboardCallback() const > return m_context->callbackWithID(CallbackTypeDidHideKeyboard); > } > >+void UIScriptController::setDidShowMenuCallback(JSValueRef callback) >+{ >+ m_context->registerCallback(callback, CallbackTypeDidShowMenu); >+ platformSetDidShowMenuCallback(); >+} >+ >+JSValueRef UIScriptController::didShowMenuCallback() const >+{ >+ return m_context->callbackWithID(CallbackTypeDidShowMenu); >+} >+ >+void UIScriptController::setDidHideMenuCallback(JSValueRef callback) >+{ >+ m_context->registerCallback(callback, CallbackTypeDidHideMenu); >+ platformSetDidHideMenuCallback(); >+} >+ >+JSValueRef UIScriptController::didHideMenuCallback() const >+{ >+ return m_context->callbackWithID(CallbackTypeDidHideMenu); >+} >+ > #if !PLATFORM(COCOA) > > void UIScriptController::zoomToScale(double, JSValueRef) >@@ -489,6 +511,19 @@ void UIScriptController::platformSetDidHideKeyboardCallback() > { > } > >+void UIScriptController::platformSetDidShowMenuCallback() >+{ >+} >+ >+void UIScriptController::platformSetDidHideMenuCallback() >+{ >+} >+ >+JSObjectRef UIScriptController::menuControlsRect() const >+{ >+ return nullptr; >+} >+ > void UIScriptController::platformClearAllCallbacks() > { > } >diff --git a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >index 956c345c32f61351cfede1143f4a61c00e66c740..34094bbae9b31cced5c50f421082b1fb2ba1a161 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >+++ b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >@@ -152,6 +152,14 @@ public: > > bool isShowingKeyboard() const; > >+ void setDidHideMenuCallback(JSValueRef); >+ JSValueRef didHideMenuCallback() const; >+ >+ void setDidShowMenuCallback(JSValueRef); >+ JSValueRef didShowMenuCallback() const; >+ >+ JSObjectRef menuControlsRect() const; >+ > void setDidEndScrollingCallback(JSValueRef); > JSValueRef didEndScrollingCallback() const; > >@@ -226,6 +234,8 @@ private: > void platformSetDidEndZoomingCallback(); > void platformSetDidShowKeyboardCallback(); > void platformSetDidHideKeyboardCallback(); >+ void platformSetDidShowMenuCallback(); >+ void platformSetDidHideMenuCallback(); > void platformSetDidEndScrollingCallback(); > void platformClearAllCallbacks(); > void platformPlayBackEventStream(JSStringRef, JSValueRef); >diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp >index fa40a821ffa9f020473cd71971a39902045ca6ab..ca49598a3ac3231a1a67571c0b13fd70ffb880fa 100644 >--- a/Tools/WebKitTestRunner/TestController.cpp >+++ b/Tools/WebKitTestRunner/TestController.cpp >@@ -745,7 +745,7 @@ void TestController::resetPreferencesToConsistentValues(const TestOptions& optio > WKPreferencesSetJavaScriptRuntimeFlags(preferences, kWKJavaScriptRuntimeFlagsAllEnabled); > WKPreferencesSetJavaScriptCanOpenWindowsAutomatically(preferences, true); > WKPreferencesSetJavaScriptCanAccessClipboard(preferences, true); >- WKPreferencesSetDOMPasteAllowed(preferences, true); >+ WKPreferencesSetDOMPasteAllowed(preferences, options.domPasteAllowed); > WKPreferencesSetUniversalAccessFromFileURLsAllowed(preferences, true); > WKPreferencesSetFileAccessFromFileURLsAllowed(preferences, true); > #if ENABLE(FULLSCREEN_API) >@@ -1262,6 +1262,8 @@ static void updateTestOptionsFromTestHeader(TestOptions& testOptions, const std: > testOptions.applicationManifest = parseStringTestHeaderValueAsRelativePath(value, pathOrURL); > else if (key == "allowCrossOriginSubresourcesToAskForCredentials") > testOptions.allowCrossOriginSubresourcesToAskForCredentials = parseBooleanTestHeaderValue(value); >+ else if (key == "domPasteAllowed") >+ testOptions.domPasteAllowed = parseBooleanTestHeaderValue(value); > else if (key == "enableProcessSwapOnNavigation") > testOptions.enableProcessSwapOnNavigation = parseBooleanTestHeaderValue(value); > else if (key == "enableProcessSwapOnWindowOpen") >diff --git a/Tools/WebKitTestRunner/TestOptions.h b/Tools/WebKitTestRunner/TestOptions.h >index f91dd50c9d206b03d3f380b75a81d09523eefcbc..581ba62d3b88ca7303b9ed20cbd4d59afd1534e0 100644 >--- a/Tools/WebKitTestRunner/TestOptions.h >+++ b/Tools/WebKitTestRunner/TestOptions.h >@@ -57,6 +57,7 @@ struct TestOptions { > bool shouldShowTouches { false }; > bool dumpJSConsoleLogInStdErr { false }; > bool allowCrossOriginSubresourcesToAskForCredentials { false }; >+ bool domPasteAllowed { true }; > bool enableProcessSwapOnNavigation { true }; > bool enableProcessSwapOnWindowOpen { false }; > bool enableColorFilter { false }; >@@ -105,6 +106,7 @@ struct TestOptions { > || dumpJSConsoleLogInStdErr != options.dumpJSConsoleLogInStdErr > || applicationManifest != options.applicationManifest > || allowCrossOriginSubresourcesToAskForCredentials != options.allowCrossOriginSubresourcesToAskForCredentials >+ || domPasteAllowed != options.domPasteAllowed > || enableProcessSwapOnNavigation != options.enableProcessSwapOnNavigation > || enableProcessSwapOnWindowOpen != options.enableProcessSwapOnWindowOpen > || enableColorFilter != options.enableColorFilter >diff --git a/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h b/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h >index 5bc2cb7288bd075b31cf7dc08b03360707d369d7..28d57ac2a66ceb10e6150e11b68da0c2c9ae7688 100644 >--- a/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h >+++ b/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h >@@ -43,6 +43,8 @@ > @property (nonatomic, copy) void (^didEndZoomingCallback)(void); > @property (nonatomic, copy) void (^didShowKeyboardCallback)(void); > @property (nonatomic, copy) void (^didHideKeyboardCallback)(void); >+@property (nonatomic, copy) void (^didShowMenuCallback)(void); >+@property (nonatomic, copy) void (^didHideMenuCallback)(void); > @property (nonatomic, copy) void (^didEndScrollingCallback)(void); > @property (nonatomic, copy) void (^rotationDidEndCallback)(void); > @property (nonatomic, copy) NSString *accessibilitySpeakSelectionContent; >diff --git a/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm b/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm >index fbfca09d8d351e9417bef8340d2f13a03cd550d0..155fd69a7ecec245af9175e88b0157411f008d43 100644 >--- a/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm >+++ b/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm >@@ -55,6 +55,7 @@ @interface TestRunnerWKWebView () <WKUIDelegatePrivate> { > @property (nonatomic, copy) void (^zoomToScaleCompletionHandler)(void); > @property (nonatomic, copy) void (^retrieveSpeakSelectionContentCompletionHandler)(void); > @property (nonatomic, getter=isShowingKeyboard, setter=setIsShowingKeyboard:) BOOL showingKeyboard; >+@property (nonatomic, getter=isShowingMenu, setter=setIsShowingMenu:) BOOL showingMenu; > > @end > >@@ -77,7 +78,8 @@ - (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguratio > NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; > [center addObserver:self selector:@selector(_invokeShowKeyboardCallbackIfNecessary) name:UIKeyboardDidShowNotification object:nil]; > [center addObserver:self selector:@selector(_invokeHideKeyboardCallbackIfNecessary) name:UIKeyboardDidHideNotification object:nil]; >- >+ [center addObserver:self selector:@selector(_didShowMenu) name:UIMenuControllerDidShowMenuNotification object:nil]; >+ [center addObserver:self selector:@selector(_didHideMenu) name:UIMenuControllerDidHideMenuNotification object:nil]; > self.UIDelegate = self; > } > return self; >@@ -95,6 +97,8 @@ - (void)dealloc > self.didEndZoomingCallback = nil; > self.didShowKeyboardCallback = nil; > self.didHideKeyboardCallback = nil; >+ self.didShowMenuCallback = nil; >+ self.didHideMenuCallback = nil; > self.didEndScrollingCallback = nil; > self.rotationDidEndCallback = nil; > >@@ -172,6 +176,26 @@ - (void)_invokeHideKeyboardCallbackIfNecessary > self.didHideKeyboardCallback(); > } > >+- (void)_didShowMenu >+{ >+ if (self.showingMenu) >+ return; >+ >+ self.showingMenu = YES; >+ if (self.didShowMenuCallback) >+ self.didShowMenuCallback(); >+} >+ >+- (void)_didHideMenu >+{ >+ if (!self.showingMenu) >+ return; >+ >+ self.showingMenu = NO; >+ if (self.didHideMenuCallback) >+ self.didHideMenuCallback(); >+} >+ > - (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view > { > [super scrollViewWillBeginZooming:scrollView withView:view]; >diff --git a/Tools/WebKitTestRunner/ios/TestControllerIOS.mm b/Tools/WebKitTestRunner/ios/TestControllerIOS.mm >index 04011a6b3544837c559851730f699d76987214c3..0fafc0761a1066bbc92234ec68eb8f22607ac218 100644 >--- a/Tools/WebKitTestRunner/ios/TestControllerIOS.mm >+++ b/Tools/WebKitTestRunner/ios/TestControllerIOS.mm >@@ -142,6 +142,9 @@ void TestController::platformResetStateToConsistentValues(const TestOptions& opt > > runUntil(isDoneWaitingForKeyboardToDismiss, m_currentInvocation->shortTimeout()); > >+ if (UIMenuController.sharedMenuController.isMenuVisible) >+ UIMenuController.sharedMenuController.menuVisible = NO; >+ > if (shouldRestoreFirstResponder) > [mainWebView()->platformView() becomeFirstResponder]; > } >diff --git a/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm b/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >index 4952765a0acfd3de3f182be28e2fe8e19395683b..aca0895e9f5d55a729da5aab67d3a6400aca7e09 100644 >--- a/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >+++ b/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >@@ -785,6 +785,48 @@ void UIScriptController::platformSetDidHideKeyboardCallback() > }; > } > >+void UIScriptController::platformSetDidShowMenuCallback() >+{ >+ TestController::singleton().mainWebView()->platformView().didShowMenuCallback = ^{ >+ if (!m_context) >+ return; >+ m_context->fireCallback(CallbackTypeDidShowMenu); >+ }; >+} >+ >+void UIScriptController::platformSetDidHideMenuCallback() >+{ >+ TestController::singleton().mainWebView()->platformView().didHideMenuCallback = ^{ >+ if (!m_context) >+ return; >+ m_context->fireCallback(CallbackTypeDidHideMenu); >+ }; >+} >+ >+JSObjectRef UIScriptController::menuControlsRect() const >+{ >+ const CGFloat approximateArrowOffset = 25; >+ CGRect rect = UIMenuController.sharedMenuController.menuFrame; >+ CGFloat offsetX = 0; >+ CGFloat offsetY = 0; >+ switch ([UICalloutBar sharedCalloutBar].targetDirection) { >+ case UIMenuControllerArrowUp: >+ offsetY = approximateArrowOffset; >+ break; >+ case UIMenuControllerArrowDefault: >+ case UIMenuControllerArrowDown: >+ offsetY = -approximateArrowOffset; >+ break; >+ case UIMenuControllerArrowLeft: >+ offsetX = approximateArrowOffset; >+ break; >+ case UIMenuControllerArrowRight: >+ offsetX = -approximateArrowOffset; >+ break; >+ } >+ return m_context->objectFromRect(WebCore::FloatRect(rect.origin.x + offsetX, rect.origin.y + offsetY, rect.size.width, rect.size.height)); >+} >+ > void UIScriptController::platformSetDidEndScrollingCallback() > { > TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView(); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index c48cbd51a1ff7868fc8500a2ae1438369be2cff5..f895a947650796a237480cbbd912c73f1dd6a2c1 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,35 @@ >+2019-02-06 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Allow pages to trigger programmatic paste from script on iOS >+ https://bugs.webkit.org/show_bug.cgi?id=194271 >+ <rdar://problem/47808810> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add new tests to exercise programmatic pasting. >+ >+ * TestExpectations: >+ * editing/pasteboard/ios/programmatic-paste-confirmation-expected.txt: Added. >+ * editing/pasteboard/ios/programmatic-paste-confirmation.html: Added. >+ >+ Verify that the user can tap "Paste" to allow programmatic pasting. >+ >+ * editing/pasteboard/ios/programmatic-paste-rejection-expected.txt: Added. >+ * editing/pasteboard/ios/programmatic-paste-rejection.html: Added. >+ >+ Verify that resigning first responder dismisses the callout bar and does not allow programmatic pasting. >+ >+ * editing/pasteboard/ios/programmatic-paste-requires-user-gesture-expected.txt: Added. >+ * editing/pasteboard/ios/programmatic-paste-requires-user-gesture.html: Added. >+ >+ Verify that user gesture is required to present the callout menu for a programmatic paste request. >+ >+ * editing/pasteboard/ios/resources/programmatic-paste.js: Added. >+ (return.new.Promise.): >+ (async.handlePasteMenuActionAfterTapAt): >+ * platform/ios-wk2/TestExpectations: >+ * platform/win/TestExpectations: >+ > 2019-02-04 Frederic Wang <fwang@igalia.com> > > [css-scroll-snap] scroll-snap-align not honored on child with non-visible overflow >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index 95275e489a7d5698b6e9e59af67abd2655e1e871..c53c46d696cfdd41dc91180fe4e447c4f251f457 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -52,6 +52,7 @@ http/tests/cookies/same-site [ Skip ] > system-preview [ Skip ] > editing/images [ Skip ] > pointerevents/ios [ Skip ] >+editing/pasteboard/ios [ Skip ] > editing/pasteboard/mac [ Skip ] > > # window.showModalDialog is only tested in DumpRenderTree on Mac. >diff --git a/LayoutTests/editing/pasteboard/ios/programmatic-paste-confirmation-expected.txt b/LayoutTests/editing/pasteboard/ios/programmatic-paste-confirmation-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1cc3a9fb607f300b8d4549f2c56d5bffb91a70f5 >--- /dev/null >+++ b/LayoutTests/editing/pasteboard/ios/programmatic-paste-confirmation-expected.txt >@@ -0,0 +1,18 @@ >+Click here to copy >+Click here to copy >+Click here to copy >+Verifies that a callout is shown when the page programmatically triggers paste, and that tapping the callout allows the paste to happen. To manually test, tap the text on the top, tap the editable area below, and then select 'Paste' in the resulting callout menu. The text 'Click here to copy' should be pasted twice in the editable area. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+PASS document.queryCommandSupported('Paste') is true >+PASS document.queryCommandEnabled('Paste') is true >+PASS event.clipboardData.getData('text/plain') is "Click here to copy" >+PASS document.execCommand('Paste') is true >+PASS event.clipboardData.getData('text/plain') is "Click here to copy" >+PASS document.execCommand('Paste') is true >+PASS editor.textContent is "Click here to copyClick here to copy" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/editing/pasteboard/ios/programmatic-paste-confirmation.html b/LayoutTests/editing/pasteboard/ios/programmatic-paste-confirmation.html >new file mode 100644 >index 0000000000000000000000000000000000000000..450a8fccce18106dff60d0d55b8408dfa95d041f >--- /dev/null >+++ b/LayoutTests/editing/pasteboard/ios/programmatic-paste-confirmation.html >@@ -0,0 +1,72 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ domPasteAllowed=false, useFlexibleViewport=true ] --> >+<html> >+<meta name="viewport" content="width=device-width, initial-scale=1"> >+<head> >+<script src="./resources/programmatic-paste.js"></script> >+<script src="../../../resources/js-test.js"></script> >+<script src="../../../resources/ui-helper.js"></script> >+<style> >+body { >+ margin: 0; >+} >+ >+#copy, #editor { >+ text-align: center; >+} >+ >+#copy { >+ font-size: 40px; >+ height: 50px; >+ border: 1px dashed black; >+} >+ >+#editor { >+ width: 100%; >+ height: 100px; >+ border: 1px dashed silver; >+} >+</style> >+</head> >+<body> >+<div id="copy">Click here to copy</div> >+<div id="editor" contenteditable></div> >+<div id="description"></div> >+<div id="console"></div> >+<script> >+jsTestIsAsync = true; >+ >+const copy = document.getElementById("copy"); >+const editor = document.getElementById("editor"); >+ >+description("Verifies that a callout is shown when the page programmatically triggers paste, and that tapping the callout allows the paste to happen. To manually test, tap the text on the top, tap the editable area below, and then select 'Paste' in the resulting callout menu. The text 'Click here to copy' should be pasted <strong><em>twice</em></strong> in the editable area."); >+ >+copy.addEventListener("click", () => { >+ getSelection().selectAllChildren(copy); >+ document.execCommand("Copy"); >+ getSelection().removeAllRanges(); >+}); >+ >+editor.addEventListener("paste", event => shouldBeEqualToString("event.clipboardData.getData('text/plain')", "Click here to copy")); >+editor.addEventListener("click", event => { >+ getSelection().setPosition(editor); >+ shouldBe("document.queryCommandSupported('Paste')", "true"); >+ shouldBe("document.queryCommandEnabled('Paste')", "true"); >+ shouldBe("document.execCommand('Paste')", "true"); >+ document.execCommand('InsertParagraph'); >+ shouldBe("document.execCommand('Paste')", "true"); >+ shouldBeEqualToString("editor.textContent", "Click here to copyClick here to copy"); >+ event.preventDefault(); >+ editor.blur(); >+ finishJSTest(); >+}); >+ >+(async () => { >+ if (!window.testRunner) >+ return; >+ >+ await UIHelper.activateAt(160, 30); >+ await handlePasteMenuActionAfterTapAt(160, 100); >+})(); >+</script> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/editing/pasteboard/ios/programmatic-paste-rejection-expected.txt b/LayoutTests/editing/pasteboard/ios/programmatic-paste-rejection-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..aa583cfd41ef03fba72a663a2d0613bef61011dc >--- /dev/null >+++ b/LayoutTests/editing/pasteboard/ios/programmatic-paste-rejection-expected.txt >@@ -0,0 +1,14 @@ >+Click here to copy >+Verifies that a callout is shown when the page programmatically triggers paste, and that dismissing the callout prevents the paste from happening. To manually test, tap the text on the top, tap the editable area below, and then dismiss the resulting callout menu by scrolling or tapping elsewhere. The text 'Click here to copy' should not be pasted, and the callout bar should disappear. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+PASS document.queryCommandSupported('Paste') is true >+PASS document.queryCommandEnabled('Paste') is true >+PASS document.execCommand('Paste') is false >+PASS document.execCommand('Paste') is false >+PASS editor.textContent is "" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/editing/pasteboard/ios/programmatic-paste-rejection.html b/LayoutTests/editing/pasteboard/ios/programmatic-paste-rejection.html >new file mode 100644 >index 0000000000000000000000000000000000000000..4f7f930180dab95806c695adda279c1848fcf4a5 >--- /dev/null >+++ b/LayoutTests/editing/pasteboard/ios/programmatic-paste-rejection.html >@@ -0,0 +1,71 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ domPasteAllowed=false, useFlexibleViewport=true ] --> >+<html> >+<meta name="viewport" content="width=device-width, initial-scale=1"> >+<head> >+<script src="./resources/programmatic-paste.js"></script> >+<script src="../../../resources/js-test.js"></script> >+<script src="../../../resources/ui-helper.js"></script> >+<style> >+body { >+ margin: 0; >+} >+ >+#copy, #editor { >+ text-align: center; >+} >+ >+#copy { >+ font-size: 40px; >+ height: 50px; >+ border: 1px dashed black; >+} >+ >+#editor { >+ width: 100%; >+ height: 100px; >+ border: 1px dashed silver; >+} >+</style> >+</head> >+<body> >+<div id="copy">Click here to copy</div> >+<div id="editor" contenteditable></div> >+<div id="description"></div> >+<div id="console"></div> >+<script> >+jsTestIsAsync = true; >+ >+const copy = document.getElementById("copy"); >+const editor = document.getElementById("editor"); >+ >+description("Verifies that a callout is shown when the page programmatically triggers paste, and that dismissing the callout prevents the paste from happening. To manually test, tap the text on the top, tap the editable area below, and then dismiss the resulting callout menu by scrolling or tapping elsewhere. The text 'Click here to copy' should <strong>not</strong> be pasted, and the callout bar should disappear."); >+ >+copy.addEventListener("click", () => { >+ getSelection().selectAllChildren(copy); >+ document.execCommand("Copy"); >+ getSelection().removeAllRanges(); >+}); >+ >+editor.addEventListener("paste", event => shouldBeEqualToString("event.clipboardData.getData('text/plain')", "Click here to copy")); >+editor.addEventListener("click", event => { >+ getSelection().setPosition(editor); >+ shouldBe("document.queryCommandSupported('Paste')", "true"); >+ shouldBe("document.queryCommandEnabled('Paste')", "true"); >+ shouldBe("document.execCommand('Paste')", "false"); >+ shouldBe("document.execCommand('Paste')", "false"); >+ shouldBeEqualToString("editor.textContent", ""); >+ event.preventDefault(); >+ editor.blur(); >+ finishJSTest(); >+}); >+ >+(async () => { >+ if (!window.testRunner) >+ return; >+ >+ await UIHelper.activateAt(160, 30); >+ await handlePasteMenuActionAfterTapAt(160, 100, false); >+})(); >+</script> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/editing/pasteboard/ios/programmatic-paste-requires-user-gesture-expected.txt b/LayoutTests/editing/pasteboard/ios/programmatic-paste-requires-user-gesture-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1ee6c5ae607a28bba3133add16a4f16f3f20b409 >--- /dev/null >+++ b/LayoutTests/editing/pasteboard/ios/programmatic-paste-requires-user-gesture-expected.txt >@@ -0,0 +1,10 @@ >+Click here to copy >+Verifies that no callout is shown when the page programmatically triggers paste outside the scope of user interaction. This test requires WebKitTestRunner. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+PASS document.execCommand('Paste') is false >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/editing/pasteboard/ios/programmatic-paste-requires-user-gesture.html b/LayoutTests/editing/pasteboard/ios/programmatic-paste-requires-user-gesture.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8698bd9de50bb60b9373706ef424acc70dd6d5b6 >--- /dev/null >+++ b/LayoutTests/editing/pasteboard/ios/programmatic-paste-requires-user-gesture.html >@@ -0,0 +1,59 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ domPasteAllowed=false, useFlexibleViewport=true ] --> >+<html> >+<meta name="viewport" content="width=device-width, initial-scale=1"> >+<head> >+<script src="../../../resources/js-test.js"></script> >+<script src="../../../resources/ui-helper.js"></script> >+<style> >+body { >+ margin: 0; >+} >+ >+#copy, #editor { >+ text-align: center; >+} >+ >+#copy { >+ font-size: 40px; >+ height: 50px; >+ border: 1px dashed black; >+} >+ >+#editor { >+ width: 100%; >+ height: 100px; >+ border: 1px dashed silver; >+} >+</style> >+</head> >+<body> >+<div id="copy">Click here to copy</div> >+<div id="editor" contenteditable></div> >+<div id="description"></div> >+<div id="console"></div> >+<script> >+jsTestIsAsync = true; >+ >+const copy = document.getElementById("copy"); >+const editor = document.getElementById("editor"); >+ >+description("Verifies that no callout is shown when the page programmatically triggers paste outside the scope of user interaction. This test requires WebKitTestRunner."); >+ >+copy.addEventListener("click", () => { >+ getSelection().selectAllChildren(copy); >+ document.execCommand("Copy"); >+ getSelection().removeAllRanges(); >+}); >+ >+(async () => { >+ if (!window.testRunner) >+ return; >+ >+ await UIHelper.activateAt(160, 30); >+ editor.focus(); >+ shouldBe("document.execCommand('Paste')", "false"); >+ finishJSTest(); >+})(); >+</script> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/editing/pasteboard/ios/resources/programmatic-paste.js b/LayoutTests/editing/pasteboard/ios/resources/programmatic-paste.js >new file mode 100644 >index 0000000000000000000000000000000000000000..7c9dadf95784fc0e305926e2da900a5cb66b4312 >--- /dev/null >+++ b/LayoutTests/editing/pasteboard/ios/resources/programmatic-paste.js >@@ -0,0 +1,26 @@ >+ >+async function handlePasteMenuActionAfterTapAt(x, y, proceedWithPaste = true) { >+ return new Promise(resolve => { >+ testRunner.runUIScript(` >+ (() => { >+ doneCount = 0; >+ function incrementProgress() { >+ if (++doneCount == 3) >+ uiController.uiScriptComplete(); >+ } >+ >+ uiController.didShowMenuCallback = () => { >+ uiController.didHideMenuCallback = incrementProgress; >+ if (${proceedWithPaste}) { >+ const rect = uiController.menuControlsRect; >+ uiController.singleTapAtPoint(rect.left + rect.width / 2, rect.top + rect.height / 2, incrementProgress); >+ } else { >+ uiController.resignFirstResponder(); >+ incrementProgress(); >+ } >+ }; >+ >+ uiController.singleTapAtPoint(${x}, ${y}, incrementProgress); >+ })()`, resolve); >+ }); >+} >diff --git a/LayoutTests/platform/ios-wk2/TestExpectations b/LayoutTests/platform/ios-wk2/TestExpectations >index 0849d6bcef00f604a62dd18b36965a116befeba5..0e33f753afdeb3e0785b315acbdeb7b0c32c8a58 100644 >--- a/LayoutTests/platform/ios-wk2/TestExpectations >+++ b/LayoutTests/platform/ios-wk2/TestExpectations >@@ -15,6 +15,7 @@ scrollingcoordinator [ Pass ] > fast/web-share [ Pass ] > editing/find [ Pass ] > editing/input/ios [ Pass ] >+editing/pasteboard/ios [ Pass ] > editing/undo-manager [ Pass ] > > editing/selection/character-granularity-rect.html [ Failure ] >diff --git a/LayoutTests/platform/win/TestExpectations b/LayoutTests/platform/win/TestExpectations >index 3230bf0469a649e9fad7767ce2b6152db4f528ee..ffec15ae231e10adac03b3db2c8987d629a3736f 100644 >--- a/LayoutTests/platform/win/TestExpectations >+++ b/LayoutTests/platform/win/TestExpectations >@@ -1157,6 +1157,7 @@ media/track/track-in-band-cues-added-once.html [ Skip ] # Timeout > ###### Pasteboard > ###### These tests are very flaky. > editing/pasteboard/ [ Pass Failure ] >+editing/pasteboard/ios [ Skip ] > [ Debug ] editing/pasteboard/copy-crash.html [ Skip ] # Debug Assertion > [ Debug ] editing/pasteboard/copy-crash-with-extraneous-attribute.html [ Skip ] # Debug Assertion > [ Debug ] editing/pasteboard/testcase-9507.html [ Skip ] # Debug Assertion
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194271
:
361202
|
361212
|
361252
|
361305
|
361306
|
361316
|
361350
|
361351
|
361397
|
361398
|
361537
|
361547
|
361582
|
361702
|
361837
|
361847