Diff
Modified: trunk/Source/WebKit2/ChangeLog (201297 => 201298)
--- trunk/Source/WebKit2/ChangeLog 2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/ChangeLog 2016-05-23 22:06:57 UTC (rev 201298)
@@ -1,3 +1,61 @@
+2016-05-23 Beth Dakin <[email protected]>
+
+ Need SPI for clients to require a user action to get an editing controls
+ manager
+ https://bugs.webkit.org/show_bug.cgi?id=157992
+ -and corresponding-
+ rdar://problem/26379927
+
+ Reviewed by Tim Horton.
+
+ New SPI _setRequiresUserActionForEditingControlsManager. The SPI defaults to
+ False, which means that by default there is no user action requirement to
+ have an editing controls manager. The SPI is on WKViewPrivate and
+ WKWebViewConfigurationPrivate, and it’s implemented in WebViewImpl.
+ * UIProcess/API/Cocoa/WKViewPrivate.h:
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _initializeWithConfiguration:]):
+ * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+ (-[WKWebViewConfiguration init]):
+ (-[WKWebViewConfiguration copyWithZone:]):
+ (-[WKWebViewConfiguration _requiresUserActionForEditingControlsManager]):
+ (-[WKWebViewConfiguration _setRequiresUserActionForEditingControlsManager:]):
+ * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView _requiresUserActionForEditingControlsManager]):
+ (-[WKView _setRequiresUserActionForEditingControlsManager:]):
+ * UIProcess/Cocoa/WebViewImpl.h:
+ (WebKit::WebViewImpl::setRequiresUserActionForEditingControlsManager):
+ (WebKit::WebViewImpl::requiresUserActionForEditingControlsManager):
+
+ New message allows the WebProcess to tell the UI process whether the current
+ web page has had any selection changes based on user interaction.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::setHasHadSelectionChangesFromUserInteraction):
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::hasHadSelectionChangesFromUserInteraction):
+ * UIProcess/WebPageProxy.messages.in:
+
+ m_userIsInteracting m_hasFocusedDueToUserInteraction used to be iOS only, but
+ now we want to track them for Mac as well.
+ * WebProcess/WebPage/WebPage.cpp:
+
+ Handling mouse events and key events will toggle m_userIsInteracting.
+ (WebKit::WebPage::mouseEvent):
+ (WebKit::WebPage::keyEvent):
+
+ m_userIsInteracting is no longer iOS-only.
+ (WebKit::WebPage::setInitialFocus):
+
+ Send a message to the UI process on page transition to re-set
+ hasHadSelectionChangesFromUserInteraction to false.
+ (WebKit::WebPage::didStartPageTransition):
+
+ Send a message to the UI process if this is the first selection change to
+ happen as a result of a user action.
+ (WebKit::WebPage::didChangeSelection):
+ * WebProcess/WebPage/WebPage.h:
+
2016-05-23 Alex Christensen <[email protected]>
Add logging for NSURLSession calls
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h (201297 => 201298)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h 2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h 2016-05-23 22:06:57 UTC (rev 201298)
@@ -87,6 +87,8 @@
@property (strong, nonatomic, setter=_setInspectorAttachmentView:) NSView *_inspectorAttachmentView WK_AVAILABLE(10_11, NA);
#endif
+@property (nonatomic, readwrite, setter=_setRequiresUserActionForEditingControlsManager:) BOOL _requiresUserActionForEditingControlsManager;
+
- (NSView*)fullScreenPlaceholderView;
- (NSWindow*)createFullScreenWindow;
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (201297 => 201298)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-05-23 22:06:57 UTC (rev 201298)
@@ -536,6 +536,7 @@
_page = &_impl->page();
_impl->setAutomaticallyAdjustsContentInsets(true);
+ _impl->setRequiresUserActionForEditingControlsManager([configuration _requiresUserActionForEditingControlsManager]);
#endif
_page->setBackgroundExtendsBeyondPage(true);
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (201297 => 201298)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2016-05-23 22:06:57 UTC (rev 201298)
@@ -120,6 +120,7 @@
BOOL _showsURLsInToolTips;
BOOL _serviceControlsEnabled;
BOOL _imageControlsEnabled;
+ BOOL _requiresUserActionForEditingControlsManager;
#endif
#if USE(APPLE_INTERNAL_SDK)
@@ -168,6 +169,7 @@
_showsURLsInToolTips = NO;
_serviceControlsEnabled = NO;
_imageControlsEnabled = NO;
+ _requiresUserActionForEditingControlsManager = NO;
#endif
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
@@ -290,6 +292,7 @@
configuration->_showsURLsInToolTips = self->_showsURLsInToolTips;
configuration->_serviceControlsEnabled = self->_serviceControlsEnabled;
configuration->_imageControlsEnabled = self->_imageControlsEnabled;
+ configuration->_requiresUserActionForEditingControlsManager = self->_requiresUserActionForEditingControlsManager;
#endif
#if ENABLE(DATA_DETECTION) && PLATFORM(IOS)
configuration->_dataDetectorTypes = self->_dataDetectorTypes;
@@ -676,6 +679,17 @@
{
_imageControlsEnabled = imageControlsEnabled;
}
+
+- (BOOL)_requiresUserActionForEditingControlsManager
+{
+ return _requiresUserActionForEditingControlsManager;
+}
+
+- (void)_setRequiresUserActionForEditingControlsManager:(BOOL)requiresUserAction
+{
+ _requiresUserActionForEditingControlsManager = requiresUserAction;
+}
+
#endif // PLATFORM(MAC)
#if USE(APPLE_INTERNAL_SDK)
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h (201297 => 201298)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h 2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h 2016-05-23 22:06:57 UTC (rev 201298)
@@ -63,6 +63,7 @@
@property (nonatomic, setter=_setShowsURLsInToolTips:) BOOL _showsURLsInToolTips WK_AVAILABLE(WK_MAC_TBA, NA);
@property (nonatomic, setter=_setServiceControlsEnabled:) BOOL _serviceControlsEnabled WK_AVAILABLE(WK_MAC_TBA, NA);
@property (nonatomic, setter=_setImageControlsEnabled:) BOOL _imageControlsEnabled WK_AVAILABLE(WK_MAC_TBA, NA);
+@property (nonatomic, readwrite, setter=_setRequiresUserActionForEditingControlsManager:) BOOL _requiresUserActionForEditingControlsManager WK_AVAILABLE(WK_MAC_TBA, NA);
#endif
@property (nonatomic, strong, setter=_setVisitedLinkProvider:) _WKVisitedLinkProvider *_visitedLinkProvider WK_DEPRECATED(10_10, WK_MAC_TBA, 8_0, WK_IOS_TBA, "Please use _visitedLinkStore instead");
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (201297 => 201298)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2016-05-23 22:06:57 UTC (rev 201298)
@@ -1107,6 +1107,16 @@
}
#endif
+- (BOOL)_requiresUserActionForEditingControlsManager
+{
+ return _data->_impl->requiresUserActionForEditingControlsManager();
+}
+
+- (void)_setRequiresUserActionForEditingControlsManager:(BOOL)requiresUserAction
+{
+ _data->_impl->setRequiresUserActionForEditingControlsManager(requiresUserAction);
+}
+
- (NSView *)fullScreenPlaceholderView
{
return _data->_impl->fullScreenPlaceholderView();
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h (201297 => 201298)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h 2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h 2016-05-23 22:06:57 UTC (rev 201298)
@@ -478,6 +478,9 @@
bool windowIsFrontWindowUnderMouse(NSEvent *);
+ void setRequiresUserActionForEditingControlsManager(bool requiresUserActionForEditingControlsManager) { m_requiresUserActionForEditingControlsManager = requiresUserActionForEditingControlsManager; }
+ bool requiresUserActionForEditingControlsManager() const { return m_requiresUserActionForEditingControlsManager; }
+
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
void handleAcceptedCandidate(NSTextCheckingResult *acceptedCandidate);
#if USE(APPLE_INTERNAL_SDK)
@@ -635,6 +638,7 @@
#endif
NSRange m_softSpaceRange { NSNotFound, 0 };
bool m_isHandlingAcceptedCandidate { false };
+ bool m_requiresUserActionForEditingControlsManager { false };
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (201297 => 201298)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-05-23 22:06:57 UTC (rev 201298)
@@ -4076,6 +4076,11 @@
}
#endif
+void WebPageProxy::setHasHadSelectionChangesFromUserInteraction(bool hasHadUserSelectionChanges)
+{
+ m_hasHadSelectionChangesFromUserInteraction = hasHadUserSelectionChanges;
+}
+
// BackForwardList
void WebPageProxy::backForwardAddItem(uint64_t itemID)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (201297 => 201298)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-05-23 22:06:57 UTC (rev 201298)
@@ -1108,6 +1108,8 @@
UserInterfaceLayoutDirection userInterfaceLayoutDirection();
+ bool hasHadSelectionChangesFromUserInteraction() const { return m_hasHadSelectionChangesFromUserInteraction; }
+
private:
WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
void platformInitialize();
@@ -1265,6 +1267,7 @@
void editorStateChanged(const EditorState&);
void compositionWasCanceled(const EditorState&);
+ void setHasHadSelectionChangesFromUserInteraction(bool);
// Back/Forward list management
void backForwardAddItem(uint64_t itemID);
@@ -1807,6 +1810,8 @@
bool m_isResourceCachingDisabled { false };
+ bool m_hasHadSelectionChangesFromUserInteraction { false };
+
#if ENABLE(MEDIA_SESSION)
bool m_hasMediaSessionWithActiveMediaElements { false };
#endif
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (201297 => 201298)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2016-05-23 22:06:57 UTC (rev 201298)
@@ -233,6 +233,7 @@
# Editor notifications
EditorStateChanged(struct WebKit::EditorState editorState)
CompositionWasCanceled(struct WebKit::EditorState editorState)
+ SetHasHadSelectionChangesFromUserInteraction(bool hasHadUserSelectionChanges)
# Find messages
DidCountStringMatches(String string, uint32_t matchCount)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (201297 => 201298)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-05-23 22:06:57 UTC (rev 201298)
@@ -341,6 +341,7 @@
, m_hasWheelEventHandlers(false)
, m_cachedPageCount(0)
, m_autoSizingShouldExpandToViewHeight(false)
+ , m_userIsInteracting(false)
#if ENABLE(CONTEXT_MENUS)
, m_isShowingContextMenu(false)
#endif
@@ -350,7 +351,6 @@
, m_scaleWasSetByUIProcess(false)
, m_userHasChangedPageScaleFactor(false)
, m_hasStablePageScaleFactor(true)
- , m_userIsInteracting(false)
, m_hasPendingBlurNotification(false)
, m_useTestingViewportConfiguration(false)
, m_isInStableState(true)
@@ -2173,6 +2173,8 @@
void WebPage::mouseEvent(const WebMouseEvent& mouseEvent)
{
+ m_userIsInteracting = true;
+
m_page->pageThrottler().didReceiveUserInput();
bool shouldHandleEvent = true;
@@ -2189,6 +2191,7 @@
if (!shouldHandleEvent) {
send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(mouseEvent.type()), false));
+ m_userIsInteracting = false;
return;
}
@@ -2214,6 +2217,7 @@
}
send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(mouseEvent.type()), handled));
+ m_userIsInteracting = false;
}
static bool handleWheelEvent(const WebWheelEvent& wheelEvent, Page* page)
@@ -2249,6 +2253,8 @@
void WebPage::keyEvent(const WebKeyboardEvent& keyboardEvent)
{
+ m_userIsInteracting = true;
+
m_page->pageThrottler().didReceiveUserInput();
CurrentEvent currentEvent(keyboardEvent);
@@ -2259,6 +2265,8 @@
handled = performDefaultBehaviorForKeyEvent(keyboardEvent);
send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(keyboardEvent.type()), handled));
+
+ m_userIsInteracting = false;
}
void WebPage::validateCommand(const String& commandName, uint64_t callbackID)
@@ -2461,9 +2469,7 @@
if (!m_page)
return;
-#if PLATFORM(IOS)
TemporaryChange<bool> userIsInteractingChange { m_userIsInteracting, true };
-#endif
Frame& frame = m_page->focusController().focusedOrMainFrame();
frame.document()->setFocusedElement(0);
@@ -2558,8 +2564,14 @@
void WebPage::didStartPageTransition()
{
m_drawingArea->setLayerTreeStateIsFrozen(true);
-#if PLATFORM(IOS)
+
+#if PLATFORM(MAC)
+ bool hasPreviouslyFocusedDueToUserInteraction = m_hasFocusedDueToUserInteraction;
+#endif
m_hasFocusedDueToUserInteraction = false;
+#if PLATFORM(MAC)
+ if (hasPreviouslyFocusedDueToUserInteraction)
+ send(Messages::WebPageProxy::SetHasHadSelectionChangesFromUserInteraction(m_hasFocusedDueToUserInteraction));
#endif
}
@@ -4697,6 +4709,11 @@
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));
+
// 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.
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (201297 => 201298)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2016-05-23 21:55:54 UTC (rev 201297)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2016-05-23 22:06:57 UTC (rev 201298)
@@ -1376,6 +1376,9 @@
WebCore::IntSize m_minimumLayoutSize;
bool m_autoSizingShouldExpandToViewHeight;
+ bool m_userIsInteracting;
+ bool m_hasFocusedDueToUserInteraction { false };
+
#if ENABLE(CONTEXT_MENUS)
bool m_isShowingContextMenu;
#endif
@@ -1400,8 +1403,6 @@
bool m_scaleWasSetByUIProcess;
bool m_userHasChangedPageScaleFactor;
bool m_hasStablePageScaleFactor;
- bool m_userIsInteracting;
- bool m_hasFocusedDueToUserInteraction { false };
bool m_hasPendingBlurNotification;
bool m_useTestingViewportConfiguration;
bool m_isInStableState;