PDFPlugin: Find-in-page
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Dec 2012 11:08:22 +0000 (11:08 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Dec 2012 11:08:22 +0000 (11:08 +0000)
commitd52204121d30d896aca3291eeeb7874521a1db88
tree86abab94cdfdae6b1e0320479df25273cf0cd053
parent6bd78a916b75695a817474d43a4de3e302499ff6
PDFPlugin: Find-in-page
https://bugs.webkit.org/show_bug.cgi?id=105710
<rdar://problem/12555331>

Reviewed by Alexey Proskuryakov.

Make use of PDFLayerController's find-in-page functionality to mimic WebKit's.
Add two Plugin methods, countFindMatches and findString, and make use of them
if attempting to find-in-page within a PluginDocument.

* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::countFindMatches): Added. We don't support find-in-page for NetscapePlugin.
(WebKit::NetscapePlugin::findString): Added. We don't support find-in-page for NetscapePlugin.
* WebProcess/Plugins/Netscape/NetscapePlugin.h: Add countFindMatches and findString.
* WebProcess/Plugins/PDF/PDFLayerControllerDetails.h: Add requisite PDFLayerController interfaces.
* WebProcess/Plugins/PDF/PDFPlugin.h: Add countFindMatches, findString, and nextMatchForString,
as well as  storage for the most-recently-searched string.
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::writeItemsToPasteboard):
(WebKit::PDFPlugin::countFindMatches):
(WebKit::PDFPlugin::nextMatchForString):
(WebKit::PDFPlugin::findString):
* WebProcess/Plugins/PDF/SimplePDFPlugin.h: Add countFindMatches and findString.
* WebProcess/Plugins/Plugin.h: Add countFindMatches and findString.
* WebProcess/Plugins/PluginProxy.h: Add countFindMatches and findString, but since PDFPlugin
is in-process, we don't need to forward these calls to the PluginProcess.
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::countFindMatches): Forward countFindMatches to the plugin.
(WebKit::PluginView::findString): Forward findString to the plugin.
* WebProcess/Plugins/PluginView.h: Add countFindMatches and findString.
* WebProcess/WebPage/FindController.cpp:
(WebKit::pluginViewForFrame): If the given frame hosts a PluginDocument, grab its PluginView.
(WebKit::FindController::countStringMatches): Forward countStringMatches to PluginView if necessary.
(WebKit::FindController::updateFindUIAfterPageScroll): Only use unmarkAllTextMatches if we're using
ordinary find-in-page and don't have a plugin. If we have a plugin, disable our overlay, as it must
be handled by the plugin itself, and request the number of matches for the search from the plugin.
(WebKit::FindController::findString): If necessary, forward findString to the plugin.
(WebKit::FindController::hideFindUI): Hide the search highlight by searching for an empty string.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@138461 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
Source/WebKit2/WebProcess/Plugins/PDF/PDFLayerControllerDetails.h
Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h
Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm
Source/WebKit2/WebProcess/Plugins/PDF/SimplePDFPlugin.h
Source/WebKit2/WebProcess/Plugins/Plugin.h
Source/WebKit2/WebProcess/Plugins/PluginProxy.h
Source/WebKit2/WebProcess/Plugins/PluginView.cpp
Source/WebKit2/WebProcess/Plugins/PluginView.h
Source/WebKit2/WebProcess/WebPage/FindController.cpp