バグ?

Use Selection for Findを実装するのにWebViewのwriteSelectionWithPasteboardTypes:toPasteboard:を呼んでも上手く行かなかった。WebDocumentViewの同名メソッドを直接呼べばちゃんと動く事は分かったのだが、ソースコードを追っかけてみた。

- (void)writeSelectionWithPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard
{
    WebBridge *bridge = [self _bridgeForCurrentSelection];
    if ([bridge selectionState] != WebSelectionStateRange) {
        NSView <WebDocumentView> *documentView = [[[bridge webFrame] frameView] documentView];
        if ([documentView conformsToProtocol:@protocol(WebDocumentSelection)]) {
            [(NSView <WebDocumentSelection> *)documentView writeSelectionWithPasteboardTypes:types toPasteboard:pasteboard];
        }
    }
}
http://trac.webkit.org/projects/webkit/browser/releases/Apple/Tiger/Security%20Update%202006-007/WebKit/WebView.subproj/WebView.m

ひょっとして、selectionStateの比較演算子を間違えている? Trunkの方は全然違う実装になってた。
結局、First ResponderがWebDocumentTextを実装しているかどうかを調べて、selectedStringを自分でFind Pasteboardに乗せる事にした。