Source/WebCore: WebCore part of <rdar://problem/9281695> Add text search API for...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Aug 2011 23:36:47 +0000 (23:36 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Aug 2011 23:36:47 +0000 (23:36 +0000)
commitb15593b705f58d28ba9f47d4ce387fa9c3072092
tree65ba699c7b4ba3d9e4b80dc6c4af2ebbdd3a6e70
parentb5f3ecbcfc44f01db3e5830d242631d8eda7fd48
Source/WebCore: WebCore part of <rdar://problem/9281695> Add text search API for getting the DOM range of a text match
https://bugs.webkit.org/show_bug.cgi?id=67230

Reviewed by Darin Adler.

Test: TestWebKitAPI/Tests/mac/DOMRangeOfString.

* WebCore.exp.in: Export Page::rangeOfString().
* dom/Range.h: Added a default ASSERT_NO_EXCEPTION to a few more member functions.
* editing/Editor.cpp:
(WebCore::Editor::findString): Moved most of the logic into rangeOfString(), which this function
now calls, passing in the current selection as the reference range and setting the selection to
the returned range.
(WebCore::Editor::rangeOfString): Added. Contains the find logic from findString().
* editing/Editor.h:
* page/Page.cpp:
(WebCore::Page::rangeOfString): Added. This function is similar to findString(), but it takes an optional
reference range and returns a Range, rather than using the current selection as the reference range and setting the
selection to the next match.
* page/Page.h:

Source/WebKit/mac: <rdar://problem/9281695> Add text search API for getting the DOM range of a text match
https://bugs.webkit.org/show_bug.cgi?id=67230

Reviewed by Darin Adler.

* WebView/WebHTMLView.mm:
* WebView/WebView.mm:
(coreOptions): Moved this function from WebHTMLView.mm to here and made
it accessible from both this file and WebHTMLView.mm.
(-[WebView DOMRangeOfString:relativeTo:options:]): Added this new API.
* WebView/WebViewInternal.h:
* WebView/WebViewPrivate.h:

Tools: Test for <rdar://problem/9281695> Add text search API for getting the DOM range of a text match
https://bugs.webkit.org/show_bug.cgi?id=67230

Reviewed by Darin Adler.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/mac/DOMRangeOfString.html: Added.
* TestWebKitAPI/Tests/mac/DOMRangeOfString.mm: Added.
(-[DOMRangeOfStringFrameLoadDelegate webView:didFinishLoadForFrame:]):
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@94124 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/dom/Range.h
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/Editor.h
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebHTMLView.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/mac/WebView/WebViewInternal.h
Source/WebKit/mac/WebView/WebViewPrivate.h
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/mac/DOMRangeOfString.html [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/mac/DOMRangeOfString.mm [new file with mode: 0644]