Title: [177246] trunk/Source/WebKit2
Revision
177246
Author
[email protected]
Date
2014-12-12 16:00:32 -0800 (Fri, 12 Dec 2014)

Log Message

[iOS] Predictions are not updated when using navigation buttons.
https://bugs.webkit.org/show_bug.cgi?id=139567
rdar://problem/19132585

Reviewed by Dan Bernstein.

When moving focus programmatically, we need to notify the keyboard so that it
can update the prediction bar.

* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKFormInputSession setAccessoryViewCustomButtonTitle:]):
(-[WKContentView requiresAccessoryView]):
(-[WKContentView inputAssistantButtonItems]):
(-[WKContentView accessoryTab:]):
(-[WKContentView _startAssistingKeyboard]):
(-[WKContentView _stopAssistingNode]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::focusNextAssistedNode):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::focusNextAssistedNode):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (177245 => 177246)


--- trunk/Source/WebKit2/ChangeLog	2014-12-12 23:46:13 UTC (rev 177245)
+++ trunk/Source/WebKit2/ChangeLog	2014-12-13 00:00:32 UTC (rev 177246)
@@ -1,3 +1,29 @@
+2014-12-12  Enrica Casucci  <[email protected]>
+
+        [iOS] Predictions are not updated when using navigation buttons.
+        https://bugs.webkit.org/show_bug.cgi?id=139567
+        rdar://problem/19132585
+
+        Reviewed by Dan Bernstein.
+
+        When moving focus programmatically, we need to notify the keyboard so that it
+        can update the prediction bar.
+
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKFormInputSession setAccessoryViewCustomButtonTitle:]):
+        (-[WKContentView requiresAccessoryView]):
+        (-[WKContentView inputAssistantButtonItems]):
+        (-[WKContentView accessoryTab:]):
+        (-[WKContentView _startAssistingKeyboard]):
+        (-[WKContentView _stopAssistingNode]):
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::focusNextAssistedNode):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::focusNextAssistedNode):
+
 2014-12-12  Timothy Horton  <[email protected]>
 
         TextIndicator (and other view-relative subwindows) is not dismissed on zoom gesture

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (177245 => 177246)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-12-12 23:46:13 UTC (rev 177245)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-12-13 00:00:32 UTC (rev 177246)
@@ -450,7 +450,7 @@
     void performActionOnElement(uint32_t action);
     void saveImageToLibrary(const SharedMemory::Handle& imageHandle, uint64_t imageSize);
     void didUpdateBlockSelectionWithTouch(uint32_t touch, uint32_t flags, float growThreshold, float shrinkThreshold);
-    void focusNextAssistedNode(bool isForward);
+    void focusNextAssistedNode(bool isForward, std::function<void (CallbackBase::Error)>);
     void setAssistedNodeValue(const String&);
     void setAssistedNodeValueAsNumber(double);
     void setAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection = false);

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (177245 => 177246)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2014-12-12 23:46:13 UTC (rev 177245)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2014-12-13 00:00:32 UTC (rev 177246)
@@ -149,6 +149,10 @@
 + (BOOL)_addCompletion:(void(^)(BOOL))completion;
 @end
 
+@interface UIWebFormAccessory (StagingToRemove)
+@property(nonatomic,retain) NSArray *buttonItems;
+@end
+
 @interface WKFormInputSession : NSObject <_WKFormInputSession>
 
 - (instancetype)initWithContentView:(WKContentView *)view userObject:(NSObject <NSSecureCoding> *)userObject;
@@ -193,6 +197,8 @@
         [[_contentView formAccessoryView] showAutoFillButtonWithTitle:title];
     else
         [[_contentView formAccessoryView] hideAutoFillButton];
+    if (UICurrentUserInterfaceIdiomIsPad())
+        [_contentView reloadInputViews];
 }
 
 - (void)invalidate
@@ -1144,10 +1150,10 @@
     case InputType::Phone:
     case InputType::Number:
     case InputType::NumberPad:
-        return YES;
+        return !UICurrentUserInterfaceIdiomIsPad();
     case InputType::ContentEditable:
     case InputType::TextArea:
-        return YES;
+        return !UICurrentUserInterfaceIdiomIsPad();
     case InputType::Select:
     case InputType::Date:
     case InputType::DateTime:
@@ -1172,6 +1178,15 @@
     return _formAccessoryView.get();
 }
 
+- (NSArray *)inputAssistantButtonItems
+{
+    if (!_formAccessoryView) {
+        _formAccessoryView = adoptNS([[UIWebFormAccessory alloc] init]);
+        [_formAccessoryView setDelegate:self];
+    }
+    return ([_formAccessoryView respondsToSelector:@selector(buttonItems)]) ? [_formAccessoryView buttonItems] : nil;
+}
+
 - (NSArray *)supportedPasteboardTypesForCurrentSelection
 {
     if (_page->editorState().selectionIsNone)
@@ -1967,7 +1982,12 @@
     _inputPeripheral = nil;
 
     _didAccessoryTabInitiateFocus = YES; // Will be cleared in either -_displayFormNodeInputView or -cleanupInteraction.
-    _page->focusNextAssistedNode(isNext);
+    [self beginSelectionChange];
+    _page->focusNextAssistedNode(isNext, [self](CallbackBase::Error) {
+        [self endSelectionChange];
+        [self reloadInputViews];
+    });
+
 }
 
 - (void)accessoryAutoFill
@@ -2634,6 +2654,7 @@
 - (void)_startAssistingKeyboard
 {
     [self useSelectionAssistantWithMode:UIWebSelectionModeTextOnly];
+    [self reloadInputViews];
 }
 
 - (void)_stopAssistingKeyboard
@@ -2715,6 +2736,7 @@
     _inputPeripheral = nil;
 
     [self _stopAssistingKeyboard];
+    [_formAccessoryView hideAutoFillButton];
     [self reloadInputViews];
     [self _updateAccessory];
     // The name is misleading, but this actually clears the selection views and removes any selection.

Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (177245 => 177246)


--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm	2014-12-12 23:46:13 UTC (rev 177245)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm	2014-12-13 00:00:32 UTC (rev 177246)
@@ -800,9 +800,15 @@
 }
 #endif
 
-void WebPageProxy::focusNextAssistedNode(bool isForward)
+void WebPageProxy::focusNextAssistedNode(bool isForward, std::function<void (CallbackBase::Error)> callbackFunction)
 {
-    process().send(Messages::WebPage::FocusNextAssistedNode(isForward), m_pageID);
+    if (!isValid()) {
+        callbackFunction(CallbackBase::Error::Unknown);
+        return;
+    }
+    
+    uint64_t callbackID = m_callbacks.put(WTF::move(callbackFunction), std::make_unique<ProcessThrottler::BackgroundActivityToken>(m_process->throttler()));
+    process().send(Messages::WebPage::FocusNextAssistedNode(isForward, callbackID), m_pageID);
 }
 
 void WebPageProxy::setAssistedNodeValue(const String& value)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (177245 => 177246)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-12-12 23:46:13 UTC (rev 177245)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-12-13 00:00:32 UTC (rev 177246)
@@ -511,7 +511,7 @@
     void startInteractionWithElementAtPosition(const WebCore::IntPoint&);
     void stopInteraction();
     void performActionOnElement(uint32_t action);
-    void focusNextAssistedNode(bool isForward);
+    void focusNextAssistedNode(bool isForward, uint64_t callbackID);
     void setAssistedNodeValue(const String&);
     void setAssistedNodeValueAsNumber(double);
     void setAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (177245 => 177246)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2014-12-12 23:46:13 UTC (rev 177245)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2014-12-13 00:00:32 UTC (rev 177246)
@@ -82,7 +82,7 @@
     StartInteractionWithElementAtPosition(WebCore::IntPoint point)
     StopInteraction()
     PerformActionOnElement(uint32_t action)
-    FocusNextAssistedNode(bool isForward)
+    FocusNextAssistedNode(bool isForward, uint64_t callbackID)
     SetAssistedNodeValue(String value)
     SetAssistedNodeValueAsNumber(double value)
     SetAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (177245 => 177246)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2014-12-12 23:46:13 UTC (rev 177245)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2014-12-13 00:00:32 UTC (rev 177246)
@@ -2125,13 +2125,14 @@
     return nextAssistableElement(startNode, page, isForward);
 }
 
-void WebPage::focusNextAssistedNode(bool isForward)
+void WebPage::focusNextAssistedNode(bool isForward, uint64_t callbackID)
 {
     Element* nextElement = nextAssistableElement(m_assistedNode.get(), *m_page, isForward);
     m_userIsInteracting = true;
     if (nextElement)
         nextElement->focus();
     m_userIsInteracting = false;
+    send(Messages::WebPageProxy::VoidCallback(callbackID));
 }
 
 void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to