2015-06-08 Babak Shafiei Merge r183682. 2015-05-01 Brady Eidson Add API to disable meta refreshes. and https://bugs.webkit.org/show_bug.cgi?id=144269 Reviewed by Alexey Proskuryakov. Add a preference to enable/disable meta refreshes, enabled by default. * Shared/WebPreferencesDefinitions.h: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetMetaRefreshEnabled): (WKPreferencesGetMetaRefreshEnabled): (WKPreferencesGetIgnoreViewportScalingConstraints): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): 2015-04-23 Babak Shafiei Merge r181656 & r182985. 2015-04-18 Simon Fraser REGRESSION (r181656): Animated tiled layers are missing content https://bugs.webkit.org/show_bug.cgi?id=143911 rdar://problem/20596328 Reviewed by Darin Adler. After r181656, all requestAnimationFrame was falling back to timers, and not using the platform's DisplayRefreshMonitor, because of a Nullopt vs nullptr fumble. Replace this confusing Optional<> code with simpler code that just forces the clients to make a DisplayRefreshMonitor if they can, first asking ChromeClient, and then falling back to createDefaultDisplayRefreshMonitor(). Make lots of things into references, and use C++11 initialization in some places. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createDisplayRefreshMonitor): * WebProcess/WebCoreSupport/WebChromeClient.h: 2015-03-17 Timothy Horton Reproducible null deref under ScriptedAnimationController::createDisplayRefreshMonitor https://bugs.webkit.org/show_bug.cgi?id=142776 Reviewed by Alexey Proskuryakov. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createDisplayRefreshMonitor): * WebProcess/WebCoreSupport/WebChromeClient.h: Adjust to the new signature. 2015-04-23 Babak Shafiei Roll out r181656. rdar://problem/20545362 2015-04-22 Dana Burkart Merge r181580 for rdar://problem/20545393. 2015-03-13 Enrica Casucci Webkit crash in WebKit::nextFocusableElement() when typing TAB on external keyboard rdar://problem/20155503 Reviewed by David Kilzer. Adding null check! * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::nextFocusableElement): 2015-04-22 Matthew Hanson Merge r182746. rdar://problem/20645260 2015-04-13 Timothy Horton javascript: links in inline PDFs shouldn't execute JavaScript in the context of the host website https://bugs.webkit.org/show_bug.cgi?id=143642 Reviewed by Darin Adler. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::clickedLink): Don't follow javascript: URLs. 2015-04-22 Matthew Hanson Merge r182084. rdar://problem/20557359 2015-03-27 Andreas Kling WebProcessProxy should not retain WebBackForwardListItems forever. Reviewed by Anders Carlsson. Have WebProcessProxy actually forget about a WebBackForwardListItem after it's removed from the WebBackForwardList. This ensures that we don't accumulate too many of these objects, which can get quite large due to the session state encoded in them. We already have graceful handling of the case where an incoming IPC message references a removed back/forward list item. * UIProcess/WebBackForwardList.cpp: (WebKit::WebBackForwardList::didRemoveItem): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::backForwardRemovedItem): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::removeBackForwardItem): * UIProcess/WebProcessProxy.h: 2015-04-22 Matthew Hanson Merge r181991. rdar://problem/20545332 2015-03-25 Chris Dumez [WK2] WebFrameLoaderClient::dispatchDecidePolicyForResponse() should always call the FramePolicyFunction https://bugs.webkit.org/show_bug.cgi?id=143036 Reviewed by Alexey Proskuryakov. WebFrameLoaderClient::dispatchDecidePolicyForResponse() should always call the FramePolicyFunction. Previously, it would fail to do in 2 cases: - m_frame->page() returns null or - webPage->sendSync() returns false If the FramePolicyFunction is not called, we will fail to clear the callback in the PolicyChecker and DocumentLoader::continueAfterContentPolicy() will not be called. DocumentLoader::continueAfterContentPolicy() is in charge of resetting m_waitingForContentPolicy flag to false. This could therefore explain the following assertion being hit in DocumentLoader::detachFromFrame() (see ): RELEASE_ASSERT(!m_waitingForContentPolicy) Also, as the PolicyChecker callback is not cleared, it could make it possible for DocumentLoader::continueAfterContentPolicy() to be called *after* the load is finished, when later canceling the PolicyCallback: FrameLoader::stopAllLoaders() -> PolicyChecker::stopCheck() -> PolicyCallback::cancel() -> DocumentLoader::continueAfterContentPolicy(PolicyIgnore) Calling continueAfterContentPolicy(PolicyIgnore) after the load is finished would be bad and could explain some of the crashes we've seen in DocumentLoader::continueAfterContentPolicy() -> DocumentLoader:: stopLoadingForPolicyChange() (see ). This patch also applies the same fix to dispatchDecidePolicyForNewWindowAction() and dispatchDecidePolicyForNavigationAction() as they use the same pattern. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): 2015-04-22 Matthew Hanson Merge r181812. rdar://problem/20557289 2015-03-20 Beth Dakin [Immediate Actions] Should re-enable immediate actions for iBooks https://bugs.webkit.org/show_bug.cgi?id=142915 -and corresponding- rdar://problem/19585689 Reviewed by Tim Horton. * UIProcess/API/mac/WKView.mm: (-[WKView initWithFrame:processPool:configuration:webView:]): 2015-04-22 Matthew Hanson Merge r181656. rdar://problem/20545362 2015-03-17 Timothy Horton Reproducible null deref under ScriptedAnimationController::createDisplayRefreshMonitor https://bugs.webkit.org/show_bug.cgi?id=142776 Reviewed by Alexey Proskuryakov. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createDisplayRefreshMonitor): * WebProcess/WebCoreSupport/WebChromeClient.h: Adjust to the new signature. 2015-04-22 Matthew Hanson Merge r174288. rdar://problem/20368461 2014-10-03 Jer Noble Revert an accidental change introduced by r173318. Rubber-stamped by Tim Horton. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::suspendPainting): (WebKit::TiledCoreAnimationDrawingArea::resumePainting): 2015-04-17 Lucas Forschler Merge r182285 2015-04-02 Alexey Proskuryakov Make checkURLReceivedFromWebProcess not rely on details of platform URL implementation. https://bugs.webkit.org/show_bug.cgi?id=143222 rdar://problem/19978997 Reviewed by Sam Weinig. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::checkURLReceivedFromWebProcess): 2015-04-17 Lucas Forschler Merge r181864 2015-03-23 Anders Carlsson Make platform/mac-wk2/plugins/destroy-during-async-npp-new.html work again. https://bugs.webkit.org/show_bug.cgi?id=133692 rdar://problem/17255947 Reviewed by Alexey Proskuryakov. Add plug-in destruction protectors around message receiver code that can call out to NPObjects or JavaScript where we need the plug-in to stay around after the call. * Shared/Plugins/NPObjectMessageReceiver.cpp: (WebKit::NPObjectMessageReceiver::invoke): (WebKit::NPObjectMessageReceiver::invokeDefault): (WebKit::NPObjectMessageReceiver::getProperty): (WebKit::NPObjectMessageReceiver::setProperty): (WebKit::NPObjectMessageReceiver::construct): 2015-03-07 Babak Shafiei Merge r181176. 2015-03-06 Beth Dakin REGRESSION (r180782): Data Detector popovers are not dismissed on scroll or zoom https://bugs.webkit.org/show_bug.cgi?id=142371 -and corresponding- rdar://problem/20059224 Reviewed by Tim Horton. This patch has the WKImmediateActionController keep track of whether or not it has an active immediate action. Then we only call into Lookup and DD if the window is key OR if the WKView’s immediateActionController has an active action. * UIProcess/API/mac/WKView.mm: (-[WKView _dismissContentRelativeChildWindows]): * UIProcess/mac/WKImmediateActionController.h: * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController initWithPage:view:recognizer:]): (-[WKImmediateActionController willDestroyView:]): (-[WKImmediateActionController _clearImmediateActionState]): (-[WKImmediateActionController hasActiveImmediateAction]): (-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]): 2015-03-04 Lucas Forschler Merge r180782 2015-02-27 Beth Dakin Lookup panel dismisses when pages are loading in other tabs/windows https://bugs.webkit.org/show_bug.cgi?id=142104 -and corresponding- rdar://problem/19882137 Reviewed by Tim Horton. Until rdar://problem/13875766 is resolved, we should only call into Lookup and DataDetectors for key windows. * UIProcess/API/mac/WKView.mm: (-[WKView _dismissContentRelativeChildWindows]): 2015-02-20 Dana Burkart Merged r180293. 2015-02-18 Beth Dakin iBooks immediate action blacklist should not even create the gesture recognizer https://bugs.webkit.org/show_bug.cgi?id=141768 -and corresponding- rdar://problem/19806770 Reviewed by Tim Horton. Move the runtime-application check to the point where the gesture recognizer is created so that we can avoid doing so. * UIProcess/API/mac/WKView.mm: (-[WKView initWithFrame:processPool:configuration:webView:]): * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _updateImmediateActionItem]): 2015-02-20 Dana Burkart Merged r180242. 2015-02-17 Timothy Horton REGRESSION (r178595): Clicking on DD highlights sometimes do not work https://bugs.webkit.org/show_bug.cgi?id=141728 Reviewed by Beth Dakin. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _cancelImmediateActionIfNeeded]): (-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]): The change that r178595 intended to make was purely that things that we have no immediate actions for should cancel the immediate action gesture recognizer. Moving the DataDetectors activation code as well breaks strict ordering of immediate action callbacks vs. shouldUseActionsWithContext: that they depend on. 2015-02-19 Dana Burkart Merged r180115. 2015-02-14 Beth Dakin REGRESSION: Page opens with enlarged font after visiting PDF, navigating back, then doing a process swap https://bugs.webkit.org/show_bug.cgi?id=141584 -and corresponding- rdar://problem/18167729 Reviewed by Tim Horton. This patch keeps the plugin zoom/scale factors separate from page zoom/scale factors in the UI process since they are used for slightly different purposes for plugins (i.e., PDFs) than they are for normal pages. Keeping track of the right factor for the right type of document will ensure that we don’t use the wrong one. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::WebPageProxy): (WebKit::WebPageProxy::pageZoomFactor): (WebKit::WebPageProxy::pageScaleFactor): (WebKit::WebPageProxy::pluginScaleFactorDidChange): (WebKit::WebPageProxy::pluginZoomFactorDidChange): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::pageZoomFactorDidChange): Deleted. * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::pageZoomFactor): Deleted. (WebKit::WebPageProxy::pageScaleFactor): Deleted. * UIProcess/WebPageProxy.messages.in: * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::setPageScaleFactor): 2015-02-19 Dana Burkart Merged r180094. 2015-02-13 Simon Fraser Crash closing a tab when a context or popup menu is open https://bugs.webkit.org/show_bug.cgi?id=141582 rdar://problem/17700475 Reviewed by Anders Carlsson. If a context menu or a popup menu is open when a tab is programmatically closed, then we'd crash because both the WebContextMenuProxyMac/WebPopupMenuProxyMac and the WebPageProxy would be deleted while still in use, via messages handled via the nested event tracking runloop. Fix by protecting those things while showing the popup. Also programmatically dismiss the popup when closing the WebPageProxy. * UIProcess/WebContextMenuProxy.h: (WebKit::WebContextMenuProxy::cancelTracking): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::close): (WebKit::WebPageProxy::showPopupMenu): Clean up some EFL-related confusion that we don't need. Retaining |this| will also retain m_activePopupMenu. (WebKit::WebPageProxy::hidePopupMenu): (WebKit::WebPageProxy::showContextMenu): (WebKit::WebPageProxy::resetState): * UIProcess/WebPopupMenuProxy.h: (WebKit::WebPopupMenuProxy::cancelTracking): * UIProcess/mac/WebContextMenuProxyMac.h: * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::WebContextMenuProxyMac::showContextMenu): (WebKit::WebContextMenuProxyMac::cancelTracking): * UIProcess/mac/WebPopupMenuProxyMac.h: For popups, we need to remember if we were canceled to avoid trying to send events after closing. * UIProcess/mac/WebPopupMenuProxyMac.mm: (WebKit::WebPopupMenuProxyMac::WebPopupMenuProxyMac): (WebKit::WebPopupMenuProxyMac::showPopupMenu): (WebKit::WebPopupMenuProxyMac::cancelTracking): 2015-02-19 Dana Burkart Merged r180076. 2015-02-13 Brent Fulgham [Mac, iOS] Adjust pagination behavior for Mail.app printing use https://bugs.webkit.org/show_bug.cgi?id=141569 Reviewed by Anders Carlsson. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode): Add new flag. (WebKit::WebPageCreationParameters::decode): Ditto. * Shared/WebPageCreationParameters.h: Ditto. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): Set new page construction flag. * UIProcess/WebPageProxy.h: * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::paginationQuirkEnabled): Ask for new pagination flag when running as a Mail client. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): Set up pagination based on desired settings. 2015-02-19 Dana Burkart Merged r180062. 2015-02-12 Simon Fraser determinePrimarySnapshottedPlugIn() should only traverse visible Frames https://bugs.webkit.org/show_bug.cgi?id=141547 Part of rdar://problem/18445733. Reviewed by Anders Carlsson. Use FrameTree::traverseNextRendered() to avoid doing things in unrendered frames which are not guaranteed to have been laid out. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::determinePrimarySnapshottedPlugIn): 2015-02-11 Lucas Forschler Merge r179736 2015-02-05 Tim Horton Null deref in ViewGestureController::beginSwipeGesture when swiping while script is navigating https://bugs.webkit.org/show_bug.cgi?id=141308 Reviewed by Simon Fraser. * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::trackSwipeGesture): If script navigates (history.back, probably other cases too) while in the middle of building up enough scroll events to start a swipe, it can destroy the history item that we were planning to swipe to. If this happens, bail from the swipe. 2015-02-11 Lucas Forschler Merge r179586 2015-02-03 Timothy Horton Every PageOverlayClientImpl leaks https://bugs.webkit.org/show_bug.cgi?id=141224 Reviewed by Simon Fraser. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (WKBundlePageOverlayCreate): * WebProcess/WebPage/WebPageOverlay.cpp: (WebKit::WebPageOverlay::create): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::pageOverlayDestroyed): (WebKit::WebPageOverlay::willMoveToPage): (WebKit::WebPageOverlay::didMoveToPage): (WebKit::WebPageOverlay::drawRect): (WebKit::WebPageOverlay::mouseEvent): (WebKit::WebPageOverlay::didScrollFrame): (WebKit::WebPageOverlay::actionContextForResultAtPoint): (WebKit::WebPageOverlay::dataDetectorsDidPresentUI): (WebKit::WebPageOverlay::dataDetectorsDidChangeUI): (WebKit::WebPageOverlay::dataDetectorsDidHideUI): (WebKit::WebPageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeNames): * WebProcess/WebPage/WebPageOverlay.h: (WebKit::WebPageOverlay::client): Keep the PageOverlayClientImpl as a unique_ptr instead of a leaked reference, ensuring that it's cleaned up when the WebPageOverlay is torn down. 2015-02-10 Lucas Forschler Merge r177849 2015-01-01 Jeff Miller Update user-visible copyright strings to include 2015 https://bugs.webkit.org/show_bug.cgi?id=139880 Reviewed by Darin Adler. * DatabaseProcess/EntryPoint/mac/LegacyProcess/Info.plist: * DatabaseProcess/EntryPoint/mac/XPCService/DatabaseService.Development/Info.plist: * DatabaseProcess/EntryPoint/mac/XPCService/DatabaseService/Info.plist: * Info.plist: * NetworkProcess/EntryPoint/mac/LegacyProcess/Info.plist: * NetworkProcess/EntryPoint/mac/XPCService/NetworkService.Development/Info-OSX.plist: * NetworkProcess/EntryPoint/mac/XPCService/NetworkService.Development/Info-iOS.plist: * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX.plist: * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-iOS.plist: * PluginProcess/EntryPoint/mac/LegacyProcess/Info.plist: * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist: * PluginProcess/EntryPoint/mac/XPCService/PluginService.Development/Info.plist: * WebProcess/EntryPoint/mac/LegacyProcess/Info.plist: * WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/Info-OSX.plist: * WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/Info-iOS.plist: * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist: * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist: * mac/Info-WebKit2.plist: 2015-02-09 Babak Shafiei Merge r179809. 2015-02-08 Timothy Horton Null deref in _clearImmediateActionState when closing a view with a DataDetectors popover open https://bugs.webkit.org/show_bug.cgi?id=141377 Reviewed by Darin Adler. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _clearImmediateActionState]): We can have already detached the page when DataDetectors calls us back in interactionStoppedHandler. While we have kept a strong reference to the page in the interactionStoppedHandler block, _page is nulled out. It's OK to avoid doing this work, in any case, because closing a page tears down the TextIndicator anyway. 2015-02-02 Matthew Hanson Merge r179066. rdar://problem/19670515 2015-01-24 David Kilzer REGRESSION (iOS 8): Reproducible null deref in WebKit::nextFocusableElement Merged small change from r175549. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::nextFocusableElement): Add isElementNode() check. 2015-01-20 Babak Shafiei Merge r173737. 2014-09-18 Simon Fraser Avoid divide by zero when we get an empty rect while snapshotting a node https://bugs.webkit.org/show_bug.cgi?id=136932 rdar://problem/18383473 Reviewed by Dean Jackson. renderer()->paintingRootRect() can return an empty rect for some inline configurations, for example an containing a floated When this occurs, avoid a divide by zero and return a null snapshot image. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::snapshotNode): 2015-01-20 Babak Shafiei Merge r173071. 2014-08-27 Enrica Casucci textStylingAtPosition returns incorrect values after executing toggleBold, toggleItalic and toggleUnderline. https://bugs.webkit.org/show_bug.cgi?id=136323 rdar://problem/18141964 Reviewed by Antti Koivisto. For underline style we need to check typingStyle first and use that information to populate the dictionary. If there is no typing style we can use the render style. We also need to update the editor state for the toggle commands to reflect the state in the UIProcess even for commands that don't change the selection. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::editorState): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::executeEditCommandWithCallback): 2015-01-29 Matthew Hanson Merge r179339. rdar://problem/19619999 2015-01-29 Tim Horton Avoid manually handling quickLookWithEvent: if the immediate action gesture recognizer will do Lookup for us https://bugs.webkit.orgshow_bug.cgi?id=141018 * UIProcess/API/mac/WKView.mm: (-[WKView quickLookWithEvent:]): Yosemite is 101000, not 10100. 2015-01-29 Matthew Hanson Merge r179320. rdar://problem/19619999 2015-01-28 Timothy Horton Avoid manually handling quickLookWithEvent: if the immediate action gesture recognizer will do Lookup for us https://bugs.webkit.org/show_bug.cgi?id=141018 Reviewed by Beth Dakin. * UIProcess/API/mac/WKView.mm: (-[WKView quickLookWithEvent:]): If we have an immediate action gesture recognizer, just call super and avoid WebKit's special quickLookWithEvent: implementation. 2015-01-28 Babak Shafiei Merge r179230. 2015-01-27 Beth Dakin Immediate action gesture recognizer still doesn't work well with IB https://bugs.webkit.org/show_bug.cgi?id=140967 -and corresponding- rdar://problem/19621509 Reviewed by Tim Horton. We should add (or remove) the gesture recognizer in viewDidMoveToWindow because initWithFrame it too early and IB might mess with it. * UIProcess/API/mac/WKView.mm: (-[WKView viewDidMoveToWindow]): (-[WKView initWithFrame:processPool:configuration:webView:]): 2015-01-28 Matthew Merge r179195. rdar://problem/19572685 2015-01-27 Beth Dakin Invoking an immediate action on link often dismisses selection https://bugs.webkit.org/show_bug.cgi?id=140911 -and corresponding- rdar://problem/19572685 Reviewed by Tim Horton. Calling _page->setMaintainsInactiveSelection(false) in complete is often too soon. Instead, call it in dismissContentRelativeChildWindows. This is more similar to the timing for the TextIndicator. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController dismissContentRelativeChildWindows]): (-[WKImmediateActionController immediateActionRecognizerWillPrepare:]): (-[WKImmediateActionController immediateActionRecognizerDidCompleteAnimation:]): 2015-01-28 Matthew Merge r179129. rdar://problem/19489518 2015-01-26 Beth Dakin Blacklist iBooks for WebKit's default immediate actions https://bugs.webkit.org/show_bug.cgi?id=140854 -and corresponding- rdar://problem/19489518 Reviewed by Tim Horton. Blacklist iBooks. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _updateImmediateActionItem]): 2015-01-28 Matthew Merge r179087. rdar://problem/19571057 2015-01-25 Timothy Horton Unresponsive Web processes sometimes throw ObjC exceptions under didPerformActionMenuHitTest: https://bugs.webkit.org/show_bug.cgi?id=140859 Reviewed by Darin Adler. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController didPerformActionMenuHitTest:userData:]): If we've already given up on this gesture (either because it was canceled or the willBeginAnimation timeout expired), we shouldn't build a new animationController for it. This is true both because it wouldn't look good to swap animationControllers out from under the gesture, but also because AppKit throws an exception when you do this and that breaks a lot of things. 2015-01-28 Matthew Merge r179023. rdar://problem/19573674 2015-01-23 Timothy Horton Fix the pre-Yosemite build. * UIProcess/API/mac/WKView.mm: (-[WKView _dismissContentRelativeChildWindows]): 2015-01-28 Matthew Merge r179014. rdar://problem/19573674 2015-01-23 Timothy Horton QLPreviewMenuItem popovers don't close when the page scrolls https://bugs.webkit.org/show_bug.cgi?id=140806 Reviewed by Beth Dakin. Now that QLPreviewMenuItem's popover doesn't eat scrolls, we need to dismiss it if the page scrolls. * UIProcess/API/mac/WKView.mm: (-[WKView _dismissContentRelativeChildWindows]): Send _dismissContentRelativeChildWindows on to WKImmediateActionController. * UIProcess/mac/WKImmediateActionController.h: * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _clearImmediateActionState]): (-[WKImmediateActionController dismissContentRelativeChildWindows]): (-[WKImmediateActionController _defaultAnimationController]): Keep track of the active QLPreviewMenuItem, and close it upon scroll. 2015-01-28 Matthew Merge r179013. rdar://problem/19571601 2015-01-23 Timothy Horton Infinite recursion in _clearImmediateActionState https://bugs.webkit.org/show_bug.cgi?id=140807 Reviewed by Anders Carlsson. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _clearImmediateActionState]): Clear _hasActivatedActionContext before calling didUseActions, because didUseActions can call _clearImmediateActionState. 2015-01-28 Matthew Merge r178938. rdar://problem/19558472 2015-01-22 Beth Dakin ibtoold crash below -[WebView close] https://bugs.webkit.org/show_bug.cgi?id=140782 -and corresponding- rdar://problem/19558472 Reviewed by Tim Horton. Retain the NSImmediateActionGestureRecognizer. This should not be necessary, but it is because interface builder can mess with our views. * UIProcess/mac/WKImmediateActionController.h: * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController willDestroyView:]): (-[WKImmediateActionController _cancelImmediateAction]): (-[WKImmediateActionController _cancelImmediateActionIfNeeded]): (-[WKImmediateActionController _updateImmediateActionItem]): 2015-01-28 Matthew Merge r178858. rdar://problem/19540806 2015-01-21 Beth Dakin Crash in QuickLook preview delegate method https://bugs.webkit.org/show_bug.cgi?id=140740 -and corresponding- rdar://problem/19540806 Reviewed by Tim Horton. Clear out the delegate. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController willDestroyView:]): 2015-01-23 Babak Shafiei Merge r178595. rdar://problem/19490114 2015-01-16 Beth Dakin Should cancel immediate action sooner in WK2 https://bugs.webkit.org/show_bug.cgi?id=140561 -and corresponding- rdar://problem/19490114 Reviewed by Tim Horton. _cancelImmediateActionIfNeeded will cancel the immediate action if there is no animation controller or if the DDActionContext doesn’t want to use its actions. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _cancelImmediateActionIfNeeded]): Call _cancelImmediateActionIfNeeded to cancel earlier. (-[WKImmediateActionController didPerformActionMenuHitTest:userData:]): Re-factor this code to use the newly-added method _cancelImmediateActionIfNeeded (-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]): 2015-01-22 Matthew Hanson Merge r174708. rdar://problem/19451256 2014-10-14 Alexey Proskuryakov REGRESSION (r165356): Issues with Japanese text input https://bugs.webkit.org/show_bug.cgi?id=137719 rdar://problem/18431952 rdar://problem/18483741 Reviewed by Darin Adler. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didChangeSelection): In sync code path, ensure consistent message delivery order by adding a DispatchMessageEvenWhenWaitingForSyncReply flag. This way, delayed EditorStateChanged messages won't confuse UI process. 2015-01-22 Matthew Hanson Merge r177152. rdar://problem/19451288 2014-12-11 Alexey Proskuryakov REGRESSION (Async Text Input): Text input method state is not reset when reloading a page https://bugs.webkit.org/show_bug.cgi?id=139504 rdar://problem/19034674 Reviewed by Enrica Casucci. WebKit2 used to look at EditorState changes and guess when to cancel a composition. This was quite unreliable, and needlessly complicated - WebCore knows when it decides to destroy a composition, so it now explicitly notifies the clients. * UIProcess/API/mac/WKView.mm: (-[WKView _processDidExit]): Address crashing case too. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetStateAfterProcessExited): * WebProcess/WebCoreSupport/WebEditorClient.cpp: (WebKit::WebEditorClient::discardedComposition): * WebProcess/WebCoreSupport/WebEditorClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didChangeSelection): (WebKit::WebPage::discardedComposition): * WebProcess/WebPage/WebPage.h: 2015-01-22 Matthew Hanson Merge r177033. rdar://problem/19451244 2014-12-09 Chris Dumez [WK2] Crash when answering notification permission request after navigating https://bugs.webkit.org/show_bug.cgi?id=139429 Reviewed by Andreas Kling. When requesting a notification permission, navigating away and then answering the permission, WebKit2 would crash. This is because upon navigating, the request is cancelled and removed from the HashMaps in NotificationPermissionRequestManager. When didReceiveNotificationPermissionDecision() is later called, it would look for the request identifier in m_idToOriginMap HashMap. As the request was cancelled, HashMap::take() call would return null for the SecurityOrigin*. This security origin pointer is then removed from m_originToIDMap, but the code was failing to do a null check first. Calling HashMap::remove(nullptr) would then crash. This patch adds the missing null check and a layout test to cover this case. Test: http/tests/notifications/legacy/notification-request-permission-then-navigate.html * WebProcess/Notifications/NotificationPermissionRequestManager.cpp: (WebKit::NotificationPermissionRequestManager::didReceiveNotificationPermissionDecision): 2015-01-22 Matthew Hanson Merge r175759. rdar://problem/19450899 2014-11-07 Anshu Chimala Make it possible to associate snapshots with back/forward list items other than the current item. https://bugs.webkit.org/show_bug.cgi?id=138490 Reviewed by Tim Horton. * UIProcess/API/Cocoa/WKViewPrivate.h: Declare -saveBackForwardSnapshotForItem:, an alternative to -saveBackForwardSnapshotForCurrentItem that accepts a back/forward list item as an argument. * UIProcess/API/mac/WKView.mm: (-[WKView saveBackForwardSnapshotForItem:]): Pass the provided back/forward list item along to WebPageProxy::recordNavigationSnapshot(). * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::recordNavigationSnapshot): Overloaded to optionally take a back/forward list item as an argument. If one isn't provided, default to the current item as before; otherwise, associate the snapshot with whichever item was provided. * UIProcess/WebPageProxy.h: Declare the new recordNavigationSnapshot() overload. * UIProcess/mac/ViewSnapshotStore.h: Make recordSnapshot() take a back/forward list item as an argument. * UIProcess/mac/ViewSnapshotStore.mm: (WebKit::ViewSnapshotStore::recordSnapshot): Store the snapshot in the provided back/forward list item instead of in the current item. 2015-01-15 Matthew Hanson Merge r175719. rdar://problem/19424169 2014-11-05 Jer Noble De-templatize Timer https://bugs.webkit.org/show_bug.cgi?id=138450 Reviewed by Anders Carlsson. Remove template specifiers from Timer. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::bufferingTimerFired): * NetworkProcess/NetworkResourceLoader.h: * Shared/WebMemorySampler.cpp: (WebKit::WebMemorySampler::sampleTimerFired): (WebKit::WebMemorySampler::stopTimerFired): * Shared/WebMemorySampler.h: * Shared/mac/RemoteLayerBackingStoreCollection.h: * Shared/mac/RemoteLayerBackingStoreCollection.mm: (WebKit::RemoteLayerBackingStoreCollection::volatilityTimerFired): * UIProcess/API/efl/EwkView.cpp: (EwkView::displayTimerFired): * UIProcess/API/efl/EwkView.h: * UIProcess/efl/TextCheckerClientEfl.cpp: (TextCheckerClientEfl::languagesUpdateTimerFired): (TextCheckerClientEfl::spellCheckingSettingChangeTimerFired): * UIProcess/efl/TextCheckerClientEfl.h: * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp: (WebKit::CoordinatedLayerTreeHost::layerFlushTimerFired): * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::layerFlushTimerFired): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::processSuspensionCleanupTimerFired): (WebKit::WebProcess::nonVisibleProcessCleanupTimerFired): * WebProcess/WebProcess.h: 2015-01-15 Babak Shafiei Merge r178290. rdar://problem/19441243 2015-01-12 Timothy Horton Multi-rect TextIndicators are vertically flipped in WebKit1 https://bugs.webkit.org/show_bug.cgi?id=140350 Reviewed by Beth Dakin. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): Adjust to the field name changes. * UIProcess/API/mac/WKView.mm: (-[WKView _setTextIndicator:fadeOut:]): Convert the textBoundingRect from root view to screen coordinates. * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindIndicator): (WebKit::FindController::drawRect): Adjust to the new name, and use contentsToRootView when comparing against the stored m_findIndicatorRect. 2015-01-14 Dana Burkart Merged r175400. 2014-10-30 Jer Noble [EME] Add Setting for accessing storage location for MediaKeys data https://bugs.webkit.org/show_bug.cgi?id=138147 Reviewed by Brady Eidson. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): Pass from WebMediaKeyStorageManager into Settings. 2015-01-14 Dana Burkart Merged r175288. 2014-10-28 Jer Noble [EME] Pass location for media key storage through from WebKit/WebKit2. https://bugs.webkit.org/show_bug.cgi?id=137120 Reviewed by Anders Carlsson. Allow the location for media key storage to be passed into the WebProcess from the UIProcess through the WebContextConfiguraiton struct. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode): Add mediaKeysStorageDirectory. (WebKit::WebProcessCreationParameters::decode): Ditto. * Shared/WebProcessCreationParameters.h: * UIProcess/API/C/WKContextConfigurationRef.cpp: (WKContextConfigurationCopyMediaKeysStorageDirectory): Added getter. (WKContextConfigurationSetMediaKeysStorageDirectory): Added setter. * UIProcess/API/C/WKContextConfigurationRef.h: * UIProcess/API/C/WKOriginDataManager.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _initWithConfiguration:]): Provide a default location. * UIProcess/APIContextConfiguration.cpp: (API::ContextConfiguration::webContextConfiguration): Set mediaKeysStorageDirectory. * UIProcess/APIContextConfiguration.h: (API::ContextConfiguration::mediaKeysStorageDirectory): Added getter. (API::ContextConfiguration::setMediaKeysStorageDirectory): Added setter. * UIProcess/WebContext.cpp: (WebKit::WebContext::applyPlatformSpecificConfigurationDefaults): Apply mediaKeysStorageDirectory. (WebKit::WebContext::WebContext): Initialize m_mediaKeysStorageDirectory. (WebKit::WebContext::createNewWebProcess): Create a sandbox extension handle for mediaKeysStorageDirectory. * UIProcess/WebContext.h: * UIProcess/efl/WebContextEfl.cpp: (WebKit::WebContext::platformDefaultMediaKeysStorageDirectory): Return a default location. * UIProcess/gtk/WebContextGtk.cpp: (WebKit::WebContext::platformDefaultMediaKeysStorageDirectory): Ditto. * UIProcess/mac/WebContextMac.mm: (WebKit::WebContext::platformDefaultMediaKeysStorageDirectory): Return an overridable default location. * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp: Added. (WebKit::WebMediaKeyStorageManager::initialize): Pull the mediaKeysStorageDirectory out of configuration. (WebKit::WebMediaKeyStorageManager::supplementName): Return a configuration name. (WebKit::WebMediaKeyStorageManager::mediaKeyStorageDirectoryForOrigin): Return the correct storage directory based on the SecureOrigin. (WebKit::WebMediaKeyStorageManager::getMediaKeyOrigins): Return the origins within the storage directory. (WebKit::removeAllMediaKeyStorageForOriginPath): Static, remove contents and directory at path. (WebKit::WebMediaKeyStorageManager::deleteMediaKeyEntriesForOrigin): Use removeAllMediaKeyStorageForOriginPath to remove origin data. (WebKit::WebMediaKeyStorageManager::deleteMediaKeyEntriesModifiedBetweenDates): Ditto. (WebKit::WebMediaKeyStorageManager::deleteAllMediaKeyEntries): Ditto. * WebProcess/MediaCache/WebMediaKeyStorageManager.h: Added. (WebKit::WebMediaKeyStorageManager::WebMediaKeyStorageManager): Default constructor. (WebKit::WebMediaKeyStorageManager::~WebMediaKeyStorageManager): Default virtual destructor. (WebKit::WebMediaKeyStorageManager::mediaKeyStorageDirectory): Simple accessor. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::WebProcess): Add WebMediaKeyStorageManager as a supplement. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): Create a sandbox extension from the sandbox extension handle. Add new source files to project(s). * PlatformEfl.cmake: * PlatformGTK.cmake: * WebKit2.xcodeproj/project.pbxproj: * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp: (WebKit::WebMediaKeyStorageManager::getMediaKeyOrigins): (WebKit::removeAllMediaKeyStorageForOriginPath): Drive-by fix: references to VoidCallback are ambiguous, since the same name is re-used in multiple namespaces. Make references to WebCore::VoidCallback explicit where the entire WebCore (and other) namespaces are pulled in. * WebProcess/Notifications/NotificationPermissionRequestManager.cpp: (WebKit::NotificationPermissionRequestManager::startRequest): (WebKit::NotificationPermissionRequestManager::didReceiveNotificationPermissionDecision): * WebProcess/WebCoreSupport/WebNotificationClient.cpp: (WebKit::WebNotificationClient::requestPermission): 2015-01-14 Dana Burkart Merged r175188. 2014-10-24 Jer Noble Abstractify WebOriginDataManager to support arbitrary ChildProcess supplements. https://bugs.webkit.org/show_bug.cgi?id=137993 Reviewed by Brady Eidson. To allow different ChildProcess subclasses to handle listing and deletion of origin data, make WebOriginDataManager more generic by having a supplement implement the details, leaving WebOriginDataManager to deal with cross-process messaging. De-virtualize AsyncTask, allowing a task to be created by passing in a function, rather than an object, method, and arguments. * Shared/AsyncTask.h: (WebKit::AsyncTask::AsyncTask): (WebKit::AsyncTask::performTask): (WebKit::AsyncTask::~AsyncTask): Deleted. Add a new virtual base class, to be implemented by various ChildProcesses, which WebOriginDataManager will use to implement listing and deletion requests. * WebProcess/OriginData/WebOriginDataManager.h: * WebProcess/OriginData/WebOriginDataManagerSupplement.h: Added. (WebKit::WebOriginDataManagerSupplement::WebOriginDataManagerSupplement): (WebKit::WebOriginDataManagerSupplement::~WebOriginDataManagerSupplement): (WebKit::WebOriginDataManagerSupplement::getOrigins): (WebKit::WebOriginDataManagerSupplement::deleteEntriesForOrigin): (WebKit::WebOriginDataManagerSupplement::deleteEntriesModifiedBetweenDates): (WebKit::WebOriginDataManagerSupplement::deleteAllEntries): * WebKit2.xcodeproj/project.pbxproj: WebOriginDataManager doesn't need to be a ChildSupplement. Remove the DatabaseProcess- specific implementations for its message handlers and replace with clean, generic calls to its supplement. Because these supplements may want to respond to the request asynchronously, pass a completion function in to be called by the supplement once its work is complete. * WebProcess/OriginData/WebOriginDataManager.cpp: (WebKit::WebOriginDataManager::WebOriginDataManager): (WebKit::WebOriginDataManager::getOrigins): (WebKit::WebOriginDataManager::deleteEntriesForOrigin): (WebKit::WebOriginDataManager::deleteEntriesModifiedBetweenDates): (WebKit::WebOriginDataManager::deleteAllEntries): (WebKit::WebOriginDataManager::supplementName): Deleted. DatabaseProcess already uses WebOriginDataManager, so it will be the first process to fall under the heel of the new regime. DatabaseProcess will subclass WebOriginDataManagerSupplement, and pass itself in twice to the WebOriginDataManager constructor. Create a lambda-based AsyncTask for each request, and call the completion function when each request is complete. * DatabaseProcess/DatabaseProcess.cpp: (WebKit::DatabaseProcess::DatabaseProcess): (WebKit::DatabaseProcess::getIndexedDatabaseOrigins): (WebKit::DatabaseProcess::deleteIndexedDatabaseEntriesForOrigin): (WebKit::DatabaseProcess::deleteIndexedDatabaseEntriesModifiedBetweenDates): (WebKit::DatabaseProcess::deleteAllIndexedDatabaseEntries): (WebKit::DatabaseProcess::getOrigins): (WebKit::DatabaseProcess::deleteEntriesForOrigin): (WebKit::DatabaseProcess::deleteEntriesModifiedBetweenDates): (WebKit::DatabaseProcess::deleteAllEntries): (WebKit::DatabaseProcess::doGetIndexedDatabaseOrigins): Deleted. (WebKit::DatabaseProcess::doDeleteIndexedDatabaseEntriesForOrigin): Deleted. (WebKit::DatabaseProcess::doDeleteIndexedDatabaseEntriesModifiedBetweenDates): Deleted. (WebKit::DatabaseProcess::doDeleteAllIndexedDatabaseEntries): Deleted. * DatabaseProcess/DatabaseProcess.h: 2015-01-07 Matthew Hanson Merge r178056. rdar://problem/19300492 2015-01-07 Beth Dakin Adopt delegate callbacks so that standardQuickLookMenuItem does not obscure the link https://bugs.webkit.org/show_bug.cgi?id=140206 -and corresponding- rdar://problem/19300492 Reviewed by Tim Horton. Providing and item frame will ensure that the original link is not obscured. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController menuItem:itemFrameForPoint:]): For now use a max size that is smaller than the WKView, with the screen’s aspect ratio, and scaled down. (-[WKImmediateActionController menuItem:maxSizeForPoint:]): 2015-01-07 Matthew Hanson Merge r178003. rdar://problem/19255417 2015-01-06 Timothy Horton View state change callbacks are sometimes dropped on the floor https://bugs.webkit.org/show_bug.cgi?id=140156 Reviewed by Anders Carlsson. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::dispatchViewStateChange): Always send SetViewState to the Web process if we have any registered view state change callbacks. Otherwise, if nothing changed, we can end up never calling the callback. 2015-01-07 Matthew Hanson Merge r177970. rdar://problem/19383425 2015-01-06 Timothy Horton Make explicit which TextIndicator animations are driven manually, and which run automatically https://bugs.webkit.org/show_bug.cgi?id=140113 Reviewed by Darin Adler. * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::didPerformDictionaryLookup): Delete an inaccurate comment. 2015-01-07 Matthew Hanson Merge r177928. rdar://problem/19298391 2015-01-05 Timothy Horton Implicitly dismissed DD popovers don't clear immediate action state, prematurely dismissing the next DD highlight https://bugs.webkit.org/show_bug.cgi?id=140088 Reviewed by Anders Carlsson. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _menuItemForDataDetectedText]): Instead of just tearing down the TextIndicator, clear all state. 2015-01-07 Matthew Hanson Merge r177754. rdar://problem/19343307 2014-12-26 Conrad Shultz Safari build crashes when "zooming into"/choosing a tab from tab view https://bugs.webkit.org/show_bug.cgi?id=139934 Reviewed by Dan Bernstein. * UIProcess/API/mac/WKView.mm: (-[WKView _setIgnoresNonWheelEvents:]): Trying to add a nil gesture recognizer raises an exception. Stop assuming that a gesture recognizer is non-nil. 2015-01-07 Matthew Hanson Merge r177705. rdar://problem/19333076 2014-12-23 Timothy Horton Install a TextIndicator for link immediate actions https://bugs.webkit.org/show_bug.cgi?id=139897 Reviewed by Anders Carlsson. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _defaultAnimationController]): Install the link's TextIndicator. (-[WKImmediateActionController menuItemDidClose:]): Dismiss the TextIndicator and clean up when the item closes. 2015-01-07 Matthew Hanson Merge r177704. rdar://problem/19333075 2014-12-23 Timothy Horton Expose ElementBoundingBox on WKHitTestResult https://bugs.webkit.org/show_bug.cgi?id=139895 Reviewed by Dan Bernstein. * UIProcess/API/C/WKHitTestResult.cpp: (WKHitTestResultGetElementBoundingBox): * UIProcess/API/C/WKHitTestResult.h: Expose the rect. 2015-01-07 Matthew Hanson Merge r177702. rdar://problem/19333074 2014-12-23 Timothy Horton Remove the custom web page preview code https://bugs.webkit.org/show_bug.cgi?id=139894 Reviewed by Dan Bernstein. * UIProcess/API/Cocoa/WKViewPrivate.h: * UIProcess/API/mac/WKView.mm: (-[WKView _dismissContentRelativeChildWindows]): (-[WKView _viewForPreviewingURL:initialFrameSize:]): Deleted. (-[WKView _titleForPreviewOfURL:]): Deleted. (-[WKView _setPreviewTitle:]): Deleted. (-[WKView _setPreviewLoading:]): Deleted. (-[WKView _setPreviewOverrideImage:]): Deleted. (-[WKView _finishPreviewingURL:withPreviewView:]): Deleted. (-[WKView _handleClickInPreviewView:URL:]): Deleted. (-[WKView _shouldUseStandardQuickLookPreview]): Deleted. * UIProcess/mac/WKImmediateActionController.h: * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController willDestroyView:]): (-[WKImmediateActionController _clearImmediateActionState]): (-[WKImmediateActionController immediateActionRecognizerWillPrepare:]): (-[WKImmediateActionController _defaultAnimationController]): (-[WKImmediateActionController hidePreview]): Deleted. (-[WKImmediateActionController setPreviewTitle:]): Deleted. (-[WKImmediateActionController setPreviewLoading:]): Deleted. (-[WKImmediateActionController setPreviewOverrideImage:]): Deleted. (-[WKImmediateActionController _animationControllerForCustomPreview]): Deleted. * UIProcess/mac/WKPagePreviewViewController.h: Removed. * UIProcess/mac/WKPagePreviewViewController.mm: Removed. * UIProcess/mac/WKPreviewPopoverAnimationController.h: Removed. * UIProcess/mac/WKPreviewPopoverAnimationController.mm: Removed. * WebKit2.xcodeproj/project.pbxproj: Remove all of the custom web page preview code. Clients that want the custom preview can implement it by overriding the immediate action. 2015-01-07 Matthew Hanson Merge r177604. rdar://problem/19312111 2014-12-19 Timothy Horton Fix the build. * UIProcess/API/mac/WKView.mm: (-[WKView _setIgnoresNonWheelEvents:]): 2015-01-07 Matthew Hanson Merge r177601. rdar://problem/19301470 2014-12-19 Beth Dakin Preview popovers don't show an arrow for large links https://bugs.webkit.org/show_bug.cgi?id=139842 -and corresponding- Reviewed by Tim Horton. This patch addresses the case where the link is so large that there is no available space on any side once you factor in screen padding. In that case, we should give up early on not obscuring the link. * UIProcess/mac/WKPreviewPopoverAnimationController.mm: (-[WKPreviewPopoverAnimationController _targetSizeForPagePreview]): (-[WKPreviewPopoverAnimationController _effectivePaddingWithPreviewPadding:]): (-[WKPreviewPopoverAnimationController _maxSpaceAvailableOnYEdgeForOriginRect:withScreenRect:previewPadding:]): (-[WKPreviewPopoverAnimationController _maxSpaceAvailableOnXEdgeForOriginRect:withScreenRect:previewPadding:]): (-[WKPreviewPopoverAnimationController _preferredPopoverSizeWithPreviewPadding:forTargetSize:]): 2015-01-07 Matthew Hanson Merge r177600. rdar://problem/19312111 2014-12-19 Timothy Horton WKView's ignoresNonWheelEvents should ignore immediate actions https://bugs.webkit.org/show_bug.cgi?id=139839 Reviewed by Anders Carlsson. * UIProcess/API/mac/WKView.mm: (-[WKView initWithFrame:context:configuration:webView:]): (-[WKView _setIgnoresNonWheelEvents:]): Install/uninstall the immediate action gesture recognizer when toggling ignoresNonWheelEvents. 2015-01-06 Lucas Forschler Rollout r177932. rdar://problem/19312111 2015-01-06 Lucas Forschler Rollout r177933. rdar://problem/19301470 2015-01-06 Lucas Forschler Rollout r177934. rdar://problem/19312111 2015-01-06 Lucas Forschler Rollout r177939. 2015-01-05 Lucas Forschler Merge r177702. rdar://problem/19333074 2014-12-23 Timothy Horton Remove the custom web page preview code https://bugs.webkit.org/show_bug.cgi?id=139894 Reviewed by Dan Bernstein. * UIProcess/API/Cocoa/WKViewPrivate.h: * UIProcess/API/mac/WKView.mm: (-[WKView _dismissContentRelativeChildWindows]): (-[WKView _viewForPreviewingURL:initialFrameSize:]): Deleted. (-[WKView _titleForPreviewOfURL:]): Deleted. (-[WKView _setPreviewTitle:]): Deleted. (-[WKView _setPreviewLoading:]): Deleted. (-[WKView _setPreviewOverrideImage:]): Deleted. (-[WKView _finishPreviewingURL:withPreviewView:]): Deleted. (-[WKView _handleClickInPreviewView:URL:]): Deleted. (-[WKView _shouldUseStandardQuickLookPreview]): Deleted. * UIProcess/mac/WKImmediateActionController.h: * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController willDestroyView:]): (-[WKImmediateActionController _clearImmediateActionState]): (-[WKImmediateActionController immediateActionRecognizerWillPrepare:]): (-[WKImmediateActionController _defaultAnimationController]): (-[WKImmediateActionController hidePreview]): Deleted. (-[WKImmediateActionController setPreviewTitle:]): Deleted. (-[WKImmediateActionController setPreviewLoading:]): Deleted. (-[WKImmediateActionController setPreviewOverrideImage:]): Deleted. (-[WKImmediateActionController _animationControllerForCustomPreview]): Deleted. * UIProcess/mac/WKPagePreviewViewController.h: Removed. * UIProcess/mac/WKPagePreviewViewController.mm: Removed. * UIProcess/mac/WKPreviewPopoverAnimationController.h: Removed. * UIProcess/mac/WKPreviewPopoverAnimationController.mm: Removed. * WebKit2.xcodeproj/project.pbxproj: Remove all of the custom web page preview code. Clients that want the custom preview can implement it by overriding the immediate action. 2015-01-05 Lucas Forschler Merge r177604. rdar://problem/19312111 2014-12-19 Timothy Horton Fix the build. * UIProcess/API/mac/WKView.mm: (-[WKView _setIgnoresNonWheelEvents:]): 2015-01-05 Lucas Forschler Merge r177601. 2014-12-19 Beth Dakin Preview popovers don't show an arrow for large links https://bugs.webkit.org/show_bug.cgi?id=139842 -and corresponding- Reviewed by Tim Horton. This patch addresses the case where the link is so large that there is no available space on any side once you factor in screen padding. In that case, we should give up early on not obscuring the link. * UIProcess/mac/WKPreviewPopoverAnimationController.mm: (-[WKPreviewPopoverAnimationController _targetSizeForPagePreview]): (-[WKPreviewPopoverAnimationController _effectivePaddingWithPreviewPadding:]): (-[WKPreviewPopoverAnimationController _maxSpaceAvailableOnYEdgeForOriginRect:withScreenRect:previewPadding:]): (-[WKPreviewPopoverAnimationController _maxSpaceAvailableOnXEdgeForOriginRect:withScreenRect:previewPadding:]): (-[WKPreviewPopoverAnimationController _preferredPopoverSizeWithPreviewPadding:forTargetSize:]): 2015-01-05 Lucas Forschler Merge r177600. 2014-12-19 Timothy Horton WKView's ignoresNonWheelEvents should ignore immediate actions https://bugs.webkit.org/show_bug.cgi?id=139839 Reviewed by Anders Carlsson. * UIProcess/API/mac/WKView.mm: (-[WKView initWithFrame:context:configuration:webView:]): (-[WKView _setIgnoresNonWheelEvents:]): Install/uninstall the immediate action gesture recognizer when toggling ignoresNonWheelEvents. 2014-12-18 Matthew Hanson Build fix. Unreviewed. * UIProcess/mac/WKPreviewPopoverAnimationController.mm: (-[WKPreviewPopoverAnimationController setPreviewOverrideImage:]): Explicitly pass float into the std::min template. 2014-12-18 Matthew Hanson Merge r177528. rdar://problem/19299367 2014-12-18 Beth Dakin Need to re-enable action menus https://bugs.webkit.org/show_bug.cgi?id=139795 -and corresponding- rdar://problem/19299367 Reviewed by Tim Horton. Re-enable the menus by un-commenting the code to create the menu and controller. * UIProcess/API/mac/WKView.mm: (-[WKView initWithFrame:context:configuration:webView:]): performActionMenuHitTest already takes a parameter indicating whether the hit test is for an immediate action or not. The callback didPerformActionMenuHitTest needs that information too so that it knows whether to call into the ActionMenuController or the ImmediateActionController. (-[WKView _didPerformActionMenuHitTest:forImmediateAction:userData:]): (-[WKView _didPerformActionMenuHitTest:userData:]): Deleted. * UIProcess/API/mac/WKViewInternal.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didPerformActionMenuHitTest): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::didPerformActionMenuHitTest): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performActionMenuHitTestAtLocation): 2014-12-18 Matthew Hanson Merge r177525. rdar://problem/19288547 2014-12-18 Timothy Horton Fix the build. * UIProcess/API/mac/WKView.mm: (-[WKView _setPreviewOverrideImage:]): 2014-12-18 Matthew Hanson Merge r177522. rdar://problem/19288547 2014-12-18 Timothy Horton Change page preview loading order, and add a TextIndicator https://bugs.webkit.org/show_bug.cgi?id=139793 Reviewed by Beth Dakin. * Shared/mac/ActionMenuHitTestResult.h: * Shared/mac/ActionMenuHitTestResult.mm: (WebKit::ActionMenuHitTestResult::encode): (WebKit::ActionMenuHitTestResult::decode): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performActionMenuHitTestAtLocation): Build a TextIndicator for links. * UIProcess/API/Cocoa/WKViewPrivate.h: * UIProcess/API/mac/WKView.mm: (-[WKView _dismissContentRelativeChildWindows]): (-[WKView _setPreviewTitle:]): (-[WKView _setPreviewLoading:]): Remove unneeded WK_API_ENABLED #ifs. (-[WKView _setPreviewOverrideImage:]): Add; forward to WKImmediateActionController. * UIProcess/mac/WKImmediateActionController.h: * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController willDestroyView:]): Shut down the WKPreviewPopoverAnimationController. (-[WKImmediateActionController _clearImmediateActionState]): (-[WKImmediateActionController immediateActionRecognizerWillPrepare:]): Don't build an immediate action item here; we'll always build it in willBeginAnimation, and the one we build here is likely to be wrong. (-[WKImmediateActionController _defaultAnimationController]): (-[WKImmediateActionController hidePreview]): (-[WKImmediateActionController setPreviewTitle:]): (-[WKImmediateActionController setPreviewLoading:]): (-[WKImmediateActionController setPreviewOverrideImage:]): (-[WKImmediateActionController _animationControllerForCustomPreview]): (-[WKImmediateActionController _createPreviewPopoverIfNeededForURL:]): Deleted. (-[WKImmediateActionController popoverWillClose:]): Deleted. (targetSizeFitsInAvailableSpace): Deleted. (-[WKImmediateActionController largestPopoverSize]): Deleted. (-[WKImmediateActionController _preferredPopoverSizeWithPreviewPadding:]): Deleted. (-[WKImmediateActionController pagePreviewViewController:viewForPreviewingURL:initialFrameSize:]): Deleted. (-[WKImmediateActionController pagePreviewViewController:titleForPreviewOfURL:]): Deleted. (-[WKImmediateActionController pagePreviewViewControllerWasClicked:]): Deleted. Move preview popover code to WKPreviewPopoverAnimationController. Install and uninstall the link text indicator when necessary. * UIProcess/mac/WKPagePreviewViewController.h: * UIProcess/mac/WKPagePreviewViewController.mm: (-[WKPagePreviewViewController setLoading:]): (-[WKPagePreviewViewController loadView]): (-[WKPagePreviewViewController replacePreviewWithImage:atSize:]): Allow overriding the preview with a full-view NSImage. Hide the preview view until the loading spinner goes away. * UIProcess/mac/WKPreviewPopoverAnimationController.h: Copied from Source/WebKit2/UIProcess/mac/WKImmediateActionController.h. * UIProcess/mac/WKPreviewPopoverAnimationController.mm: Added. (+[WKPreviewPopoverAnimationController _shouldImmediatelyShowPreview]): (-[WKPreviewPopoverAnimationController initWithURL:view:page:originRect:eventLocationInView:]): (-[WKPreviewPopoverAnimationController close]): (-[WKPreviewPopoverAnimationController setPreviewLoading:]): (-[WKPreviewPopoverAnimationController setPreviewOverrideImage:]): If we have shown the popover, choose a size strictly smaller than its current size. (-[WKPreviewPopoverAnimationController _hidePreview]): (-[WKPreviewPopoverAnimationController setPreviewTitle:]): (-[WKPreviewPopoverAnimationController _createPreviewPopover]): (-[WKPreviewPopoverAnimationController _showPreview]): (targetSizeFitsInAvailableSpace): (-[WKPreviewPopoverAnimationController largestPopoverSize]): (-[WKPreviewPopoverAnimationController _targetSizeForPagePreview]): (-[WKPreviewPopoverAnimationController _preferredPopoverSizeWithPreviewPadding:forTargetSize:]): (-[WKPreviewPopoverAnimationController _previewWatchdogTimerFired:]): (-[WKPreviewPopoverAnimationController recognizerWillBeginAnimation:]): (-[WKPreviewPopoverAnimationController recognizerDidUpdateAnimation:]): (-[WKPreviewPopoverAnimationController recognizerDidCancelAnimation:]): (-[WKPreviewPopoverAnimationController recognizerDidCompleteAnimation:]): (-[WKPreviewPopoverAnimationController recognizerDidDismissAnimation:]): (-[WKPreviewPopoverAnimationController pagePreviewViewController:viewForPreviewingURL:initialFrameSize:]): (-[WKPreviewPopoverAnimationController pagePreviewViewController:titleForPreviewOfURL:]): (-[WKPreviewPopoverAnimationController pagePreviewViewControllerWasClicked:]): (-[WKPreviewPopoverAnimationController popoverWillClose:]): Move code in from WKImmediateActionController. Forward NSImmediateActionAnimationControllerDelegate methods to the popover's animation controller if we've popped it. Pop the popover if we've loaded or 1 second has passed, whichever comes first. * WebKit2.xcodeproj/project.pbxproj: 2014-12-17 Matthew Hanson Merge r177473. rdar://problem/19286550 2014-12-17 Beth Dakin Page previews are sometimes sized much smaller than it seems they should be https://bugs.webkit.org/show_bug.cgi?id=139754 -and corresponding- rdar://problem/19286550 Reviewed by Tim Horton. Increase the minimum size and add in a missing else!! * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _preferredPopoverSizeWithPreviewPadding:]): 2014-12-17 Matthew Hanson Merge r177427. rdar://problem/19237945 2014-12-16 Timothy Horton Implement and adopt two new TextIndicator presentation animations https://bugs.webkit.org/show_bug.cgi?id=139715 Reviewed by Anders Carlsson. * UIProcess/API/mac/WKView.mm: (-[WKView _setTextIndicator:fadeOut:]): (-[WKView _setTextIndicatorAnimationProgress:]): (-[WKView _setTextIndicator:fadeOut:animationCompletionHandler:]): Deleted. * UIProcess/API/mac/WKViewInternal.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::WebPageProxy): (WebKit::WebPageProxy::setTextIndicatorAnimationProgress): (WebKit::WebPageProxy::performActionMenuHitTestAtLocation): * UIProcess/WebPageProxy.h: * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::setTextIndicatorAnimationProgress): (WebKit::PageClientImpl::didPerformDictionaryLookup): Remove the completion handler block argument from TextIndicator installation. Plumb animation progress through PageClient to TextIndicatorWindow. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController prepareForMenu:withEvent:]): (-[WKActionMenuController _defaultMenuItemsForDataDetectedText]): * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _clearImmediateActionState]): (-[WKImmediateActionController immediateActionRecognizerWillPrepare:]): (-[WKImmediateActionController immediateActionRecognizerDidUpdateAnimation:]): (-[WKImmediateActionController immediateActionRecognizerDidCancelAnimation:]): (-[WKImmediateActionController immediateActionRecognizerDidCompleteAnimation:]): (-[WKImmediateActionController _menuItemForDataDetectedText]): (-[WKImmediateActionController _animationControllerForText]): Forward immediate action gesture recognizer animation progress to TextIndicator. Force us to keep the selection when immediate action popovers steal first responder status from the WebView. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::textIndicatorTransitionForActionMenu): (WebKit::WebPage::performActionMenuHitTestAtLocation): Factor out the presentation animation decision code. For immediate actions, of the Lookup range is equal to the selection range, use a Crossfade animation; otherwise, use a FadeIn animation. Push whether the actionMenuHitTest is for an immediate action or a menu to the Web process, to make the presentation animation decision code live entirely in the Web process. Avoid extracting encoded image data if we know we're doing an immediate action and will never need it. 2014-12-17 Matthew Hanson Merge r177411. rdar://problem/19271854 2014-12-16 Beth Dakin Speculative build fix. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _animationControllerForCustomPreview]): 2014-12-17 Matthew Hanson Merge r177409. rdar://problem/19271854 2014-12-16 Beth Dakin REGRESSION: Preview popovers obscure the link, look wrong https://bugs.webkit.org/show_bug.cgi?id=139711 -and corresponding- rdar://problem/19271854 Reviewed by Tim Horton. Switch to using NSPopoverAnimationController. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _defaultAnimationController]): (-[WKImmediateActionController _animationControllerForCustomPreview]): 2014-12-17 Matthew Hanson Merge r177402. rdar://problem/19266297 2014-12-16 Conrad Shultz Add a progress indicator to the preview popover https://bugs.webkit.org/show_bug.cgi?id=139699 Reviewed by Tim Horton. * UIProcess/API/Cocoa/WKViewPrivate.h: * UIProcess/API/mac/WKView.mm: (-[WKView _setPreviewLoading:]): Wrap -[WKImmediateActionController setPreviewLoading:]. * UIProcess/mac/WKImmediateActionController.h: * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _createPreviewPopoverIfNeededForURL:]): Flag the preview view controller as loading before beginning the load. (-[WKImmediateActionController setPreviewLoading:]): Wrap -[WKPagePreviewViewController setLoading:]. * UIProcess/mac/WKPagePreviewViewController.h: * UIProcess/mac/WKPagePreviewViewController.mm: (-[WKPagePreviewViewController setLoading:]): Toggle the progress indicator animation state. (-[WKPagePreviewViewController isLoading]): Accessor. (-[WKPagePreviewViewController loadView]): Create and center an indeterminate progress indicator that won't scale with the preview content. 2014-12-16 Matthew Hanson Merge r177406. rdar://problem/19270279 2014-12-16 Timothy Horton Immediate action popovers can get stuck open https://bugs.webkit.org/show_bug.cgi?id=139709 Reviewed by Beth Dakin. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _clearImmediateActionState]): Don't clear the animation controller; it breaks things and was unnecessary. 2014-12-16 Matthew Hanson Build Fix. Reviewed by Dana Burkart. * UIProcess/mac/WKImmediateActionController.h: Hide the method declaration for setPreviewTitle: into an WK_API_ENABLED ifdef 2014-12-16 Matthew Hanson Merge r177371. rdar://problem/19266902 2014-12-16 Tim Horton Disable TextIndication for Lookup immediate actions https://bugs.webkit.org/show_bug.cgi?id=139684 Reviewed by Anders Carlsson. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _animationControllerForText]): 2014-12-16 Matthew Hanson Merge r177230. rdar://problem/19208291 2014-12-12 Mark Rowe Fix the 32-bit build. * UIProcess/API/mac/WKView.mm: (-[WKView _setPreviewTitle:]): 2014-12-16 Dana Burkart Merged r177323. 2014-12-15 Beth Dakin Make lookup an immediate action instead of an action menu item https://bugs.webkit.org/show_bug.cgi?id=139661 -and corresponding- rdar://problem/19198414 Reviewed by Tim Horton. New type. * Shared/API/c/WKImmediateActionTypes.h: ActionMenuHitTestResult now includes a DictionaryPopupInfo. * Shared/mac/ActionMenuHitTestResult.h: * Shared/mac/ActionMenuHitTestResult.mm: (WebKit::ActionMenuHitTestResult::encode): (WebKit::ActionMenuHitTestResult::decode): Remove all lookup menu items. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForText]): (-[WKActionMenuController _defaultMenuItemsForEditableText]): (-[WKActionMenuController _defaultMenuItemsForEditableTextWithSuggestions]): (-[WKActionMenuController _createActionMenuItemForTag:]): (-[WKActionMenuController _lookupText:]): Deleted. Set the defaultAnimationController to the lookup-provided animation controller when appropriate. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _defaultAnimationController]): (-[WKImmediateActionController _animationControllerForText]): Re-factor performDictionaryLookupForRange() so that most of the work is done in a new function called dictionaryPopupInfoForRange(). This was that code can be used for both performing a dictionary lookup and just getting the DictionaryPopupInfo for the ActionMenuHitTest. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::dictionaryPopupInfoForRange): (WebKit::WebPage::performDictionaryLookupForRange): (WebKit::WebPage::performActionMenuHitTestAtLocation): (WebKit::WebPage::lookupTextAtLocation): 2014-12-16 Dana Burkart Merged r177303. 2014-12-15 Timothy Horton Implement Data Detectors immediate actions for WebKit2 https://bugs.webkit.org/show_bug.cgi?id=139617 Reviewed by Beth Dakin. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _menuItemForDataDetectedText]): Note that this action context is only for immediate actions. 2014-12-15 Myles C. Maxfield Addressing post-review comments in r177035 https://bugs.webkit.org/show_bug.cgi?id=139557 Reviewed by Darin Adler. * Shared/WebHitTestResult.cpp: (WebKit::WebHitTestResult::Data::elementBoundingBoxInWindowCoordinates): Migrate off rendererBoundingBox(). * WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp: (WebKit::WebPage::findZoomableAreaForPoint): Ditto. 2014-12-16 Dana Burkart Merged r177298. 2014-12-15 Timothy Horton Implement Data Detectors immediate actions for WebKit2 https://bugs.webkit.org/show_bug.cgi?id=139617 Reviewed by Beth Dakin. * Shared/API/c/WKImmediateActionTypes.h: Add a new type. * UIProcess/API/mac/WKView.mm: (-[WKView mouseDown:]): Send mouseDown along to the WKImmediateActionController too. (-[WKView initWithFrame:context:configuration:webView:]): Temporarily disable action menus. (-[WKView _dismissContentRelativeChildWindows]): Hide the immediate action preview when detaching child windows. * UIProcess/mac/WKImmediateActionController.h: * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController willDestroyView:]): Clear the DDActionContext when tearing down the view. (-[WKImmediateActionController wkView:willHandleMouseDown:]): (-[WKImmediateActionController _cancelImmediateAction]): (-[WKImmediateActionController _clearImmediateActionState]): (-[WKImmediateActionController immediateActionRecognizerWillPrepare:]): (-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]): (-[WKImmediateActionController _defaultAnimationController]): (-[WKImmediateActionController _updateImmediateActionItem]): (-[WKImmediateActionController hidePreview]): (-[WKImmediateActionController popoverWillClose:]): (-[WKImmediateActionController _menuItemForDataDetectedText]): Copy most of the DataDetectors implementation into WKImmediateActionController. 2014-12-15 Myles C. Maxfield Delete Notation because we don't use it https://bugs.webkit.org/show_bug.cgi?id=139171 Reviewed by Kent Tamura. * WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm: (WebKit::WKDOMNodeClass): * mac/MigrateHeadersFromWebKitLegacy.make: 2014-12-16 Dana Burkart Merged r177242. 2014-12-12 Timothy Horton TextIndicator (and other view-relative subwindows) is not dismissed on zoom gesture https://bugs.webkit.org/show_bug.cgi?id=139580 Reviewed by Anders Carlsson. * UIProcess/PageClient.h: * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::dismissContentRelativeChildWindows): (WebKit::PageClientImpl::dismissDictionaryLookupPanel): Deleted. (WebKit::PageClientImpl::dismissActionMenuPopovers): Deleted. Merge dismissDictionaryLookupPanel and dismissActionMenuPopovers into _dismissContentRelativeChildWindows, which also dismisses TextIndicator and the text correction panel. Dismissal of any child windows which are anchored to the page content now bottlenecks through this function. (WebKit::PageClientImpl::navigationGestureDidBegin): Dismiss all anchored subwindows when starting a navigation gesture, not just TextIndicator and action menu popovers. * UIProcess/API/mac/WKView.mm: (-[WKView scrollWheel:]): No need to dismiss TextIndicator here; we've got this covered in the more-inclusive WebPageProxy::pageDidScroll, and will now dismiss more things. (-[WKView mouseDown:]): Dismiss more things. (-[WKView viewDidMoveToWindow]): Dismiss more things. (-[WKView _dismissContentRelativeChildWindows]): The aforementioned combined dismissal function. (-[WKView magnifyWithEvent:]): (-[WKView smartMagnifyWithEvent:]): (-[WKView setMagnification:centeredAtPoint:]): (-[WKView setMagnification:]): Any time the page magnification changes, dismiss all the things. * UIProcess/API/mac/WKViewPrivate.h: Expose _dismissContentRelativeChildWindows instead of _dismissActionMenuPopovers; for all existing clients, it makes more sense to dismiss all view-relative subwindows than just a subset of them. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::pageDidScroll): (WebKit::WebPageProxy::resetStateAfterProcessExited): Make use of dismissAnchoredSubwindows. * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController prepareForMenu:withEvent:]): Dismiss more things. (-[WKActionMenuController _defaultMenuItemsForDataDetectedText]): (-[WKActionMenuController dismissActionMenuPopovers]): Deleted. dismissActionMenuPopovers is folded into WKView's _dismissContentRelativeChildWindows. (-[WKActionMenuController _showTextIndicator]): Deleted. (-[WKActionMenuController _hideTextIndicator]): Deleted. Fold _showTextIndicator and _hideTextIndicator into their only callers. _isShowingTextIndicator was never necessary, because it's OK to change the current TextIndicator at any time, and a newer one is always more relevant. 2014-12-16 Dana Burkart Merged r177192. 2014-12-11 Beth Dakin WK2: Need new SPI for Webkit clients to override default immediate action https://bugs.webkit.org/show_bug.cgi?id=139564 -and corresponding- rdar://problem/19225448 Reviewed by Tim Horton. New SPI _immediateActionAnimationControllerForHitTestResult:withType:userData: * UIProcess/API/Cocoa/WKViewPrivate.h: * UIProcess/API/mac/WKView.mm: (-[WKView _immediateActionAnimationControllerForHitTestResult:withType:userData:]): Keep at ivar for the userData so that it can be passed to the new SPI. * UIProcess/mac/WKImmediateActionController.h: * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _clearImmediateActionState]): (-[WKImmediateActionController didPerformActionMenuHitTest:userData:]): Always give the SPI a chance to override the animationController. (-[WKImmediateActionController _updateImmediateActionItem]): Need to mark WKImmediateActionTypes.h as Private. * WebKit2.xcodeproj/project.pbxproj: 2014-12-16 Dana Burkart Merged r177186. 2014-12-11 Timothy Horton Move the preview popover to WebImmediateActionController https://bugs.webkit.org/show_bug.cgi?id=139563 Reviewed by Beth Dakin. * UIProcess/mac/WKImmediateActionController.h: Remove an unnecessary forward declaration. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController willDestroyView:]): Clear the immediate action recognizer when the view goes away. 2014-12-16 Dana Burkart Merged r177183. 2014-12-11 Timothy Horton Fix the build. * UIProcess/mac/WKImmediateActionController.h: * UIProcess/mac/WKImmediateActionController.mm: 2014-12-16 Dana Burkart Merged r177180. 2014-12-11 Timothy Horton Move the preview popover to WKImmediateActionController https://bugs.webkit.org/show_bug.cgi?id=139560 Reviewed by Beth Dakin. * Shared/API/c/WKImmediateActionTypes.h: Add a link preview type. * UIProcess/API/mac/WKView.mm: (-[WKView initWithFrame:context:configuration:webView:]): Pass the gesture recognizer to the WKImmediateActionController. (-[WKView _setPreviewTitle:]): Forward preview title changes to the WKImmediateActionController, because that's where the preview popover lives now. * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: Move WKPagePreviewViewController into its own file. Move page preview popover related code to WKImmediateActionController. * UIProcess/mac/WKImmediateActionController.h: * UIProcess/mac/WKImmediateActionController.mm: Compare the gesture recognizers directly instead of their views, for accuracy. Move page preview popover related code in from WKActionMenuController. Some of this should eventually move to WKPagePreviewViewController, but for now for ease of transition we will move it here. * UIProcess/mac/WKPagePreviewViewController.h: Added. * UIProcess/mac/WKPagePreviewViewController.mm: Added. * WebKit2.xcodeproj/project.pbxproj: Move WKPagePreviewViewController into its own file. 2014-12-16 Dana Burkart Merged r177116. 2014-12-10 Beth Dakin Follow-up build fix. * UIProcess/API/mac/WKView.mm: (-[WKView initWithFrame:context:configuration:webView:]): 2014-12-16 Dana Burkart Merged r177114. 2014-12-10 Beth Dakin Speculative build fix. * UIProcess/API/mac/WKView.mm: (-[WKView initWithFrame:context:configuration:webView:]): 2014-12-15 Dana Burkart Merged r177113. 2014-12-10 Beth Dakin WK2: Add initial support for immediate actions https://bugs.webkit.org/show_bug.cgi?id=139511 Reviewed by Tim Horton. New enum to track immediate action types as we add them. * Shared/API/c/WKImmediateActionTypes.h: Added. Create an NSImmediateActionGestureRecognizer if possible and a controller. * UIProcess/API/mac/WKView.mm: (-[WKView dealloc]): (-[WKView initWithFrame:context:configuration:webView:]): (-[WKView _didPerformActionMenuHitTest:userData:]): This basic implementation of the controller will use the delegate methods to perform an ActionMenuHitTest when relevant. Future patches will patch _updateImmediateActionItem to use the hit test result to determine if there is any immediate action that should be taken. * UIProcess/mac/WKImmediateActionController.h: Added. * UIProcess/mac/WKImmediateActionController.mm: Added. (-[WKImmediateActionController willDestroyView:]): (-[WKImmediateActionController _clearImmediateActionState]): (-[WKImmediateActionController didPerformActionMenuHitTest:userData:]): Does much of the work done in Action Menu’s prepareForMenu. (-[WKImmediateActionController immediateActionRecognizerWillPrepare:]): Does much of the work done in Action Menu’s menuNeedsUpdate. (-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]): Does much of the work done in Action Menu’s didCloseMenu. (-[WKImmediateActionController immediateActionRecognizerDidCancelAnimation:]): Does much of the work done in Action Menu’s willOpenMenu. (-[WKImmediateActionController immediateActionRecognizerDidCompleteAnimation:]): To be filled in. (-[WKImmediateActionController _updateImmediateActionItem]): * WebKit2.xcodeproj/project.pbxproj: 2014-12-15 Matthew Hanson Merge r177253. rdar://problem/19221935 2014-12-12 Beth Dakin Need a fake mouse move after hiding data detectors UI https://bugs.webkit.org/show_bug.cgi?id=139608 -and corresponding- rdar://problem/19221935 Reviewed by Tim Horton. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::dataDetectorsDidHideUI): 2014-12-11 Matthew Hanson Merge r177106. rdar://problem/19135389 2014-12-10 Timothy Horton Fix the build. * UIProcess/API/mac/WKView.mm: (-[WKView _targetWindowForMovePreparation]): 2014-12-11 Matthew Hanson Merge r177104. rdar://problem/19135389 2014-12-10 Timothy Horton Provide SPI to asynchronously move a WKView into a window and know when it has painted https://bugs.webkit.org/show_bug.cgi?id=139460 Reviewed by Anders Carlsson. * UIProcess/API/Cocoa/WKViewPrivate.h: Add _prepareForMoveToWindow:withCompletionHandler:, which internally goes through the motions of being parented in that window and calls the completion handler once painting is done and the view is ready to be displayed (upon which we expect the view to actually move into the window). * UIProcess/API/mac/WKView.mm: (-[WKView viewWillMoveToWindow:]): If we currently have a _targetWindowForMovePreparation (and are pretending to be in that window), avoid performing viewWillMoveToWindow: for a different window. (-[WKView viewDidMoveToWindow]): (-[WKView doWindowDidChangeScreen]): (-[WKView _intrinsicDeviceScaleFactor]): (-[WKView _colorSpace]): (-[WKView _targetWindowForMovePreparation]): If we have a _targetWindowForMovePreparation, use its properties instead of self.window's. (-[WKView _prepareForMoveToWindow:withCompletionHandler:]): Simulate a move into the target window, but defer sending the view state update. Then, send the view state update after registering the completion handler. * UIProcess/API/mac/WKViewInternal.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::WebPageProxy): Rename m_viewStateChangeWantsReply to m_viewStateChangeWantsSynchronousReply. (WebKit::WebPageProxy::installViewStateChangeCompletionHandler): Added. Allow installing a block that will be called the next time we get a didUpdateViewState back from the WebProcess after pushing the current view state changes. (WebKit::WebPageProxy::viewStateDidChange): Adapt to the aforementioned rename. (WebKit::WebPageProxy::dispatchViewStateChange): Adapt to the aforementioned rename. Send the view state change callback IDs along with SetViewState. (WebKit::WebPageProxy::updateViewState): Adapt to the aforementioned rename. * UIProcess/WebPageProxy.h: * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::activeWindow): (WebKit::PageClientImpl::isViewWindowActive): (WebKit::PageClientImpl::isViewVisible): (WebKit::PageClientImpl::isViewVisibleOrOccluded): (WebKit::PageClientImpl::isViewInWindow): (WebKit::PageClientImpl::viewLayerHostingMode): If we have a _targetWindowForMovePreparation, use its properties instead of the WKView's window's. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::viewStateDidChange): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::reinitializeWebPage): (WebKit::WebPage::setViewState): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::viewStateDidChange): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::viewStateDidChange): Push the callback IDs to the WebProcess, and accumulate them in TiledCoreAnimationDrawingArea. (WebKit::TiledCoreAnimationDrawingArea::didUpdateViewStateTimerFired): Call all of the callbacks after one runloop cycle, just like DidUpdateViewState. 2014-12-11 Matthew Hanson Merge r177111. rdar://problem/19198388 2014-12-10 Timothy Horton Should have copy and paste items in all text menus https://bugs.webkit.org/show_bug.cgi?id=139510 Reviewed by Beth Dakin. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForText]): Add a disabled paste menu item into the read-only text menu. (-[WKActionMenuController _defaultMenuItemsForWhitespaceInEditableArea]): Add a disabled copy menu item into the editable whitespace text menu. 2014-12-10 Matthew Hanson Merge r176999. rdar://problem/19149219 2014-12-08 Beth Dakin Copy and Lookup menu items should be disabled when something is not copyable https://bugs.webkit.org/show_bug.cgi?id=139423 Reviewed by Tim Horton. Add allowsCopy to the WebHitTestResult. * Shared/WebHitTestResult.cpp: (WebKit::WebHitTestResult::Data::Data): (WebKit::WebHitTestResult::Data::encode): (WebKit::WebHitTestResult::Data::decode): * Shared/WebHitTestResult.h: (WebKit::WebHitTestResult::allowsCopy): Set autoenablesItems to NO. It’s messing with our ability to control the enable/ disable state otherwise. * UIProcess/API/mac/WKView.mm: (-[WKView initWithFrame:context:configuration:webView:]): Disable both lookup and copy when a WebHitTestResult does not allow copy. * UIProcess/mac/WKActionMenuController.mm: 2014-12-08 Matthew Hanson Merge r176883. 2014-12-05 Tim Horton If the action menu hit test times out, a menu with a single separator appears https://bugs.webkit.org/show_bug.cgi?id=139320 Reviewed by Beth Dakin. * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController menuNeedsUpdate:]): (-[WKActionMenuController _defaultMenuItems]): Add a new "TimedOut" state, which we get into if the sync wait for didPerformActionMenuHitTest times out. In this case, we'll drop the separator item and give up on the menu. This way, the menu will never have just a single separator item at the end of menuNeedsUpdate:. 2014-12-08 Matthew Hanson Merge r176870. 2014-12-05 Tim Horton Keyboard input should be disabled in the preview popover https://bugs.webkit.org/show_bug.cgi?id=139219 Reviewed by Anders Carlsson. * UIProcess/API/mac/WKView.mm: (-[WKView performKeyEquivalent:]): (-[WKView keyUp:]): (-[WKView keyDown:]): (-[WKView flagsChanged:]): There are two implementations of each of these methods in this file. Adjust the ones that the original patch missed. 2014-12-08 Matthew Hanson Merge r176116. 2014-11-13 Dan Bernstein Two WKWebView internal methods are implemented in a category https://bugs.webkit.org/show_bug.cgi?id=138728 Reviewed by Tim HOrton. Moved the implementations from the category to the class. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _ignoresNonWheelMouseEvents]): (-[WKWebView _setIgnoresNonWheelMouseEvents:]): 2014-12-08 Matthew Hanson Merge r176596. 2014-12-01 Joseph Pecoraro Web Inspector: Crash in WebInspectorClient::hideHighlight when page is destroyed https://bugs.webkit.org/show_bug.cgi?id=139136 Reviewed by Simon Fraser. * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::hideHighlight): Speculatively fix by null-checking the main frame which can be null during page destruction. 2014-12-05 Dana Burkart Merge r176820. 2014-12-04 Beth Dakin Clients disabling action menus sometimes still invoke action menu behaviors https://bugs.webkit.org/show_bug.cgi?id=139270 -and corresponding- rdar://problem/19147218 Reviewed by Tim Horton. By default, we will keep a single item in the action menu up until the point where _state == ActionMenuState::Ready. So by checking _state here, we are preventing clients from opting out of our choice to wait. Ideally we would always still wait for the Ready state, but this will get the best behavior in the mean time. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _updateActionMenuItems]): 2014-12-05 Dana Burkart Merge r176811. 2014-12-04 Timothy Horton Fix the 32-bit build. * UIProcess/API/mac/WKView.mm: (-[WKView _setTextIndicator:fadeOut:animationCompletionHandler:]): 2014-12-05 Dana Burkart Merge r176810. 2014-12-04 Tim Horton TextIndicator::createWithSelectionInFrame does synchronous IPC in WebKit2 https://bugs.webkit.org/show_bug.cgi?id=139252 Reviewed by Anders Carlsson. It turns out contentsToScreen requires sync IPC in Mac WebKit2, which we really don't want to be doing here (especially since the UI process will often be sitting in waitForAndDispatchImmediately waiting for didPerformActionMenuHitTest). Go back to keeping TextIndicator rects in "window" coordinates and do the conversion in each of the WebKits instead of trying to share that code. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * UIProcess/API/mac/WKView.mm: (-[WKView _setTextIndicator:fadeOut:animationCompletionHandler:]): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindIndicator): (WebKit::FindController::drawRect): Adjust to the WebCore changes. 2014-12-05 Dana Burkart Merge r173566. 2014-09-11 Andy Estes [WebKit2] WKImageCreateCGImage crashes when passed a null WKImage https://bugs.webkit.org/show_bug.cgi?id=136768 Reviewed by Tim Horton. WKImageCreateFromCGImage can return null, so it only seems fair that WKImageCreateCGImage should tolerate null. * Shared/API/c/cg/WKImageCG.cpp: (WKImageCreateCGImage): 2014-12-04 Dana Burkart Merge r176766. 2014-12-03 Beth Dakin elements get whitespace action menu instead of editable text menu https://bugs.webkit.org/show_bug.cgi?id=139241 -and corresponding- rdar://problem/19072083 Reviewed by Sam Weinig. Add isOverTextInsideFormControlElement to WebHitTestResult. * Shared/WebHitTestResult.cpp: (WebKit::WebHitTestResult::Data::Data): (WebKit::WebHitTestResult::Data::encode): (WebKit::WebHitTestResult::Data::decode): * Shared/WebHitTestResult.h: (WebKit::WebHitTestResult::isOverTextInsideFormControlElement): Offer the text menus for text inside form controls. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItems]): We should disallow shadow content in the hit test. This is the default and it is how context menus behave. We originally wanted to text inside shadow content so that we could find the text, but the new function I added to HitTestResult will allow that. * WebProcess/WebPage/mac/WebPageMac.mm: Adjust to the fact that we don’t hit test shadow content any more. (WebKit::WebPage::performActionMenuHitTestAtLocation): (WebKit::WebPage::lookupTextAtLocation): (WebKit::WebPage::focusAndSelectLastActionMenuHitTestResult): 2014-12-04 Dana Burkart Merge r173235. 2014-09-03 Enrica Casucci Remove PLATFORM(IOS) from WebCore/editing (Part 1). https://bugs.webkit.org/show_bug.cgi?id=136474 Reviewed by Tim Horton. * UIProcess/WebEditCommandProxy.cpp: (WebKit::WebEditCommandProxy::nameForEditAction): 2014-12-04 Dana Burkart Merge r176763. 2014-12-03 Tim Horton Implement action menus for tel: URLs https://bugs.webkit.org/show_bug.cgi?id=139240 Reviewed by Anders Carlsson. * Shared/API/c/WKActionMenuTypes.h: Add a new type. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForDataDetectableLink]): Rename this function as it will work for both mailto and tel URLs. Adjust it to use contextForView:. (-[WKActionMenuController _clearActionMenuState]): (-[WKActionMenuController menuNeedsUpdate:]): (-[WKActionMenuController _defaultMenuItems]): Don't check the menu type when going to interact with _currentActionContext. We'll only have a _currentActionContext if we have a data detected item, and there are multiple menu types that end up using DDActionContext. 2014-12-03 Dana Burkart Merge r176753. 2014-12-03 Tim Horton Keyboard input should be disabled in the preview popover https://bugs.webkit.org/show_bug.cgi?id=139219 Reviewed by Anders Carlsson. Make sure that keyboard input, Quick Look, etc. are blocked in preview popovers and WKThumbnailViews. Also block the fake mouseMove events that originate in the Web process upon scrolling, because we were missing those despite blocking ordinary mouseMove events. * UIProcess/API/Cocoa/WKViewPrivate.h: * UIProcess/API/mac/WKView.mm: Rename _ignoresNonWheelMouseEvents to _ignoresNonWheelEvents, because it will apply not only to mouse events but also key events, Quick Look events, menu preparation events, swipe events, etc. Add _ignoresAllEvents, which means the same thing as _ignoresNonWheelEvents with the addition of ignoring scrollWheel events. (-[WKView scrollWheel:]): (-[WKView swipeWithEvent:]): (-[WKView mouseMoved:]): (-[WKView mouseDown:]): (-[WKView mouseUp:]): (-[WKView mouseDragged:]): Adjust to the new name. (-[WKView performKeyEquivalent:]): (-[WKView keyUp:]): (-[WKView keyDown:]): (-[WKView flagsChanged:]): (-[WKView quickLookWithEvent:]): (-[WKView prepareForMenu:withEvent:]): (-[WKView willOpenMenu:withEvent:]): (-[WKView didCloseMenu:withEvent:]): Block all of these events as well as those we were previously blocking. (-[WKView _setIgnoresAllEvents:]): (-[WKView _setIgnoresNonWheelMouseEvents:]): (-[WKView _setIgnoresNonWheelEvents:]): (-[WKView _ignoresNonWheelEvents]): (-[WKView _ignoresAllEvents]): * UIProcess/API/mac/WKViewInternal.h: Adjust to the new names and the addition of ignoresAllEvents. * UIProcess/mac/WKActionMenuController.mm: (-[WKPagePreviewViewController loadView]): Adjust to the new name. (-[WKActionMenuController prepareForMenu:withEvent:]): Move bailing from prepareForMenu: up to WKView. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _ignoresNonWheelEvents]): (-[WKWebView _setIgnoresNonWheelEvents:]): (-[WKWebView _ignoresNonWheelMouseEvents]): Deleted. (-[WKWebView _setIgnoresNonWheelMouseEvents:]): Deleted. * UIProcess/API/Cocoa/WKWebViewInternal.h: Adjust to the new name (without "mouse" in it). * UIProcess/API/Cocoa/_WKThumbnailView.mm: (-[_WKThumbnailView _viewWasUnparented]): (-[_WKThumbnailView _viewWasParented]): Explicitly tell WKView to disable event handling while thumbnailed, instead of having WKView special-case thumbnail views internally. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setShouldDispatchFakeMouseMoveEvents): * UIProcess/WebPageProxy.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::shouldDispatchFakeMouseMoveEvents): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::shouldDispatchFakeMouseMoveEvents): (WebKit::WebPage::setShouldDispatchFakeMouseMoveEvents): * WebProcess/WebPage/WebPage.messages.in: Plumb shouldDispatchFakeMouseMoveEvents from the UI process to the Web process and through to WebKit2's ChromeClient implementation. 2014-12-04 Dana Burkart Merge r176707. 2014-12-02 Conrad Shultz Don't block menu highlighting when presenting a page preview https://bugs.webkit.org/show_bug.cgi?id=139217 Reviewed by Tim Horton. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _previewURLFromActionMenu:]): Defer popover presentation to the next turn of the runloop. 2014-12-03 Dana Burkart Merge r176691. 2014-12-02 Beth Dakin Build fix. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForLink]): 2014-12-03 Dana Burkart Merge r176690. 2014-12-02 Beth Dakin More build fix. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForLink]): 2014-12-03 Dana Burkart Merge r176684. 2014-12-02 Beth Dakin Should use standardQuickLookMenuItem for apps that don't implement customizations https://bugs.webkit.org/show_bug.cgi?id=139193 -and corresponding- rdar://problem/18944696 Reviewed by Anders Carlsson. New SPI will allow clients to opt-out of the standardQuickLookMenuItem. By default, opt in. * UIProcess/API/Cocoa/WKViewPrivate.h: * UIProcess/API/mac/WKView.mm: (-[WKView _shouldUseStandardQuickLookPreview]): * UIProcess/mac/WKActionMenuController.mm: Use [NSMenuItem standardQuickLookMenuItem] unless the client has requested otherwise. (-[WKActionMenuController _defaultMenuItemsForLink]): Delegate methods to set up the standardQuickLookMenuItem. (-[WKActionMenuController menuItem:viewAtScreenPoint:]): (-[WKActionMenuController menuItem:previewItemAtPoint:]): (-[WKActionMenuController menuItem:preferredEdgeForPoint:]): 2014-12-03 Dana Burkart Merge r176678. 2014-12-02 Tim Horton TextIndicator can get stuck (especially if we don't get LUNotificationPopoverWillClose when we should) https://bugs.webkit.org/show_bug.cgi?id=139175 Reviewed by Beth Dakin. * UIProcess/API/mac/WKView.mm: (-[WKView scrollWheel:]): (-[WKView mouseDown:]): Work around by always explicitly clearing the active text indicator in mouseDown: and scrollWheel:. This way, even if you manage to get a text indicator that outlives the Look Up popover (or find-in-page, or whatever), it will be dismissed by clicking or scrolling the view. 2014-12-02 Dana Burkart Merge r176474. 2014-11-21 Tim Horton Crashes while encoding a TextIndicator with no contentImageWithHighlight https://bugs.webkit.org/show_bug.cgi?id=138984 Reviewed by Sam Weinig. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): encodeImage doesn't deal with null images, so handle that case gracefully. 2014-12-02 Dana Burkart Merge r176613. 2014-12-01 Conrad Shultz Clients need a way to explicitly set the title of a page preview https://bugs.webkit.org/show_bug.cgi?id=139161 Reviewed by Beth Dakin. This implicitly assumes that only one page preview can be associate with a given WKView at a time. * UIProcess/API/Cocoa/WKViewPrivate.h: * UIProcess/API/mac/WKView.mm: (-[WKView _setPreviewTitle:]): Wrap -[WKActionMenuController setPreviewTitle:] * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: Add ivars for the title and the title text field (previously not independently exposed). (-[WKPagePreviewViewController previewTitle]): Accessor. (-[WKPagePreviewViewController setPreviewTitle:]): Accessor; set the text field's string value. (-[WKPagePreviewViewController loadView]): Adopt the _titleTextField ivar; assume that if a client has explicitly set the previewTitle then we don't need to ask for it again. (-[WKActionMenuController setPreviewTitle:]): Wrap -[WKPagePreviewViewController setPreviewTitle:]. 2014-12-02 Dana Burkart Merge r176599. 2014-12-01 Tim Horton Implement yellow highlight for WebKit1 data detectors https://bugs.webkit.org/show_bug.cgi?id=138956 Reviewed by Beth Dakin. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindIndicator): (WebKit::FindController::drawRect): Adjust to the fact that TextIndicator keeps screen-relative rects. 2014-12-02 Dana Burkart Merge r176462. 2014-11-21 Tim Horton Move TextIndicator{Window} to WebCore https://bugs.webkit.org/show_bug.cgi?id=138954 Some adjustments by Csaba Osztrogonác. Reviewed by Anders Carlsson. * CMakeLists.txt: Remove TextIndicator.cpp. * Scripts/webkit/messages.py: (struct_or_class): (headers_for_type): Tell messages.py that TextIndicatorData is a struct, and comes from TextIndicator.h. * Shared/WebCoreArgumentCoders.h: * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): Add argument coders for TextIndicatorData. * Shared/DictionaryPopupInfo.h: * Shared/mac/ActionMenuHitTestResult.h: * Shared/mac/ActionMenuHitTestResult.mm: * UIProcess/API/gtk/PageClientImpl.h: * UIProcess/API/gtk/PageClientImpl.cpp: * UIProcess/API/mac/WKView.mm: * UIProcess/API/mac/WKViewInternal.h: * UIProcess/CoordinatedGraphics/WebView.h: * UIProcess/CoordinatedGraphics/WebView.cpp: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/WKContentView.h: * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: * UIProcess/mac/WKActionMenuController.mm: * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm: * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: * WebProcess/WebPage/mac/WebPageMac.mm: Adjust to TextIndicator and TextIndicatorWindow's new home. 2014-12-02 Dana Burkart Merge r176574. 2014-11-29 Anders Carlsson Crash when calling WKPageClose on the originated page from within createNewPage callback https://bugs.webkit.org/show_bug.cgi?id=139099 Reviewed by Sam Weinig. Null check the namespace ID. * UIProcess/Storage/StorageManager.cpp: (WebKit::StorageManager::cloneSessionStorageNamespaceInternal): 2014-12-02 Dana Burkart Merge r176570. 2014-11-28 Tim Horton Stale userData is handed to WKView _actionMenuItemsForHitTestResult under prepareForMenu https://bugs.webkit.org/show_bug.cgi?id=139069 Reviewed by Sam Weinig. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController wkView:willHandleMouseDown:]): (-[WKActionMenuController didCloseMenu:withEvent:]): (-[WKActionMenuController _clearActionMenuState]): Previously, _userData was not being cleared in didCloseMenu, so a subsequent action menu invocation would end up sending stale userData to _actionMenuItemsForHitTestResult. Additionally, factor all of the cleanup code out into _clearActionMenuState, and call it from both wkView:willHandleMouseDown: and didCloseMenu:withEvent:. 2014-12-02 Dana Burkart Merge r176569. 2014-11-26 Timothy Horton DataDetectors PageOverlay callbacks are never called https://bugs.webkit.org/show_bug.cgi?id=139067 Reviewed by Anders Carlsson. * Shared/mac/ActionMenuHitTestResult.mm: (WebKit::ActionMenuHitTestResult::encode): (WebKit::ActionMenuHitTestResult::decode): Encode/decode the PageOverlay ID. 2014-12-02 Dana Burkart Merge r176511. 2014-11-23 Conrad Shultz Page previews should have titles https://bugs.webkit.org/show_bug.cgi?id=139020 Reviewed by Tim Horton. * UIProcess/API/Cocoa/WKViewPrivate.h: Declare -_titleForPreviewOfURL:. * UIProcess/API/mac/WKView.mm: (-[WKView _titleForPreviewOfURL:]): Stub implementation. * UIProcess/mac/WKActionMenuController.mm: (+[WKPagePreviewViewController previewPadding]): Account for the title height. (-[WKPagePreviewViewController loadView]): Set correct autoresize masks on some views; create and configure a title view that is horizontally and vertically centered. (-[WKActionMenuController pagePreviewViewController:titleForPreviewOfURL:]): WKPagePreviewViewControllerDelegate method; wrap -[WKView _titleForPreviewOfURL:]. 2014-11-21 Jer Noble Support multiple signatures of diagnostic logging. https://bugs.webkit.org/show_bug.cgi?id=138690 Reviewed by Anders Carlsson. Extend the existing WKBundlePageDiagnosticLoggingClient interface by deprecating the original logDiagnosticMessage client method in V1 and adding three new, explicit client methods. * CMakeLists.txt: * WebKit2.xcodeproj/project.pbxproj: * WebProcess/InjectedBundle/API/c/WKBundlePageDiagnosticLoggingClient.h: * WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.cpp: (WebKit::InjectedBundlePageDiagnosticLoggingClient::logDiagnosticMessageDeprecated): Renamed from logDiagnosticMessage(). (WebKit::InjectedBundlePageDiagnosticLoggingClient::logDiagnosticMessage): Pass to the client. (WebKit::InjectedBundlePageDiagnosticLoggingClient::logDiagnosticMessageWithResult): Ditto. (WebKit::InjectedBundlePageDiagnosticLoggingClient::logDiagnosticMessageWithValue): Ditto. * WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.h: * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::logDiagnosticMessage): Deleted. * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp: Added. (WebKit::WebDiagnosticLoggingClient::WebDiagnosticLoggingClient): Simple constructor. (WebKit::WebDiagnosticLoggingClient::~WebDiagnosticLoggingClient): Simple destructor. (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessage): Pass to the injected bundle. (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithResult): Ditto. (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithValue): Ditto. * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h: Added. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): Initialize the new client. 2014-12-02 Dana Burkart Merge r176486. 2014-11-21 Timothy Horton Fix the build. * UIProcess/API/mac/WKView.mm: (-[WKView mouseDown:]): 2014-12-02 Dana Burkart Merge r176485. 2014-11-21 Beth Dakin The preview action menu item should not have a title https://bugs.webkit.org/show_bug.cgi?id=138989 -and corresponding- rdar://problem/19061959 Reviewed by Anders Carlsson. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _createActionMenuItemForTag:]): 2014-12-02 Dana Burkart Merge r176483. 2014-11-21 Conrad Shultz Page previews should have a margin. https://bugs.webkit.org/show_bug.cgi?id=138990 Reviewed by Beth Dakin. Enclose the WKWebView (or client-supplied preview view) in a container slightly larger than the preview view. Adjust sizing code to accommodate the margin. * UIProcess/mac/WKActionMenuController.mm: (+[WKPagePreviewViewController previewPadding]): Return the total amount of fixed padding surrounding the preview (-[WKPagePreviewViewController loadView]): Store the actual previewView in an ivar so that clients can distinguish it from the container view; wrap the preview in a container view; set frames appropriately. (-[WKActionMenuController _createPreviewPopover]): Update to reflect method rename; supplement the popover size with the fixed padding. (-[WKActionMenuController _preferredPopoverSizeWithPreviewPadding:]): Renamed from -_preferredPopoverSize; account for the fixed padding when computing the preferred size. (-[WKActionMenuController _clearPreviewPopover]): Use the previewView ivar instead of the view controller's view. (-[WKActionMenuController pagePreviewViewControllerWasClicked:]): Ditto. (-[WKActionMenuController _preferredPopoverSize]): Deleted. 2014-12-02 Dana Burkart Merge r176480. 2014-11-21 Tim Horton REGRESSION (r176415): Can get stuck, unable to invoke any DataDetectors popovers https://bugs.webkit.org/show_bug.cgi?id=138955 Reviewed by Anders Carlsson. * UIProcess/API/mac/WKView.mm: (-[WKView mouseDown:]): * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController wkView:willHandleMouseDown:]): (-[WKActionMenuController didCloseMenu:withEvent:]): (-[WKActionMenuController menuNeedsUpdate:]): Keep track of whether we have called shouldUseActionsWithContext: on a DDActionContext; if we get a mouseDown without having seen didCloseMenu: (and thus don't properly pair the shouldUseActionsWithContext: with a didUseActions), tear down the old DDActionContext before proceeding. 2014-12-02 Dana Burkart Merge r176477. 2014-11-21 Tim Horton REGRESSION (r176351): Parts of apple.com/contact aren't Lookup-able ​https://bugs.webkit.org/show_bug.cgi?id=138960 Reviewed by Anders Carlsson. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForDataDetectedText]): (-[WKActionMenuController _defaultMenuItemsForMailtoLink]): Deleted. Use DataDetectors SPI instead of an explicit blacklist. 2014-12-02 Dana Burkart Merge r176463. 2014-11-21 Tim Horton REGRESSION (r176351): Parts of apple.com/contact aren't Lookup-able https://bugs.webkit.org/show_bug.cgi?id=138960 Reviewed by Beth Dakin. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForDataDetectedText]): Blacklist contact results, because they don't have useful menus. If we bail before setting up _currentActionContext, we'll still allow fallthrough to ordinary text actions, avoiding mysterious failure when a contact is detected. This doesn't break the case that r176351 was intended to fix, because in that case we were detecting e.g. addresses. 2014-12-02 Dana Burkart Merge r176460. 2014-11-21 Tim Horton REGRESSION (r176238): Mailto links are getting preloaded, which results in a compose window https://bugs.webkit.org/show_bug.cgi?id=138972 Reviewed by Beth Dakin. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController willOpenMenu:withEvent:]): Only preload links. 2014-12-02 Dana Burkart Merge r176430. 2014-11-20 Beth Dakin Preview popover needs minimum and maximum sizes https://bugs.webkit.org/show_bug.cgi?id=138943 -and corresponding- rdar://problem/18904651 Reviewed by Tim Horton. Quick follow-up to get the right screen. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController largestPopoverSize]): 2014-12-02 Dana Burkart Merge r176429. 2014-11-20 Beth Dakin Preview popover needs minimum and maximum sizes https://bugs.webkit.org/show_bug.cgi?id=138943 -and corresponding- rdar://problem/18904651 Reviewed by Tim Horton. This patch enforces minimum and maximum popover sizes. If the popover needs to be sized up to be above the minimum, it will end up covering some of the _hitTestResult, so we should compute a new origin rect based on the original event location. * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController prepareForMenu:withEvent:]): (-[WKActionMenuController _previewURLFromActionMenu:]): (-[WKActionMenuController _createPreviewPopover]): (-[WKActionMenuController largestPopoverSize]): (-[WKActionMenuController _preferredPopoverSize]): (-[WKActionMenuController _preferredSizeForPopoverPresentedFromOriginRect:]): Deleted. 2014-12-02 Dana Burkart Merge r176428. 2014-11-20 Conrad Shultz Clicks on previews can be recognized multiple times https://bugs.webkit.org/show_bug.cgi?id=138944 Reviewed by Tim Horton. * UIProcess/mac/WKActionMenuController.mm: (-[WKPagePreviewViewController _clickRecognized:]): Only dispatch the delegate message on the appropriate gesture recognizer state transition. 2014-11-20 Conrad Shultz Clients should be able to customize preview click behavior https://bugs.webkit.org/show_bug.cgi?id=138940 Reviewed by Tim Horton. * UIProcess/API/Cocoa/WKViewPrivate.h: Declare -_handleClickInPreviewView:URL:. * UIProcess/API/mac/WKView.mm: (-[WKView _handleClickInPreviewView:URL:]): Extracted from -[WKActionMenuController pagePreviewViewControllerWasClicked:]. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController pagePreviewViewControllerWasClicked:]): Extract code to -[WKView _handleClickInPreviewView:URL:]. 2014-12-02 Dana Burkart Merge r176418. 2014-11-20 Tim Horton TextIndicator should have getters for TextIndicator::Data properties https://bugs.webkit.org/show_bug.cgi?id=138920 Reviewed by Beth Dakin. Instead of having clients reach into the data(), add getters. Remove frameRect(), which is identical to the textBoundingRectInWindowCoordinates getter. Remove declarations for draw/drawContentImage, which were already removed. * Shared/TextIndicator.cpp: (WebKit::TextIndicator::frameRect): Deleted. * Shared/TextIndicator.h: (WebKit::TextIndicator::textBoundingRectInWindowCoordinates): (WebKit::TextIndicator::textRectsInBoundingRectCoordinates): (WebKit::TextIndicator::contentImageScaleFactor): (WebKit::TextIndicator::contentImageWithHighlight): (WebKit::TextIndicator::contentImage): * UIProcess/mac/TextIndicatorWindow.mm: (-[WKTextIndicatorView initWithFrame:textIndicator:margin:]): (-[WKTextIndicatorView presentWithCompletionHandler:]): (WebKit::TextIndicatorWindow::setTextIndicator): 2014-12-02 Dana Burkart Merge r176415. rdar://problem/18950441 2014-11-20 Tim Horton Cancel DataDetectors menu earlier if we know it can't be presented https://bugs.webkit.org/show_bug.cgi?id=138922 Reviewed by Beth Dakin. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController willOpenMenu:withEvent:]): If we end up with a menu with no items, don't change selection or anything. (-[WKActionMenuController menuNeedsUpdate:]): Move our call to shouldUseActionsWithContext earlier, to menuNeedsUpdate, and use a bigger hammer (removeAllItems). 2014-12-02 Dana Burkart Merge r176414. rdar://problem/19042207 2014-11-20 Tim Horton Don't use a TextIndicator BounceAndCrossfade transition if the selection highlight is never shown https://bugs.webkit.org/show_bug.cgi?id=138919 Reviewed by Beth Dakin. * Shared/TextIndicator.h: (WebKit::TextIndicator::presentationTransition): (WebKit::TextIndicator::setPresentationTransition): Add getter and setter pair. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForDataDetectedText]): If the selection highlight will never be shown because there's only a single menu item, use a normal bounce animation instead of bounce + crossfade. 2014-12-02 Dana Burkart Merge r176412. rdar://problem/18904600 2014-11-20 Beth Dakin Invalid message WebPageProxy.DidPerformDictionaryLookup on Google stocks result https://bugs.webkit.org/show_bug.cgi?id=138568 -and corresponding- rdar://problem/18904600 Reviewed by Tim Horton. Skip images for lookup. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performDictionaryLookupForRange): 2014-11-19 Dana Burkart Merge r176374. rdar://problem/18840128 2014-11-19 Timothy Horton Try to fix the iOS build * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::performDictionaryLookupForSelection): (WebKit::WebPage::performDictionaryLookupForRange): 2014-11-19 Dana Burkart Merge r176370. rdar://problem/18840128 2014-11-19 Timothy Horton Fix the 32-bit build * UIProcess/mac/TextIndicatorWindow.mm: (WebKit::TextIndicatorWindow::setTextIndicator): 2014-11-19 Dana Burkart Merge r176363. rdar://problem/18840128 2014-11-19 Tim Horton Add an optional entry transition (from selection highlight) to TextIndicator https://bugs.webkit.org/show_bug.cgi?id=138856 Reviewed by Anders Carlsson. * Shared/TextIndicator.cpp: (WebKit::outsetIndicatorRectIncludingShadow): (WebKit::TextIndicator::createWithRange): (WebKit::snapshotSelectionWithHighlight): (WebKit::TextIndicator::createWithSelectionInFrame): (WebKit::TextIndicator::frameRect): (WebKit::TextIndicator::Data::encode): (WebKit::TextIndicator::Data::decode): Remove TextIndicator::draw and related functions; drawing is handled entirely by the TextIndicatorWindow now, and TextIndicator just stores the required data. Unify outsetIndicatorRectIncludingShadow. Add an argument to createWithRange/createWithSelectionInFrame to indicate if the TextIndicator should transition from the selection highlight to the yellow bubble. If we're doing the transition, paint the selection into a second bitmap, without forcing the text to black and without hiding the blue highlight. Encode/decode the second bitmap. * Shared/TextIndicator.h: * UIProcess/mac/TextIndicatorWindow.h: * UIProcess/mac/TextIndicatorWindow.mm: (-[WKTextIndicatorView initWithFrame:textIndicator:margin:transitionFromSelectionColor:]): (-[WKTextIndicatorView presentWithCompletionHandler:]): (-[WKTextIndicatorView hideWithCompletionHandler:]): (-[WKTextIndicatorView isFlipped]): (WebKit::TextIndicatorWindow::TextIndicatorWindow): (WebKit::TextIndicatorWindow::setTextIndicator): (WebKit::TextIndicatorWindow::closeWindow): (WebKit::TextIndicatorWindow::startFadeOutTimerFired): Re-implement the bounce animation using CoreAnimation instead of the WKSI-based WKWindowBounceAnimation*. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performDictionaryLookupForSelection): (WebKit::WebPage::performDictionaryLookupOfCurrentSelection): (WebKit::WebPage::performDictionaryLookupForRange): (WebKit::WebPage::performActionMenuHitTestAtLocation): * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm: Use the aforementioned transition animation for performDictionaryLookupOfCurrentSelection, the context menu lookup item, and for Data Detectors. 2014-11-19 Dana Burkart Merge r176356. rdar://problem/18996776 2014-11-19 Beth Dakin Invoking an action menu on a selection should result in the text menu https://bugs.webkit.org/show_bug.cgi?id=138892 -and corresponding- rdar://problem/18996776 Reviewed by Tim Horton. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItems]): 2014-11-19 Dana Burkart Merge r176351. rdar://problem/18971616 2014-11-19 Beth Dakin Data detected results with no menu items should not fall through to regular text action menus https://bugs.webkit.org/show_bug.cgi?id=138887 -and corresponding- rdar://problem/18971616 Reviewed by Tim Horton. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItems]): 2014-11-19 Dana Burkart Merge r176299. rdar://problem/19024541 2014-11-18 Conrad Shultz Give clients a way to cancel preview popovers https://bugs.webkit.org/show_bug.cgi?id=138855 Reviewed by Tim Horton. Promote -[WKView _dismissActionMenuPopovers] from internal to private. * UIProcess/API/Cocoa/WKViewPrivate.h: * UIProcess/API/mac/WKView.mm: (-[WKView _dismissActionMenuPopovers]): * UIProcess/API/mac/WKViewInternal.h: 2014-11-19 Dana Burkart Merge r176288. rdar://problem/18840382 2014-11-18 Tim Horton Avoid re-encoding action menu image data https://bugs.webkit.org/show_bug.cgi?id=138817 Reviewed by Anders Carlsson. * Shared/mac/ActionMenuHitTestResult.h: * Shared/mac/ActionMenuHitTestResult.mm: (WebKit::ActionMenuHitTestResult::encode): (WebKit::ActionMenuHitTestResult::decode): Store and encode a SharedMemory with the raw encoded image data, instead of re-painting the image into a ShareableBitmap. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _hitTestResultImage]): (-[WKActionMenuController _defaultMenuItemsForImage]): (-[WKActionMenuController _copyImage:]): (-[WKActionMenuController _addImageToPhotos:]): (-[WKActionMenuController _defaultMenuItems]): (-[WKActionMenuController _canAddMediaToPhotos]): Deleted. Build a temporary filename from a UUID and the image's desired extension. Use the Image's encoded data instead of re-encoding it with CGImageDestination. Build an image menu only if we have an image, URL, data, and extension. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performActionMenuHitTestAtLocation): 2014-11-19 Dana Burkart Merge r176238. rdar://problem/18990674 2014-11-17 Conrad Shultz Page previews should be loaded sooner https://bugs.webkit.org/show_bug.cgi?id=138814 Reviewed by Tim Horton. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController willOpenMenu:withEvent:]): Send -_createPreviewPopover.. (-[WKActionMenuController _previewURLFromActionMenu:]): Relocate some logic to the new -_createPreviewPopover; gate early return on popover visibility. (-[WKActionMenuController _createPreviewPopover]): Renamed from -_createPreviewPopoverForURL:originRect:; explicitly send -loadView to warm up the preview view. (-[WKActionMenuController _createPreviewPopoverForURL:originRect:]): Deleted. 2014-11-19 Dana Burkart Merge r176237. rdar://problem/18900839 2014-11-17 Beth Dakin Preview is sometimes dismissed too early https://bugs.webkit.org/show_bug.cgi?id=138811 -and corresponding- rdar://problem/18900839 Reviewed by Tim Horton. Don’t make the popover transient until didCloseMenu: time. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController didCloseMenu:withEvent:]): (-[WKActionMenuController _createPreviewPopoverForURL:originRect:]): 2014-11-19 Dana Burkart Merge r176221. rdar://problem/18991369 2014-11-17 Tim Horton DataDetectors PageOverlay callbacks can come in to the wrong overlay https://bugs.webkit.org/show_bug.cgi?id=138801 Reviewed by Anders Carlsson. We can call dataDetectorsDidHideUI on the wrong (or no) PageOverlay, because it's possible to have another performActionMenuHitTestAtLocation between the first one and the dataDetectorsDid*UI that correspond to it. To make sure that the callbacks come to the right PageOverlay, plumb an integer ID through all of the callbacks and find the overlay based on that. * Shared/mac/ActionMenuHitTestResult.h: Store the ID of the PageOverlay that overrode data detection. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForDataDetectedText]): Send the ID back to the Web process when replying from DD callbacks. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performActionMenuHitTestAtLocation): Store the ID of the PageOverlay that overrode data detection instead of keeping the PageOverlay itself. (WebKit::WebPage::dataDetectorsDidPresentUI): (WebKit::WebPage::dataDetectorsDidChangeUI): (WebKit::WebPage::dataDetectorsDidHideUI): Find and reply to the correct page overlay. 2014-11-19 Dana Burkart Merge r176220. rdar://problem/18944893 2014-11-17 Beth Dakin Whitespace action menus should focus the HitTestResult and create an insertion point https://bugs.webkit.org/show_bug.cgi?id=138786 -and corresponding- rdar://problem/18944893 Reviewed by Tim Horton. Whitespace menus should cause the HitTestResult to be focused, and they should set the selection based on the HitTest location. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::focusAndSelectLastActionMenuHitTestResult): * UIProcess/WebPageProxy.h: * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController isMenuForTextContent]): (-[WKActionMenuController willOpenMenu:withEvent:]): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performActionMenuHitTestAtLocation): (WebKit::WebPage::focusAndSelectLastActionMenuHitTestResult): 2014-11-18 Dana Burkart Merge r176166. rdar://problem/18953982 2014-11-16 Tim Horton Use TextIndicator instead of the built in Lookup highlight https://bugs.webkit.org/show_bug.cgi?id=138775 Follow-up to r176164. * UIProcess/API/mac/WKView.mm: (-[WKView dealloc]): (-[WKView initWithFrame:context:configuration:webView:]): * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::didPerformDictionaryLookup): Include the softlinking macros directly in the files they're used in, as they're supposed to be used. 2014-11-18 Dana Burkart Merge r176164. rdar://problem/18953982 2014-11-16 Tim Horton Use TextIndicator instead of the built in Lookup highlight https://bugs.webkit.org/show_bug.cgi?id=138775 Reviewed by Anders Carlsson. In order to make the yellow highlight for Lookup more accurately match the painted content of the web page (in light of e.g. Web fonts, and interesting text features that only WebKit implements and cannot round-trip through NSAttributedString), use a TextIndicator instead of the built-in Lookup highlight where possible. * Configurations/BaseTarget.xcconfig: Make it possible to include headers from private frameworks. This matches WebCore. * Shared/DictionaryPopupInfo.cpp: (WebKit::DictionaryPopupInfo::encode): (WebKit::DictionaryPopupInfo::decode): * Shared/DictionaryPopupInfo.h: Include the attributed string inside the DictionaryPopupInfo, instead of as a secondary argument to DidPerformDictionaryLookup. Add a TextIndicator to DictionaryPopupInfo, which can be used to highlight the text in the UI process. * UIProcess/API/mac/WKView.mm: (-[WKView dealloc]): (-[WKView viewDidMoveToWindow]): (-[WKView _dictionaryLookupPopoverWillClose:]): (-[WKView _setTextIndicator:fadeOut:animate:animationCompletionHandler:]): (-[WKView _setTextIndicator:fadeOut:animate:]): (-[WKView initWithFrame:context:configuration:webView:]): (+[WKView hideWordDefinitionWindow]): * UIProcess/API/mac/WKViewInternal.h: Adopt the Lookup SPI header. If we have the requisite API, register the notification that Lookup sends when the popover closes, and hook that up to hide the text indicator. Add a version of _setTextIndicator: that takes an animation completion handler. * UIProcess/PageClient.h: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::didPerformDictionaryLookup): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::didPerformDictionaryLookup): Adjust to the new didPerformDictionaryLookup signature. * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: (InitWebCoreSystemInterface): Remove a WKSI import. * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::didPerformDictionaryLookup): If we have the requisite API, disable Lookup's built-in highlight and present a TextIndicator instead. We currently have to run the animations serially (first bounce the TextIndicator, then animate in the Lookup popover) because the act of adding the Lookup popover blocks us from getting any animation events for the TextIndicator, and breaks the bounce. We could also fix this by using a threaded animation for the TextIndicator, but it's not clear that it's safe to do so. (WebKit::PageClientImpl::dismissDictionaryLookupPanel): When explicitly dismissing the Lookup panel, also hide the text indicator. * UIProcess/mac/TextIndicatorWindow.h: * UIProcess/mac/TextIndicatorWindow.mm: (WebKit::TextIndicatorWindow::setTextIndicator): Store the completion handler. (WebKit::TextIndicatorWindow::bounceAnimationDidEnd): Call the completion handler when the animation completes. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _createActionMenuItemForTag:]): Disable the Lookup item if lookup is not available. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::showDefinitionForAttributedString): Adjust to the new didPerformDictionaryLookup signature. Since PDFPlugin can't trivially repaint the required part of the PDF, we don't build a TextIndicator. This will result in PDFPlugin continuing to use Lookup's built-in highlight. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performDictionaryLookupForRange): Build a TextIndicator from the Lookup range and pass it along with the DictionaryPopupInfo. 2014-11-18 Dana Burkart Merge r176108. rdar://problem/19005904 2014-11-13 Eric Carlson Context menus should not offer the "Download video" option for videos that cannot be downloaded https://bugs.webkit.org/show_bug.cgi?id=138530 -and corresponding- rdar://problem/18919130 Reviewed by Tim Horton. Expose isDownloadableMedia() to the InjectedBundleHitTestResult. * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp: (WKBundleHitTestResultIsDownloadableMedia): * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h: * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp: (WebKit::InjectedBundleHitTestResult::isDownloadableMedia): * WebProcess/InjectedBundle/InjectedBundleHitTestResult.h: 2014-11-17 Dana Burkart Merge r176150. 2014-11-14 Tim Horton Remove pre-[DDActionContext contextForView:...] fallback path https://bugs.webkit.org/show_bug.cgi?id=138735 Reviewed by Simon Fraser. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController willOpenMenu:withEvent:]): (-[WKActionMenuController didCloseMenu:withEvent:]): (-[WKActionMenuController _defaultMenuItemsForDataDetectedText]): (hasDataDetectorsCompletionAPI): Deleted. Remove the now-unnecessary fallback path. 2014-11-17 Dana Burkart Merge r176148. 2014-11-14 Tim Horton Frequent crashes under actionContextForResultAtPoint https://bugs.webkit.org/show_bug.cgi?id=138761 Reviewed by Dean Jackson. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (PageOverlayClientImpl::actionContextForResultAtPoint): Initialize apiRange. 2014-11-17 Dana Burkart Merge r176131. 2014-11-14 Beth Dakin URLs for some videos are not valid URLs, should not be exposed to action menu https://bugs.webkit.org/show_bug.cgi?id=138746 -and corresponding- rdar://problem/18941927 Reviewed by Tim Horton. If the video cannot be downloaded, that is also an indication that the URL of the video will not be valid on its own. In these cases, we should share or copy the main page’s URL. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForVideo]): (-[WKActionMenuController _copyVideoURL:]): 2014-11-17 Dana Burkart Merge r176156. 2014-11-15 David Kilzer REGRESSION (r176137): iOS build broke after moving DataDetectors scanning code to WebCore This regressed with the following commit: Move DataDetectors scanning code to WebCore https://bugs.webkit.org/show_bug.cgi?id=138731 * Shared/mac/ActionMenuHitTestResult.mm: Add PLATFORM(MAC) check around the entire implementation since it it unused on iOS. 2014-11-17 Dana Burkart Merge r176153. 2014-11-15 Tim Horton Implement data detectors and mailto action menus for WebKit1 https://bugs.webkit.org/show_bug.cgi?id=138765 Reviewed by Beth Dakin. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForMailtoLink]): 2014-11-17 Dana Burkart Merge r176137. 2014-11-14 Tim Horton Move DataDetectors scanning code to WebCore https://bugs.webkit.org/show_bug.cgi?id=138731 Reviewed by Anders Carlsson. Move DataDetectors scanning code to WebCore, so that both WebKits can use it. * Shared/TextIndicator.cpp: (WebKit::TextIndicator::createWithRange): Move createWithRange in from WebPageMac's textIndicatorForRange. (WebKit::TextIndicator::createWithSelectionInFrame): * Shared/TextIndicator.h: * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::createSelectionSnapshot): * WebProcess/WebPage/WebFrame.h: Constify some things. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performActionMenuHitTestAtLocation): Avoid using the DD result if it didn't come with a non-null Range. Make use of detectItemAroundHitTestResult and TextIndicator::createWithRange. (WebKit::scanForDataDetectedItems): Deleted. (WebKit::textIndicatorForRange): Deleted. Moved these two to other places. 2014-11-13 Tim Horton Adjust the WKBundlePageOverlay Data Detectors SPI https://bugs.webkit.org/show_bug.cgi?id=138685 Reviewed by Anders Carlsson. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForDataDetectedText]): Forward DDActionContext callbacks to the Web process. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h: * WebProcess/WebPage/WebPageOverlay.cpp: * WebProcess/WebPage/WebPageOverlay.h: Add four DataDetectors-related WebKit2-only page overlay callbacks: (WebKit::WebPageOverlay::actionContextForResultAtPoint): Called during the action menu hit test; clients can reply with a DDActionContext and a DOM range, and WebKit will treat that result and range as if it had detected it itself, building the action menu and showing the yellow highlight as usual. (WebKit::WebPageOverlay::dataDetectorsPresentedUI): (WebKit::WebPageOverlay::dataDetectorsChangedUI): (WebKit::WebPageOverlay::dataDetectorsHidUI): These correspond to the DDActionContext callbacks, and can be used by clients to show/hide corresponding UI while DataDetectors in the UI process is presenting UI. (WebKit::WebPageOverlay::prepareForActionMenu): Deleted. Get rid of prepareForActionMenu, as nobody ever used it. * WebProcess/WebPage/WebPage.cpp: Add WebPageOverlay.h so that we can build, because the destructor lives here. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performActionMenuHitTestAtLocation): Give all of the WebPageOverlays the first shot at data detection; if none of them reply with a valid DDActionContext/DOM range, we'll go ahead and do our normal detection. (WebKit::WebPage::dataDetectorsPresentedUI): (WebKit::WebPage::dataDetectorsChangedUI): (WebKit::WebPage::dataDetectorsHidUI): Forward these along to the active WebPageOverlay. 2014-11-12 Matthew Hanson Merge r175966. 2014-11-11 Tim Horton DataDetectors' menu items aren't presented in the telephone number menu https://bugs.webkit.org/show_bug.cgi?id=138602 Reviewed by Beth Dakin. We currently round-trip the DataDetectors telephone number NSMenuItems through the very-lossy WebContextMenuItemData, for no real reason. We should avoid this so that DataDetectors' actual NSMenuItems are presented in the final menu, so that they can adjust their items after providing them to us. * Platform/mac/MenuUtilities.h: * Platform/mac/MenuUtilities.mm: (WebKit::menuItemTitleForTelephoneNumber): Deleted. Stop adjusting the menu item titles, as they come correct now. (WebKit::menuItemsForTelephoneNumber): Deleted. (WebKit::menuForTelephoneNumber): Return a fully-formed menu for the single telephone number case. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::showTelephoneNumberMenu): Present the fully-formed menu, without round-tripping through WebContextMenuItemData, because we do not need to hand the items to the context menu client (and indeed, were not), and because this allows us to use the exact items returned by DataDetectors, so they can keep ahold of the items that we actually present. * UIProcess/PageClient.h: * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::showPlatformContextMenu): Add a Mac-only PageClient function for presenting a NSMenu at a WKView-relative point. 2014-11-12 Matthew Hanson Merge r176038. 2014-11-12 Tim Horton Two action menu item titles are swapped https://bugs.webkit.org/show_bug.cgi?id=138667 Reviewed by Beth Dakin. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _createActionMenuItemForTag:]): Swap them back. 2014-11-12 Matthew Hanson Merge r176037. 2014-11-12 Tim Horton Need to show the text indicator when Data Detectors shows a popover https://bugs.webkit.org/show_bug.cgi?id=138664 Reviewed by Beth Dakin. * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: (hasDataDetectorsCompletionAPI): Determine if we have the new API. (-[WKActionMenuController willDestroyView:]): (-[WKActionMenuController willOpenMenu:withEvent:]): Make use of the new API. If we wanted to show a Data Detectors menu but have no items (or they're all disabled), cancel the menu. If we don't have it, manually manipulate the highlight. (-[WKActionMenuController didCloseMenu:withEvent:]): Make use of the new API. If we don't have it, manually manipulate the highlight. (-[WKActionMenuController _defaultMenuItemsForDataDetectedText]): Set up completion handlers if we have the new API; when DataDetectors presents UI, show the text indicator, when it dismisses, hide it. If we don't have the API, manually manipulate the highlight. 2014-11-12 Matthew Hanson Merge r176027. 2014-11-12 Tim Horton Make action menus much more reliable https://bugs.webkit.org/show_bug.cgi?id=138654 Reviewed by Anders Carlsson. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController prepareForMenu:withEvent:]): Remove MenuUpdateStage; nothing actually uses this value, we just pass it around. (-[WKActionMenuController didPerformActionMenuHitTest:userData:]): Update the menu as soon as we have a reply from the Web process. (-[WKActionMenuController menuNeedsUpdate:]): If our sync-wait for the Web process' reply times out, we should still update the menu to remove the placeholder separator item. (-[WKActionMenuController _updateActionMenuItems]): (-[WKActionMenuController _updateActionMenuItemsForStage:]): Deleted. If we have our final answer for this menu (_state == Ready), and the final answer has no items in the menu, cancel tracking on the menu. 2014-11-11 Tim Horton Add support for mailto: link action menus https://bugs.webkit.org/show_bug.cgi?id=138641 Reviewed by Beth Dakin. * Shared/API/c/WKActionMenuTypes.h: Add a new type for mailto links. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForMailtoLink]): Build a DDActionContext and grab menu items for our mailto link. (-[WKActionMenuController _defaultMenuItems]): Get menu items from _defaultMenuItemsForMailtoLink if needed. 2014-11-12 Matthew Hanson Merge r175985. 2014-11-11 Conrad Shultz Clients should be notified when a page preview finishes https://bugs.webkit.org/show_bug.cgi?id=138635 Reviewed by Tim Horton. Add SPI to WKView to allow clients to do any cleanup that might be necessary when the preview closes. * UIProcess/API/Cocoa/WKViewPrivate.h: Declare new SPI. * UIProcess/API/mac/WKView.mm: (-[WKView _finishPreviewingURL:withPreviewView:]): Stub SPI implementation. * UIProcess/mac/WKActionMenuController.h: Add an ivar for the preview view controller. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _createPreviewPopoverForURL:originRect:]): Update to use the ivar. (-[WKActionMenuController _clearPreviewPopover]): Send -_finishPreviewingURL:withPreviewView: and nil out the view controller ivar. 2014-11-12 Matthew Hanson Merge r175983. 2014-11-11 Tim Horton Update artwork for some action menu items https://bugs.webkit.org/show_bug.cgi?id=138634 Reviewed by Anders Carlsson. * Resources/OpenInNewWindowTemplate.pdf: Removed. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _createActionMenuItemForTag:]): (webKitBundleImageNamed): Deleted. * WebKit2.xcodeproj/project.pbxproj: Get rid of our custom art, and use system art for two more items. 2014-11-12 Matthew Hanson Merge r175973. 2014-11-11 Tim Horton Occasional assertion failure under recommendedScrollbarStyleDidChange() https://bugs.webkit.org/show_bug.cgi?id=138604 Reviewed by Beth Dakin. It is possible for AppKit to install tracking areas into our view behind our back, but we have code that depends on knowing exactly the set of tracking areas installed on WKView. Make this more robust by keeping a reference to the tracking area we use for many things and manipulating that instead of making assumptions about the total set of tracking areas on WKView. * UIProcess/API/mac/WKView.mm: (-[WKView _primaryTrackingArea]): (-[WKView _replacePrimaryTrackingArea:]): Provide a 'primary' tracking area setter/getter. (-[WKView initWithFrame:context:configuration:webView:]): Keep a reference to the original tracking area installed at initialization time. * UIProcess/API/mac/WKViewInternal.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::recommendedScrollbarStyleDidChange): Instead of walking the set of tracking areas, make use of the fact that we know exactly which tracking area we installed, and uninstall just that one, and replace it with our newly-built one. 2014-11-12 Matthew Hanson Merge r175969. 2014-11-11 Timothy Horton Add a respondsToSelector check to dismissActionMenuPopovers ​https://bugs.webkit.org/show_bug.cgi?id=138600 Reviewed by Beth Dakin. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController dismissActionMenuPopovers]): Avoid calling this wherever it doesn't exist. 2014-11-12 Matthew Hanson Merge r175964. 2014-11-11 Tim Horton Adopt DDActionContext menu type SPI https://bugs.webkit.org/show_bug.cgi?id=138603 Reviewed by Anders Carlsson. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForDataDetectedText]): Use the new SPI instead of WKSI. 2014-11-12 Matthew Hanson Merge r175963. 2014-11-11 Tim Horton Data Detectors popovers should be dismissed upon scrolling https://bugs.webkit.org/show_bug.cgi?id=138600 Reviewed by Beth Dakin. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController prepareForMenu:withEvent:]): Dismiss popovers when we start preparing another menu. (-[WKActionMenuController dismissActionMenuPopovers]): Use the new DataDetectors SPI. 2014-11-12 Matthew Hanson Merge r175962. 2014-11-11 Tim Horton Localize strings for action menus https://bugs.webkit.org/show_bug.cgi?id=138591 Reviewed by Dan Bates. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _showTextIndicator]): (-[WKActionMenuController _hideTextIndicator]): (-[WKActionMenuController _createActionMenuItemForTag:]): Make use of the new strings. 2014-11-07 Tim Horton Popovers do not dismiss when navigating back and forth using gestures https://bugs.webkit.org/show_bug.cgi?id=138512 Reviewed by Beth Dakin. * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::navigationGestureDidBegin): Dismiss action menu related popovers when navigation gestures begin. 2014-11-11 Matthew Hanson Merge r175835. 2014-11-10 Beth Dakin Whitespace action menus aren't working properly https://bugs.webkit.org/show_bug.cgi?id=138585 -and corresponding- rdar://problem/18933586 Reviewed by Tim Horton. Treat the whitespace menu as a text menu. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController isMenuForTextContent]): 2014-11-10 Beth Dakin WK1: Support default actions for read-only text https://bugs.webkit.org/show_bug.cgi?id=138552 -and corresponding- rdar://problem/18877483 Reviewed by Tim Horton. WK1 now needs to do a lot of dictionary lookup operations that it did not previously have to handle. So this patch takes a lot of that functionality, which was implemented as static functions in WebPageMac for WK2 and moves it into WebCore. * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: (InitWebCoreSystemInterface): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performDictionaryLookupForRange): (WebKit::isPositionInRange): Deleted. (WebKit::shouldUseSelection): Deleted. (WebKit::rangeExpandedAroundPositionByCharacters): Deleted. (WebKit::rangeForDictionaryLookupForSelection): Deleted. (WebKit::rangeForDictionaryLookupAtHitTestResult): Deleted. 2014-11-11 Matthew Hanson Merge r175790. 2014-11-09 Conrad Shultz Move _ignoresNonWheelMouseEvents implementation to WKView(Private) https://bugs.webkit.org/show_bug.cgi?id=138487 Reviewed by Dan Bernstein. Relocate some methods that should have been in a category implementation. * UIProcess/API/mac/WKView.mm: (-[WKView _setIgnoresNonWheelMouseEvents:]): (-[WKView _ignoresNonWheelMouseEvents]): 2014-11-11 Matthew Hanson Merge r175780. 2014-11-08 Beth Dakin WKActionMenuController methods should be more careful to use the best WebHitTestResult https://bugs.webkit.org/show_bug.cgi?id=138536 -and corresponding- rdar://problem/18919195 Reviewed by Tim Horton. This patch re-names _hitTestResultForStage to _webHitTestResult. The method no longer takes a stage since that value is really not necessary to determine the correct WebHitTestResult. This patch also makes all spots in this file that access a WebHitTestResult go through _webHitTestResult to ensure that they get the most up-to-date option. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController willOpenMenu:withEvent:]): (-[WKActionMenuController _openURLFromActionMenu:]): (-[WKActionMenuController _addToReadingListFromActionMenu:]): (-[WKActionMenuController _previewURLFromActionMenu:]): (-[WKActionMenuController _defaultMenuItemsForVideo]): (-[WKActionMenuController _copyVideoURL:]): (-[WKActionMenuController _saveVideoToDownloads:]): (-[WKActionMenuController _saveImageToDownloads:]): (-[WKActionMenuController _defaultMenuItems]): (-[WKActionMenuController _updateActionMenuItemsForStage:]): (imageForResource:name::switch): Deleted. (-[WKActionMenuController _defaultMenuItems:]): Deleted. 2014-11-11 Matthew Hanson Merge r175779. 2014-11-08 Beth Dakin Implement action menu support for videos https://bugs.webkit.org/show_bug.cgi?id=138534 -and corresponding- rdar://problem/18742164 Reviewed by Tim Horton. New menu type and items types. * Shared/API/c/WKActionMenuItemTypes.h: * Shared/API/c/WKActionMenuTypes.h: Plumb isMediaThatCanBeDownloaded() up to WebHitTestResult. * Shared/WebHitTestResult.cpp: (WebKit::WebHitTestResult::Data::Data): (WebKit::WebHitTestResult::Data::encode): (WebKit::WebHitTestResult::Data::decode): * Shared/WebHitTestResult.h: (WebKit::WebHitTestResult::isMediaThatCanBeDownloaded): Re-name _canAddImageToPhotos to _canAddMediaToPhotos, which is more accurate. We might use this method for videos some day, so now it has an accurate name. * UIProcess/mac/WKActionMenuController.mm: Default items and their actions. (-[WKActionMenuController _defaultMenuItemsForVideo]): (-[WKActionMenuController _copyVideoURL:]): (-[WKActionMenuController _saveVideoToDownloads:]): (-[WKActionMenuController _defaultMenuItemsForImage]): (-[WKActionMenuController _canAddMediaToPhotos]): (-[WKActionMenuController _addImageToPhotos:]): (-[WKActionMenuController _createActionMenuItemForTag:]): (-[WKActionMenuController _defaultMenuItems:]): (-[WKActionMenuController _canAddImageToPhotos]): Deleted. We hit test including shadow content to get the desired result for editable text regions. But for media, we want to re-set to the shadow root. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performActionMenuHitTestAtLocation): 2014-11-11 Matthew Hanson Merge r175770. 2014-11-07 Conrad Shultz "Lookup" action menu should read "Look up" https://bugs.webkit.org/show_bug.cgi?id=138509 Reviewed by Tim Horton. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _createActionMenuItemForTag:]): 2014-11-11 Matthew Hanson Merge r175761. 2014-11-07 Beth Dakin Null deref performing Lookup on Apple Trailers full screen button https://bugs.webkit.org/show_bug.cgi?id=138513 -and corresponding- rdar://problem/18909699 Reviewed by Tim Horton. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performDictionaryLookupForSelection): 2014-11-11 Matthew Hanson Merge r175756. 2014-11-07 Beth Dakin Action menu preview popover should dismiss on scroll https://bugs.webkit.org/show_bug.cgi?id=138511 -and corresponding- rdar://problem/18901445 Reviewed by Tim Horton. This patch re-names dismissActionMenuDataDetectorPopovers() to dismissActionMenuPopovers() and also calls _clearPreviewPopover from that method as well. * UIProcess/API/mac/WKView.mm: (-[WKView viewDidMoveToWindow]): (-[WKView _dismissActionMenuPopovers]): (-[WKView _dismissActionMenuDataDetectorPopovers]): Deleted. * UIProcess/API/mac/WKViewInternal.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::pageDidScroll): (WebKit::WebPageProxy::resetStateAfterProcessExited): * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::dismissActionMenuPopovers): (WebKit::PageClientImpl::dismissActionMenuDataDetectorPopovers): Deleted. * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController dismissActionMenuPopovers]): (-[WKActionMenuController dismissActionMenuDataDetectorPopovers]): Deleted. 2014-11-11 Matthew Hanson Merge r175754. 2014-11-07 Beth Dakin Support action menus for whitespace in editable areas https://bugs.webkit.org/show_bug.cgi?id=138488 -and corresponding- rdar://problem/18877717 Reviewed by Tim Horton. Very simple menu for whitespace in editable areas. * Shared/API/c/WKActionMenuTypes.h: * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForWhitespaceInEditableArea]): (-[WKActionMenuController _defaultMenuItems:]): 2014-11-11 Matthew Hanson Merge r175753. 2014-11-07 Beth Dakin Invoking an action menu should dismiss existing selection https://bugs.webkit.org/show_bug.cgi?id=138496 -and corresponding- rdar://problem/18892787 Reviewed by Tim Horton. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController willOpenMenu:withEvent:]): 2014-11-11 Matthew Hanson Merge r175732. 2014-11-06 Conrad Shultz Clients should be able to customize the view used for page previews https://bugs.webkit.org/show_bug.cgi?id=138447 Reviewed by Tim Horton. Add SPI to WKView that clients can use to customize the view used in the page preview popover. * UIProcess/API/Cocoa/WKViewPrivate.h: Declare -_viewForPreviewingURL:initialFrameSize:. * UIProcess/API/mac/WKView.mm: (-[WKView _viewForPreviewingURL:initialFrameSize:]): Return nil in the default implementation. * UIProcess/mac/WKActionMenuController.mm: (-[WKPagePreviewViewController loadView]): Only spin up a WKWebView if the delegate (and, therefore, the presenting WKView) doesn't supply a custom view. (-[WKActionMenuController pagePreviewViewController:viewForPreviewingURL:initialFrameSize:]): WKPagePreviewViewControllerDelegate method; wrap the WKView SPI. 2014-11-10 Matthew Hanson Merge r175711. 2014-11-06 Tim Horton Data detectors popover points at the first line of the detected item https://bugs.webkit.org/show_bug.cgi?id=138471 Reviewed by Sam Weinig. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::scanForDataDetectedItems): Determine the bounding box of all quads of the detected item's text. This way, the popover will point at the border of the item, instead of right at the very first line. 2014-11-10 Matthew Hanson Merge r175705. 2014-11-06 Tim Horton TextIndicatorWindow's bounce animation is lopsided when indicating two short lines of text https://bugs.webkit.org/show_bug.cgi?id=138458 Reviewed by Simon Fraser. Previously, the TextIndicator's frame() covered the entire selection highlight bounds. This was undesirable in cases where the highlight included areas far outside the bounds of the selected text, as the TextIndicatorWindow's 'bounce' animation would be misaligned (centered on the highlight instead of on the text). * Shared/TextIndicator.cpp: Get rid of the many-argument TextIndicator::create, because it was only used internally, and have createWithSelectionInFrame make a ::Data instead. (WebKit::TextIndicator::createWithSelectionInFrame): Compute and store the bounding rect of all of the selected text rects, and store all of the text rects relative to that bounding rect instead of relative to the selection highlight bounds. We do this because the selection highlight bounds often includes area which is far outside of the text bounds (in the case of a selection that spans multiple lines), and causes the text indicator bounce animation to bounce in a lopsided manner. (WebKit::TextIndicator::TextIndicator): Adjust to the rename of textRectsInSelectionRectCoordinates -> textRectsInBoundingRectCoordinates. (WebKit::TextIndicator::frameRect): Instead of the TextIndicator's frame being the selection highlight bounds, it is now the bounds of all of the text rects. (WebKit::TextIndicator::draw): Translate into the image by the difference between the selection highlight bounds and the text bounding rect. This is necessary because the content image is still generated covering the entire selection highlight bounds, but the text rects are in text-rect-bounds coordinates. (WebKit::TextIndicator::Data::encode): (WebKit::TextIndicator::Data::decode): Adjust to the rename of textRectsInSelectionRectCoordinates -> textRectsInBoundingRectCoordinates. Encode/decode textBoundingRectInWindowCoordinates. * Shared/TextIndicator.h: (WebKit::TextIndicator::contentImage): Deleted. Get rid of an unnecessary getter and constructor. 2014-11-10 Matthew Hanson Merge r175704. 2014-11-06 Tim Horton Only provide a single result to the action menu DDActionContext https://bugs.webkit.org/show_bug.cgi?id=138469 Reviewed by Anders Carlsson. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::scanForDataDetectedItems): Only provide one result; secondary results can be extremely unrelated to the primary one and confuse Data Detectors further down the line. 2014-11-10 Matthew Hanson Merge r175702. 2014-11-06 Tim Horton Null deref in rangeForDictionaryLookupAtHitTestResult on occasion https://bugs.webkit.org/show_bug.cgi?id=138459 Reviewed by Andreas Kling. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::rangeForDictionaryLookupAtHitTestResult): rangeExpandedAroundPositionByCharacters can return null. 2014-11-10 Matthew Hanson Merge r175701. 2014-11-06 Tim Horton Prefer link action menus over images https://bugs.webkit.org/show_bug.cgi?id=138461 Reviewed by Anders Carlsson. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItems:]): Swap the priority of links and images. 2014-11-06 Dana Burkart Merge r175710. 2014-11-06 Beth Dakin Preview views often misplaced inside popover https://bugs.webkit.org/show_bug.cgi?id=138472 Reviewed by Tim Horton. This patch makes the popover maintain aspect ratio, and it uses the final scale of that popover to scale the preview view as well. * UIProcess/mac/WKActionMenuController.mm: (-[WKPagePreviewViewController initWithPageURL:mainViewSize:popoverToViewScale:]): (-[WKPagePreviewViewController loadView]): (-[WKActionMenuController _createPreviewPopoverForURL:originRect:]): (-[WKActionMenuController _targetSize:fitsInAvailableSpace:]): (-[WKActionMenuController _preferredSizeForPopoverPresentedFromOriginRect:]): (-[WKPagePreviewViewController initWithPageURL:]): Deleted. 2014-11-05 Dana Burkart Merge r175649. 2014-11-05 Timothy Horton Fix the build. * UIProcess/mac/WKActionMenuController.mm: 2014-11-05 Dana Burkart Merge r175646. 2014-11-05 Conrad Shultz It should be possible to open a page preview by clicking on it https://bugs.webkit.org/show_bug.cgi?id=138445 Reviewed by Tim Horton. Add a click recognizer to WKPagePreviewViewController and plumb it through to WKActionMenuController. * UIProcess/mac/WKActionMenuController.mm: Declare , currently home to just a single method. (-[WKPagePreviewViewController loadView]): Configure and add a click gesture recognizer to the WKWebView. (-[WKPagePreviewViewController _clickRecognized:]): Gesture recognizer action; send -pagePreviewViewControllerWasClicked: to the delegate. (-[WKActionMenuController willDestroyView:]): Extract code to -_clearPreviewPopover. (-[WKActionMenuController didCloseMenu:withEvent:]): Ditto. (-[WKActionMenuController _createPreviewPopoverForURL:]): Set ourself as the delegate of the page preview controller. (-[WKActionMenuController _clearPreviewPopover]): Extracted from various other methods; if appropriate, nil out the preview view controller's delegate. (-[WKActionMenuController popoverWillClose:]): Extract code to -_clearPreviewPopover. (-[WKActionMenuController pagePreviewViewControllerWasClicked:]): WKPagePreviewViewControllerDelegate method; open the URL of the clicked page. 2014-11-05 Dana Burkart Merge r175645. 2014-11-05 Beth Dakin Page preview popover should show scaled-down web content https://bugs.webkit.org/show_bug.cgi?id=138444 Reviewed by Anders Carlsson. Instead of keeping the preferred size in the controller, keep the main view’s size, and then scale the bounds of the popover’s view using that and the scale factor as a constant. Set the size of the popover explicitly so that it doesn’t get the view’s size. This will cause it to scale the WKWebView. * UIProcess/mac/WKActionMenuController.mm: (-[WKPagePreviewViewController initWithPageURL:]): (-[WKPagePreviewViewController loadView]): (-[WKActionMenuController _createPreviewPopoverForURL:originRect:]): (-[WKActionMenuController _preferredSizeForPopoverPresentedFromOriginRect:]): 2014-11-05 Dana Burkart Merge r175643. 2014-11-05 Conrad Shultz Page preview popovers sometimes cover their originating element https://bugs.webkit.org/show_bug.cgi?id=138437 Reviewed by Beth Dakin. If a popover is sufficiently large, and the originating element is in a particular location, it's possible that the popover can't be positioned in a manner that doesn't occlude the originating element. Address this by scaling down the popover content if it can't fit entirely between the originating element and the screen edge. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _previewURLFromActionMenu:]): Update to use -_createPreviewPopoverForURL:originRect:. (-[WKActionMenuController _createPreviewPopoverForURL:originRect:]): Renamed from -_createPreviewPopoverForURL:; extract code to -_preferredSizeForPopoverPresentedFromOriginRect:. (-[WKActionMenuController _preferredSizeForPopoverPresentedFromOriginRect:]): Compute a size that is as large as possible while keeping the popover between the origin rect and screen edge (with an arbitrary padding applied to keep from directly abutting the screen edge). (-[WKActionMenuController _createPreviewPopoverForURL:]): Deleted. 2014-11-05 Dana Burkart Merge r175637. 2014-11-05 Tim Horton Select Data Detectors results instead of just highlighting them https://bugs.webkit.org/show_bug.cgi?id=138435 Reviewed by Beth Dakin. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::selectLastActionMenuRange): (WebKit::WebPageProxy::selectLookupTextAtLocation): Deleted. Rename selectLookupTextAtLocation to selectLastActionMenuRange. * UIProcess/WebPageProxy.h: * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController willOpenMenu:withEvent:]): Do a real selection for single-item Data Detector menus; show the yellow highlight otherwise. Adopt selectLastActionMenuRange for non-detected text. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performActionMenuHitTestAtLocation): (WebKit::WebPage::selectLastActionMenuRange): (WebKit::WebPage::selectLookupTextAtLocation): Deleted. Store the last (detected data or Lookup-derived) action menu range. Select it upon selectLastActionMenuRange. 2014-11-05 Dana Burkart Merge r175635. 2014-11-05 Conrad Shultz Disable action menus on page previews https://bugs.webkit.org/show_bug.cgi?id=138431 Reviewed by Anders Carlsson. * UIProcess/API/mac/WKView.mm: (-[WKView _shouldIgnoreMouseEvents]): Renamed from -shouldIgnoreMouseEvents since this isn't actually public. (-[WKView swipeWithEvent:]): (-[WKView mouseMoved:]): (-[WKView mouseDown:]): (-[WKView mouseUp:]): (-[WKView mouseDragged:]): Updated to reflect method rename. (-[WKView shouldIgnoreMouseEvents]): Deleted. * UIProcess/API/mac/WKViewInternal.h: Expose -_shouldIgnoreMouseEvents. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController prepareForMenu:withEvent:]): Cancel the menu if the presenting WKView should ignore mouse events. 2014-11-05 Dana Burkart Merge r175632. 2014-11-05 Beth Dakin Action menu URL preview should "peek," i.e. appear when the menu item is highlighted https://bugs.webkit.org/show_bug.cgi?id=138432 -and corresponding- rdar://problem/18774264 Reviewed by Anders Carlsson. New ivars. Keep a reference to the popover, and a BOOL that indicates whether we should close the popover when the menu goes away. * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: Re-set the preview bool to NO whenever we are about to pop up a new menu. (-[WKActionMenuController prepareForMenu:withEvent:]): Close the popover when the menu closes unless _shouldKeepPreviewPopoverOpen has been set. (-[WKActionMenuController didCloseMenu:withEvent:]): Set _shouldKeepPreviewPopoverOpen. (-[WKActionMenuController _keepPreviewOpen:]): Re-factored to use ivar. (-[WKActionMenuController _previewURLFromActionMenu:]): (-[WKActionMenuController _createPreviewPopoverForURL:]): Now call _previewURLFromActionMenu on menu item highlight. (-[WKActionMenuController menu:willHighlightItem:]): NSPopover delegate method so that we can keep our BOOL and ivar accurate in the case where the popover is closed by some other mechanism than the action menu going away. (-[WKActionMenuController popoverWillClose:]): New selector for the preview. Now when this item is actually selected, we just want to set the BOOL _shouldKeepPreviewPopoverOpen to YES so that we keep the preview open. (-[WKActionMenuController _createActionMenuItemForTag:]): 2014-11-05 Dana Burkart Merge r175630. 2014-11-05 Conrad Shultz Disable interaction with action menu page previews https://bugs.webkit.org/show_bug.cgi?id=138400 Reviewed by Tim Horton. Expand on the existing -[WKView shouldIgnoreMouseEvents] by adding facilities to suppress handling of all non-wheel events, effectively creating a scroll-only web view. Deploy this in WKPagePreviewViewController. * UIProcess/API/Cocoa/WKViewPrivate.h: Declare the OS X-only ignoresNonWheelMouseEvents SPI. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _ignoresNonWheelMouseEvents]): (-[WKWebView _setIgnoresNonWheelMouseEvents:]): Wrap the underlying WKView methods. * UIProcess/API/Cocoa/WKWebViewInternal.h: Declare the OS X-only ignoresNonWheelMouseEvents property. * UIProcess/API/mac/WKView.mm: Add _ignoresNonWheelMouseEvents to WKViewData. (-[WKView shouldIgnoreMouseEvents]): Include a check for _ignoresNonWheelMouseEvents. (-[WKView _setIgnoresNonWheelMouseEvents:]): Set the ivar in WKViewData. (-[WKView _ignoresNonWheelMouseEvents]): Fetch the ivar in WKViewData. (-[WKView _shouldIgnoreWheelEvents]): Implement the old -shouldIgnoreMouseEvents behavior. (-[WKView scrollWheel:]): -shouldIgnoreMouseEvents -> -_shouldIgnoreWheelEvents. * UIProcess/mac/WKActionMenuController.mm: (-[WKPagePreviewViewController loadView]): Configure the WKWebView to ignore non-wheel mouse events; use RetainPtr for the WKWebView. 2014-11-05 Dana Burkart Merge r175591. 2014-11-04 Anders Carlsson Try to fix the 32-bit build. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForLink]): (-[WKActionMenuController _createActionMenuItemForTag:]): 2014-11-05 Dana Burkart Merge r175589. 2014-11-04 Conrad Shultz Use a web view for Quick Look in action menus https://bugs.webkit.org/show_bug.cgi?id=138370 Reviewed by Anders Carlsson. Instead of using the QLPreviewBubble SPI, show a popover containing a web view. This currently does not inherit any configuration from the presenting WKView and does not expose any customization options. * UIProcess/mac/WKActionMenuController.mm: Declare new internal NSViewController subclass, WKPagePreviewViewController. (-[WKPagePreviewViewController initWithPageURL:]): Store the passed-in URL and set a somewhat arbitrary (iPhone 5 screen size) default preferred size. (-[WKPagePreviewViewController loadView]): Create a WKWebView and load the URL passed into the initializer. (-[WKActionMenuController _previewURLFromActionMenu:]): Renamed from -_quickLookURLFromActionMenu:; present the popover returned by -_createPreviewPopoverForURL:. (-[WKActionMenuController _createPreviewPopoverForURL:]): New helper method; return a popover that owns a _WKPagePreviewViewController configured to show a scaled-down web page. (-[WKActionMenuController _createActionMenuItemForTag:]): Update to reflect method rename. (-[WKActionMenuController _quickLookURLFromActionMenu:]): Deleted. 2014-11-05 Dana Burkart Merge r175610. 2014-11-04 Beth Dakin Speculative build fix. * UIProcess/API/mac/WKView.mm: (-[WKView _dismissActionMenuDataDetectorPopovers]): * UIProcess/API/mac/WKViewInternal.h: 2014-11-05 Dana Burkart Merge r175609. 2014-11-04 Beth Dakin Un-anchor data detector popovers on scroll https://bugs.webkit.org/show_bug.cgi?id=138385 -and corresponding- rdar://problem/18869345 Reviewed by Tim Horton. Whenever we dismiss the dictionary popover, and on scroll, we should try to dismiss the data detector popovers. Right now we don’t have the ability to know if a dismiss succeeded, so we will settle for un-anchoring the popover. * UIProcess/API/mac/WKView.mm: (-[WKView viewDidMoveToWindow]): (-[WKView _dismissActionMenuDataDetetcorPopovers]): * UIProcess/API/mac/WKViewInternal.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::pageDidScroll): (WebKit::WebPageProxy::resetStateAfterProcessExited): * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::dismissActionMenuDataDetetcorPopovers): * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController dismissActionMenuDataDetetcorPopovers]): 2014-11-05 Dana Burkart Merge r175597. 2014-11-04 Tim Horton Add bundle SPI allowing PageOverlay to customize the action menu https://bugs.webkit.org/show_bug.cgi?id=138388 Reviewed by Anders Carlsson. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: Bump the BundlePageOverlay client version. (WKBundlePageOverlayCreate): (WKBundlePageOverlaySetAccessibilityClient): Don't return if we have a version; the version check happens later anyway, and now it is valid to have a version >0. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h: Bump the BundlePageOverlay client version. Add prepareForActionMenu callback. * WebProcess/WebPage/WebPageOverlay.h: (WebKit::WebPageOverlay::Client::prepareForActionMenu): * WebProcess/WebPage/WebPageOverlay.cpp: (WebKit::overlayMap): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::~WebPageOverlay): (WebKit::WebPageOverlay::fromCoreOverlay): (WebKit::WebPageOverlay::pageOverlayDestroyed): Keep track of a map of PageOverlay to WebPageOverlay. (WebKit::WebPageOverlay::prepareForActionMenu): Forward prepareForActionMenu to the client. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performActionMenuHitTestAtLocation): Iterate through the overlays and let them prepareForActionMenu; the first overlay that returns true wins. If no overlays want to do anything, hand preparation along to the context menu client. 2014-11-05 Dana Burkart Merge r175568. 2014-11-04 Csaba Osztrogonác URTBF after r175564 for !PLATFORM(COCOA). * Shared/TextIndicator.cpp: 2014-11-05 Dana Burkart Merge r175564. 2014-11-04 Tim Horton Implement yellow highlight over data detected items https://bugs.webkit.org/show_bug.cgi?id=138340 Reviewed by Anders Carlsson. * Shared/TextIndicator.cpp: Renamed from Source/WebKit2/UIProcess/TextIndicator.cpp. * Shared/TextIndicator.h: Renamed from Source/WebKit2/UIProcess/TextIndicator.h. Move TextIndicator to Shared. Move all of the members to a Data struct. Implement encode/decode for TextIndicator::Data, so it can be passed as the argument to SetTextIndicator, and also as a field on ActionMenuHitTestResult. Add 'createWithSelectionInFrame', which builds a TextIndicator from the selection in the given frame. * Shared/mac/ActionMenuHitTestResult.h: * Shared/mac/ActionMenuHitTestResult.mm: (WebKit::ActionMenuHitTestResult::encode): (WebKit::ActionMenuHitTestResult::decode): Rename actionBoundingBox to detectedDataBoundingBox. Store/encode/decode detectedDataTextIndicator. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setTextIndicator): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: Create a TextIndicator from the TextIndicator::Data. Add an explicit ClearTextIndicator message instead of sending empty Data. * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController prepareForMenu:withEvent:]): If the text indicator is up when preparing for a new menu invocation, hide it. (-[WKActionMenuController willOpenMenu:withEvent:]): Show the text indicator when the menu opens, for data detected items. (-[WKActionMenuController didCloseMenu:withEvent:]): Hide the text indicator when the menu closes, unless we only had one item. Then, we'll hide it in the DDActionContext completionHandler block. (-[WKActionMenuController _showTextIndicator]): (-[WKActionMenuController _hideTextIndicator]): Added. Show and hide the text indicator based on the TextIndicator data included in the action menu hit test result. (-[WKActionMenuController _defaultMenuItemsForDataDetectedText]): Hide the text indicator when the data detector popover completes. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::getImageForFindMatch): Make use of the newly-moved createSelectionSnapshot. (WebKit::FindController::updateFindIndicator): Make use of TextIndicator::createWithSelectionInFrame, which allows us to share this code for building a TextIndicator with other callers. (WebKit::FindController::hideFindIndicator): (WebKit::getFindIndicatorBitmap): Deleted. Move getFindIndicatorBitmap to WebFrame::createSelectionSnapshot. * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::createSelectionSnapshot): Moved from FindController's getFindIndicatorBitmap. Now returns a ShareableBitmap instead of going ahead and making a Handle. * WebProcess/WebPage/WebFrame.h: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::scanForDataDetectedItems): (WebKit::textIndicatorForRange): Temporarily change the selection to the given range, then use TextIndicator::indicatorWithSelectionInFrame to acquire a TextIndicator, then reset the selection. (WebKit::WebPage::performActionMenuHitTestAtLocation): Create a TextIndicator from the data detected range. 2014-11-05 Dana Burkart Merge r175524. 2014-11-04 Tim Horton Dictionary lookup panel pops up at random when clicking on selected text https://bugs.webkit.org/show_bug.cgi?id=138353 * WebProcess/WebPage/WebPage.h: Fix the build; this needs to be public. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::rangeForDictionaryLookupAtHitTestResult): Use the right selection (the one we just tested) in the change from r175517. 2014-11-05 Dana Burkart Merge r175517. 2014-11-04 Tim Horton Dictionary lookup panel pops up at random when clicking on selected text https://bugs.webkit.org/show_bug.cgi?id=138353 Reviewed by Andreas Kling. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::rangeForDictionaryLookupForSelection): (WebKit::rangeForDictionaryLookupAtHitTestResult): Factor rangeForDictionaryLookupForSelection out of performDictionaryLookupForSelection. Make use of rangeForDictionaryLookupForSelection in rangeForDictionaryLookupAtHitTestResult, returning the selection-based range if the hit test intersects the selected text. Previously, we were just going forward with performDictionaryLookupForSelection, which would actually *do* the lookup, even if we just wanted to retrieve the range. Make rangeForDictionaryLookup* static. (WebKit::WebPage::performDictionaryLookupForSelection): Make use of rangeForDictionaryLookupForSelection. 2014-11-03 Beth Dakin Implement action menus for editable text with spelling suggestions https://bugs.webkit.org/show_bug.cgi?id=138333 -and corresponding- rdar://problem/18742371 Reviewed by Tim Horton. New types. * Shared/API/c/WKActionMenuItemTypes.h: * Shared/API/c/WKActionMenuTypes.h: ActionMenuHitTestResult now stores the String result of the lookup. * Shared/mac/ActionMenuHitTestResult.h: * Shared/mac/ActionMenuHitTestResult.mm: (WebKit::ActionMenuHitTestResult::encode): (WebKit::ActionMenuHitTestResult::decode): Make getGuessesForWord() public so we can call it from WKActionMenuController. * UIProcess/WebPageProxy.h: * UIProcess/mac/WKActionMenuController.mm: Select the text for all types of text menus. (-[WKActionMenuController isMenuForTextContent]): (-[WKActionMenuController willOpenMenu:withEvent:]): Spelling suggestions are presented in a sub-menu and will replace the selection when chosen. (-[WKActionMenuController _defaultMenuItemsForEditableTextWithSuggestions:]): (-[WKActionMenuController _changeSelectionToSuggestion:]): (-[WKActionMenuController _createActionMenuItemForTag:]): (-[WKActionMenuController _defaultMenuItems:]): New function to store the lookupText as a String on the ActionMenuHitTestResult. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performActionMenuHitTestAtLocation): (WebKit::WebPage::lookupTextAtLocation): 2014-10-29 Tim Horton Rename WebPageProxy::activeActionMenuHitTestResult to lastMouseMoveHitTestResult https://bugs.webkit.org/show_bug.cgi?id=138137 Reviewed by Anders Carlsson. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::mouseDidMoveOverElement): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::lastMouseMoveHitTestResult): (WebKit::WebPageProxy::activeActionMenuHitTestResult): Deleted. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForLink]): (-[WKActionMenuController _openURLFromActionMenu:]): (-[WKActionMenuController _addToReadingListFromActionMenu:]): (-[WKActionMenuController _quickLookURLFromActionMenu:]): (-[WKActionMenuController _saveImageToDownloads:]): (imageForResource:name::if): (-[WKActionMenuController _updateActionMenuItems]): Rename to the more accurate and general name. 2014-11-03 Tim Horton _actionMenuItemsForHitTestResult is given kWKActionMenuLink but an empty array of defaultMenuItems https://bugs.webkit.org/show_bug.cgi?id=138321 Reviewed by Beth Dakin. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForLink]): (-[WKActionMenuController _defaultMenuItems:]): Move the HTTP-family-URLs-only condition to the place where we decide what kind of menu to show. We depend on _defaultMenuItemsForLink returning the link menu, and should never set the link menu type if we aren't going to build a link menu. 2014-11-03 Tim Horton Use FrameSnapshotting functions in FindController::getFindIndicatorBitmap https://bugs.webkit.org/show_bug.cgi?id=138300 Reviewed by Simon Fraser. Share more code by using WebCore's FrameSnapshotting::snapshotSelection in FindController instead of copying it into FindController wholesale. * WebProcess/WebPage/FindController.cpp: (WebKit::getFindIndicatorBitmap): Make getFindIndicatorBitmap static, rename it from getFindIndicatorBitmapAndRect, and drop the rect argument because only one caller wanted it, and we no longer need to compute it (this happens in WebCore now). Use snapshotSelection; all of the removed paint behaviors get added by code in or underneath snapshotSelection now. Draw the snapshot into our ShareableBitmap; we could avoid this in a future patch by refactoring the FrameSnapshotting functions to take GraphicsContexts. (WebKit::FindController::getImageForFindMatch): (WebKit::FindController::updateFindIndicator): Adopt the new getFindIndicatorBitmap. * WebProcess/WebPage/FindController.h: Remove getFindIndicatorBitmap(AndRect), which is now static. 2014-11-03 Beth Dakin Implement action menus for editable text https://bugs.webkit.org/show_bug.cgi?id=138284 -and corresponding- rdar://problem/18742323 Reviewed by Tim Horton. New item type for paste. * Shared/API/c/WKActionMenuItemTypes.h: New menu type for editable text. * Shared/API/c/WKActionMenuTypes.h: * UIProcess/mac/WKActionMenuController.mm: willOpenMenu should select text for both regular text menus and editable text menus. (-[WKActionMenuController willOpenMenu:withEvent:]): Default items for editable text. (-[WKActionMenuController _defaultMenuItemsForEditableText]): (-[WKActionMenuController _paste:]): (-[WKActionMenuController _createActionMenuItemForTag:]): New method _hitTestResultForStage:(MenuUpdateStage)stage will figure out whether we can use the WebHitTestResult from the ActionMenuHitTestResult or if we have to use the potentially out-of-date WebHitTestResult that is cached on WebPageProxy. An important difference between these results is that the ActionMenuHitTest result, in addition to being more recent and accurate, also now includes shadow content, which affects some editable regions on important sites such as bugs.webkit.org and nytimes.com. (-[WKActionMenuController _defaultMenuItems:]): (-[WKActionMenuController _updateActionMenuItemsForStage:]): (imageForResource:name::if): Deleted. Allow shadow content in action menu hit testing. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performActionMenuHitTestAtLocation): (WebKit::WebPage::selectLookupTextAtLocation): 2014-11-04 Dana Burkart Merge r175482. 2014-11-03 Csaba Osztrogonác URTBF after r175476 to make GTK and EFL build happy. * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::setTextIndicator): (WebKit::PageClientImpl::setFindIndicator): Deleted. * UIProcess/API/gtk/PageClientImpl.h: * UIProcess/CoordinatedGraphics/WebView.cpp: (WebKit::WebView::setTextIndicator): (WebKit::WebView::setFindIndicator): Deleted. * UIProcess/CoordinatedGraphics/WebView.h: 2014-11-04 Dana Burkart Merge r175476. 2014-11-03 Tim Horton Rename FindIndicator{Window} to TextIndicator{Window} https://bugs.webkit.org/show_bug.cgi?id=138302 Reviewed by Anders Carlsson. Rename FindIndicator{Window} to TextIndicator{Window} (and related), because it will soon be used to indicate ranges of text that are not necessarily find-in-page results. FindController still has things named 'findIndicator' internally, and I left the API alone (because all the API bits are actually find-specific), but the actual FindIndicator/Window and the message to set it up, etc. are all now called Text*. * CMakeLists.txt: * UIProcess/API/mac/WKView.mm: * UIProcess/API/mac/WKViewInternal.h: * UIProcess/PageClient.h: * UIProcess/TextIndicator.cpp: Renamed from Source/WebKit2/UIProcess/FindIndicator.cpp. * UIProcess/TextIndicator.h: Renamed from Source/WebKit2/UIProcess/FindIndicator.h. * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: * UIProcess/ios/WKContentView.h: * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: * UIProcess/mac/TextIndicatorWindow.h: Renamed from Source/WebKit2/UIProcess/mac/FindIndicatorWindow.h. * UIProcess/mac/TextIndicatorWindow.mm: Renamed from Source/WebKit2/UIProcess/mac/FindIndicatorWindow.mm. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/FindController.cpp: 2014-11-04 Matthew Hanson Merge r175425. 2014-10-31 Beth Dakin Use system art for action menus when possible https://bugs.webkit.org/show_bug.cgi?id=138260 Reviewed by Tim Horton. * Resources/AddImageToPhotosTemplate.pdf: Removed. * Resources/CopyImageTemplate.pdf: Removed. * Resources/SaveImageToDownloadsTemplate.pdf: Removed. * Resources/ShareImageTemplate.pdf: Removed. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _createActionMenuItemForTag:]): * WebKit2.xcodeproj/project.pbxproj: 2014-11-04 Dana Burkart Merge r175444. 2014-10-31 Sam Weinig Add bundle SPI to customize the action menu https://bugs.webkit.org/show_bug.cgi?id=138271 Reviewed by Anders Carlsson. - Adds a new function to the WKBundlePageContextMenuClient that allows the client to pass construct user data in the bundle that can be available when customizing the menu in -[WKView _actionMenuItemsForHitTestResult...]. - Changes the signature of -[WKView _actionMenuItemsForHitTestResult...] to add userData. - Makes the actual hit test result available in the second invocation of -[WKView _actionMenuItemsForHitTestResult...] by serializing it in the ActionMenuHitTestResult. * Shared/mac/ActionMenuHitTestResult.h: * Shared/mac/ActionMenuHitTestResult.mm: (WebKit::ActionMenuHitTestResult::encode): (WebKit::ActionMenuHitTestResult::decode): Adds the WebHitTestResult and the original hit test request location. * UIProcess/API/Cocoa/WKViewPrivate.h: Adds a new version of _actionMenuItemsForHitTestResult that passes userData along. * UIProcess/API/mac/WKView.mm: (-[WKView _didPerformActionMenuHitTest:userData:]): (-[WKView _actionMenuItemsForHitTestResult:withType:defaultActionMenuItems:userData:]): * UIProcess/API/mac/WKViewInternal.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didPerformActionMenuHitTest): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::didPerformActionMenuHitTest): Pipe the user data through to the WKView. * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController prepareForMenu:withEvent:]): (-[WKActionMenuController didPerformActionMenuHitTest:userData:]): (-[WKActionMenuController menuNeedsUpdate:]): (-[WKActionMenuController _updateActionMenuItemsForStage:]): Differentiate between the two times _updateActionMenuItems was called via a new stage parameter, (it is called once in prepareForMenu, and once in menuNeedsUpdate). Use the last mouse move hit test result in the prepareForMenu case (as we don't have a real result yet), and the hit result passed in via didPerformActionMenuHitTest in the menuNeedsUpdate case (assuming we didn't time out) waiting on the web process. * WebProcess/InjectedBundle/API/c/WKBundlePageContextMenuClient.h: * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp: (WebKit::InjectedBundlePageContextMenuClient::prepareForActionMenu): * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performActionMenuHitTestAtLocation): Adds new bundle SPI to collect user data to pass to the -[WKView _actionMenuItemsForHitTestResult...] method. 2014-11-04 Dana Burkart Merge r175428. 2014-10-31 Tim Horton REGRESSION (r175376): Occasional null deref when doing a dictionary lookup https://bugs.webkit.org/show_bug.cgi?id=138261 Reviewed by Anders Carlsson. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performDictionaryLookupAtLocation): rangeForDictionaryLookupAtHitTestResult can easily return null. 2014-11-04 Dana Burkart Merge r175422. 2014-10-31 Timothy Horton Fix the build for Yosemite systems after r175417 * UIProcess/mac/WKActionMenuController.mm: 2014-11-04 Dana Burkart Merge r175420. 2014-10-31 Timothy Horton Fix the build for pre-Yosemite systems after r175417 * UIProcess/API/mac/WKView.mm: (-[WKView dealloc]): (-[WKView initWithFrame:context:configuration:webView:]): * UIProcess/API/mac/WKViewInternal.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::didPerformActionMenuHitTest): * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: 2014-11-04 Dana Burkart Merge r175418. 2014-10-31 Timothy Horton Remove "Add to iPhoto" from the action menu's sharing menu https://bugs.webkit.org/show_bug.cgi?id=138251 Reviewed by Anders Carlsson. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController sharingServicePicker:sharingServicesForItems:mask:proposedSharingServices:]): Retain/autorelease the new array. 2014-11-04 Dana Burkart Merge r175417. 2014-10-31 Tim Horton Remove "Add to iPhoto" from the action menu's sharing menu https://bugs.webkit.org/show_bug.cgi?id=138251 Reviewed by Anders Carlsson. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController sharingServicePicker:sharingServicesForItems:mask:proposedSharingServices:]): Filter out "Add to iPhoto". 2014-11-04 Dana Burkart Merge r175388. 2014-10-30 Tim Horton Long spins under rangeExpandedAroundPosition on Yahoo Mail https://bugs.webkit.org/show_bug.cgi?id=138223 Reviewed by Enrica Casucci. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::rangeExpandedAroundPositionByCharacters): Reimplement rangeExpandedAroundPosition to operate on characters instead of lines, and to use Position. Moving VisiblePositions by line can be very expensive in some cases, and for generating lookup/Data Detectors context, we don't care about that kind of precision. This makes this function ~1000x faster when it hits on a row in the Yahoo Mail message list. (WebKit::WebPage::performDictionaryLookupAtLocation): (WebKit::scanForDataDetectedItems): Adopt the new rangeExpandedAroundPositionByCharacters, expanding 250 characters before and after, which roughly matches what we were usually getting going by line, and is a reasonable amount of context for these operations. 2014-11-04 Dana Burkart Merge r175349. 2014-10-29 Anders Carlsson Clear ViewSnapshots when back/forward list items are removed from their list https://bugs.webkit.org/show_bug.cgi?id=138188 Reviewed by Tim Horton. Ideally we should remove the WebBackForwardListItem objects as well, but this is a somewhat safer fix. Change all the "remove item" codepaths to call WebBackForwardList::didRemoveItem and have it clear out the snapshot. * UIProcess/WebBackForwardList.cpp: (WebKit::WebBackForwardList::pageClosed): (WebKit::WebBackForwardList::addItem): (WebKit::WebBackForwardList::removeAllItems): (WebKit::WebBackForwardList::clear): (WebKit::WebBackForwardList::didRemoveItem): * UIProcess/WebBackForwardList.h: 2014-11-04 Dana Burkart Merge r175339. 2014-10-29 Tim Horton Hide the 'Add to Photos' item if it isn't available https://bugs.webkit.org/show_bug.cgi?id=138182 Reviewed by Beth Dakin. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForImage]): (-[WKActionMenuController _canAddImageToPhotos]): (-[WKActionMenuController _addImageToPhotos:]): Factor _canAddImageToPhotos out of _addImageToPhotos:, and use it in _defaultMenuItemsForImage to avoid including the menu item in the first place. 2014-10-31 Dana Burkart Rollout rollout of r174369. 2014-10-06 Chris Dumez [Mac] We are spending too much time serializing ProtectionSpace objects https://bugs.webkit.org/show_bug.cgi?id=137367 Reviewed by Dan Bernstein. When profiling the load of nytimes.com, I noticed that we were spending a lot of CPU time serializing ProtectionSpace objects (in particular the NSURLProtectionSpace platform data): - 5.6% of CPU time for Network Process - 2.5% of CPU time for WebProcess Serializing an NSURLProtectionSpace seems to be costly due to server trust verification. We do this for every sub-resource load over HTTPS due to the canAuthenticateAgainstProtectionSpace() callback for server trust validation, from the NetworkProcess to the WebProcess and then to the UIProcess. This patch adds a WKContextSetCanHandleHTTPSServerTrustEvaluation(bool) WK2 private API that the client can call to indicate that it cannot handle HTTPS server trust evaluation and that it is thus unnecessary to call the canAuthenticateAgainstProtectionSpace() callback for such evaluations. This reduces the amount of IPC between the process and thus the number of times we have to serialize the ProtectionSpace. In the case of the nytimes.com load, there is no longer any ProtectionSpace serialization happening as canAuthenticateAgainstProtectionSpace() was only called for HTTPS server trust evaluation. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::NetworkProcess): (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::setCanHandleHTTPSServerTrustEvaluation): * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::canHandleHTTPSServerTrustEvaluation): * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync): * Shared/Network/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode): (WebKit::NetworkProcessCreationParameters::decode): * Shared/Network/NetworkProcessCreationParameters.h: * UIProcess/API/C/WKContext.cpp: (WKContextSetCanHandleHTTPSServerTrustEvaluation): * UIProcess/API/C/WKContextPrivate.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _setCanHandleHTTPSServerTrustEvaluation:]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/WebContext.cpp: (WebKit::WebContext::WebContext): (WebKit::WebContext::ensureNetworkProcess): (WebKit::WebContext::setCanHandleHTTPSServerTrustEvaluation): * UIProcess/WebContext.h: 2014-10-29 Tim Horton Merge r175376 and r175390. 2014-10-30 Beth Dakin Implement action menus for text https://bugs.webkit.org/show_bug.cgi?id=138220 -and corresponding- rdar://problem/18742297 Reviewed by Tim Horton. Two new types of actions for the two text actions. * Shared/API/c/WKActionMenuItemTypes.h: One new type of menu. * Shared/API/c/WKActionMenuTypes.h: Pass willOpenMenu on to the WKActionMenuController. * UIProcess/API/mac/WKView.mm: (-[WKView willOpenMenu:withEvent:]): Two new WebPageProxy functions that will pass messages along to the web process. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::selectLookupTextAtLocation): * UIProcess/WebPageProxy.h: At willOpenMenu time, text menus should select text so that it is clear what the menu actions will apply to. * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: Menu items for text menus. (-[WKActionMenuController willOpenMenu:withEvent:]): (-[WKActionMenuController _defaultMenuItemsForText]): (-[WKActionMenuController _copyText:]): (-[WKActionMenuController _lookupText:]): (-[WKActionMenuController _createActionMenuItemForTag:]): (imageForResource:name::if): New messages to the web process. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::performDictionaryLookupOfCurrentSelection): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Re-factor performDictionaryLookupAtLocation() to re-use the code that finds the Range for the dictionary lookup. That code now lives in rangeForDictionaryLookupAtHitTestResult() and can be used by performDictionaryLookupAtLocation() and our new function selectLookupTextAtLocation(). * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::rangeForDictionaryLookupAtHitTestResult): (WebKit::WebPage::performDictionaryLookupAtLocation): Since the action menu text is always selected, when the lookup action is chosen, we can just lookup the current selection. (WebKit::WebPage::performDictionaryLookupOfCurrentSelection): Uses the new function rangeForDictionaryLookupAtHitTestResult() to get a lookup range and then select it. (WebKit::WebPage::selectLookupTextAtLocation): 2014-10-29 Tim Horton Merge r175160. 2014-10-24 Marcos Chavarría Teijeiro [GTK] Implement is_selected method on WebKitHitTestResult https://bugs.webkit.org/show_bug.cgi?id=137110 Reviewed by Tim Horton. Expose CONTEXT_SELECTION for WebKitHitTestResult. * Shared/WebHitTestResult.cpp: Add is_selected field and getter for this field. (WebKit::WebHitTestResult::Data::Data): (WebKit::WebHitTestResult::Data::encode): (WebKit::WebHitTestResult::Data::decode): * Shared/WebHitTestResult.h: (WebKit::WebHitTestResult::isSelected): * UIProcess/API/gtk/WebKitHitTestResult.cpp: Add WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION context and method to check it. (webkitHitTestResultCreate): (webkitHitTestResultCompare): (webkit_hit_test_result_context_is_selection): * UIProcess/API/gtk/WebKitHitTestResult.h: * UIProcess/API/gtk/WebKitWebView.cpp: Modify context-menu callback to set the new context option. (webkitWebViewPopulateContextMenu): * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add documentation about new function. 2014-10-29 Matthew Hanson Merge r175353. rdar://problem/18817803 2014-10-29 Tim Horton Null deref under performActionMenuHitTestAtLocation https://bugs.webkit.org/show_bug.cgi?id=138197 Reviewed by Beth Dakin. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::scanForDataDetectedItems): Null-check the expanded range. 2014-10-29 Matthew Hanson Rollout r174369. 2014-10-06 Chris Dumez [Mac] We are spending too much time serializing ProtectionSpace objects https://bugs.webkit.org/show_bug.cgi?id=137367 Reviewed by Dan Bernstein. When profiling the load of nytimes.com, I noticed that we were spending a lot of CPU time serializing ProtectionSpace objects (in particular the NSURLProtectionSpace platform data): - 5.6% of CPU time for Network Process - 2.5% of CPU time for WebProcess Serializing an NSURLProtectionSpace seems to be costly due to server trust verification. We do this for every sub-resource load over HTTPS due to the canAuthenticateAgainstProtectionSpace() callback for server trust validation, from the NetworkProcess to the WebProcess and then to the UIProcess. This patch adds a WKContextSetCanHandleHTTPSServerTrustEvaluation(bool) WK2 private API that the client can call to indicate that it cannot handle HTTPS server trust evaluation and that it is thus unnecessary to call the canAuthenticateAgainstProtectionSpace() callback for such evaluations. This reduces the amount of IPC between the process and thus the number of times we have to serialize the ProtectionSpace. In the case of the nytimes.com load, there is no longer any ProtectionSpace serialization happening as canAuthenticateAgainstProtectionSpace() was only called for HTTPS server trust evaluation. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::NetworkProcess): (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::setCanHandleHTTPSServerTrustEvaluation): * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::canHandleHTTPSServerTrustEvaluation): * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync): * Shared/Network/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode): (WebKit::NetworkProcessCreationParameters::decode): * Shared/Network/NetworkProcessCreationParameters.h: * UIProcess/API/C/WKContext.cpp: (WKContextSetCanHandleHTTPSServerTrustEvaluation): * UIProcess/API/C/WKContextPrivate.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _setCanHandleHTTPSServerTrustEvaluation:]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/WebContext.cpp: (WebKit::WebContext::WebContext): (WebKit::WebContext::ensureNetworkProcess): (WebKit::WebContext::setCanHandleHTTPSServerTrustEvaluation): * UIProcess/WebContext.h: 2014-08-29 Matthew Hanson Merge r175335. rdar://problem/18709436 2014-10-29 Tim Horton Implement action menus for data detected items https://bugs.webkit.org/show_bug.cgi?id=138178 Reviewed by Anders Carlsson. * Shared/API/c/WKActionMenuTypes.h: Add a new type. * Shared/WebHitTestResult.cpp: (WebKit::WebHitTestResult::Data::Data): (WebKit::WebHitTestResult::Data::encode): (WebKit::WebHitTestResult::Data::decode): * Shared/WebHitTestResult.h: (WebKit::WebHitTestResult::isTextNode): Determine, store, encode, and decode whether or not the hit node is a text node. * Shared/mac/ActionMenuHitTestResult.h: * Shared/mac/ActionMenuHitTestResult.mm: Renamed from Source/WebKit2/Shared/mac/ActionMenuHitTestResult.cpp. (WebKit::ActionMenuHitTestResult::encode): (WebKit::ActionMenuHitTestResult::decode): Make ActionMenuHitTestResult an Obj-C++ file. Store, encode, and decode (securely!) a DDActionContext and FloatRect representing the bounding box of the data detected item, if any. * UIProcess/API/mac/WKView.mm: (-[WKView initWithFrame:context:configuration:webView:]): (-[WKView willOpenMenu:withEvent:]): Deleted. Stop using willOpenMenu; we'll use NSMenuDelegate's menuNeedsUpdate: instead. Hook up WKActionMenuController as our action menu's delegate. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController prepareForMenu:withEvent:]): Call _updateActionMenuItems *after* we've adjusted _state, so that it can depend on the value being correct. (-[WKActionMenuController willOpenMenu:withEvent:]): (-[WKActionMenuController didPerformActionMenuHitTest:]): Move menu updating to menuNeedsUpdate for more accurate timing. (_updateActionMenuItems): When building the menu, if we have a text node that is not a link, and hit a data detected item, retrieve the menu from the DDActionContext. If we have nothing, make sure to reset _type, and if the final hit-test is still pending, build a menu with a dummy item. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::performActionMenuHitTestAtLocation): Moved to WebPageMac. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::rangeExpandedAroundPosition): Factor this out of performDictionaryLookupAtLocation. (WebKit::WebPage::performDictionaryLookupAtLocation): Make use of rangeExpandedAroundPosition. (WebKit::scanForDataDetectedItems): Expand to four lines of context around the hit point. Convert that range to plain text, and feed it to DataDetectors. Find the result that intersects the hit point, and make a DDActionContext for it. Also, store the bounding box of the first quad of the detected text, to provide to Data Detectors as a hint for UI placement. (WebKit::WebPage::performActionMenuHitTestAtLocation): If the hit node is a text node, call scanForDataDetectedItems and store the resultant DDActionContext and bounding rect on our ActionMenuHitTestResult for transfer to the UI process. 2014-10-29 Lucas Forschler Merge r175256 2014-10-28 Tim Horton Remove an inaccurate comment in WKActionMenuController https://bugs.webkit.org/show_bug.cgi?id=138135 Reviewed by Anders Carlsson. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForLink]): The comment is wrong; the separator is there for spacing, not just as a workaround. 2014-10-29 Lucas Forschler Merge r175238 2014-10-27 Conrad Shultz NSSharingService protocol conformance should be internal to WKActionMenuController https://bugs.webkit.org/show_bug.cgi?id=138112 Reviewed by Tim Horton. * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: Move protocol conformance from the interface to a class extension. 2014-10-29 Lucas Forschler Merge r175193 2014-10-24 Beth Dakin _actionMenuItemsForHitTestResult should also take a type indicating what the menu was built for https://bugs.webkit.org/show_bug.cgi?id=138063 Reviewed by Dan Bernstein. New type enum that can be used by clients. * Shared/API/c/WKActionMenuTypes.h: Added. Remove the old SPI and add the new. * UIProcess/API/Cocoa/WKViewPrivate.h: * UIProcess/API/mac/WKView.mm: (-[WKView _actionMenuItemsForHitTestResult:withType:defaultActionMenuItems:]): (-[WKView _actionMenuItemsForHitTestResult:defaultActionMenuItems:]): Deleted. Now keep an ivar for the type. * UIProcess/mac/WKActionMenuController.h: Create a category for the old SPI so that we can still call it if clients have implemented it. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController initWithPage:view:]): (-[WKActionMenuController didCloseMenu:withEvent:]): (imageForResource:name::if): (-[WKActionMenuController _updateActionMenuItems]): * WebKit2.xcodeproj/project.pbxproj: 2014-10-29 Lucas Forschler Merge r175190 2014-10-24 Tim Horton Share sheet doesn't attach to the window https://bugs.webkit.org/show_bug.cgi?id=138062 Reviewed by Beth Dakin. * UIProcess/mac/WKActionMenuController.h: WKActionMenuController is now a NSSharingService{Picker}Delegate. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItemsForImage]): Set us up as the NSSharingServicePicker delegate. (-[WKActionMenuController sharingServicePicker:delegateForSharingService:]): Set us up as the NSSharingService delegate. (-[WKActionMenuController sharingService:sourceWindowForShareItems:sharingContentScope:]): Return the appropriate window to attach to. 2014-10-29 Lucas Forschler Merge r175187 2014-10-24 Beth Dakin Very large images crash in action menu code https://bugs.webkit.org/show_bug.cgi?id=138059 -and corresponding- rdar://problem/18767859 Reviewed by Tim Horton. If the HitTestResult failed to create and image, then don’t go for the image action menu. * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController _defaultMenuItems]): ShareableBitmap::createShareable() can fail. The result needs to be null-checked. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::performActionMenuHitTestAtLocation): 2014-10-29 Lucas Forschler Merge r175185 2014-10-24 Beth Dakin Build fix. * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: 2014-10-29 Lucas Forschler Merge r175184 2014-10-24 Tim Horton Blindly try to fix all the builds. * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: 2014-10-29 Lucas Forschler Merge r175181 2014-10-24 Timothy Horton Blindly try to fix all the builds. * UIProcess/mac/WKActionMenuController.h: 2014-10-29 Lucas Forschler Merge r175180 2014-10-24 Timothy Horton Blindly try to fix the 32-bit build. * UIProcess/mac/WKActionMenuController.h: * UIProcess/mac/WKActionMenuController.mm: 2014-10-29 Lucas Forschler Merge r175179 2014-10-24 Tim Horton [Mac][WebKit2] Move action menu code into its own file https://bugs.webkit.org/show_bug.cgi?id=138034 * UIProcess/mac/WKActionMenuController.mm: (-[WKActionMenuController prepareForMenu:withEvent:]): (-[WKActionMenuController _addImageToPhotos:]): Review comments that were not previously addressed. 2014-10-29 Lucas Forschler Merge r175178 2014-10-24 Tim Horton [Mac][WebKit2] Move action menu code into its own file https://bugs.webkit.org/show_bug.cgi?id=138034 Reviewed by Dan Bernstein. * UIProcess/API/mac/WKView.mm: (-[WKView initWithFrame:context:configuration:webView:]): Make a WKActionMenuController if needed. (-[WKView prepareForMenu:withEvent:]): (-[WKView willOpenMenu:withEvent:]): (-[WKView didCloseMenu:withEvent:]): (-[WKView _didPerformActionMenuHitTest:]): Forward these to WKActionMenuController. (-[WKView _openURLFromActionMenu:]): Deleted. (-[WKView _addToReadingListFromActionMenu:]): Deleted. (-[WKView _quickLookURLFromActionMenu:]): Deleted. (-[WKView _createActionMenuItemForTag:]): Deleted. (webKitBundleImageNamed): Deleted. (-[WKView _copyImage:]): Deleted. (-[WKView _saveImageToDownloads:]): Deleted. (temporaryPhotosDirectoryPath): Deleted. (pathToPhotoOnDisk): Deleted. (-[WKView _addImageToPhotos:]): Deleted. (-[WKView _defaultMenuItemsForImage]): Deleted. (-[WKView _defaultMenuItems]): Deleted. (-[WKView _updateActionMenu]): Deleted. Moved to WKActionMenuController. * UIProcess/mac/WKActionMenuController.h: Added. * UIProcess/mac/WKActionMenuController.mm: Added. (-[WKActionMenuController initWithPage:view:]): (-[WKActionMenuController prepareForMenu:withEvent:]): (-[WKActionMenuController willOpenMenu:withEvent:]): (-[WKActionMenuController didCloseMenu:withEvent:]): (-[WKActionMenuController didPerformActionMenuHitTest:]): (-[WKActionMenuController _defaultMenuItemsForLink]): (-[WKActionMenuController _openURLFromActionMenu:]): (-[WKActionMenuController _addToReadingListFromActionMenu:]): (-[WKActionMenuController _quickLookURLFromActionMenu:]): (-[WKActionMenuController _defaultMenuItemsForImage]): (-[WKActionMenuController _copyImage:]): (-[WKActionMenuController _saveImageToDownloads:]): (temporaryPhotosDirectoryPath): (pathToPhotoOnDisk): (-[WKActionMenuController _addImageToPhotos:]): (-[WKActionMenuController _createActionMenuItemForTag:]): (webKitBundleImageNamed): (imageForResource:name::if): (-[WKActionMenuController _updateActionMenuItems]): Moved from WKView. * WebKit2.xcodeproj/project.pbxproj: 2014-10-29 Lucas Forschler Merge r175147 2014-10-23 Tim Horton Add some SPI headers for NSExtension and NSSharingService{Picker} https://bugs.webkit.org/show_bug.cgi?id=138027 Reviewed by Anders Carlsson. * UIProcess/API/mac/WKView.mm: * UIProcess/mac/ServicesController.mm: * UIProcess/mac/WebContextMenuProxyMac.mm: Replace redefinitions with SPI header #imports. 2014-10-29 Lucas Forschler Merge r172542 2014-08-13 Mark Rowe WebKit should build on Yosemite with the public SDK. Reviewed by Darin Adler. * Platform/IPC/mac/ImportanceAssertion.h: Forward-declare the new assertion functions we use. * UIProcess/mac/WebContextMenuProxyMac.mm: Forward-declare some details related to NSSharingServicePicker. 2014-10-28 Dana Burkart Merge r174791. 2014-10-16 Tim Horton Implement selection services menu for Legacy WebKit https://bugs.webkit.org/show_bug.cgi?id=137582 Reviewed by Brady Eidson. * UIProcess/mac/WebContextMenuProxyMac.mm: (-[WKSharingServicePickerDelegate sharingService:didShareItems:]): Add a note that we should transition to using replaceSelectionWithAttributedString. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::handleSelectionServiceClick): Allow editor services in editable-but-not-rich-text areas, just like in WebKit1. 2014-10-28 Dana Burkart Merge r174524. 2014-10-09 Tim Horton Move ServicesOverlayController to WebCore https://bugs.webkit.org/show_bug.cgi?id=137416 Reviewed by Anders Carlsson. * Platform/Logging.h: Move Services logging channel to WebCore. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::handleTelephoneNumberClick): (WebKit::WebChromeClient::handleSelectionServiceClick): (WebKit::WebChromeClient::hasRelevantSelectionServices): Implement services-related ChromeClient callbacks. Clicks are forwarded to WebPageMac where they do what they used to; hasRelevantSelectionServices is implemented as it was when it lived inside ServicesOverlayController. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebEditorClient.cpp: (WebKit::WebEditorClient::selectedTelephoneNumberRangesChanged): Deleted. (WebKit::WebEditorClient::selectionRectsDidChange): Deleted. * WebProcess/WebCoreSupport/WebEditorClient.h: Remove WebEditorClient overrides for now-removed functions. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): (WebKit::WebPage::updatePreferences): Forward serviceControlsEnabled setting to WebCore. (WebKit::WebPage::servicesOverlayController): Deleted. * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::serviceControlsEnabled): Deleted. 2014-10-28 Dana Burkart Merge r174231. 2014-10-02 Tim Horton Move PageOverlay[Controller] to WebCore https://bugs.webkit.org/show_bug.cgi?id=137164 Reviewed by Anders Carlsson. * CMakeLists.txt: * WebKit2.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Make WKBundlePageOverlayRef map to WebPageOverlay instead of PageOverlay. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlay): (WKBundlePageUninstallPageOverlay): (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): Forward PageOverlay installation/uninstallation to WebCore. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (WKBundlePageOverlayGetTypeID): (WKBundlePageOverlayCreate): (WKBundlePageOverlaySetAccessibilityClient): Use WebPageOverlay instead of PageOverlay, and references instead of pointers. We forward client callbacks through from PageOverlay::Client to WebPageOverlay::Client. (PageOverlayClientImpl::copyAccessibilityAttributeValue): (PageOverlayClientImpl::copyAccessibilityAttributeNames): Convert from wtf types to WebKit2 types. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::graphicsLayerFactory): If we don't have a drawing area, don't dereference it! (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Forward attachViewOverlayGraphicsLayer to the DrawingArea. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebInspectorClient.cpp: * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/FindController.h: * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h: * WebProcess/WebPage/mac/ServicesOverlayController.mm: * WebProcess/WebPage/ServicesOverlayController.h: Mechanical changes to adopt to the fact that PageOverlay is in WebCore now. * WebProcess/WebPage/LayerTreeHost.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: Remove support for WebKit2-based page overlays. Return MainFrame instead of Frame from mainFrame(). * WebProcess/WebPage/WebPageOverlay.cpp: Added. * WebProcess/WebPage/WebPageOverlay.h: Added. (WebKit::WebPageOverlay::create): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::~WebPageOverlay): (WebKit::WebPageOverlay::setNeedsDisplay): (WebKit::WebPageOverlay::clear): (WebKit::WebPageOverlay::pageOverlayDestroyed): (WebKit::WebPageOverlay::willMoveToPage): (WebKit::WebPageOverlay::didMoveToPage): (WebKit::WebPageOverlay::drawRect): (WebKit::WebPageOverlay::mouseEvent): (WebKit::WebPageOverlay::didScrollFrame): (WebKit::WebPageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeNames): WebPageOverlay exists to be our API object, but forwards everything to its WebCore::PageOverlay, and implements WebCore::PageOverlay::Client, and forwards client callbacks to its WebPageOverlay::Client (which WKBundlePageOverlay implements). * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Forward the three AX properties that PageOverlays are ever queried for to the appropriate PageOverlayController function. * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): If we attach/detach the view-relative page overlay root layer, reattach the root compositing layer's children. (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): Ditto for the root compositing layer. (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Make use of updateRootLayers when we attach/detach root compositing layer/view overlay layer. (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * Shared/WebRenderLayer.cpp: * Shared/WebRenderObject.cpp: * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebProcess.cpp: Include MainFrame.h because WebPage::mainFrame returns a MainFrame now. 2014-10-28 Dana Burkart Merge r174369. 2014-10-06 Chris Dumez [Mac] We are spending too much time serializing ProtectionSpace objects https://bugs.webkit.org/show_bug.cgi?id=137367 Reviewed by Dan Bernstein. When profiling the load of nytimes.com, I noticed that we were spending a lot of CPU time serializing ProtectionSpace objects (in particular the NSURLProtectionSpace platform data): - 5.6% of CPU time for Network Process - 2.5% of CPU time for WebProcess Serializing an NSURLProtectionSpace seems to be costly due to server trust verification. We do this for every sub-resource load over HTTPS due to the canAuthenticateAgainstProtectionSpace() callback for server trust validation, from the NetworkProcess to the WebProcess and then to the UIProcess. This patch adds a WKContextSetCanHandleHTTPSServerTrustEvaluation(bool) WK2 private API that the client can call to indicate that it cannot handle HTTPS server trust evaluation and that it is thus unnecessary to call the canAuthenticateAgainstProtectionSpace() callback for such evaluations. This reduces the amount of IPC between the process and thus the number of times we have to serialize the ProtectionSpace. In the case of the nytimes.com load, there is no longer any ProtectionSpace serialization happening as canAuthenticateAgainstProtectionSpace() was only called for HTTPS server trust evaluation. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::NetworkProcess): (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::setCanHandleHTTPSServerTrustEvaluation): * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::canHandleHTTPSServerTrustEvaluation): * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync): * Shared/Network/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode): (WebKit::NetworkProcessCreationParameters::decode): * Shared/Network/NetworkProcessCreationParameters.h: * UIProcess/API/C/WKContext.cpp: (WKContextSetCanHandleHTTPSServerTrustEvaluation): * UIProcess/API/C/WKContextPrivate.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _setCanHandleHTTPSServerTrustEvaluation:]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/WebContext.cpp: (WebKit::WebContext::WebContext): (WebKit::WebContext::ensureNetworkProcess): (WebKit::WebContext::setCanHandleHTTPSServerTrustEvaluation): * UIProcess/WebContext.h: 2014-10-28 Dana Burkart Merge r174257. 2014-10-02 Csaba Osztrogonác URTBF after r174231 to fix non Apple builds. * WebProcess/WebPage/WebPage.h: 2014-10-23 Matthew Hanson Correcting the merge for r175075. Rubber-stamped by Tim Horton. * UIProcess/WebPageProxy.messages.in: 2014-10-23 Matthew Hanson Merge r175127. 2014-10-23 Tim Horton Assertion failures in ImageKit soft linking https://bugs.webkit.org/show_bug.cgi?id=138009 Reviewed by Anders Carlsson. * UIProcess/API/mac/WKView.mm: Soft-link ImageKit correctly. ImageKit is inside the Quartz umbrella framework. 2014-10-23 Matthew Hanson Correcting the merge for r175075. Rubber-stamped by Tim Horton. * Scripts/webkit2/messages.py: (struct_or_class): 2014-10-23 Matthew Hanson Merge r175075. 2014-10-22 Tim Horton Add action menu support for images https://bugs.webkit.org/show_bug.cgi?id=137987 Reviewed by Anders Carlsson, Sam Weinig, and Beth Dakin. * Resources/AddImageToPhotos.pdf: Added. * Resources/CopyImage.pdf: Added. * Resources/SaveImageToDownloads.pdf: Added. * Resources/ShareImage.pdf: Added. Add some temporary artwork. * Scripts/webkit/messages.py: (struct_or_class): ActionMenuHitTestResult is a struct. * Shared/API/c/WKActionMenuItemTypes.h: Add new items for image menus. * Shared/mac/ActionMenuHitTestResult.cpp: (WebKit::ActionMenuHitTestResult::encode): (WebKit::ActionMenuHitTestResult::decode): For now, pass the hit image data across to the UI process as a ShareableBitmap. * Shared/mac/ActionMenuHitTestResult.h: * UIProcess/API/mac/WKView.mm: (-[WKView _createActionMenuItemForTag:]): Refactor action menu item creation into a single function, so that callers can share code and be much simpler. (webKitBundleImageNamed): Add a helper to acquire an image from the WebKit2 bundle. (-[WKView _copyImage:]): (-[WKView _saveImageToDownloads:]): (temporaryPhotosDirectoryPath): (pathToPhotoOnDisk): (-[WKView _addImageToPhotos:]): Add rudimentary implementations of image actions. (-[WKView _defaultMenuItemsForImage]): Support the image menu, plus a submenu acquired from NSSharingServicePicker for the Share menu. (-[WKView _defaultMenuItems]): Call _defaultMenuItemsForImage if needed. (-[WKView _updateActionMenu]): Refactor _updateActionMenu out of prepareForMenu:withEvent:. (-[WKView prepareForMenu:withEvent:]): Ask the Web process to re-hit-test under the location that the menu will appear. Mark the menu as pending. (-[WKView _didPerformActionMenuHitTest:]): When we get the hit test reply, record the result for future use. (-[WKView willOpenMenu:withEvent:]): If we got a hit test reply, rebuild the menu immediately. If not, wait up to 500ms for the reply to come in. This eventually needs to be cancellable if the menu is rejected in the interim. (-[WKView didCloseMenu:withEvent:]): Clear all state when the menu closes. * UIProcess/API/mac/WKViewInternal.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::performActionMenuHitTestAtLocation): (WebKit::WebPageProxy::didPerformActionMenuHitTest): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::didPerformActionMenuHitTest): * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Plumb didPerformActionMenuHitTest back from WebPageProxy to WKView. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::performActionMenuHitTestAtLocation): Hit test at the given location, recording the image data if there is any, and return the result to the UI process. * WebKit2.xcodeproj/project.pbxproj: Add the PDFs. 2014-10-23 Matthew Hanson Merge r175016. 2014-10-21 Tim Horton Quick Look preview bubble has unnecessary controls https://bugs.webkit.org/show_bug.cgi?id=137940 Reviewed by Simon Fraser. * UIProcess/API/mac/WKView.mm: (-[WKView _quickLookURLFromActionMenu:]): Temporarily use more SPI to allow us to hide the preview bubble's controls. 2014-10-23 Matthew Hanson Merge r174913. 2014-10-20 Beth Dakin Action menu items should have tags https://bugs.webkit.org/show_bug.cgi?id=137898 Reviewed by Anders Carlsson. * Shared/API/c/WKActionMenuItemTypes.h: Added. * UIProcess/API/mac/WKView.mm: (-[WKView _defaultMenuItemsForLink]): * WebKit2.xcodeproj/project.pbxproj: 2014-10-23 Matthew Hanson Merge r175061. 2014-10-22 Beth Dakin Remove action menu web preference https://bugs.webkit.org/show_bug.cgi?id=137975 Reviewed by Tim Horton. * Shared/WebPreferencesDefinitions.h: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetActionMenuSupportEnabled): Deleted. (WKPreferencesGetActionMenuSupportEnabled): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/API/mac/WKView.mm: (-[WKView initWithFrame:context:configuration:webView:]): 2014-10-23 Matthew Hanson Merge r174908. 2014-10-20 Beth Dakin Add support for action menus https://bugs.webkit.org/show_bug.cgi?id=137891 rdar://problem/18451638 rdar://problem/18694470 Reviewed by Anders Carlsson. Temporary artwork needed for menu item. * Resources/OpenInNewWindowTemplate.pdf: Added. * WebKit2.xcodeproj/project.pbxproj: Add a preference that defaults to false for action menu support. * Shared/WebPreferencesDefinitions.h: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetActionMenuSupportEnabled): (WKPreferencesGetActionMenuSupportEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: New SPI. WebKit clients can implement this method to customize the action menu. * UIProcess/API/Cocoa/WKViewPrivate.h: Create the action menu if it is supported. * UIProcess/API/mac/WKView.mm: (-[WKView initWithFrame:context:configuration:webView:]): Methods to implement the default menu actions. (-[WKView _openURLFromActionMenu:]): (-[WKView _addToReadingListFromActionMenu:]): (-[WKView _quickLookURLFromActionMenu:]): Add action menus support for links. Populate the menu at the right time. (-[WKView _defaultMenuItemsForLink]): (-[WKView _defaultMenuItems]): (-[WKView prepareForMenu:withEvent:]): (-[WKView _actionMenuItemsForHitTestResult:defaultActionMenuItems:]): New member variable caches the HitTestResult on mouse move. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::mouseDidMoveOverElement): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::activeActionMenuHitTestResult): 2014-10-23 Babak Shafiei Merge r173694. 2014-09-17 Gavin Barraclough DOM timer throttling for hidden plugins https://bugs.webkit.org/show_bug.cgi?id=136197 Reviewed by Geoff Garen & Andreas Kling. For non-visible web pages we slow timers (since they can't be driving animations, etc). We should do the same for plugins. * PluginProcess/WebProcessConnection.cpp: * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp: - remove now redundant includes. * WebProcess/Plugins/PluginView.h: - audioHardwareActivity is now virtual, override. 2014-10-23 Babak Shafiei Merge r172653. 2014-08-15 Gavin Barraclough Fix plugin visibility check. https://bugs.webkit.org/show_bug.cgi?id=135991 D'oh, more unreviewed typo fix. :-( * PluginProcess/PluginControllerProxy.cpp: (WebKit::PluginControllerProxy::visibilityDidChange): (WebKit::PluginControllerProxy::windowVisibilityChanged): (WebKit::PluginControllerProxy::updateVisibilityActivity): (WebKit::PluginControllerProxy::updateVisiblityActivity): Deleted. * PluginProcess/PluginControllerProxy.h: 2014-10-23 Babak Shafiei Merge r172646. 2014-08-15 Gavin Barraclough Fix plugin visibility check. https://bugs.webkit.org/show_bug.cgi?id=135991 Unreviewed typo fix. * PluginProcess/PluginControllerProxy.cpp: (WebKit::PluginControllerProxy::PluginControllerProxy): (WebKit::PluginControllerProxy::visibilityDidChange): (WebKit::PluginControllerProxy::windowVisibilityChanged): (WebKit::PluginControllerProxy::updateVisiblityActivity): * PluginProcess/PluginControllerProxy.h: 2014-10-23 Babak Shafiei Merge r172645. 2014-08-15 Gavin Barraclough Fix plugin visibility check. https://bugs.webkit.org/show_bug.cgi?id=135991 Reviewed by Andreas Kling. We should only take a UserActivity if the plugin is in a visible window, and also is itself visible. * PluginProcess/PluginControllerProxy.cpp: (WebKit::PluginControllerProxy::PluginControllerProxy): - initialize member state. (WebKit::PluginControllerProxy::visibilityDidChange): (WebKit::PluginControllerProxy::windowVisibilityChanged): - update member state & call updateVisiblityActivity. (WebKit::PluginControllerProxy::updateVisiblityActivity): - enable the UserActivity only if both visibilities are true. * PluginProcess/PluginControllerProxy.h: - added m_isVisible, m_isWindowVisible, updateVisibilityActivity. 2014-10-23 Babak Shafiei Merge r172637. 2014-08-15 Gavin Barraclough de-PLATFORM(COCOA) a couple of methods in plugin code https://bugs.webkit.org/show_bug.cgi?id=135987 Reviewed by Sam Weinig. Pass through the visibility & focus on all platforms, to simplify & avoid any weird inconsistencies between platforms. * PluginProcess/PluginControllerProxy.cpp: (WebKit::PluginControllerProxy::windowFocusChanged): (WebKit::PluginControllerProxy::windowVisibilityChanged): * PluginProcess/PluginControllerProxy.h: * PluginProcess/PluginControllerProxy.messages.in: * PluginProcess/mac/PluginControllerProxyMac.mm: (WebKit::PluginControllerProxy::windowFocusChanged): Deleted. (WebKit::PluginControllerProxy::windowVisibilityChanged): Deleted. * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: (WebKit::NetscapePlugin::windowFocusChanged): (WebKit::NetscapePlugin::windowVisibilityChanged): * WebProcess/Plugins/Netscape/NetscapePlugin.h: * WebProcess/Plugins/Plugin.h: * WebProcess/Plugins/PluginProxy.cpp: (WebKit::PluginProxy::windowAndViewFramesChanged): * WebProcess/Plugins/PluginProxy.h: * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::viewStateDidChange): (WebKit::PluginView::platformViewStateDidChange): Deleted. * WebProcess/Plugins/PluginView.h: 2014-10-23 Babak Shafiei Merge r172634. 2014-08-15 Gavin Barraclough Fix plugin visibility initialization https://bugs.webkit.org/show_bug.cgi?id=135985 Reviewed by Geoffrey Garen. * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::didInitializePlugin): - We're not currently initializing the plugin visibility state, and we're passing the wrong value for window visibility. 2014-10-23 Babak Shafiei Merge r172629. 2014-08-15 Gavin Barraclough Simplify visibility activity accounting for plugins https://bugs.webkit.org/show_bug.cgi?id=135981 Reviewed by Dan Bernstein. Just take one per connection, rather than implementing a counting mechanism. * PluginProcess/PluginControllerProxy.cpp: (WebKit::PluginControllerProxy::PluginControllerProxy): * PluginProcess/PluginControllerProxy.h: - added m_visiblityActivity. * PluginProcess/PluginProcess.cpp: (WebKit::PluginProcess::PluginProcess): (WebKit::PluginProcess::pluginsForWebProcessDidBecomeVisible): Deleted. (WebKit::PluginProcess::pluginsForWebProcessDidBecomeHidden): Deleted. * PluginProcess/PluginProcess.h: - removed pluginsForWebProcessDidBecomeVisible/Hidden. * PluginProcess/WebProcessConnection.cpp: (WebKit::WebProcessConnection::removePluginControllerProxy): (WebKit::WebProcessConnection::pluginDidBecomeVisible): Deleted. (WebKit::WebProcessConnection::pluginDidBecomeHidden): Deleted. * PluginProcess/WebProcessConnection.h: - removed pluginDidBecomeVisible/Hidden. * PluginProcess/mac/PluginControllerProxyMac.mm: (WebKit::PluginControllerProxy::windowVisibilityChanged): - windowVisibilityChanged uses m_visiblityActivity, rather than calling to PluginControllerProxy. 2014-10-21 Dana Burkart Merge r174708 2014-10-14 Alexey Proskuryakov REGRESSION (r165356): Issues with Japanese text input https://bugs.webkit.org/show_bug.cgi?id=137719 rdar://problem/18431952 rdar://problem/18483741 Reviewed by Darin Adler. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didChangeSelection): In sync code path, ensure consistent message delivery order by adding a DispatchMessageEvenWhenWaitingForSyncReply flag. This way, delayed EditorStateChanged messages won't confuse UI process. 2014-10-21 Dana Burkart Merge r173888 2014-09-23 Jer Noble REGRESSION (r171197): Clip's content is drawn behind Safari window when entering Full Screen youtube html5 first time https://bugs.webkit.org/show_bug.cgi?id=137029 Reviewed by Brent Fulgham. In r171197, we ordered the full screen window on- and off-screen so that the fullscreen animation went to the correct screen, which introduced a subtle glitch at the beginning and end of an animation. For entering, ensure that the window is scaled to its starting size before ordering on-screen. For exiting, order the window off- screen before resetting its clipping rect. * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]): (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): 2014-10-21 Dana Burkart Merge r172968 2014-08-26 Simon Fraser Crashes in hit testing under WebPage::determinePrimarySnapshottedPlugIn() https://bugs.webkit.org/show_bug.cgi?id=136240 rdar://problem/17231462 Reviewed by Darin Adler. determinePrimarySnapshottedPlugIn() does render tree hit testing, so needs to ensure that layout is up-to-date. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::determinePrimarySnapshottedPlugIn): 2014-09-13 Babak Shafiei Merge r173595 2014-09-12 Tim Horton Swiping back from a Twitter image to Twitter flashes to the wrong position https://bugs.webkit.org/show_bug.cgi?id=136798 Reviewed by Darin Adler and Sam Weinig. * UIProcess/mac/ViewGestureController.h: * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::ViewGestureController): (WebKit::ViewGestureController::didFinishLoadForMainFrame): (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame): Add a 250ms repeating timer that we start in didFinishLoadForMainFrame if we are for some reason still loading, and in didSameDocumentNavigationForMainFrame unconditionally, to match behavior of the old swipe implementation. Also, do the active gesture check in both of those places so that we don't start the timer if we're in the middle of a live swipe or have already torn down the snapshot (removeSwipeSnapshotAfterRepaint does this as well, so this isn't really a behavior change). (WebKit::ViewGestureController::activeLoadMonitoringTimerFired): Every time the timer fires, check if we're still loading; if not, tear down the swipe snapshot (after repainting). (WebKit::ViewGestureController::removeSwipeSnapshotAfterRepaint): Stop the active load monitoring timer. 2014-09-12 Lucas Forschler Merge r173573 2014-09-12 Tim Horton Flash of page scrolled to wrong origin before restoring scroll position after swiping back to CNN front page from an article https://bugs.webkit.org/show_bug.cgi?id=136788 Reviewed by Sam Weinig. * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::didHitRenderTreeSizeThreshold): (WebKit::ViewGestureController::didFirstVisuallyNonEmptyLayoutForMainFrame): Always wait until didFinishLoadForMainFrame or didSameDocumentNavigationForMainFrame before removing the snapshot, because otherwise we don't know if the scroll position has been restored yet. We should revisit this at some point, because it should be possible to determine if the scroll position has been restored appropriately, but for now it is safest to restore the antique behavior. 2014-08-29 Lucas Forschler Merge r173121 2014-08-29 Alexey Proskuryakov Crashes in IPC code under VisitedLinkProvider::pendingVisitedLinksTimerFired https://bugs.webkit.org/show_bug.cgi?id=136384 rdar://problem/16991213 Reviewed by Sam Weinig. VisitedLinkProvider process tracking relied on a combination of WebPageProxy process lifecycle notifications and checking process state. As evidenced by multiple FIXMEs, these are not yet as reliable as they should be. Changed to unregister a process when it closes, not when it no longer has any pages using the particular VisitedLinkProvider or WebUserContentControllerProxy. This is a deoptimization that should not matter in practice. * UIProcess/UserContent/WebUserContentControllerProxy.cpp: (WebKit::WebUserContentControllerProxy::~WebUserContentControllerProxy): (WebKit::WebUserContentControllerProxy::removeProcess): (WebKit::WebUserContentControllerProxy::addUserScript): (WebKit::WebUserContentControllerProxy::removeAllUserScripts): (WebKit::WebUserContentControllerProxy::addUserStyleSheet): (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets): (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler): (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName): * UIProcess/UserContent/WebUserContentControllerProxy.h: * UIProcess/VisitedLinkProvider.cpp: (WebKit::VisitedLinkProvider::~VisitedLinkProvider): (WebKit::VisitedLinkProvider::removeProcess): (WebKit::VisitedLinkProvider::removeAll): (WebKit::VisitedLinkProvider::pendingVisitedLinksTimerFired): (WebKit::VisitedLinkProvider::resizeTable): * UIProcess/VisitedLinkProvider.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::WebPageProxy): (WebKit::WebPageProxy::close): (WebKit::WebPageProxy::processDidFinishLaunching): (WebKit::WebPageProxy::resetStateAfterProcessExited): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::disconnect): (WebKit::WebProcessProxy::addVisitedLinkProvider): (WebKit::WebProcessProxy::addWebUserContentControllerProxy): (WebKit::WebProcessProxy::didDestroyVisitedLinkProvider): (WebKit::WebProcessProxy::didDestroyWebUserContentControllerProxy): * UIProcess/WebProcessProxy.h: 2014-08-29 Lucas Forschler Merge r173118 2014-08-29 Alexey Proskuryakov WebPageProxy::close() is a no-op for terminated processes https://bugs.webkit.org/show_bug.cgi?id=136378 Related to and to Reviewed by Brady Eidson. Also fixes issues that got uncovered after making close() work. * UIProcess/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::invalidate): Don't close the page, because it makes no sense, and causes an assertion now. Previosly, this was OK because the page was invalid already, and close() was a no-op. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::~WebPageProxy): Added some assertions to catch invalidation issues earlier. (WebKit::WebPageProxy::reattachToWebProcess): Make it an invariant that a page's process always has a message receiver for it, until close() removes it. (WebKit::WebPageProxy::close): Make this function work for all open pages, whether they have a page or not. (WebKit::WebPageProxy::processDidFinishLaunching): Added an asserion that process agrees about its state. (WebKit::WebPageProxy::resetStateAfterProcessExited): Don't remove a message receiver, we now only do this in reattach or close. 2014-08-28 Lucas Forschler Merge r173093 2014-08-28 Tim Horton _setDidMoveSwipeSnapshotCallback's block should only be called if the snapshot is going to move https://bugs.webkit.org/show_bug.cgi?id=136354 Reviewed by Simon Fraser. * UIProcess/API/Cocoa/WKViewPrivate.h: Update the comment to note the new behavior. * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::beginSwipeGesture): Don't call the block until the snapshot is actually moving (if the snapshot never moves because it's behind the live view, don't call the block at all). 2014-08-28 Lucas Forschler Merge r173092 2014-08-28 Tim Horton Occasional thread-safety-related crashes on the ServicesController queue https://bugs.webkit.org/show_bug.cgi?id=136356 Reviewed by Dan Bernstein. * UIProcess/mac/ServicesController.mm: (WebKit::hasCompatibleServicesForItems): Added. Check directly with NSSharingService if we have any services for the given items. We should eventually check Viewer and Editor services separately so the Web process can be smarter about when it shows the overlay, but for now this maintains the existing behavior. (WebKit::ServicesController::refreshExistingServices): Make use of hasCompatibleServicesForItems instead of having NSSharingServicePicker construct NSMenus. 2014-08-28 Lucas Forschler Merge r172989 2014-08-26 Joseph Pecoraro FileReader cannot read files selected with in iOS 8 https://bugs.webkit.org/show_bug.cgi?id=136117 Reviewed by Alexey Proskuryakov. * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Correct an overzealous deny that was accidentally denying all com.apple.app-sandbox.read extensions instead of just the ones in Application bundles it was trying to deny. 2014-08-28 Lucas Forschler Merge r171782 2014-07-29 Enrica Casucci REGRESSION [WebKit2 iOS]: Cannot add shortcut to user dictionary from non editable content. https://bugs.webkit.org/show_bug.cgi?id=135392 Reviewed by Benjamin Poulain. Adding a shortcut to the user dictionary needs to be available in non editable content too. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _addShortcut:]): 2014-08-28 Lucas Forschler Merge r173078 2014-08-28 Tim Horton WebKit2 doesn't support viewer services that accept image attachments https://bugs.webkit.org/show_bug.cgi?id=136349 Reviewed by Brady Eidson. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode): (WebKit::WebProcessCreationParameters::decode): Encode the already-existing parameter. 2014-08-28 Lucas Forschler Merge r173040 2014-08-27 Tim Horton WebKit2 swipe gesture should report the position of the snapshot to the client https://bugs.webkit.org/show_bug.cgi?id=136308 rdar://problem/18105827 Reviewed by Simon Fraser. * UIProcess/API/Cocoa/WKViewPrivate.h: * UIProcess/API/mac/WKView.mm: (-[WKView _setDidMoveSwipeSnapshotCallback:]): Add _setDidMoveSwipeSnapshotCallback, and plumb it to ViewGestureController. Callers provide a block which is called whenever ViewGestureController moves the swipe *snapshot* layer around. * UIProcess/PageClient.h: * UIProcess/WebPageProxy.h: * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::boundsOfLayerInLayerBackedWindowCoordinates): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::boundsOfLayerInLayerBackedWindowCoordinates): Expose a Mac-only way to get the bounds of a given CALayer in window coordinates, respecting transforms. This only works for layer-backed windows because it uses CA in order to do the mapping respecting transforms. * UIProcess/mac/ViewGestureController.h: * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::ViewGestureController): (WebKit::ViewGestureController::~ViewGestureController): (WebKit::ViewGestureController::setDidMoveSwipeSnapshotCallback): Do the Block_copy and Block_release dance to keep our copy of the callback block. (WebKit::ViewGestureController::beginSwipeGesture): (WebKit::ViewGestureController::handleSwipeGesture): (WebKit::ViewGestureController::didMoveSwipeSnapshotLayer): When the swipe snapshot layer moves around, call the block. 2014-08-28 Lucas Forschler Merge r173029 2014-08-27 Tim Horton Occasional crashes in commitTransientZoom's transaction completion block https://bugs.webkit.org/show_bug.cgi?id=136309 Reviewed by Dan Bernstein. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::commitTransientZoom): Hold a reference to zoomLayer and the WebPage. It's possible that either of these things could have gone away by the time the transaction is committed. 2014-08-28 Lucas Forschler Merge r172939 2014-08-25 Brady Eidson Don't crash when the DataDetectors framework is unavailable. and https://bugs.webkit.org/show_bug.cgi?id=136234 Reviewed by Tim Horton. * WebProcess/WebPage/mac/ServicesOverlayController.mm: (WebKit::ServicesOverlayController::buildPhoneNumberHighlights): Bail if DD.framework didn’t soft link. (WebKit::ServicesOverlayController::buildSelectionHighlight): Ditto. 2014-08-26 Dana Burkart Merge r172988. 2014-08-26 Tim Horton Crashes in ViewGestureController::beginSwipeGesture when swiping in rapid succession https://bugs.webkit.org/show_bug.cgi?id=136271 Reviewed by Simon Fraser. It was possible to get into trackSwipeGesture while another swipe was still occurring, because the guard against this happening depended on m_pendingSwipeReason never being set while a swipe was occurring. However, if the very first scroll event had sufficient magnitude, we would still set m_pendingSwipeReason to InsufficientMagnitude, and then *never clear it*, leading to a path around the guard against multiple live swipes. This in turn allowed stale layers in m_liveSwipeLayers, which lead to the crash. * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::handleScrollWheelEvent): Don't unset m_pendingSwipeReason before calling trackSwipeGesture; trackSwipeGesture will do it itself. Don't set m_pendingSwipeReason to InsufficientMagnitude if the event actually *has* sufficient magnitude to start a swipe. (WebKit::ViewGestureController::trackSwipeGesture): Assert that we don't have an active gesture while starting a swipe. Reset m_pendingSwipeReason, because the swipe is no longer pending! 2014-08-26 Dana Burkart Merge r172966. 2014-08-26 Tim Horton REGRESSION (r172771): Amazon product page becomes unresponsive after swiping back to it https://bugs.webkit.org/show_bug.cgi?id=136260 Reviewed by Dan Bernstein. Previously, when a swipe ended up performing a same-document navigation, we would never get didFinishLoadForMainFrame nor didFirstVisuallyNonEmptyLayoutForMainFrame nor would we even get didHitRenderTreeSizeThreshold in all cases, so we would never remove the swipe snapshot. Previous implementations removed the snapshot on didSameDocumentNavigation for the main frame if the navigation type was Replace or Pop, so we will match that behavior. Also, reinstate the watchdog that starts at swipe-end which would have prevented this bug from forever breaking the view it was associated with. Also, defend against removing the snapshot before the swipe has finished (before we have even caused the navigation that we're watching for the effects of). * UIProcess/API/mac/WKView.mm: (-[WKView _didSameDocumentNavigationForMainFrame:]): * UIProcess/API/mac/WKViewInternal.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame): * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame): Plumb main-frame same-document navigation notification from WebPageProxy to ViewGestureControllerMac via PageClient and WKView. * UIProcess/mac/ViewGestureController.h: * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::ViewGestureController): (WebKit::ViewGestureController::beginSwipeGesture): (WebKit::ViewGestureController::endSwipeGesture): Keep track of whether a swipe is currently occurring. We can't use activeGestureType for this because the swipe currently remains the "active" gesture until the snapshot is removed. Reintroduce the old swipeWatchdogTimer (and rename the shorter timer that starts when we get a visually non-empty layout) so that we will always remove the snapshot after 5 seconds, even if we haven't committed the load. This could lead to flashing back to the old content if we fail to get a single byte for 5 seconds, but that is a rare case and should eventually get additional special treatment (dropping the tiles until we do get content, or some such). (WebKit::ViewGestureController::didHitRenderTreeSizeThreshold): If a swipe is still in progress, we haven't done our navigation and thus don't care about render tree size changes. (WebKit::ViewGestureController::didFirstVisuallyNonEmptyLayoutForMainFrame): If a swipe is still in progress, we haven't done our navigation and thus don't care about layouts. Stop the 5 second overall watchdog if we start the 3 second after-visuallyNonEmptyLayout watchdog. This means that the snapshot could stay up for a maximum of 8 seconds for a very, very slow load. (WebKit::ViewGestureController::didFinishLoadForMainFrame): If a swipe is still in progress, we haven't done our navigation and thus don't care about loads that complete. (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame): Remove the swipe snapshot after painting if we do replaceState or popState. (WebKit::ViewGestureController::removeSwipeSnapshotAfterRepaint): If a swipe is still in progress, we shouldn't remove the snapshot yet. 2014-08-19 Dana Burkart Merge r172643. 2014-08-15 Enrica Casucci [Services with UI] Selections are incorrect when selecting three lines. https://bugs.webkit.org/show_bug.cgi?id=135989 Reviewed by Tim Horton. The stitching algorithm did not handle correctly the case of selections over three lines if the middle line is composed of only one rectangle. * WebProcess/WebPage/mac/ServicesOverlayController.mm: (WebKit::stitchRects): 2014-08-19 Dana Burkart Merge r172639. 2014-08-15 Tim Horton Service overlays stay fixed when