12010-12-09 Maciej Stachowiak <mjs@apple.com>
2
3 Reviewed by NOBODY (OOPS!).
4
5 Implement "Use Selection for Find" in WebKit2
6 https://bugs.webkit.org/show_bug.cgi?id=50737
7
8 Implement a TakeFindStringFromSelection editor command. This is
9 used solely to implement the "Use Selection for Find" menu command
10 on Mac, and is not made available to script. On WebKit2, it is
11 very convenient to reuse the editing machinery since this command
12 is very similar to Copy.
13
14 * editing/Editor.h:
15 * editing/EditorCommand.cpp:
16 (WebCore::executeTakeFindStringFromSelection): Call to a mac-only Editor function.
17 (WebCore::enabledTakeFindStringFromSelection): Check using Editor::canCopyExcludingStandaloneImage
18 (WebCore::createCommandMap): Add "TakeFindStringFromSelection" command.
19 * editing/mac/EditorMac.mm:
20 (WebCore::Editor::canCopyExcludingStandaloneImages): Helper function; we can't use Editor::canCopy
21 since it would make no sense to enable "Use Selection for Find" when viewing a standalone image
22 document.
23 (WebCore::Editor::takeFindStringFromSelection): Implement by copying the selected text
24 to the special Find pasteboard.
25