WebKit Bugzilla
Attachment 356741 Details for
Bug 187554
: [iOS] WKWebView should match UITextView behavior when editing text with an RTL keyboard
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-187554-20181206125252.patch (text/plain), 41.82 KB, created by
Wenson Hsieh
on 2018-12-06 12:52:52 PST
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2018-12-06 12:52:52 PST
Size:
41.82 KB
patch
obsolete
>Subversion Revision: 238921 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index caeb614be21c19d1b7da9be0169fcd58d6cf4ea4..87a4c56d21b3d171e2cf711c94789a3460d3764f 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,70 @@ >+2018-12-06 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [iOS] WKWebView should match UITextView behavior when editing text with an RTL keyboard >+ https://bugs.webkit.org/show_bug.cgi?id=187554 >+ <rdar://problem/42075638> >+ >+ Reviewed by Tim Horton. >+ >+ Add support for automatically switching the base writing direction to the default writing direction with respect >+ to the current keyboard in an editable WKWebView by implementing `-setBaseWritingDirection:forRange:`. On iOS 12 >+ and earlier, UIKit invokes this protocol method whenever the keyboard is changed to one with a different writing >+ direction, although in some other versions of iOS, this only happens when first focusing an editable area. >+ >+ Test: editing/input/ios/rtl-keyboard-input-on-focus.html >+ >+ * Platform/spi/ios/UIKitSPI.h: >+ >+ Declare UIKeyboardImpl IPI methods mostly for use in WebKitTestRunner (with the exception of >+ `-setInitialDirection`, which we may invoke when we receive the first post-layout EditorState update after >+ focusing an editable element). >+ >+ * UIProcess/PageClient.h: >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::increaseListLevel): >+ (WebKit::WebPageProxy::decreaseListLevel): >+ (WebKit::WebPageProxy::changeListType): >+ (WebKit::WebPageProxy::setBaseWritingDirection): >+ >+ Drive-by style fixes: make these bail and return early if `!isValid()`. >+ >+ (WebKit::WebPageProxy::resetStateAfterProcessExited): >+ >+ Reset assisted node state in the UI process upon web process termination. >+ >+ * UIProcess/WebPageProxy.h: >+ >+ Add plumbing for `setBaseWritingDirection`, from `WebPageProxy` to `WebPage` to `Editor`. >+ >+ * UIProcess/ios/PageClientImplIOS.h: >+ * UIProcess/ios/PageClientImplIOS.mm: >+ (WebKit::PageClientImpl::didReceiveEditorStateUpdateAfterFocus): >+ * UIProcess/ios/WKContentViewInteraction.h: >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView baseWritingDirectionForPosition:inDirection:]): >+ (coreWritingDirection): >+ (-[WKContentView setBaseWritingDirection:forRange:]): >+ >+ Support `-setBaseWritingDirectionForPosition:forRange:`, but only in the case where the given range is the >+ selected range. This is all that's currently needed to fulfill the requirements in <rdar://problem/42075638>, >+ though we could potentially add full support for this in the future by mapping the given text range to a DOM >+ range and moving the selection prior to setting the base writing direction. >+ >+ (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]): >+ >+ Add a hook to notify WKContentView when the first post-layout EditorState has been received in the UI process. >+ When this is invoked, if the web view is editable and the selection is not a range, we call into `UIKeyboardImpl` >+ to change the initial writing direction if necessary. >+ >+ * UIProcess/ios/WebPageProxyIOS.mm: >+ (WebKit::WebPageProxy::startAssistingNode): >+ (WebKit::WebPageProxy::stopAssistingNode): >+ (WebKit::WebPageProxy::editorStateChanged): >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::setBaseWritingDirection): >+ * WebProcess/WebPage/WebPage.h: >+ * WebProcess/WebPage/WebPage.messages.in: >+ > 2018-12-05 Jiewen Tan <jiewen_tan@apple.com> > > [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky >diff --git a/Source/WebKit/Platform/spi/ios/UIKitSPI.h b/Source/WebKit/Platform/spi/ios/UIKitSPI.h >index 23237969fd35426feee93e0085eed977f440d998..56988c68e24658cc2059402ec1f821e1c8684212 100644 >--- a/Source/WebKit/Platform/spi/ios/UIKitSPI.h >+++ b/Source/WebKit/Platform/spi/ios/UIKitSPI.h >@@ -913,6 +913,7 @@ typedef enum { > @end > > @interface UIKeyboardInputMode : UITextInputMode <NSCopying> >++ (UIKeyboardInputMode *)keyboardInputModeWithIdentifier:(NSString *)identifier; > @property (nonatomic, readonly, retain) NSArray <NSString *> *multilingualLanguages; > @property (nonatomic, readonly, retain) NSString *languageWithRegion; > @end >@@ -1062,6 +1063,12 @@ typedef NSInteger UICompositingMode; > - (CGFloat)getVerticalOverlapForView:(UIView *)view usingKeyboardInfo:(NSDictionary *)info; > @end > >+@interface UIKeyboardImpl (IPI) >+- (void)setInitialDirection; >+- (void)prepareKeyboardInputModeFromPreferences:(UIKeyboardInputMode *)lastUsedMode; >+@property (nonatomic, readonly) UIKeyboardInputMode *currentInputModeInPreference; >+@end >+ > @interface _UILayerHostView : UIView > @end > >diff --git a/Source/WebKit/UIProcess/PageClient.h b/Source/WebKit/UIProcess/PageClient.h >index df6ec005c468b425b9be55f682f02ede5aac61be..c5179af75eedc2a1da87c7014b48301894d104e2 100644 >--- a/Source/WebKit/UIProcess/PageClient.h >+++ b/Source/WebKit/UIProcess/PageClient.h >@@ -363,6 +363,7 @@ public: > > virtual void startAssistingNode(const AssistedNodeInformation&, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, API::Object* userData) = 0; > virtual void stopAssistingNode() = 0; >+ virtual void didReceiveEditorStateUpdateAfterFocus() = 0; > virtual bool isAssistingNode() = 0; > virtual bool interpretKeyEvent(const NativeWebKeyboardEvent&, bool isCharEvent) = 0; > virtual void positionInformationDidChange(const InteractionInformationAtPosition&) = 0; >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index 8e5946faa92e271f0c8aca55f91c06532528bc4c..76a9653f4bd0236fa32bb342c4aa6eb85220a2d9 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -160,6 +160,7 @@ > #include <WebCore/TextIndicator.h> > #include <WebCore/ValidationBubble.h> > #include <WebCore/WindowFeatures.h> >+#include <WebCore/WritingDirection.h> > #include <stdio.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/SystemTracing.h> >@@ -1854,20 +1855,34 @@ void WebPageProxy::validateCommand(const String& commandName, WTF::Function<void > > void WebPageProxy::increaseListLevel() > { >- if (isValid()) >- m_process->send(Messages::WebPage::IncreaseListLevel(), m_pageID); >+ if (!isValid()) >+ return; >+ >+ m_process->send(Messages::WebPage::IncreaseListLevel(), m_pageID); > } > > void WebPageProxy::decreaseListLevel() > { >- if (isValid()) >- m_process->send(Messages::WebPage::DecreaseListLevel(), m_pageID); >+ if (!isValid()) >+ return; >+ >+ m_process->send(Messages::WebPage::DecreaseListLevel(), m_pageID); > } > > void WebPageProxy::changeListType() > { >- if (isValid()) >- m_process->send(Messages::WebPage::ChangeListType(), m_pageID); >+ if (!isValid()) >+ return; >+ >+ m_process->send(Messages::WebPage::ChangeListType(), m_pageID); >+} >+ >+void WebPageProxy::setBaseWritingDirection(WritingDirection direction) >+{ >+ if (!isValid()) >+ return; >+ >+ m_process->send(Messages::WebPage::SetBaseWritingDirection(direction), m_pageID); > } > > void WebPageProxy::updateFontAttributesAfterEditorStateChange() >@@ -6423,6 +6438,8 @@ void WebPageProxy::resetStateAfterProcessExited(ProcessTerminationReason termina > #endif > > #if PLATFORM(IOS_FAMILY) >+ m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement = false; >+ m_deferredNodeAssistanceArguments = nullptr; > m_activityToken = nullptr; > #endif > >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index 734d211719e94bff95a961f3f0d6309ccc3efa15..53d8c3db094df7061d83c6e52e08290e1f37e126 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -178,6 +178,7 @@ enum class HasInsecureContent : bool; > enum class NotificationDirection : uint8_t; > enum class ShouldSample : bool; > enum class ShouldTreatAsContinuingLoad : bool; >+enum class WritingDirection : uint8_t; > > struct ApplicationManifest; > struct BackForwardItemIdentifier; >@@ -563,6 +564,8 @@ public: > void decreaseListLevel(); > void changeListType(); > >+ void setBaseWritingDirection(WebCore::WritingDirection); >+ > std::optional<WebCore::FontAttributes> cachedFontAttributesAtSelectionStart() const { return m_cachedFontAttributesAtSelectionStart; } > > #if PLATFORM(COCOA) >@@ -1765,6 +1768,7 @@ private: > > void startAssistingNode(const AssistedNodeInformation&, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, const UserData&); > void stopAssistingNode(); >+ void didReceiveEditorStateUpdateAfterFocus(); > > void showInspectorHighlight(const WebCore::Highlight&); > void hideInspectorHighlight(); >@@ -2252,6 +2256,7 @@ private: > > #if PLATFORM(IOS_FAMILY) > std::unique_ptr<NodeAssistanceArguments> m_deferredNodeAssistanceArguments; >+ bool m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement { false }; > bool m_forceAlwaysUserScalable { false }; > WebCore::FloatSize m_viewportConfigurationViewLayoutSize; > double m_viewportConfigurationLayoutSizeScaleFactor { 1 }; >diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.h b/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >index 8ecee147aa07891a2d22102d960543897be46596..6f14b4071290885498b928d1bc6df4e241bfbfa3 100644 >--- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >+++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >@@ -140,6 +140,7 @@ private: > > void startAssistingNode(const AssistedNodeInformation&, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, API::Object* userData) override; > void stopAssistingNode() override; >+ void didReceiveEditorStateUpdateAfterFocus() override; > bool isAssistingNode() override; > void selectionDidChange() override; > bool interpretKeyEvent(const NativeWebKeyboardEvent&, bool isCharEvent) override; >diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >index 57b5acef3b4fa639a13f8ff230706e2419a80cb8..e9b1f1c219caf10af780fc494e7db52ecb7b27d7 100644 >--- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >+++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >@@ -578,6 +578,11 @@ void PageClientImpl::stopAssistingNode() > [m_contentView _stopAssistingNode]; > } > >+void PageClientImpl::didReceiveEditorStateUpdateAfterFocus() >+{ >+ [m_contentView _didReceiveEditorStateUpdateAfterFocus]; >+} >+ > void PageClientImpl::showPlaybackTargetPicker(bool hasVideo, const IntRect& elementRect, WebCore::RouteSharingPolicy policy, const String& contextUID) > { > [m_contentView _showPlaybackTargetPicker:hasVideo fromRect:elementRect routeSharingPolicy:policy routingContextUID:contextUID]; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >index da26332214679fd91cc54d0fc84ec823077e4d88..e794e3c631ddeb53a1a469b7909429b4cba3bc61 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >@@ -388,6 +388,7 @@ FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW) > - (void)_disableDoubleTapGesturesDuringTapIfNecessary:(uint64_t)requestID; > - (void)_startAssistingNode:(const WebKit::AssistedNodeInformation&)information userIsInteracting:(BOOL)userIsInteracting blurPreviousNode:(BOOL)blurPreviousNode changingActivityState:(BOOL)changingActivityState userObject:(NSObject <NSSecureCoding> *)userObject; > - (void)_stopAssistingNode; >+- (void)_didReceiveEditorStateUpdateAfterFocus; > - (void)_selectionChanged; > - (void)_updateChangedSelection; > - (BOOL)_interpretKeyEvent:(::WebEvent *)theEvent isCharEvent:(BOOL)isCharEvent; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 9a843e0bdac0a267056ce49ae7c75259e764d5d5..2941dbd250093afccdd72959beccd8c628e37665 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -92,6 +92,7 @@ > #import <WebCore/TextIndicator.h> > #import <WebCore/VisibleSelection.h> > #import <WebCore/WebEvent.h> >+#import <WebCore/WritingDirection.h> > #import <WebKit/WebSelectionRect.h> // FIXME: WK2 should not include WebKit headers! > #import <pal/spi/cg/CoreGraphicsSPI.h> > #import <pal/spi/cocoa/DataDetectorsCoreSPI.h> >@@ -3582,16 +3583,34 @@ - (UITextRange *)characterRangeByExtendingPosition:(UITextPosition *)position in > return nil; > } > >-ALLOW_DEPRECATED_DECLARATIONS_BEGIN >-- (UITextWritingDirection)baseWritingDirectionForPosition:(UITextPosition *)position inDirection:(UITextStorageDirection)direction >+- (NSWritingDirection)baseWritingDirectionForPosition:(UITextPosition *)position inDirection:(UITextStorageDirection)direction > { >- return UITextWritingDirectionLeftToRight; >+ return NSWritingDirectionLeftToRight; > } > >-- (void)setBaseWritingDirection:(UITextWritingDirection)writingDirection forRange:(UITextRange *)range >+static WritingDirection coreWritingDirection(NSWritingDirection direction) > { >+ switch (direction) { >+ case NSWritingDirectionNatural: >+ return WritingDirection::Natural; >+ case NSWritingDirectionLeftToRight: >+ return WritingDirection::LeftToRight; >+ case NSWritingDirectionRightToLeft: >+ return WritingDirection::RightToLeft; >+ default: >+ ASSERT_NOT_REACHED(); >+ return WritingDirection::Natural; >+ } >+} >+ >+- (void)setBaseWritingDirection:(NSWritingDirection)direction forRange:(UITextRange *)range >+{ >+ if (range && ![range isEqual:self.selectedTextRange]) { >+ // We currently only support changing the base writing direction at the selection. >+ return; >+ } >+ _page->setBaseWritingDirection(coreWritingDirection(direction)); > } >-ALLOW_DEPRECATED_DECLARATIONS_END > > - (CGRect)firstRectForRange:(UITextRange *)range > { >@@ -4513,6 +4532,23 @@ - (void)_stopAssistingNode > [self _stopSuppressingSelectionAssistantForReason:FocusedElementIsTransparent]; > } > >+- (void)_didReceiveEditorStateUpdateAfterFocus >+{ >+ if (!_page->isEditable()) >+ return; >+ >+ auto& editorState = _page->editorState(); >+ if (editorState.selectionIsNone || editorState.selectionIsRange) >+ return; >+ >+ UIKeyboardImpl *keyboard = UIKeyboardImpl.activeInstance; >+ if (keyboard.delegate != self) >+ return; >+ >+ // Synchronize the keyboard's writing direction with the newly received EditorState. >+ [keyboard setInitialDirection]; >+} >+ > - (void)updateCurrentAssistedNodeInformation:(Function<void(bool didUpdate)>&&)callback > { > WeakObjCPtr<WKContentView> weakSelf { self }; >diff --git a/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm b/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >index 2795f730bbfec62e44f54f6a809c82bab633d367..7c890adfe610030fd835cd2041e90b9896b28afd 100644 >--- a/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >+++ b/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >@@ -895,6 +895,8 @@ void WebPageProxy::didGetTapHighlightGeometries(uint64_t requestID, const WebCor > > void WebPageProxy::startAssistingNode(const AssistedNodeInformation& information, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, const UserData& userData) > { >+ m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement = true; >+ > API::Object* userDataObject = process().transformHandlesToObjects(userData.object()).get(); > if (m_editorState.isMissingPostLayoutData) { > m_deferredNodeAssistanceArguments = std::make_unique<NodeAssistanceArguments>(NodeAssistanceArguments { information, userIsInteracting, blurPreviousNode, changingActivityState, userDataObject }); >@@ -906,6 +908,7 @@ void WebPageProxy::startAssistingNode(const AssistedNodeInformation& information > > void WebPageProxy::stopAssistingNode() > { >+ m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement = false; > m_deferredNodeAssistanceArguments = nullptr; > pageClient().stopAssistingNode(); > } >@@ -1054,6 +1057,11 @@ void WebPageProxy::editorStateChanged(const EditorState& editorState) > bool couldChangeSecureInputState = m_editorState.isInPasswordField != editorState.isInPasswordField || m_editorState.selectionIsNone; > > m_editorState = editorState; >+ >+ if (m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement && !m_editorState.isMissingPostLayoutData) { >+ pageClient().didReceiveEditorStateUpdateAfterFocus(); >+ m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement = false; >+ } > > // Selection being none is a temporary state when editing. Flipping secure input state too quickly was causing trouble (not fully understood). > if (couldChangeSecureInputState && !editorState.selectionIsNone) >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index ac475152d74bea92cddeba43b82e3cd0ea6cf1f0..44941ff90aa5879308bebca7f2dc002697f8167e 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -219,6 +219,7 @@ > #include <WebCore/VisiblePosition.h> > #include <WebCore/VisibleUnits.h> > #include <WebCore/WebGLStateTracker.h> >+#include <WebCore/WritingDirection.h> > #include <WebCore/markup.h> > #include <pal/SessionID.h> > #include <wtf/ProcessID.h> >@@ -1164,6 +1165,11 @@ void WebPage::changeListType() > m_page->focusController().focusedOrMainFrame().editor().changeSelectionListType(); > } > >+void WebPage::setBaseWritingDirection(WritingDirection direction) >+{ >+ m_page->focusController().focusedOrMainFrame().editor().setBaseWritingDirection(direction); >+} >+ > bool WebPage::isEditingCommandEnabled(const String& commandName) > { > Frame& frame = m_page->focusController().focusedOrMainFrame(); >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 074a041fa65883294730d7a587e2e42e33f281ce..c880029c2483b0645808d83194368eb2b70a039d 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -169,6 +169,7 @@ class VisiblePosition; > enum SyntheticClickType : int8_t; > enum class ShouldTreatAsContinuingLoad : bool; > enum class TextIndicatorPresentationTransition : uint8_t; >+enum class WritingDirection : uint8_t; > > struct BackForwardItemIdentifier; > struct CompositionUnderline; >@@ -1215,6 +1216,8 @@ private: > void decreaseListLevel(); > void changeListType(); > >+ void setBaseWritingDirection(WebCore::WritingDirection); >+ > void setNeedsFontAttributes(bool); > > void mouseEvent(const WebMouseEvent&); >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >index 43236559af0fc7c9b94e219f2ee0dc00e775d3d5..520abe7708743e1d1e6fa7f09e58f144923e429c 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >@@ -222,6 +222,8 @@ messages -> WebPage LegacyReceiver { > DecreaseListLevel() > ChangeListType() > >+ SetBaseWritingDirection(enum:uint8_t WebCore::WritingDirection direction) >+ > SetNeedsFontAttributes(bool needsFontAttributes) > > RequestFontAttributesAtSelectionStart(WebKit::CallbackID callbackID) >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index d4a32b204c6858cfe73f35472c9eb21317a609eb..3dfa182a380b5826b78af2e5f46fba8926e470de 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,52 @@ >+2018-12-06 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [iOS] WKWebView should match UITextView behavior when editing text with an RTL keyboard >+ https://bugs.webkit.org/show_bug.cgi?id=187554 >+ <rdar://problem/42075638> >+ >+ Reviewed by Tim Horton. >+ >+ Add support for simulating the keyboard input mode in layout tests using UIScriptController, as well as a new >+ `TestOption` to make the web view editable. >+ >+ * DumpRenderTree/ios/UIScriptControllerIOS.mm: >+ (WTR::UIScriptController::setKeyboardInputModeIdentifier): >+ * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: >+ * TestRunnerShared/UIScriptContext/UIScriptController.cpp: >+ (WTR::UIScriptController::setKeyboardInputModeIdentifier): >+ * TestRunnerShared/UIScriptContext/UIScriptController.h: >+ * WebKitTestRunner/PlatformWebView.h: >+ * WebKitTestRunner/TestController.cpp: >+ (WTR::updateTestOptionsFromTestHeader): >+ * WebKitTestRunner/TestController.h: >+ (WTR::TestController::overriddenKeyboardInputMode const): >+ * WebKitTestRunner/TestOptions.h: >+ (WTR::TestOptions::hasSameInitializationOptions const): >+ * WebKitTestRunner/cocoa/TestControllerCocoa.mm: >+ (WTR::TestController::platformCreateWebView): >+ * WebKitTestRunner/gtk/PlatformWebViewGtk.cpp: >+ (WTR::PlatformWebView::setEditable): >+ * WebKitTestRunner/ios/PlatformWebViewIOS.mm: >+ (WTR::PlatformWebView::setEditable): >+ * WebKitTestRunner/ios/TestControllerIOS.mm: >+ (WTR::TestController::platformResetStateToConsistentValues): >+ (WTR::swizzleCurrentInputMode): >+ (WTR::TestController::setKeyboardInputModeIdentifier): >+ >+ Swizzle out several `UIKeyboardInputModeController` methods in order to convince UIKit that the user has >+ selected a `UIKeyboardInputMode` corresponding to the given identifier. The call to >+ `-prepareKeyboardInputModeFromPreferences:` is also necessary on iOS 12 in order to update cached writing >+ direction state in UIKit. >+ >+ * WebKitTestRunner/ios/UIScriptControllerIOS.mm: >+ (WTR::UIScriptController::setKeyboardInputModeIdentifier): >+ * WebKitTestRunner/mac/PlatformWebViewMac.mm: >+ (WTR::PlatformWebView::setEditable): >+ * WebKitTestRunner/win/PlatformWebViewWin.cpp: >+ (WTR::PlatformWebView::setEditable): >+ * WebKitTestRunner/wpe/PlatformWebViewWPE.cpp: >+ (WTR::PlatformWebView::setEditable): >+ > 2018-12-05 Wenson Hsieh <wenson_hsieh@apple.com> > > [Cocoa] Share ClassMethodSwizzler and InstanceMethodSwizzler between TestWebKitAPI and WebKitTestRunner >diff --git a/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm b/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >index 25662e28cb61f4d71bc1c893190c3e06542fd7c2..90b42ebfa460885b2b4b2a8643fa31ba2481ddde 100644 >--- a/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >+++ b/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >@@ -436,6 +436,10 @@ JSObjectRef UIScriptController::attachmentInfo(JSStringRef) > return nullptr; > } > >+void UIScriptController::setKeyboardInputModeIdentifier(JSStringRef) >+{ >+} >+ > } > > #endif // PLATFORM(IOS_FAMILY) >diff --git a/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl b/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >index 915f6db0d1af2c2e951662648b713d73e6e143a7..7d204e85726a86d3fa8ec2c38b9778c13b706623 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >+++ b/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >@@ -258,6 +258,8 @@ interface UIScriptController { > void setDefaultCalendarType(DOMString calendarIdentifier); > readonly attribute object inputViewBounds; > >+ void setKeyboardInputModeIdentifier(DOMString identifier); >+ > void replaceTextAtRange(DOMString text, long location, long length); > void removeAllDynamicDictionaries(); > >diff --git a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >index e2d053598c85b8bb10ba25b679e76d7cfc45e490..f877dcedc53a9f65d51d568af57b14cb4569ed4d 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >+++ b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >@@ -510,6 +510,10 @@ JSObjectRef UIScriptController::attachmentInfo(JSStringRef) > return nullptr; > } > >+void UIScriptController::setKeyboardInputModeIdentifier(JSStringRef) >+{ >+} >+ > #endif > > #if !PLATFORM(COCOA) >diff --git a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >index 2176f9d7e123075650f05d5c9d0ae20f5bb800b5..7621470f7fd6a12ed755496927a8c9ae4a24dfdf 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >+++ b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >@@ -171,6 +171,8 @@ public: > void setDefaultCalendarType(JSStringRef calendarIdentifier); > JSObjectRef inputViewBounds() const; > >+ void setKeyboardInputModeIdentifier(JSStringRef); >+ > void replaceTextAtRange(JSStringRef, int location, int length); > void removeAllDynamicDictionaries(); > >diff --git a/Tools/WebKitTestRunner/PlatformWebView.h b/Tools/WebKitTestRunner/PlatformWebView.h >index db419c7d4fb8bbc4fbf28ac6e1cd5277f1a0e164..6cdfd7351eaab23dad091465fe703058f6c4b8f2 100644 >--- a/Tools/WebKitTestRunner/PlatformWebView.h >+++ b/Tools/WebKitTestRunner/PlatformWebView.h >@@ -103,6 +103,8 @@ public: > bool drawsBackground() const; > void setDrawsBackground(bool); > >+ void setEditable(bool); >+ > void removeFromWindow(); > void addToWindow(); > >diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp >index 56374f70cc0f8e3033f2129ddea0f825f7756ed5..0850558130bc5b76285afb8245a7fb8fe43c1f05 100644 >--- a/Tools/WebKitTestRunner/TestController.cpp >+++ b/Tools/WebKitTestRunner/TestController.cpp >@@ -1257,6 +1257,8 @@ static void updateTestOptionsFromTestHeader(TestOptions& testOptions, const std: > testOptions.shouldShowSpellCheckingDots = parseBooleanTestHeaderValue(value); > else if (key == "enableEditableImages") > testOptions.enableEditableImages = parseBooleanTestHeaderValue(value); >+ else if (key == "editable") >+ testOptions.editable = parseBooleanTestHeaderValue(value); > pairStart = pairEnd + 1; > } > } >diff --git a/Tools/WebKitTestRunner/TestController.h b/Tools/WebKitTestRunner/TestController.h >index e31b2eb44910a59f1fb61af1afc3fbe568d39b2e..13a39c6905f0d87ba87b9db57f8dad5c17ac71bc 100644 >--- a/Tools/WebKitTestRunner/TestController.h >+++ b/Tools/WebKitTestRunner/TestController.h >@@ -40,9 +40,11 @@ > > #if PLATFORM(COCOA) > #include "ClassMethodSwizzler.h" >+#include "InstanceMethodSwizzler.h" > #endif > > OBJC_CLASS NSString; >+OBJC_CLASS UIKeyboardInputMode; > OBJC_CLASS WKWebViewConfiguration; > > namespace WTR { >@@ -270,6 +272,12 @@ public: > RetainPtr<NSString> getOverriddenCalendarIdentifier() const; > void setDefaultCalendarType(NSString *identifier); > #endif // PLATFORM(COCOA) >+ >+#if PLATFORM(IOS_FAMILY) >+ void setKeyboardInputModeIdentifier(const String&); >+ UIKeyboardInputMode *overriddenKeyboardInputMode() const { return m_overriddenKeyboardInputMode.get(); } >+#endif >+ > private: > WKRetainPtr<WKPageConfigurationRef> generatePageConfiguration(WKContextConfigurationRef); > WKRetainPtr<WKContextConfigurationRef> generateContextConfiguration() const; >@@ -441,6 +449,11 @@ private: > WKRetainPtr<WKContextRef> m_context; > WKRetainPtr<WKPageGroupRef> m_pageGroup; > >+#if PLATFORM(IOS_FAMILY) >+ Vector<std::unique_ptr<InstanceMethodSwizzler>> m_inputModeSwizzlers; >+ RetainPtr<UIKeyboardInputMode> m_overriddenKeyboardInputMode; >+#endif >+ > enum State { > Initial, > Resetting, >diff --git a/Tools/WebKitTestRunner/TestOptions.h b/Tools/WebKitTestRunner/TestOptions.h >index 36588dcf5dae59308f2547177b4f7d27624ad716..10786e04125c7192fcd282503b68d96b853b0c88 100644 >--- a/Tools/WebKitTestRunner/TestOptions.h >+++ b/Tools/WebKitTestRunner/TestOptions.h >@@ -65,6 +65,7 @@ struct TestOptions { > bool shouldIgnoreMetaViewport { false }; > bool shouldShowSpellCheckingDots { false }; > bool enableEditableImages { false }; >+ bool editable { false }; > > float deviceScaleFactor { 1 }; > Vector<String> overrideLanguages; >@@ -107,7 +108,8 @@ struct TestOptions { > || checkForWorldLeaks != options.checkForWorldLeaks > || shouldShowSpellCheckingDots != options.shouldShowSpellCheckingDots > || shouldIgnoreMetaViewport != options.shouldIgnoreMetaViewport >- || enableEditableImages != options.enableEditableImages) >+ || enableEditableImages != options.enableEditableImages >+ || editable != options.editable) > return false; > > if (experimentalFeatures != options.experimentalFeatures) >diff --git a/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm b/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >index 69a4ac62ae165c35895bf07b216448ee2ee8a845..11b0e3ae34fbbe7e1ba9e1721a4d118d33026796 100644 >--- a/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >+++ b/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >@@ -171,6 +171,9 @@ void TestController::platformCreateWebView(WKPageConfigurationRef, const TestOpt > > if (options.punchOutWhiteBackgroundsInDarkMode) > m_mainWebView->setDrawsBackground(false); >+ >+ if (options.editable) >+ m_mainWebView->setEditable(true); > #else > m_mainWebView = std::make_unique<PlatformWebView>(globalWebViewConfiguration, options); > #endif >diff --git a/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp b/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp >index de614b463b70aa479823a81c878ac77524fb8dbd..b3668441a5c774cdf3f550bbe2e021409284b00d 100644 >--- a/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp >+++ b/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp >@@ -198,5 +198,9 @@ void PlatformWebView::setDrawsBackground(bool) > { > } > >+void PlatformWebView::setEditable(bool) >+{ >+} >+ > } // namespace WTR > >diff --git a/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm b/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm >index a91cc6d1e47401170d8970d28517b7cc9761bd15..fda732daaafffea850260fabdc3eb4422d0e872e 100644 >--- a/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm >+++ b/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm >@@ -294,6 +294,15 @@ void PlatformWebView::changeWindowScaleIfNeeded(float) > // Retina only surface. > } > >+void PlatformWebView::setEditable(bool editable) >+{ >+#if WK_API_ENABLED >+ m_view._editable = editable; >+#else >+ UNUSED_PARAM(editable); >+#endif >+} >+ > bool PlatformWebView::drawsBackground() const > { > return false; >diff --git a/Tools/WebKitTestRunner/ios/TestControllerIOS.mm b/Tools/WebKitTestRunner/ios/TestControllerIOS.mm >index 0b437aeb6a1fda94628b10b14d57b1775e5925d3..4a1080cad49df10dc1b4446705c076c1e0afbb4d 100644 >--- a/Tools/WebKitTestRunner/ios/TestControllerIOS.mm >+++ b/Tools/WebKitTestRunner/ios/TestControllerIOS.mm >@@ -116,6 +116,9 @@ void TestController::platformResetStateToConsistentValues(const TestOptions& opt > cocoaResetStateToConsistentValues(options); > > [[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait animated:NO]; >+ >+ m_inputModeSwizzlers.clear(); >+ m_overriddenKeyboardInputMode = nil; > > BOOL shouldRestoreFirstResponder = NO; > if (PlatformWebView* platformWebView = mainWebView()) { >@@ -198,4 +201,31 @@ void TestController::setHidden(bool) > // FIXME: implement for iOS > } > >+static UIKeyboardInputMode *swizzleCurrentInputMode() >+{ >+ return TestController::singleton().overriddenKeyboardInputMode(); >+} >+ >+static NSArray<UIKeyboardInputMode *> *swizzleActiveInputModes() >+{ >+ return @[ TestController::singleton().overriddenKeyboardInputMode() ]; >+} >+ >+void TestController::setKeyboardInputModeIdentifier(const String& identifier) >+{ >+ m_inputModeSwizzlers.clear(); >+ m_overriddenKeyboardInputMode = [UIKeyboardInputMode keyboardInputModeWithIdentifier:identifier]; >+ if (!m_overriddenKeyboardInputMode) { >+ ASSERT_NOT_REACHED(); >+ return; >+ } >+ >+ auto controllerClass = UIKeyboardInputModeController.class; >+ m_inputModeSwizzlers.reserveCapacity(3); >+ m_inputModeSwizzlers.uncheckedAppend(std::make_unique<InstanceMethodSwizzler>(controllerClass, @selector(currentInputMode), reinterpret_cast<IMP>(swizzleCurrentInputMode))); >+ m_inputModeSwizzlers.uncheckedAppend(std::make_unique<InstanceMethodSwizzler>(controllerClass, @selector(currentInputModeInPreference), reinterpret_cast<IMP>(swizzleCurrentInputMode))); >+ m_inputModeSwizzlers.uncheckedAppend(std::make_unique<InstanceMethodSwizzler>(controllerClass, @selector(activeInputModes), reinterpret_cast<IMP>(swizzleActiveInputModes))); >+ [UIKeyboardImpl.sharedInstance prepareKeyboardInputModeFromPreferences:nil]; >+} >+ > } // namespace WTR >diff --git a/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm b/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >index abd0bc612167c11ad6d890994cdebc2ebff487b3..a9d54ad6d2540064da32867690462d0026a642ac 100644 >--- a/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >+++ b/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >@@ -925,6 +925,11 @@ long UIScriptController::numberOfStrokesInEditableImage() > #endif > } > >+void UIScriptController::setKeyboardInputModeIdentifier(JSStringRef identifier) >+{ >+ TestController::singleton().setKeyboardInputModeIdentifier(toWTFString(toWK(identifier))); >+} >+ > void UIScriptController::toggleCapsLock(JSValueRef callback) > { > // FIXME: Implement for iOS. See <https://bugs.webkit.org/show_bug.cgi?id=191815>. >diff --git a/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm b/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm >index f6cb2a08d64579cd444f820a30a6149f380dfa65..45d1f9be8c6b326bb3aeed5e8c3bf8aeda7cd8ee 100644 >--- a/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm >+++ b/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm >@@ -212,6 +212,15 @@ void PlatformWebView::setDrawsBackground(bool drawsBackground) > #endif > } > >+void PlatformWebView::setEditable(bool editable) >+{ >+#if WK_API_ENABLED >+ m_view._editable = editable; >+#else >+ UNUSED_PARAM(editable); >+#endif >+} >+ > RetainPtr<CGImageRef> PlatformWebView::windowSnapshotImage() > { > [platformView() display]; >diff --git a/Tools/WebKitTestRunner/win/PlatformWebViewWin.cpp b/Tools/WebKitTestRunner/win/PlatformWebViewWin.cpp >index fdc504981c282d4c96195e53853d082d2752d6a8..dc9d3a1efdfb75f60e51273fe60b0d4cfe41e05f 100644 >--- a/Tools/WebKitTestRunner/win/PlatformWebViewWin.cpp >+++ b/Tools/WebKitTestRunner/win/PlatformWebViewWin.cpp >@@ -259,4 +259,8 @@ void PlatformWebView::setDrawsBackground(bool) > { > } > >+void PlatformWebView::setEditable(bool) >+{ >+} >+ > } // namespace WTR >diff --git a/Tools/WebKitTestRunner/wpe/PlatformWebViewWPE.cpp b/Tools/WebKitTestRunner/wpe/PlatformWebViewWPE.cpp >index 214933e03ee919b70ed7aa1befa51d164147c96a..282c4743ca39cb212fb9f5e4e3c7fd8eaea5ef89 100644 >--- a/Tools/WebKitTestRunner/wpe/PlatformWebViewWPE.cpp >+++ b/Tools/WebKitTestRunner/wpe/PlatformWebViewWPE.cpp >@@ -141,4 +141,8 @@ void PlatformWebView::setDrawsBackground(bool) > { > } > >+void PlatformWebView::setEditable(bool) >+{ >+} >+ > } // namespace WTR >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 987f5948ed9583acdfaed3cd1c9c17407a8d50b2..b7d6d79a6b3af204651867297d7e467eb97924e1 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,26 @@ >+2018-12-06 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [iOS] WKWebView should match UITextView behavior when editing text with an RTL keyboard >+ https://bugs.webkit.org/show_bug.cgi?id=187554 >+ <rdar://problem/42075638> >+ >+ Reviewed by Tim Horton. >+ >+ Add a new layout test to verify that when focusing an editable WKWebView using a right-to-left keyboard input >+ mode, we will set the base writing direction to be right-to-left, and vice versa. >+ >+ * TestExpectations: >+ * editing/input/ios/rtl-keyboard-input-on-focus-expected.txt: Added. >+ * editing/input/ios/rtl-keyboard-input-on-focus.html: Added. >+ * platform/ios-wk2/TestExpectations: >+ * resources/ui-helper.js: >+ >+ Add a UIHelper method to set the keyboard input mode to the given identifier. Example identifiers are "en_US" >+ (the default U.S. English keyboard) and "he_IL" (the Hebrew keyboard, which is right-to-left). >+ >+ (window.UIHelper.setKeyboardInputModeIdentifier): >+ (window.UIHelper): >+ > 2018-12-05 Alicia Boya GarcÃa <aboya@igalia.com> > > [GTK] Unreviewed test gardening >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index fdb99e80bf40430be07de93507dfe097b0ba9c3b..a9f6d97d68f978459dfd0454cd49549cfd6794cf 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -15,6 +15,7 @@ accessibility/win [ Skip ] > displaylists [ Skip ] > editing/mac [ Skip ] > editing/caret/ios [ Skip ] >+editing/input/ios [ Skip ] > editing/find [ Skip ] > editing/pasteboard/gtk [ Skip ] > editing/selection/ios [ Skip ] >diff --git a/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-expected.txt b/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..30b1950e5de6d289369936199617c46b6acae6fc >--- /dev/null >+++ b/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-expected.txt >@@ -0,0 +1,38 @@ >+ >+ >+Using Hebrew keyboard: >+ <div><br></div> >+ <div style="direction: rtl;"><br></div> >+ >+ >+ >+Using English keyboard: >+ <div><br></div> >+ <div style="direction: ltr;"><br></div> >+ >+ >+ >+Observed 'beforeinput' events: [ >+ { >+ "inputType": "formatSetInlineTextDirection", >+ "data": "rtl", >+ "order": 1 >+ }, >+ { >+ "inputType": "formatSetInlineTextDirection", >+ "data": "ltr", >+ "order": 3 >+ } >+] >+Observed 'input' events: [ >+ { >+ "inputType": "formatSetInlineTextDirection", >+ "data": "rtl", >+ "order": 2 >+ }, >+ { >+ "inputType": "formatSetInlineTextDirection", >+ "data": "ltr", >+ "order": 4 >+ } >+] >diff --git a/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus.html b/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus.html >new file mode 100644 >index 0000000000000000000000000000000000000000..aa723bd56129ca6daf8a728c9f192c1f3bd223d9 >--- /dev/null >+++ b/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus.html >@@ -0,0 +1,79 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true, editable=true ] --> >+<html> >+<meta name="viewport" content="width=device-width, initial-scale=1"> >+<head> >+ <script src="../../../resources/basic-gestures.js"></script> >+ <script src="../../../resources/ui-helper.js"></script> >+ <style> >+ body { >+ margin: 0; >+ } >+ </style> >+ <script> >+ function appendOutput(string) { >+ let pre = document.createElement("pre"); >+ pre.textContent = string; >+ document.body.appendChild(pre); >+ } >+ >+ beforeInputEvents = []; >+ inputEvents = []; >+ eventNumber = 0; >+ >+ async function run() >+ { >+ script.remove(); >+ >+ document.body.addEventListener("beforeinput", event => { >+ beforeInputEvents.push({ >+ "inputType": event.inputType, >+ "data": event.data, >+ "order": ++eventNumber >+ }); >+ }); >+ >+ document.body.addEventListener("input", event => { >+ inputEvents.push({ >+ "inputType": event.inputType, >+ "data": event.data, >+ "order": ++eventNumber >+ }); >+ }); >+ >+ await UIHelper.setKeyboardInputModeIdentifier("he_IL"); >+ await UIHelper.activateAndWaitForInputSessionAt(100, 250); >+ await UIHelper.ensurePresentationUpdate(); >+ const markupUsingHebrewKeyboard = document.body.innerHTML; >+ >+ document.body.blur(); >+ await UIHelper.waitForKeyboardToHide(); >+ await UIHelper.setKeyboardInputModeIdentifier("en_US"); >+ await UIHelper.activateAndWaitForInputSessionAt(100, 250); >+ await UIHelper.ensurePresentationUpdate(); >+ const markupUsingEnglishKeyboard = document.body.innerHTML; >+ >+ appendOutput(`Using Hebrew keyboard: ${markupUsingHebrewKeyboard}`); >+ appendOutput(`Using English keyboard: ${markupUsingEnglishKeyboard}`); >+ appendOutput(`Observed 'beforeinput' events: ${JSON.stringify(beforeInputEvents, null, 4)}`); >+ appendOutput(`Observed 'input' events: ${JSON.stringify(inputEvents, null, 4)}`); >+ testRunner.notifyDone(); >+ } >+ </script> >+</head> >+<body onload="run()"> >+ <div><br></div> >+ <div><br></div> >+</body> >+<script id="script"> >+if (window.testRunner) { >+ testRunner.waitUntilDone(); >+ testRunner.dumpAsText(); >+} else { >+ const description = document.createElement("p"); >+ description.textContent = "Verifies that focusing an editable area with an RTL keyboard switches text direction to RTL. " >+ + "To test manually, switch to a Hebrew keyboard and focus the editable area. " >+ + "The editable area should be made RTL."; >+ document.body.prepend(description); >+} >+</script> >+</html> >diff --git a/LayoutTests/platform/ios-wk2/TestExpectations b/LayoutTests/platform/ios-wk2/TestExpectations >index 53bac478465471265acf9d5baacf3436aa90e902..feff1f0572252c7d27f91210f292d25faf1bd8c6 100644 >--- a/LayoutTests/platform/ios-wk2/TestExpectations >+++ b/LayoutTests/platform/ios-wk2/TestExpectations >@@ -15,6 +15,7 @@ scrollingcoordinator/ios [ Pass ] > tiled-drawing/ios [ Pass ] > fast/web-share [ Pass ] > editing/find [ Pass ] >+editing/input/ios [ Pass ] > > editing/selection/character-granularity-rect.html [ Failure ] > >diff --git a/LayoutTests/resources/ui-helper.js b/LayoutTests/resources/ui-helper.js >index e4df524071d6e710b6eb3691a68898421596c30e..67c52c0b9021f51d42ab6159da98f57d7bccbf0d 100644 >--- a/LayoutTests/resources/ui-helper.js >+++ b/LayoutTests/resources/ui-helper.js >@@ -476,4 +476,13 @@ window.UIHelper = class UIHelper { > > return new Promise(resolve => testRunner.runUIScript(`uiController.setMinimumEffectiveWidth(${effectiveWidth})`, resolve)); > } >+ >+ static setKeyboardInputModeIdentifier(identifier) >+ { >+ if (!this.isWebKit2()) >+ return Promise.resolve(); >+ >+ const escapedIdentifier = identifier.replace(/`/g, "\\`"); >+ return new Promise(resolve => testRunner.runUIScript(`uiController.setKeyboardInputModeIdentifier(\`${escapedIdentifier}\`)`, resolve)); >+ } > }
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 187554
:
356716
|
356721
|
356736
|
356738
| 356741