Changeset 72937 in webkit


Ignore:
Timestamp:
Nov 30, 2010 11:14:56 AM (13 years ago)
Author:
mitz@apple.com
Message:

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.
Location:
trunk
Files:
1 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r72931 r72937  
     12010-11-30  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        <rdar://problem/8710645> WebKitTestRunner needs layoutTestController.findString
     6        https://bugs.webkit.org/show_bug.cgi?id=50238
     7
     8        * platform/mac-wk2/Skipped: Removed editing/text-iterator/findString.html.
     9
    1102010-11-30  Xiaomei Ji  <xji@chromium.org>
    211
  • trunk/LayoutTests/platform/mac-wk2/Skipped

    r72930 r72937  
    19161916printing/page-format-data-display-none.html
    19171917
    1918 # WebKitTestRunner needs layoutTestController.findString <http://webkit.org/b/50238>
    1919 editing/text-iterator/findString.html
    1920 
    19211918# WebKit2 needs support for moving/resizing and querying the location/size the window
    19221919fast/dom/Window/window-resize-and-move-arguments.html
  • trunk/WebKit2/ChangeLog

    r72926 r72937  
     12010-11-30  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Injected bundle support for <rdar://problem/8710645> WebKitTestRunner needs layoutTestController.findString
     6        https://bugs.webkit.org/show_bug.cgi?id=50238
     7
     8        * Shared/API/c/WKFindOptions.h: Added. Moved the definition of WKFindOptions here from WKPage.h.
     9        * Shared/API/c/WKSharedAPICast.h:
     10        (WebKit::toFindOptions): Moved from WKAPICast.h.
     11        * UIProcess/API/C/WKAPICast.h:
     12        * UIProcess/API/C/WKPage.h:
     13        * WebKit2.xcodeproj/project.pbxproj: Added WKFindOptions.h.
     14        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
     15        (WKBundlePageFindString): Added.
     16        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
     17        * WebProcess/WebPage/WebPage.cpp:
     18        (WebKit::WebPage::findStringFromInjectedBundle): Added.
     19        * WebProcess/WebPage/WebPage.h:
     20
    1212010-11-30  Andreas Kling  <kling@webkit.org>
    222
  • trunk/WebKit2/Shared/API/c/WKSharedAPICast.h

    r72666 r72937  
    3030#include "WKContextMenuItemTypes.h"
    3131#include "WKEvent.h"
     32#include "WKFindOptions.h"
    3233#include "WKGeometry.h"
    3334#include "WebError.h"
    3435#include "WebEvent.h"
     36#include "WebFindOptions.h"
    3537#include "WebNumber.h"
    3638#include "WebString.h"
     
    620622}
    621623
     624inline FindOptions toFindOptions(WKFindOptions wkFindOptions)
     625{
     626    unsigned findOptions = 0;
     627
     628    if (wkFindOptions & kWKFindOptionsCaseInsensitive)
     629        findOptions |= FindOptionsCaseInsensitive;
     630    if (wkFindOptions & kWKFindOptionsAtWordStarts)
     631        findOptions |= FindOptionsAtWordStarts;
     632    if (wkFindOptions & kWKFindOptionsTreatMedialCapitalAsWordStart)
     633        findOptions |= FindOptionsTreatMedialCapitalAsWordStart;
     634    if (wkFindOptions & kWKFindOptionsBackwards)
     635        findOptions |= FindOptionsBackwards;
     636    if (wkFindOptions & kWKFindOptionsWrapAround)
     637        findOptions |= FindOptionsWrapAround;
     638    if (wkFindOptions & kWKFindOptionsShowOverlay)
     639        findOptions |= FindOptionsShowOverlay;
     640    if (wkFindOptions & kWKFindOptionsShowFindIndicator)
     641        findOptions |= FindOptionsShowFindIndicator;
     642
     643    return static_cast<FindOptions>(findOptions);
     644}
     645
    622646} // namespace WebKit
    623647
  • trunk/WebKit2/UIProcess/API/C/WKAPICast.h

    r72887 r72937  
    3333#include "WKPreferencesPrivate.h"
    3434#include "WKSharedAPICast.h"
    35 #include "WebFindOptions.h"
    3635#include <WebCore/FrameLoaderTypes.h>
    3736
     
    125124}
    126125
    127 inline FindOptions toFindOptions(WKFindOptions wkFindOptions)
    128 {
    129     unsigned findOptions = 0;
    130 
    131     if (wkFindOptions & kWKFindOptionsCaseInsensitive)
    132         findOptions |= FindOptionsCaseInsensitive;
    133     if (wkFindOptions & kWKFindOptionsAtWordStarts)
    134         findOptions |= FindOptionsAtWordStarts;
    135     if (wkFindOptions & kWKFindOptionsTreatMedialCapitalAsWordStart)
    136         findOptions |= FindOptionsTreatMedialCapitalAsWordStart;
    137     if (wkFindOptions & kWKFindOptionsBackwards)
    138         findOptions |= FindOptionsBackwards;
    139     if (wkFindOptions & kWKFindOptionsWrapAround)
    140         findOptions |= FindOptionsWrapAround;
    141     if (wkFindOptions & kWKFindOptionsShowOverlay)
    142         findOptions |= FindOptionsShowOverlay;
    143     if (wkFindOptions & kWKFindOptionsShowFindIndicator)
    144         findOptions |= FindOptionsShowFindIndicator;
    145 
    146     return static_cast<FindOptions>(findOptions);
    147 }
    148 
    149126inline FontSmoothingLevel toFontSmoothingLevel(WKFontSmoothingLevel wkLevel)
    150127{
  • trunk/WebKit2/UIProcess/API/C/WKPage.h

    r72887 r72937  
    2929#include <WebKit2/WKBase.h>
    3030#include <WebKit2/WKEvent.h>
     31#include <WebKit2/WKFindOptions.h>
    3132#include <WebKit2/WKGeometry.h>
    3233#include <WebKit2/WKNativeEvent.h>
     
    273274WK_EXPORT double WKPageGetViewScaleFactor(WKPageRef page);
    274275
    275 // Find.
    276 enum {
    277     kWKFindOptionsCaseInsensitive = 1 << 0,
    278     kWKFindOptionsAtWordStarts = 1 << 1,
    279     kWKFindOptionsTreatMedialCapitalAsWordStart = 1 << 2,
    280     kWKFindOptionsBackwards = 1 << 3,
    281     kWKFindOptionsWrapAround = 1 << 4,
    282     kWKFindOptionsShowOverlay = 1 << 5,
    283     kWKFindOptionsShowFindIndicator = 1 << 6
    284 };
    285 typedef uint32_t WKFindOptions;
    286 
    287276WK_EXPORT void WKPageFindString(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount);
    288277WK_EXPORT void WKPageHideFindUI(WKPageRef page);
  • trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r72887 r72937  
    195195                1CA8B946127C882A00576C2B /* WebInspectorProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CA8B944127C882A00576C2B /* WebInspectorProxyMessages.h */; };
    196196                1CA8B954127C891500576C2B /* WebInspectorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C8E2DAD1278C5B200BC7BD0 /* WebInspectorMac.mm */; };
     197                37F623B812A57B6200E3FDF6 /* WKFindOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 37F623B712A57B6200E3FDF6 /* WKFindOptions.h */; settings = {ATTRIBUTES = (Public, ); }; };
    197198                510FBB9A1288C95E00AFFDF4 /* WebContextMenuItemData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510FBB981288C95E00AFFDF4 /* WebContextMenuItemData.cpp */; };
    198199                510FBB9B1288C95E00AFFDF4 /* WebContextMenuItemData.h in Headers */ = {isa = PBXBuildFile; fileRef = 510FBB991288C95E00AFFDF4 /* WebContextMenuItemData.h */; };
     
    761762                1CA8B944127C882A00576C2B /* WebInspectorProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInspectorProxyMessages.h; sourceTree = "<group>"; };
    762763                32DBCF5E0370ADEE00C91783 /* WebKit2Prefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKit2Prefix.h; sourceTree = "<group>"; };
     764                37F623B712A57B6200E3FDF6 /* WKFindOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFindOptions.h; sourceTree = "<group>"; };
    763765                510FBB981288C95E00AFFDF4 /* WebContextMenuItemData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenuItemData.cpp; sourceTree = "<group>"; };
    764766                510FBB991288C95E00AFFDF4 /* WebContextMenuItemData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuItemData.h; sourceTree = "<group>"; };
     
    20682070                                BC4075E0124FF0270068F20A /* WKError.h */,
    20692071                                BC40783C1250FADD0068F20A /* WKEvent.h */,
     2072                                37F623B712A57B6200E3FDF6 /* WKFindOptions.h */,
    20702073                                BCC8B373125FB69000DE46A4 /* WKGeometry.h */,
    20712074                                BC4075E1124FF0270068F20A /* WKMutableArray.cpp */,
     
    24282431                                5153569D1291B1D2000749DC /* WebPageContextMenuClient.h in Headers */,
    24292432                                1AAB4A8D1296F0A20023952F /* SandboxExtension.h in Headers */,
     2433                                37F623B812A57B6200E3FDF6 /* WKFindOptions.h in Headers */,
    24302434                        );
    24312435                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp

    r72446 r72937  
    157157    return WebPage::canHandleRequest(toImpl(requestRef)->resourceRequest());
    158158}
     159
     160bool WKBundlePageFindString(WKBundlePageRef pageRef, WKStringRef target, WKFindOptions findOptions)
     161{
     162    return toImpl(pageRef)->findStringFromInjectedBundle(toImpl(target)->string(), toFindOptions(findOptions));
     163}
  • trunk/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h

    r72446 r72937  
    2929#include <WebKit2/WKBase.h>
    3030#include <WebKit2/WKEvent.h>
     31#include <WebKit2/WKFindOptions.h>
    3132
    3233#ifndef __cplusplus
     
    210211WK_EXPORT bool WKBundlePageCanHandleRequest(WKURLRequestRef request);
    211212
     213WK_EXPORT bool WKBundlePageFindString(WKBundlePageRef page, WKStringRef target, WKFindOptions findOptions);
     214
    212215#ifdef __cplusplus
    213216}
  • trunk/WebKit2/WebProcess/WebPage/WebPage.cpp

    r72919 r72937  
    10021002}
    10031003
     1004bool WebPage::findStringFromInjectedBundle(const String& target, FindOptions options)
     1005{
     1006    return m_page->findString(target, options);
     1007}
     1008
    10041009void WebPage::findString(const String& string, uint32_t options, uint32_t maxMatchCount)
    10051010{
  • trunk/WebKit2/WebProcess/WebPage/WebPage.h

    r72887 r72937  
    150150    InjectedBundlePageUIClient& injectedBundleUIClient() { return m_uiClient; }
    151151
     152    bool findStringFromInjectedBundle(const String&, FindOptions);
     153
    152154    WebFrame* mainFrame() const { return m_mainFrame.get(); }
    153155    PassRefPtr<Plugin> createPlugin(const Plugin::Parameters&);
  • trunk/WebKitTools/ChangeLog

    r72923 r72937  
     12010-11-30  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        <rdar://problem/8710645> WebKitTestRunner needs layoutTestController.findString
     6        https://bugs.webkit.org/show_bug.cgi?id=50238
     7
     8        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
     9        (WTR::LayoutTestController::findString): Added.
     10        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
     11
    1122010-11-30  Steve Falkenburg  <sfalken@apple.com>
    213
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp

    r71458 r72937  
    234234}
    235235
     236bool LayoutTestController::findString(JSContextRef context, JSStringRef target, JSObjectRef optionsArray)
     237{
     238    WKFindOptions options = 0;
     239
     240    JSRetainPtr<JSStringRef> lengthPropertyName(Adopt, JSStringCreateWithUTF8CString("length"));
     241    JSValueRef lengthValue = JSObjectGetProperty(context, optionsArray, lengthPropertyName.get(), 0);
     242    if (!JSValueIsNumber(context, lengthValue))
     243        return false;
     244
     245    size_t length = static_cast<size_t>(JSValueToNumber(context, lengthValue, 0));
     246    for (size_t i = 0; i < length; ++i) {
     247        JSValueRef value = JSObjectGetPropertyAtIndex(context, optionsArray, i, 0);
     248        if (!JSValueIsString(context, value))
     249            continue;
     250
     251        JSRetainPtr<JSStringRef> optionName(Adopt, JSValueToStringCopy(context, value, 0));
     252
     253        if (JSStringIsEqualToUTF8CString(optionName.get(), "CaseInsensitive"))
     254            options |= kWKFindOptionsCaseInsensitive;
     255        else if (JSStringIsEqualToUTF8CString(optionName.get(), "AtWordStarts"))
     256            options |= kWKFindOptionsAtWordStarts;
     257        else if (JSStringIsEqualToUTF8CString(optionName.get(), "TreatMedialCapitalAsWordStart"))
     258            options |= kWKFindOptionsTreatMedialCapitalAsWordStart;
     259        else if (JSStringIsEqualToUTF8CString(optionName.get(), "Backwards"))
     260            options |= kWKFindOptionsBackwards;
     261        else if (JSStringIsEqualToUTF8CString(optionName.get(), "WrapAround"))
     262            options |= kWKFindOptionsWrapAround;
     263        else if (JSStringIsEqualToUTF8CString(optionName.get(), "StartInSelection")) {
     264            // FIXME: No kWKFindOptionsStartInSelection.
     265        }
     266    }
     267
     268    return WKBundlePageFindString(InjectedBundle::shared().page()->page(), toWK(target).get(), options);
     269}
     270
    236271bool LayoutTestController::isCommandEnabled(JSStringRef name)
    237272{
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h

    r71458 r72937  
    102102    void addUserStyleSheet(JSStringRef source, bool allFrames);
    103103
     104    // Text search testing.
     105    bool findString(JSContextRef, JSStringRef, JSObjectRef optionsArray);
     106
    104107    enum WhatToDump { RenderTree, MainFrameText, AllFramesText };
    105108    WhatToDump whatToDump() const { return m_whatToDump; }
Note: See TracChangeset for help on using the changeset viewer.