- Revision
- 203312
- Author
- [email protected]
- Date
- 2016-07-15 17:39:50 -0700 (Fri, 15 Jul 2016)
Log Message
Mac UI process needs to know about element focus and blur, much like iOS
https://bugs.webkit.org/show_bug.cgi?id=159843
-and corresponding-
rdar://problem/27229504
Reviewed by Tim Horton.
This patch makes the existing iOS machinery to handle focus and blurring of
elements cross-platform. Instead of using the existing iOS messages for
startAssistingNode/stopAssistingNode, this patch adds a new message that
require only a boolean parameter: setEditableElementIsFocused.
Now that more of this code is shared, this patch teases
m_hasFocusedDueToUserInteraction out into two variables. I realized that it
was being used to mean two slightly different things on Mac and iOS, which
was very confusing. Now we have m_isAssistingNodeDueToUserInteraction to
represent the way iOS was using the variable, and we have
m_hasEverFocusedElementDueToUserInteractionSincePageTransition to represent
how Mac was using the variable. There should not be any behavior changes with
this re-name, just added clarity.
WebViewImpl has a new member variable m_editableElementIsFocused.
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::setEditableElementIsFocused):
Pipe the new setEditableElementIsFocused message to WebViewImpl.
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setEditableElementIsFocused):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::setEditableElementIsFocused):
elementDidFocus() and elementDidBlur() are now PLATFORM(COCOA) instead of
PLATFORM(IOS)
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::elementDidFocus):
(WebKit::WebChromeClient::elementDidBlur):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
(WebKit::WebChromeClient::elementDidFocus): Deleted.
(WebKit::WebChromeClient::elementDidBlur): Deleted.
m_hasPendingBlurNotification is no longer iOS-only.
* WebProcess/WebPage/WebPage.cpp:
Use our two new bools m_isAssistingNodeDueToUserInteraction and
m_hasEverFocusedElementDueToUserInteractionSincePageTransition
(WebKit::WebPage::didStartPageTransition):
(WebKit::WebPage::didChangeSelection):
These functions are all newly cross-platform. The Messages they send are
still platform-specific, but otherwise the logic is the same. We
dispatch_async the blur messages so that the UI process features won’t be
flashy when the user is tapping, tabbing, or clicking through form fields.
(WebKit::WebPage::resetAssistedNodeForFrame):
(WebKit::WebPage::elementDidFocus):
(WebKit::WebPage::elementDidBlur):
resetAssistedNodeForFrame() is no longer iOS-only.
(WebKit::WebPage::didCommitLoad):
Move variables and functions around so that they are defined for the right
platform, and declare the two new bools in place of the old one.
* WebProcess/WebPage/WebPage.h:
These functions are now defined in WebPage.cpp
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::resetAssistedNodeForFrame): Deleted.
(WebKit::WebPage::elementDidFocus): Deleted.
(WebKit::WebPage::elementDidBlur): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (203311 => 203312)
--- trunk/Source/WebKit2/ChangeLog 2016-07-16 00:09:06 UTC (rev 203311)
+++ trunk/Source/WebKit2/ChangeLog 2016-07-16 00:39:50 UTC (rev 203312)
@@ -1,3 +1,80 @@
+2016-07-15 Beth Dakin <[email protected]>
+
+ Mac UI process needs to know about element focus and blur, much like iOS
+ https://bugs.webkit.org/show_bug.cgi?id=159843
+ -and corresponding-
+ rdar://problem/27229504
+
+ Reviewed by Tim Horton.
+
+ This patch makes the existing iOS machinery to handle focus and blurring of
+ elements cross-platform. Instead of using the existing iOS messages for
+ startAssistingNode/stopAssistingNode, this patch adds a new message that
+ require only a boolean parameter: setEditableElementIsFocused.
+
+ Now that more of this code is shared, this patch teases
+ m_hasFocusedDueToUserInteraction out into two variables. I realized that it
+ was being used to mean two slightly different things on Mac and iOS, which
+ was very confusing. Now we have m_isAssistingNodeDueToUserInteraction to
+ represent the way iOS was using the variable, and we have
+ m_hasEverFocusedElementDueToUserInteractionSincePageTransition to represent
+ how Mac was using the variable. There should not be any behavior changes with
+ this re-name, just added clarity.
+
+ WebViewImpl has a new member variable m_editableElementIsFocused.
+ * UIProcess/Cocoa/WebViewImpl.h:
+ * UIProcess/Cocoa/WebViewImpl.mm:
+ (WebKit::WebViewImpl::setEditableElementIsFocused):
+
+ Pipe the new setEditableElementIsFocused message to WebViewImpl.
+ * UIProcess/PageClient.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::setEditableElementIsFocused):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/mac/PageClientImpl.h:
+ * UIProcess/mac/PageClientImpl.mm:
+ (WebKit::PageClientImpl::setEditableElementIsFocused):
+
+ elementDidFocus() and elementDidBlur() are now PLATFORM(COCOA) instead of
+ PLATFORM(IOS)
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::elementDidFocus):
+ (WebKit::WebChromeClient::elementDidBlur):
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+ * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
+ (WebKit::WebChromeClient::elementDidFocus): Deleted.
+ (WebKit::WebChromeClient::elementDidBlur): Deleted.
+
+ m_hasPendingBlurNotification is no longer iOS-only.
+ * WebProcess/WebPage/WebPage.cpp:
+
+ Use our two new bools m_isAssistingNodeDueToUserInteraction and
+ m_hasEverFocusedElementDueToUserInteractionSincePageTransition
+ (WebKit::WebPage::didStartPageTransition):
+ (WebKit::WebPage::didChangeSelection):
+
+ These functions are all newly cross-platform. The Messages they send are
+ still platform-specific, but otherwise the logic is the same. We
+ dispatch_async the blur messages so that the UI process features won’t be
+ flashy when the user is tapping, tabbing, or clicking through form fields.
+ (WebKit::WebPage::resetAssistedNodeForFrame):
+ (WebKit::WebPage::elementDidFocus):
+ (WebKit::WebPage::elementDidBlur):
+
+ resetAssistedNodeForFrame() is no longer iOS-only.
+ (WebKit::WebPage::didCommitLoad):
+
+ Move variables and functions around so that they are defined for the right
+ platform, and declare the two new bools in place of the old one.
+ * WebProcess/WebPage/WebPage.h:
+
+ These functions are now defined in WebPage.cpp
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::resetAssistedNodeForFrame): Deleted.
+ (WebKit::WebPage::elementDidFocus): Deleted.
+ (WebKit::WebPage::elementDidBlur): Deleted.
+
2016-07-15 Geoffrey Garen <[email protected]>
Added a makeRef<T> helper
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h (203311 => 203312)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h 2016-07-16 00:09:06 UTC (rev 203311)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h 2016-07-16 00:39:50 UTC (rev 203312)
@@ -272,6 +272,7 @@
void updateFontPanelIfNeeded();
void changeFontFromFontPanel();
bool validateUserInterfaceItem(id <NSValidatedUserInterfaceItem>);
+ void setEditableElementIsFocused(bool);
void startSpeaking();
void stopSpeaking(id);
@@ -647,6 +648,7 @@
NSRange m_softSpaceRange { NSNotFound, 0 };
bool m_isHandlingAcceptedCandidate { false };
bool m_requiresUserActionForEditingControlsManager { false };
+ bool m_editableElementIsFocused { false };
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm (203311 => 203312)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm 2016-07-16 00:09:06 UTC (rev 203311)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm 2016-07-16 00:39:50 UTC (rev 203312)
@@ -453,6 +453,11 @@
{
}
+void WebViewImpl::setEditableElementIsFocused(bool editableElementIsFocused)
+{
+ m_editableElementIsFocused = editableElementIsFocused;
+}
+
} // namespace WebKit
#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 && USE(APPLE_INTERNAL_SDK)
Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (203311 => 203312)
--- trunk/Source/WebKit2/UIProcess/PageClient.h 2016-07-16 00:09:06 UTC (rev 203311)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h 2016-07-16 00:39:50 UTC (rev 203312)
@@ -275,6 +275,7 @@
virtual void registerInsertionUndoGrouping() = 0;
#endif // USE(INSERTION_UNDO_GROUPING)
#endif // USE(APPKIT)
+ virtual void setEditableElementIsFocused(bool) = 0;
#endif // PLATFORM(MAC)
#if PLATFORM(IOS)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (203311 => 203312)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-07-16 00:09:06 UTC (rev 203311)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-07-16 00:39:50 UTC (rev 203312)
@@ -5955,6 +5955,11 @@
}
#endif
+void WebPageProxy::setEditableElementIsFocused(bool editableElementIsFocused)
+{
+ m_pageClient.setEditableElementIsFocused(editableElementIsFocused);
+}
+
#endif // PLATFORM(MAC)
#if PLATFORM(COCOA)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (203311 => 203312)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-07-16 00:09:06 UTC (rev 203311)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-07-16 00:39:50 UTC (rev 203312)
@@ -1419,6 +1419,8 @@
void removeDictationAlternatives(uint64_t dictationContext);
void dictationAlternatives(uint64_t dictationContext, Vector<String>& result);
#endif
+
+ void setEditableElementIsFocused(bool);
#endif // PLATFORM(MAC)
#if PLATFORM(IOS)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (203311 => 203312)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2016-07-16 00:09:06 UTC (rev 203311)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2016-07-16 00:39:50 UTC (rev 203312)
@@ -342,6 +342,8 @@
DismissCorrectionPanel(int32_t reason)
DismissCorrectionPanelSoon(int32_t reason) -> (String result)
RecordAutocorrectionResponse(int32_t responseType, String replacedString, String replacementString);
+
+ SetEditableElementIsFocused(bool editableElementIsFocused)
#endif
#if USE(DICTATION_ALTERNATIVES)
Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (203311 => 203312)
--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h 2016-07-16 00:09:06 UTC (rev 203311)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h 2016-07-16 00:39:50 UTC (rev 203312)
@@ -171,6 +171,8 @@
void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext) override;
Vector<String> dictationAlternatives(uint64_t dictationContext) override;
#endif
+ void setEditableElementIsFocused(bool) override;
+
#if USE(INSERTION_UNDO_GROUPING)
void registerInsertionUndoGrouping() override;
#endif
Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (203311 => 203312)
--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2016-07-16 00:09:06 UTC (rev 203311)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2016-07-16 00:39:50 UTC (rev 203312)
@@ -621,6 +621,11 @@
}
#endif
+void PageClientImpl::setEditableElementIsFocused(bool editableElementIsFocused)
+{
+ m_impl->setEditableElementIsFocused(editableElementIsFocused);
+}
+
#if ENABLE(FULLSCREEN_API)
WebFullScreenManagerProxyClient& PageClientImpl::fullScreenManagerProxyClient()
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (203311 => 203312)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2016-07-16 00:09:06 UTC (rev 203311)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2016-07-16 00:39:50 UTC (rev 203312)
@@ -169,6 +169,16 @@
}
#if PLATFORM(COCOA)
+void WebChromeClient::elementDidFocus(const WebCore::Node* node)
+{
+ m_page->elementDidFocus(const_cast<WebCore::Node*>(node));
+}
+
+void WebChromeClient::elementDidBlur(const WebCore::Node* node)
+{
+ m_page->elementDidBlur(const_cast<WebCore::Node*>(node));
+}
+
void WebChromeClient::makeFirstResponder()
{
m_page->send(Messages::WebPageProxy::MakeFirstResponder());
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (203311 => 203312)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h 2016-07-16 00:09:06 UTC (rev 203311)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h 2016-07-16 00:39:50 UTC (rev 203312)
@@ -236,8 +236,6 @@
#endif
#if PLATFORM(IOS)
- void elementDidFocus(const WebCore::Node*) override;
- void elementDidBlur(const WebCore::Node*) override;
void elementDidRefocus(const WebCore::Node*) override;
#endif
@@ -259,6 +257,9 @@
#endif
#if PLATFORM(COCOA)
+ void elementDidFocus(const WebCore::Node*) override;
+ void elementDidBlur(const WebCore::Node*) override;
+
void makeFirstResponder() override;
#endif
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm (203311 => 203312)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm 2016-07-16 00:09:06 UTC (rev 203311)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm 2016-07-16 00:39:50 UTC (rev 203312)
@@ -44,16 +44,6 @@
}
#endif
-void WebChromeClient::elementDidFocus(const WebCore::Node* node)
-{
- m_page->elementDidFocus(const_cast<WebCore::Node*>(node));
-}
-
-void WebChromeClient::elementDidBlur(const WebCore::Node* node)
-{
- m_page->elementDidBlur(const_cast<WebCore::Node*>(node));
-}
-
void WebChromeClient::elementDidRefocus(const WebCore::Node* node)
{
elementDidFocus(node);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (203311 => 203312)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-07-16 00:09:06 UTC (rev 203311)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-07-16 00:39:50 UTC (rev 203312)
@@ -32,6 +32,7 @@
#include "APIArray.h"
#include "APIGeometry.h"
#include "Arguments.h"
+#include "AssistedNodeInformation.h"
#include "DataReference.h"
#include "DragControllerAction.h"
#include "DrawingArea.h"
@@ -348,6 +349,7 @@
#if ENABLE(CONTEXT_MENUS)
, m_isShowingContextMenu(false)
#endif
+ , m_hasPendingBlurNotification(false)
#if PLATFORM(IOS)
, m_selectionAnchor(Start)
, m_hasReceivedVisibleContentRectsAfterDidCommitLoad(false)
@@ -354,7 +356,6 @@
, m_scaleWasSetByUIProcess(false)
, m_userHasChangedPageScaleFactor(false)
, m_hasStablePageScaleFactor(true)
- , m_hasPendingBlurNotification(false)
, m_useTestingViewportConfiguration(false)
, m_isInStableState(true)
, m_forceAlwaysUserScalable(parameters.ignoresViewportScaleLimits)
@@ -2608,12 +2609,13 @@
m_drawingArea->setLayerTreeStateIsFrozen(true);
#if PLATFORM(MAC)
- bool hasPreviouslyFocusedDueToUserInteraction = m_hasFocusedDueToUserInteraction;
+ bool hasPreviouslyFocusedDueToUserInteraction = m_hasEverFocusedElementDueToUserInteractionSincePageTransition;
#endif
- m_hasFocusedDueToUserInteraction = false;
+ m_hasEverFocusedElementDueToUserInteractionSincePageTransition = false;
+ m_isAssistingNodeDueToUserInteraction = false;
#if PLATFORM(MAC)
if (hasPreviouslyFocusedDueToUserInteraction)
- send(Messages::WebPageProxy::SetHasHadSelectionChangesFromUserInteraction(m_hasFocusedDueToUserInteraction));
+ send(Messages::WebPageProxy::SetHasHadSelectionChangesFromUserInteraction(m_hasEverFocusedElementDueToUserInteractionSincePageTransition));
#endif
}
@@ -4753,11 +4755,12 @@
m_isEditorStateMissingPostLayoutData = editorState.isMissingPostLayoutData;
#if PLATFORM(MAC)
- bool hasPreviouslyFocusedDueToUserInteraction = m_hasFocusedDueToUserInteraction;
- m_hasFocusedDueToUserInteraction |= m_userIsInteracting;
- if (!hasPreviouslyFocusedDueToUserInteraction && m_hasFocusedDueToUserInteraction)
- send(Messages::WebPageProxy::SetHasHadSelectionChangesFromUserInteraction(m_hasFocusedDueToUserInteraction));
+ bool hasPreviouslyFocusedDueToUserInteraction = m_hasEverFocusedElementDueToUserInteractionSincePageTransition;
+ m_hasEverFocusedElementDueToUserInteractionSincePageTransition |= m_userIsInteracting;
+ if (!hasPreviouslyFocusedDueToUserInteraction && m_hasEverFocusedElementDueToUserInteractionSincePageTransition)
+ send(Messages::WebPageProxy::SetHasHadSelectionChangesFromUserInteraction(m_hasEverFocusedElementDueToUserInteractionSincePageTransition));
+
// Abandon the current inline input session if selection changed for any other reason but an input method direct action.
// FIXME: This logic should be in WebCore.
// FIXME: Many changes that affect composition node do not go through didChangeSelection(). We need to do something when DOM manipulation affects the composition, because otherwise input method's idea about it will be different from Editor's.
@@ -4776,6 +4779,68 @@
#endif
}
+void WebPage::resetAssistedNodeForFrame(WebFrame* frame)
+{
+ if (!m_assistedNode)
+ return;
+ if (m_assistedNode->document().frame() == frame->coreFrame()) {
+#if PLATFORM(IOS)
+ send(Messages::WebPageProxy::StopAssistingNode());
+#elif PLATFORM(MAC)
+ send(Messages::WebPageProxy::SetEditableElementIsFocused(false));
+#endif
+ m_assistedNode = nullptr;
+ }
+}
+
+void WebPage::elementDidFocus(WebCore::Node* node)
+{
+ if (m_assistedNode == node && m_isAssistingNodeDueToUserInteraction)
+ return;
+
+ if (node->hasTagName(WebCore::HTMLNames::selectTag) || node->hasTagName(WebCore::HTMLNames::inputTag) || node->hasTagName(WebCore::HTMLNames::textareaTag) || node->hasEditableStyle()) {
+ m_assistedNode = node;
+ m_isAssistingNodeDueToUserInteraction |= m_userIsInteracting;
+
+#if PLATFORM(IOS)
+ AssistedNodeInformation information;
+ getAssistedNodeInformation(information);
+ RefPtr<API::Object> userData;
+
+ m_formClient->willBeginInputSession(this, downcast<Element>(node), WebFrame::fromCoreFrame(*node->document().frame()), userData, m_userIsInteracting);
+
+ send(Messages::WebPageProxy::StartAssistingNode(information, m_userIsInteracting, m_hasPendingBlurNotification, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+#elif PLATFORM(MAC)
+ if (node->hasTagName(WebCore::HTMLNames::selectTag))
+ send(Messages::WebPageProxy::SetEditableElementIsFocused(false));
+ else
+ send(Messages::WebPageProxy::SetEditableElementIsFocused(true));
+#endif
+ m_hasPendingBlurNotification = false;
+ }
+}
+
+void WebPage::elementDidBlur(WebCore::Node* node)
+{
+ if (m_assistedNode == node) {
+ m_hasPendingBlurNotification = true;
+ RefPtr<WebPage> protectedThis(this);
+ callOnMainThread([protectedThis] {
+ if (protectedThis->m_hasPendingBlurNotification) {
+#if PLATFORM(IOS)
+ protectedThis->send(Messages::WebPageProxy::StopAssistingNode());
+#elif PLATFORM(MAC)
+ protectedThis->send(Messages::WebPageProxy::SetEditableElementIsFocused(false));
+#endif
+ }
+ protectedThis->m_hasPendingBlurNotification = false;
+ });
+
+ m_isAssistingNodeDueToUserInteraction = false;
+ m_assistedNode = nullptr;
+ }
+}
+
void WebPage::sendPostLayoutEditorStateIfNeeded()
{
if (!m_isEditorStateMissingPostLayoutData)
@@ -4914,8 +4979,8 @@
#if PLATFORM(IOS)
frame->setFirstLayerTreeTransactionIDAfterDidCommitLoad(downcast<RemoteLayerTreeDrawingArea>(*m_drawingArea).nextTransactionID());
cancelPotentialTapInFrame(*frame);
+#endif
resetAssistedNodeForFrame(frame);
-#endif
if (!frame->isMainFrame())
return;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (203311 => 203312)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2016-07-16 00:09:06 UTC (rev 203311)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2016-07-16 00:39:50 UTC (rev 203312)
@@ -496,6 +496,10 @@
UserMediaPermissionRequestManager& userMediaPermissionRequestManager() { return m_userMediaPermissionRequestManager; }
#endif
+ void elementDidFocus(WebCore::Node*);
+ void elementDidBlur(WebCore::Node*);
+ void resetAssistedNodeForFrame(WebFrame*);
+
#if PLATFORM(IOS)
WebCore::FloatSize screenSize() const;
WebCore::FloatSize availableScreenSize() const;
@@ -538,8 +542,6 @@
void updateSelectionWithExtentPoint(const WebCore::IntPoint&, bool isInteractingWithAssistedNode, uint64_t callbackID);
void updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithAssistedNode, uint64_t callbackID);
- void elementDidFocus(WebCore::Node*);
- void elementDidBlur(WebCore::Node*);
void requestDictationContext(uint64_t callbackID);
void replaceDictatedText(const String& oldText, const String& newText);
void replaceSelectedText(const String& oldText, const String& newText);
@@ -557,7 +559,6 @@
void setAssistedNodeValue(const String&);
void setAssistedNodeValueAsNumber(double);
void setAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection);
- void resetAssistedNodeForFrame(WebFrame*);
WebCore::IntRect rectForElementAtInteractionLocation();
void updateSelectionAppearance();
void getSelectionContext(uint64_t callbackID);
@@ -1388,14 +1389,17 @@
bool m_autoSizingShouldExpandToViewHeight;
bool m_userIsInteracting;
- bool m_hasFocusedDueToUserInteraction { false };
+ bool m_isAssistingNodeDueToUserInteraction { false };
+ bool m_hasEverFocusedElementDueToUserInteractionSincePageTransition { false };
#if ENABLE(CONTEXT_MENUS)
bool m_isShowingContextMenu;
#endif
+
+ RefPtr<WebCore::Node> m_assistedNode;
+ bool m_hasPendingBlurNotification;
#if PLATFORM(IOS)
- RefPtr<WebCore::Node> m_assistedNode;
RefPtr<WebCore::Range> m_currentWordRange;
RefPtr<WebCore::Node> m_interactionNode;
WebCore::IntPoint m_lastInteractionLocation;
@@ -1414,7 +1418,6 @@
bool m_scaleWasSetByUIProcess;
bool m_userHasChangedPageScaleFactor;
bool m_hasStablePageScaleFactor;
- bool m_hasPendingBlurNotification;
bool m_useTestingViewportConfiguration;
bool m_isInStableState;
bool m_forceAlwaysUserScalable;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (203311 => 203312)
--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2016-07-16 00:09:06 UTC (rev 203311)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2016-07-16 00:39:50 UTC (rev 203312)
@@ -2632,50 +2632,6 @@
}
}
-void WebPage::resetAssistedNodeForFrame(WebFrame* frame)
-{
- if (!m_assistedNode)
- return;
- if (m_assistedNode->document().frame() == frame->coreFrame()) {
- send(Messages::WebPageProxy::StopAssistingNode());
- m_assistedNode = nullptr;
- }
-}
-
-void WebPage::elementDidFocus(WebCore::Node* node)
-{
- if (m_assistedNode == node && m_hasFocusedDueToUserInteraction)
- return;
-
- if (node->hasTagName(WebCore::HTMLNames::selectTag) || node->hasTagName(WebCore::HTMLNames::inputTag) || node->hasTagName(WebCore::HTMLNames::textareaTag) || node->hasEditableStyle()) {
- m_assistedNode = node;
- m_hasFocusedDueToUserInteraction |= m_userIsInteracting;
- AssistedNodeInformation information;
- getAssistedNodeInformation(information);
- RefPtr<API::Object> userData;
-
- m_formClient->willBeginInputSession(this, downcast<Element>(node), WebFrame::fromCoreFrame(*node->document().frame()), userData, m_userIsInteracting);
-
- send(Messages::WebPageProxy::StartAssistingNode(information, m_userIsInteracting, m_hasPendingBlurNotification, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
- m_hasPendingBlurNotification = false;
- }
-}
-
-void WebPage::elementDidBlur(WebCore::Node* node)
-{
- if (m_assistedNode == node) {
- m_hasPendingBlurNotification = true;
- RefPtr<WebPage> protectedThis(this);
- dispatch_async(dispatch_get_main_queue(), [protectedThis] {
- if (protectedThis->m_hasPendingBlurNotification)
- protectedThis->send(Messages::WebPageProxy::StopAssistingNode());
- protectedThis->m_hasPendingBlurNotification = false;
- });
- m_hasFocusedDueToUserInteraction = false;
- m_assistedNode = nullptr;
- }
-}
-
void WebPage::setViewportConfigurationMinimumLayoutSize(const FloatSize& size)
{
if (m_viewportConfiguration.setMinimumLayoutSize(size))