[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

mitz at apple.com mitz at apple.com
Wed Dec 22 17:48:28 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 941f96e13e07f7fb8fa52238252728d23ecb1bec
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 30 19:14:56 2010 +0000

    WebKit2: Injected bundle support for <rdar://problem/8710645> WebKitTestRunner needs layoutTestController.findString
    https://bugs.webkit.org/show_bug.cgi?id=50238
    
    Reviewed by Anders Carlsson.
    
    * Shared/API/c/WKFindOptions.h: Added. Moved the definition of WKFindOptions here from WKPage.h.
    * Shared/API/c/WKSharedAPICast.h:
    (WebKit::toFindOptions): Moved from WKAPICast.h.
    * UIProcess/API/C/WKAPICast.h:
    * UIProcess/API/C/WKPage.h:
    * WebKit2.xcodeproj/project.pbxproj: Added WKFindOptions.h.
    * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
    (WKBundlePageFindString): Added.
    * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::findStringFromInjectedBundle): Added.
    * WebProcess/WebPage/WebPage.h:
    
    WebKitTools: <rdar://problem/8710645> WebKitTestRunner needs layoutTestController.findString
    https://bugs.webkit.org/show_bug.cgi?id=50238
    
    Reviewed by Anders Carlsson.
    
    * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
    (WTR::LayoutTestController::findString): Added.
    * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
    
    LayoutTests: <rdar://problem/8710645> WebKitTestRunner needs layoutTestController.findString
    https://bugs.webkit.org/show_bug.cgi?id=50238
    
    Reviewed by Anders Carlsson.
    
    * platform/mac-wk2/Skipped: Removed editing/text-iterator/findString.html.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72937 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 6f150a6..b78446d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,12 @@
+2010-11-30  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        <rdar://problem/8710645> WebKitTestRunner needs layoutTestController.findString
+        https://bugs.webkit.org/show_bug.cgi?id=50238
+
+        * platform/mac-wk2/Skipped: Removed editing/text-iterator/findString.html.
+
 2010-11-30  Xiaomei Ji  <xji at chromium.org>
 
         Reviewed by David Hyatt.
diff --git a/LayoutTests/platform/mac-wk2/Skipped b/LayoutTests/platform/mac-wk2/Skipped
index 6d782d8..cac9881 100644
--- a/LayoutTests/platform/mac-wk2/Skipped
+++ b/LayoutTests/platform/mac-wk2/Skipped
@@ -1915,9 +1915,6 @@ fast/spatial-navigation
 # WebKitTestRunner needs layoutTestController.pageSizeAndMarginsInPixels
 printing/page-format-data-display-none.html
 
-# WebKitTestRunner needs layoutTestController.findString <http://webkit.org/b/50238>
-editing/text-iterator/findString.html
-
 # WebKit2 needs support for moving/resizing and querying the location/size the window
 fast/dom/Window/window-resize-and-move-arguments.html
 fast/dom/Window/window-resize.html
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 7161503..711a6c2 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,23 @@
+2010-11-30  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        Injected bundle support for <rdar://problem/8710645> WebKitTestRunner needs layoutTestController.findString
+        https://bugs.webkit.org/show_bug.cgi?id=50238
+
+        * Shared/API/c/WKFindOptions.h: Added. Moved the definition of WKFindOptions here from WKPage.h.
+        * Shared/API/c/WKSharedAPICast.h:
+        (WebKit::toFindOptions): Moved from WKAPICast.h.
+        * UIProcess/API/C/WKAPICast.h:
+        * UIProcess/API/C/WKPage.h:
+        * WebKit2.xcodeproj/project.pbxproj: Added WKFindOptions.h.
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (WKBundlePageFindString): Added.
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::findStringFromInjectedBundle): Added.
+        * WebProcess/WebPage/WebPage.h:
+
 2010-11-30  Andreas Kling  <kling at webkit.org>
 
         Reviewed by Dirk Schulze.
diff --git a/WebKit2/Shared/API/c/WKFindOptions.h b/WebKit2/Shared/API/c/WKFindOptions.h
new file mode 100644
index 0000000..3330035
--- /dev/null
+++ b/WebKit2/Shared/API/c/WKFindOptions.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKFindOptions_h
+#define WKFindOptions_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+    kWKFindOptionsCaseInsensitive = 1 << 0,
+    kWKFindOptionsAtWordStarts = 1 << 1,
+    kWKFindOptionsTreatMedialCapitalAsWordStart = 1 << 2,
+    kWKFindOptionsBackwards = 1 << 3,
+    kWKFindOptionsWrapAround = 1 << 4,
+    kWKFindOptionsShowOverlay = 1 << 5,
+    kWKFindOptionsShowFindIndicator = 1 << 6
+};
+typedef uint32_t WKFindOptions;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKFindOptions_h
diff --git a/WebKit2/Shared/API/c/WKSharedAPICast.h b/WebKit2/Shared/API/c/WKSharedAPICast.h
index 77a72d2..8ecb628 100644
--- a/WebKit2/Shared/API/c/WKSharedAPICast.h
+++ b/WebKit2/Shared/API/c/WKSharedAPICast.h
@@ -29,9 +29,11 @@
 #include "WKBase.h"
 #include "WKContextMenuItemTypes.h"
 #include "WKEvent.h"
+#include "WKFindOptions.h"
 #include "WKGeometry.h"
 #include "WebError.h"
 #include "WebEvent.h"
+#include "WebFindOptions.h"
 #include "WebNumber.h"
 #include "WebString.h"
 #include "WebURL.h"
@@ -619,6 +621,28 @@ inline WKContextMenuItemType toAPI(WebCore::ContextMenuItemType type)
     }
 }
 
+inline FindOptions toFindOptions(WKFindOptions wkFindOptions)
+{
+    unsigned findOptions = 0;
+
+    if (wkFindOptions & kWKFindOptionsCaseInsensitive)
+        findOptions |= FindOptionsCaseInsensitive;
+    if (wkFindOptions & kWKFindOptionsAtWordStarts)
+        findOptions |= FindOptionsAtWordStarts;
+    if (wkFindOptions & kWKFindOptionsTreatMedialCapitalAsWordStart)
+        findOptions |= FindOptionsTreatMedialCapitalAsWordStart;
+    if (wkFindOptions & kWKFindOptionsBackwards)
+        findOptions |= FindOptionsBackwards;
+    if (wkFindOptions & kWKFindOptionsWrapAround)
+        findOptions |= FindOptionsWrapAround;
+    if (wkFindOptions & kWKFindOptionsShowOverlay)
+        findOptions |= FindOptionsShowOverlay;
+    if (wkFindOptions & kWKFindOptionsShowFindIndicator)
+        findOptions |= FindOptionsShowFindIndicator;
+
+    return static_cast<FindOptions>(findOptions);
+}
+
 } // namespace WebKit
 
 #endif // WKSharedAPICast_h
diff --git a/WebKit2/UIProcess/API/C/WKAPICast.h b/WebKit2/UIProcess/API/C/WKAPICast.h
index 0045984..2bb9aa5 100644
--- a/WebKit2/UIProcess/API/C/WKAPICast.h
+++ b/WebKit2/UIProcess/API/C/WKAPICast.h
@@ -32,7 +32,6 @@
 #include "WKPage.h"
 #include "WKPreferencesPrivate.h"
 #include "WKSharedAPICast.h"
-#include "WebFindOptions.h"
 #include <WebCore/FrameLoaderTypes.h>
 
 namespace WebKit {
@@ -124,28 +123,6 @@ inline WKCacheModel toAPI(CacheModel cacheModel)
     return kWKCacheModelDocumentViewer;
 }
 
-inline FindOptions toFindOptions(WKFindOptions wkFindOptions)
-{
-    unsigned findOptions = 0;
-
-    if (wkFindOptions & kWKFindOptionsCaseInsensitive)
-        findOptions |= FindOptionsCaseInsensitive;
-    if (wkFindOptions & kWKFindOptionsAtWordStarts)
-        findOptions |= FindOptionsAtWordStarts;
-    if (wkFindOptions & kWKFindOptionsTreatMedialCapitalAsWordStart)
-        findOptions |= FindOptionsTreatMedialCapitalAsWordStart;
-    if (wkFindOptions & kWKFindOptionsBackwards)
-        findOptions |= FindOptionsBackwards;
-    if (wkFindOptions & kWKFindOptionsWrapAround)
-        findOptions |= FindOptionsWrapAround;
-    if (wkFindOptions & kWKFindOptionsShowOverlay)
-        findOptions |= FindOptionsShowOverlay;
-    if (wkFindOptions & kWKFindOptionsShowFindIndicator)
-        findOptions |= FindOptionsShowFindIndicator;
-
-    return static_cast<FindOptions>(findOptions);
-}
-
 inline FontSmoothingLevel toFontSmoothingLevel(WKFontSmoothingLevel wkLevel)
 {
     switch (wkLevel) {
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index 9512520..8bf9ba9 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -28,6 +28,7 @@
 
 #include <WebKit2/WKBase.h>
 #include <WebKit2/WKEvent.h>
+#include <WebKit2/WKFindOptions.h>
 #include <WebKit2/WKGeometry.h>
 #include <WebKit2/WKNativeEvent.h>
 
@@ -272,18 +273,6 @@ WK_EXPORT void WKPageSetPageAndTextZoomFactors(WKPageRef page, double pageZoomFa
 WK_EXPORT void WKPageScaleWebView(WKPageRef page, double scale, WKPoint origin);
 WK_EXPORT double WKPageGetViewScaleFactor(WKPageRef page);
 
-// Find.
-enum {
-    kWKFindOptionsCaseInsensitive = 1 << 0,
-    kWKFindOptionsAtWordStarts = 1 << 1,
-    kWKFindOptionsTreatMedialCapitalAsWordStart = 1 << 2,
-    kWKFindOptionsBackwards = 1 << 3,
-    kWKFindOptionsWrapAround = 1 << 4,
-    kWKFindOptionsShowOverlay = 1 << 5,
-    kWKFindOptionsShowFindIndicator = 1 << 6
-};
-typedef uint32_t WKFindOptions;
-
 WK_EXPORT void WKPageFindString(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount);
 WK_EXPORT void WKPageHideFindUI(WKPageRef page);
 WK_EXPORT void WKPageCountStringMatches(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount);
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 71c4e30..e9ea83d 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -194,6 +194,7 @@
 		1CA8B945127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CA8B943127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp */; };
 		1CA8B946127C882A00576C2B /* WebInspectorProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CA8B944127C882A00576C2B /* WebInspectorProxyMessages.h */; };
 		1CA8B954127C891500576C2B /* WebInspectorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C8E2DAD1278C5B200BC7BD0 /* WebInspectorMac.mm */; };
+		37F623B812A57B6200E3FDF6 /* WKFindOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 37F623B712A57B6200E3FDF6 /* WKFindOptions.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		510FBB9A1288C95E00AFFDF4 /* WebContextMenuItemData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510FBB981288C95E00AFFDF4 /* WebContextMenuItemData.cpp */; };
 		510FBB9B1288C95E00AFFDF4 /* WebContextMenuItemData.h in Headers */ = {isa = PBXBuildFile; fileRef = 510FBB991288C95E00AFFDF4 /* WebContextMenuItemData.h */; };
 		512935D71288D19400A4B695 /* WebContextMenuItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512935D51288D19400A4B695 /* WebContextMenuItem.cpp */; };
@@ -760,6 +761,7 @@
 		1CA8B943127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebInspectorProxyMessageReceiver.cpp; sourceTree = "<group>"; };
 		1CA8B944127C882A00576C2B /* WebInspectorProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInspectorProxyMessages.h; sourceTree = "<group>"; };
 		32DBCF5E0370ADEE00C91783 /* WebKit2Prefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKit2Prefix.h; sourceTree = "<group>"; };
+		37F623B712A57B6200E3FDF6 /* WKFindOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFindOptions.h; sourceTree = "<group>"; };
 		510FBB981288C95E00AFFDF4 /* WebContextMenuItemData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenuItemData.cpp; sourceTree = "<group>"; };
 		510FBB991288C95E00AFFDF4 /* WebContextMenuItemData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuItemData.h; sourceTree = "<group>"; };
 		512935D51288D19400A4B695 /* WebContextMenuItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenuItem.cpp; sourceTree = "<group>"; };
@@ -2067,6 +2069,7 @@
 				BC4075DF124FF0270068F20A /* WKError.cpp */,
 				BC4075E0124FF0270068F20A /* WKError.h */,
 				BC40783C1250FADD0068F20A /* WKEvent.h */,
+				37F623B712A57B6200E3FDF6 /* WKFindOptions.h */,
 				BCC8B373125FB69000DE46A4 /* WKGeometry.h */,
 				BC4075E1124FF0270068F20A /* WKMutableArray.cpp */,
 				BC4075E2124FF0270068F20A /* WKMutableArray.h */,
@@ -2427,6 +2430,7 @@
 				1CA8B946127C882A00576C2B /* WebInspectorProxyMessages.h in Headers */,
 				5153569D1291B1D2000749DC /* WebPageContextMenuClient.h in Headers */,
 				1AAB4A8D1296F0A20023952F /* SandboxExtension.h in Headers */,
+				37F623B812A57B6200E3FDF6 /* WKFindOptions.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
index cd8f158..57ff028 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
@@ -156,3 +156,8 @@ bool WKBundlePageCanHandleRequest(WKURLRequestRef requestRef)
 {
     return WebPage::canHandleRequest(toImpl(requestRef)->resourceRequest());
 }
+
+bool WKBundlePageFindString(WKBundlePageRef pageRef, WKStringRef target, WKFindOptions findOptions)
+{
+    return toImpl(pageRef)->findStringFromInjectedBundle(toImpl(target)->string(), toFindOptions(findOptions));
+}
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
index d507df2..f1f04ae 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
@@ -28,6 +28,7 @@
 
 #include <WebKit2/WKBase.h>
 #include <WebKit2/WKEvent.h>
+#include <WebKit2/WKFindOptions.h>
 
 #ifndef __cplusplus
 #include <stdbool.h>
@@ -209,6 +210,8 @@ WK_EXPORT void WKBundlePageUninstallPageOverlay(WKBundlePageRef page, WKBundlePa
 WK_EXPORT bool WKBundlePageHasLocalDataForURL(WKBundlePageRef page, WKURLRef url);
 WK_EXPORT bool WKBundlePageCanHandleRequest(WKURLRequestRef request);
 
+WK_EXPORT bool WKBundlePageFindString(WKBundlePageRef page, WKStringRef target, WKFindOptions findOptions);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 0f11c22..07d1d42 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -1001,6 +1001,11 @@ void WebPage::setActivePopupMenu(WebPopupMenu* menu)
     m_activePopupMenu = menu;
 }
 
+bool WebPage::findStringFromInjectedBundle(const String& target, FindOptions options)
+{
+    return m_page->findString(target, options);
+}
+
 void WebPage::findString(const String& string, uint32_t options, uint32_t maxMatchCount)
 {
     m_findController.findString(string, static_cast<FindOptions>(options), maxMatchCount);
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index ed2264d..899ed2a 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -149,6 +149,8 @@ public:
     InjectedBundlePageLoaderClient& injectedBundleLoaderClient() { return m_loaderClient; }
     InjectedBundlePageUIClient& injectedBundleUIClient() { return m_uiClient; }
 
+    bool findStringFromInjectedBundle(const String&, FindOptions);
+
     WebFrame* mainFrame() const { return m_mainFrame.get(); }
     PassRefPtr<Plugin> createPlugin(const Plugin::Parameters&);
 
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index be2674b..010ccf9 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,14 @@
+2010-11-30  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        <rdar://problem/8710645> WebKitTestRunner needs layoutTestController.findString
+        https://bugs.webkit.org/show_bug.cgi?id=50238
+
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+        (WTR::LayoutTestController::findString): Added.
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
+
 2010-11-30  Steve Falkenburg  <sfalken at apple.com>
 
         Reviewed by Adam Roben.
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
index de37383..2285d42 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
@@ -233,6 +233,41 @@ void LayoutTestController::execCommand(JSStringRef name, JSStringRef argument)
     WKBundlePageExecuteEditingCommand(InjectedBundle::shared().page()->page(), toWK(name).get(), toWK(argument).get());
 }
 
+bool LayoutTestController::findString(JSContextRef context, JSStringRef target, JSObjectRef optionsArray)
+{
+    WKFindOptions options = 0;
+
+    JSRetainPtr<JSStringRef> lengthPropertyName(Adopt, JSStringCreateWithUTF8CString("length"));
+    JSValueRef lengthValue = JSObjectGetProperty(context, optionsArray, lengthPropertyName.get(), 0);
+    if (!JSValueIsNumber(context, lengthValue))
+        return false;
+
+    size_t length = static_cast<size_t>(JSValueToNumber(context, lengthValue, 0));
+    for (size_t i = 0; i < length; ++i) {
+        JSValueRef value = JSObjectGetPropertyAtIndex(context, optionsArray, i, 0);
+        if (!JSValueIsString(context, value))
+            continue;
+
+        JSRetainPtr<JSStringRef> optionName(Adopt, JSValueToStringCopy(context, value, 0));
+
+        if (JSStringIsEqualToUTF8CString(optionName.get(), "CaseInsensitive"))
+            options |= kWKFindOptionsCaseInsensitive;
+        else if (JSStringIsEqualToUTF8CString(optionName.get(), "AtWordStarts"))
+            options |= kWKFindOptionsAtWordStarts;
+        else if (JSStringIsEqualToUTF8CString(optionName.get(), "TreatMedialCapitalAsWordStart"))
+            options |= kWKFindOptionsTreatMedialCapitalAsWordStart;
+        else if (JSStringIsEqualToUTF8CString(optionName.get(), "Backwards"))
+            options |= kWKFindOptionsBackwards;
+        else if (JSStringIsEqualToUTF8CString(optionName.get(), "WrapAround"))
+            options |= kWKFindOptionsWrapAround;
+        else if (JSStringIsEqualToUTF8CString(optionName.get(), "StartInSelection")) {
+            // FIXME: No kWKFindOptionsStartInSelection.
+        }
+    }
+
+    return WKBundlePageFindString(InjectedBundle::shared().page()->page(), toWK(target).get(), options);
+}
+
 bool LayoutTestController::isCommandEnabled(JSStringRef name)
 {
     return WKBundlePageIsEditingCommandEnabled(InjectedBundle::shared().page()->page(), toWK(name).get());
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
index 427d05e..f4921a9 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
@@ -101,6 +101,9 @@ public:
     void addUserScript(JSStringRef source, bool runAtStart, bool allFrames);
     void addUserStyleSheet(JSStringRef source, bool allFrames);
 
+    // Text search testing.
+    bool findString(JSContextRef, JSStringRef, JSObjectRef optionsArray);
+
     enum WhatToDump { RenderTree, MainFrameText, AllFramesText };
     WhatToDump whatToDump() const { return m_whatToDump; }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list