Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Factor out Lookup invocation
https://bugs.webkit.org/show_bug.cgi?id=148509 Reviewed by Anders Carlsson. There's a ton of duplicated code in legacy and modern WebKit to talk to Lookup. And, it's pretty messy. As a first step to making it less messy, make it so we only have it in one place instead of four (or two). * editing/DictionaryPopupInfo.h: Move DictionaryPopupInfo into WebCore. This was duplicated in both legacy and modern WebKit. * editing/mac/DictionaryLookup.h: * editing/mac/DictionaryLookup.mm: (WebCore::DictionaryLookup::rangeForSelection): (WebCore::DictionaryLookup::rangeAtHitTestResult): (WebCore::DictionaryLookup::stringForPDFSelection): (WebCore::showPopupOrCreateAnimationController): (WebCore::DictionaryLookup::showPopup): (WebCore::DictionaryLookup::hidePopup): (WebCore::DictionaryLookup::animationControllerForPopup): (WebCore::rangeForDictionaryLookupForSelection): Deleted. (WebCore::rangeForDictionaryLookupAtHitTestResult): Deleted. (WebCore::dictionaryLookupForPDFSelection): Deleted. Move DictionaryLookup stuff into a class for better names. Move showPopup, hidePopup, and animationControllerForPopup here. showPopup and animationControllerForPopup both bottleneck through a single function, where previously we duplicated all of the code for both of them, and in both legacy and modern WebKit. showPopup and animationControllerForPopup take a block that they *may* call if we have support for overriding Lookup's indicator with TextIndicator, because the installation process is different per WebKit. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::selectClosestWordFromHitTestResultBasedOnLookup): * testing/Internals.cpp: (WebCore::Internals::rangeForDictionaryLookupAtLocation): Adjust to the new naming. * Shared/DictionaryPopupInfo.cpp: Removed. * Shared/DictionaryPopupInfo.h: Removed. Moved to WebCore. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<DictionaryPopupInfo>::encode): (IPC::ArgumentCoder<DictionaryPopupInfo>::decode): Add encode/decoders for DictionaryPopupInfo now that it's in WebCore. * Shared/WebCoreArgumentCoders.h: * Shared/WebHitTestResult.h: * Shared/mac/ArgumentCodersMac.h: * UIProcess/API/mac/WKView.mm: (+[WKView hideWordDefinitionWindow]): (-[WKView _dismissContentRelativeChildWindows]): * UIProcess/PageClient.h: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/PageClientImpl.h: * UIProcess/mac/PageClientImpl.mm: (WebKit::PageClientImpl::didPerformDictionaryLookup): * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _animationControllerForText]): * UIProcess/mac/WebPageProxyMac.mm: * WebKit2.xcodeproj/project.pbxproj: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::showDefinitionForAttributedString): (WebKit::PDFPlugin::lookupTextAtLocation): * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performDictionaryLookupAtLocation): (WebKit::WebPage::performDictionaryLookupForSelection): (WebKit::WebPage::dictionaryPopupInfoForRange): (WebKit::WebPage::dictionaryPopupInfoForSelectionInPDFPlugin): (WebKit::WebPage::lookupTextAtLocation): Adjust to new names and move stuff to WebCore. * WebKit.xcodeproj/project.pbxproj: * WebView/DictionaryPopupInfo.h: Removed. Move to WebCore. * WebView/WebHTMLView.mm: (-[WebHTMLView _lookUpInDictionaryFromMenu:]): DictionaryPopupInfo keeps a TextIndicatorData, not a TextIndicator. * WebView/WebImmediateActionController.mm: (-[WebImmediateActionController _animationControllerForDataDetectedLink]): (dictionaryPopupInfoForRange): (-[WebImmediateActionController _animationControllerForText]): * WebView/WebView.mm: (-[WebView _prepareForDictionaryLookup]): (-[WebView _animationControllerForDictionaryLookupPopupInfo:]): (-[WebView _setTextIndicator:withLifetime:]): (-[WebView _showDictionaryLookupPopup:]): * WebView/WebViewInternal.h: Move a bunch of code to WebCore. Factor some that has to stay out into _prepareForDictionaryLookup. Canonical link: https://commits.webkit.org/166646@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189052 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
376 additions
and 302 deletions.
- +44 −0 Source/WebCore/ChangeLog
- +4 −0 Source/WebCore/WebCore.xcodeproj/project.pbxproj
- +15 −11 Source/{WebKit/mac/WebView → WebCore/editing}/DictionaryPopupInfo.h
- +25 −4 Source/WebCore/editing/mac/DictionaryLookup.h
- +70 −4 Source/WebCore/editing/mac/DictionaryLookup.mm
- +1 −1 Source/WebCore/page/mac/EventHandlerMac.mm
- +1 −1 Source/WebCore/testing/Internals.cpp
- +9 −0 Source/WebKit/ChangeLog
- +0 −4 Source/WebKit/WebKit.xcodeproj/project.pbxproj
- +27 −0 Source/WebKit/mac/ChangeLog
- +3 −2 Source/WebKit/mac/WebView/WebHTMLView.mm
- +5 −3 Source/WebKit/mac/WebView/WebImmediateActionController.mm
- +25 −46 Source/WebKit/mac/WebView/WebView.mm
- +3 −3 Source/WebKit/mac/WebView/WebViewInternal.h
- +0 −1 Source/WebKit2/CMakeLists.txt
- +45 −0 Source/WebKit2/ChangeLog
- +0 −75 Source/WebKit2/Shared/DictionaryPopupInfo.cpp
- +0 −58 Source/WebKit2/Shared/DictionaryPopupInfo.h
- +50 −0 Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
- +6 −0 Source/WebKit2/Shared/WebCoreArgumentCoders.h
- +2 −2 Source/WebKit2/Shared/WebHitTestResult.h
- +10 −0 Source/WebKit2/Shared/mac/ArgumentCodersMac.h
- +3 −5 Source/WebKit2/UIProcess/API/mac/WKView.mm
- +1 −1 Source/WebKit2/UIProcess/PageClient.h
- +2 −2 Source/WebKit2/UIProcess/WebPageProxy.h
- +1 −1 Source/WebKit2/UIProcess/WebPageProxy.messages.in
- +1 −1 Source/WebKit2/UIProcess/mac/PageClientImpl.h
- +4 −29 Source/WebKit2/UIProcess/mac/PageClientImpl.mm
- +5 −23 Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm
- +1 −1 Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
- +0 −8 Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
- +2 −4 Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm
- +1 −1 Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm
- +3 −3 Source/WebKit2/WebProcess/WebPage/WebPage.h
- +7 −8 Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.