Title: [198501] trunk
Revision
198501
Author
bfulg...@apple.com
Date
2016-03-21 15:22:16 -0700 (Mon, 21 Mar 2016)

Log Message

Source/WebKit/win:
[Win] Connect layoutTestController.findString() to support testing 
https://bugs.webkit.org/show_bug.cgi?id=50234

Patch by Hyungwook Lee <hyungwook....@navercorp.com> on 2016-03-21
Reviewed by Alex Christensen.

Implement WebView::findString to support testing efforts.

* Interfaces/IWebViewPrivate.idl: Add API declaration.
* WebView.cpp:
* WebView.h:

Tools:
[Win] Connect layoutTestController.findString() to support testing
https://bugs.webkit.org/show_bug.cgi?id=50234

Patch by Hyungwook Lee <hyungwook....@navercorp.com> on 2016-03-21
Reviewed by Alex Christensen.

Implement TestRunner::findString().

* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::findString):

LayoutTests:
[Win] Connect layoutTestController.findString() to support testing
https://bugs.webkit.org/show_bug.cgi?id=50234

Patch by Hyungwook Lee <hyungwook....@navercorp.com> on 2016-03-21
Reviewed by Alex Christensen.

* platform/win/TestExpectations: Unskip test.
* platform/win/editing/text-iterator/findString-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (198500 => 198501)


--- trunk/LayoutTests/ChangeLog	2016-03-21 22:07:33 UTC (rev 198500)
+++ trunk/LayoutTests/ChangeLog	2016-03-21 22:22:16 UTC (rev 198501)
@@ -1,3 +1,13 @@
+2016-03-21  Hyungwook Lee  <hyungwook....@navercorp.com>
+
+        [Win] Connect layoutTestController.findString() to support testing
+        https://bugs.webkit.org/show_bug.cgi?id=50234
+
+        Reviewed by Alex Christensen.
+
+        * platform/win/TestExpectations: Unskip test.
+        * platform/win/editing/text-iterator/findString-expected.txt: Added.
+
 2016-03-21  Zalan Bujtas  <za...@apple.com>
 
         Web Inspector search icon does not fit when zoomed in.

Modified: trunk/LayoutTests/platform/win/TestExpectations (198500 => 198501)


--- trunk/LayoutTests/platform/win/TestExpectations	2016-03-21 22:07:33 UTC (rev 198500)
+++ trunk/LayoutTests/platform/win/TestExpectations	2016-03-21 22:22:16 UTC (rev 198501)
@@ -1255,8 +1255,7 @@
 ###### Text Iterator
 # Plain text controller currently in Mac DumpRenderTree only.
 editing/text-iterator [ Skip ]
-# TODO Missing testRunner.findString()
-webkit.org/b/50234 editing/text-iterator/findString.html [ Skip ]
+editing/text-iterator/findString.html [ Pass ]
 
 ###### TODO Spellchecker is not implemented. Skip these test.
 webkit.org/b/66620 editing/spelling/spelling-insert-html.html [ Skip ]

Added: trunk/LayoutTests/platform/win/editing/text-iterator/findString-expected.txt (0 => 198501)


--- trunk/LayoutTests/platform/win/editing/text-iterator/findString-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/win/editing/text-iterator/findString-expected.txt	2016-03-21 22:22:16 UTC (rev 198501)
@@ -0,0 +1,176 @@
+Searching for ‘o’ in ‘Lorem ipsum dolor sit amet’ with options []:
+PASS: Got a match at 1,2 as expected.
+PASS: Got a match at 13,14 as expected.
+PASS: Got a match at 15,16 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘o’ in ‘Lorem ipsum dolor sit amet’ with options [WrapAround]:
+PASS: Got a match at 1,2 as expected.
+PASS: Got a match at 13,14 as expected.
+PASS: Got a match at 15,16 as expected.
+PASS: Got a match at 1,2 as expected.
+
+Searching for ‘o’ in ‘Lorem ipsum dolor sit amet’ with options [Backwards]:
+PASS: Got a match at 15,16 as expected.
+PASS: Got a match at 13,14 as expected.
+PASS: Got a match at 1,2 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘o’ in ‘Lorem ipsum dolor sit amet’ with options [Backwards, WrapAround]:
+PASS: Got a match at 15,16 as expected.
+PASS: Got a match at 13,14 as expected.
+PASS: Got a match at 1,2 as expected.
+PASS: Got a match at 15,16 as expected.
+
+Searching for ‘O’ in ‘Lorem ipsum dolor sit amet’ with options []:
+PASS: Got no match as expected.
+
+Searching for ‘O’ in ‘Lorem ipsum dolor sit amet’ with options [CaseInsensitive]:
+PASS: Got a match at 1,2 as expected.
+PASS: Got a match at 13,14 as expected.
+PASS: Got a match at 15,16 as expected.
+
+Searching for ‘mount’ in ‘insurmountable mountain’ with options []:
+PASS: Got a match at 5,10 as expected.
+PASS: Got a match at 15,20 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘mount’ in ‘insurmountable mountain’ with options [AtWordStarts]:
+PASS: Got a match at 15,20 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘co’ in ‘cocoa’ with options []:
+PASS: Got a match at 0,2 as expected.
+PASS: Got a match at 2,4 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘co’ in ‘cocoa’ with options [AtWordStarts]:
+PASS: Got a match at 0,2 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘org’ in ‘webkit.org’ with options [AtWordStarts]:
+FAIL: Expected a match at  but got a match at 7,10 instead.
+
+Searching for ‘.org’ in ‘webkit.org’ with options [AtWordStarts]:
+PASS: Got a match at 6,10 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘rg’ in ‘webkit.org’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
+PASS: Got no match as expected.
+
+Searching for ‘org’ in ‘webkit.org’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
+PASS: Got a match at 7,10 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘.org’ in ‘webkit.org’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
+PASS: Got a match at 6,10 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘t.org’ in ‘webkit.org’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
+PASS: Got no match as expected.
+
+Searching for ‘it’ in ‘WebKit’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
+PASS: Got no match as expected.
+
+Searching for ‘Kit’ in ‘WebKit’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
+PASS: Got a match at 3,6 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘bKit’ in ‘WebKit’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
+PASS: Got no match as expected.
+
+Searching for ‘equest’ in ‘XMLHTTPRequest’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
+PASS: Got no match as expected.
+
+Searching for ‘Request’ in ‘XMLHTTPRequest’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
+PASS: Got a match at 7,14 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘PRequest’ in ‘XMLHTTPRequest’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
+PASS: Got no match as expected.
+
+Searching for ‘64’ in ‘LP64’ with options [AtWordStarts]:
+PASS: Got no match as expected.
+
+Searching for ‘4’ in ‘LP64’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
+PASS: Got no match as expected.
+
+Searching for ‘64’ in ‘LP64’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
+PASS: Got a match at 2,4 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘P64’ in ‘LP64’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
+PASS: Got no match as expected.
+
+Searching for ‘動戦士’ in ‘起動戦士’ with options [AtWordStarts]:
+PASS: Got a match at 1,4 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘戦士’ in ‘起動戦士’ with options [AtWordStarts]:
+PASS: Got a match at 2,4 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘士’ in ‘起動戦士’ with options [AtWordStarts]:
+PASS: Got a match at 3,4 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘a’ in long string with options [AtWordStarts]:
+PASS: Got a match at 6146,6147 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘กร’ in ‘กรปูเลกชกชกรกรกชบงกช’ with options []:
+PASS: Got a match at 0,2 as expected.
+PASS: Got a match at 10,12 as expected.
+PASS: Got a match at 12,14 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘กร’ in ‘กรปูเลกชกชกรกรกชบงกช’ with options [AtWordStarts]:
+PASS: Got a match at 0,2 as expected.
+PASS: Got a match at 12,14 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘กช’ in ‘กรปูเลกชกชกรกรกชบงกช’ with options []:
+PASS: Got a match at 6,8 as expected.
+PASS: Got a match at 8,10 as expected.
+PASS: Got a match at 14,16 as expected.
+PASS: Got a match at 18,20 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘กช’ in ‘กรปูเลกชกชกรกรกชบงกช’ with options [AtWordStarts]:
+PASS: Got a match at 6,8 as expected.
+PASS: Got a match at 8,10 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘กร’ in long string with options []:
+PASS: Got a match at 6144,6146 as expected.
+PASS: Got a match at 6154,6156 as expected.
+PASS: Got a match at 6156,6158 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘กร’ in long string with options [AtWordStarts]:
+PASS: Got a match at 6156,6158 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘กร’ in long string with options [AtWordStarts]:
+PASS: Got a match at 6144,6146 as expected.
+PASS: Got a match at 6156,6158 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘กช’ in long string with options [AtWordStarts]:
+PASS: Got no match as expected.
+
+Searching for ‘ ’ in ‘Spaces, the final frontier’ with options [AtWordStarts]:
+PASS: Got a match at 7,8 as expected.
+PASS: Got a match at 11,12 as expected.
+PASS: Got a match at 17,18 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘@’ in ‘Use an @import rule’ with options [AtWordStarts]:
+PASS: Got a match at 7,8 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘(x’ in ‘If ((x + 5) * 2) = 14, then x = 2’ with options [AtWordStarts]:
+PASS: Got a match at 4,6 as expected.
+PASS: Got no match as expected.
+
+

Modified: trunk/Source/WebKit/win/ChangeLog (198500 => 198501)


--- trunk/Source/WebKit/win/ChangeLog	2016-03-21 22:07:33 UTC (rev 198500)
+++ trunk/Source/WebKit/win/ChangeLog	2016-03-21 22:22:16 UTC (rev 198501)
@@ -1,3 +1,16 @@
+2016-03-21  Hyungwook Lee  <hyungwook....@navercorp.com> 
+
+        [Win] Connect layoutTestController.findString() to support testing 
+        https://bugs.webkit.org/show_bug.cgi?id=50234
+
+        Reviewed by Alex Christensen.
+
+        Implement WebView::findString to support testing efforts.
+
+        * Interfaces/IWebViewPrivate.idl: Add API declaration.
+        * WebView.cpp:
+        * WebView.h:
+
 2016-03-16  Carlos Garcia Campos  <cgar...@igalia.com>
 
         Unreviewed, rolling out r196951 and r197031.

Modified: trunk/Source/WebKit/win/Interfaces/IWebViewPrivate.idl (198500 => 198501)


--- trunk/Source/WebKit/win/Interfaces/IWebViewPrivate.idl	2016-03-21 22:07:33 UTC (rev 198500)
+++ trunk/Source/WebKit/win/Interfaces/IWebViewPrivate.idl	2016-03-21 22:22:16 UTC (rev 198501)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2008, 2015 Apple Inc.  All rights reserved.
+ * Copyright (C) 2006-2016 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -321,8 +321,18 @@
         [in] WebUserContentInjectedFrames injectedFrames);
 }
 
+typedef enum {
+    WebFindOptionsCaseInsensitive = 1 << 0,
+    WebFindOptionsAtWordStarts = 1 << 1,
+    WebFindOptionsTreatMedialCapitalAsWordStart = 1 << 2,
+    WebFindOptionsBackwards = 1 << 3,
+    WebFindOptionsWrapAround = 1 << 4,
+    WebFindOptionsStartInSelection = 1 << 5
+} WebFindOptions;
+
 [ uuid(08C88359-76AA-48F2-BA27-820540E781E9) ]
 interface IWebViewPrivate3 : IWebViewPrivate2
 {
     HRESULT layerTreeAsString([out] BSTR*);
+    HRESULT findString([in] BSTR, [in] WebFindOptions, [out] BOOL* found); 
 }

Modified: trunk/Source/WebKit/win/WebView.cpp (198500 => 198501)


--- trunk/Source/WebKit/win/WebView.cpp	2016-03-21 22:07:33 UTC (rev 198500)
+++ trunk/Source/WebKit/win/WebView.cpp	2016-03-21 22:22:16 UTC (rev 198501)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2015 Apple, Inc.  All rights reserved.
+ * Copyright (C) 2006-2016 Apple, Inc.  All rights reserved.
  * Copyright (C) 2009, 2010, 2011 Appcelerator, Inc. All rights reserved.
  * Copyright (C) 2011 Brent Fulgham. All rights reserved.
  *
@@ -7564,3 +7564,13 @@
 
     return S_OK;
 }
+
+HRESULT WebView::findString(_In_ BSTR string, WebFindOptions options, _Deref_opt_out_ BOOL* found)
+{
+    if (!found)
+        return E_POINTER;
+
+    *found = m_page->findString(toString(string), options);
+    return S_OK;
+}
+

Modified: trunk/Source/WebKit/win/WebView.h (198500 => 198501)


--- trunk/Source/WebKit/win/WebView.h	2016-03-21 22:07:33 UTC (rev 198500)
+++ trunk/Source/WebKit/win/WebView.h	2016-03-21 22:22:16 UTC (rev 198501)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2012, 2014-2015 Apple Inc.  All rights reserved.
+ * Copyright (C) 2006-2016 Apple Inc.  All rights reserved.
  * Copyright (C) 2009, 2010, 2011 Appcelerator, Inc. All rights reserved.
  * Copyright (C) 2011 Brent Fulgham. All rights reserved.
  *
@@ -390,6 +390,7 @@
 
     // IWebViewPrivate3
     HRESULT STDMETHODCALLTYPE layerTreeAsString(_Deref_opt_out_ BSTR*);
+    HRESULT STDMETHODCALLTYPE findString(_In_ BSTR, WebFindOptions, _Deref_opt_out_ BOOL*);
 
     // WebView
     bool shouldUseEmbeddedView(const WTF::String& mimeType) const;

Modified: trunk/Tools/ChangeLog (198500 => 198501)


--- trunk/Tools/ChangeLog	2016-03-21 22:07:33 UTC (rev 198500)
+++ trunk/Tools/ChangeLog	2016-03-21 22:22:16 UTC (rev 198501)
@@ -1,3 +1,15 @@
+2016-03-21  Hyungwook Lee  <hyungwook....@navercorp.com>
+
+        [Win] Connect layoutTestController.findString() to support testing
+        https://bugs.webkit.org/show_bug.cgi?id=50234
+
+        Reviewed by Alex Christensen.
+
+        Implement TestRunner::findString().
+
+        * DumpRenderTree/win/TestRunnerWin.cpp:
+        (TestRunner::findString):
+
 2016-03-20  Dan Bernstein  <m...@apple.com>
 
         [Mac] Determine TARGET_MAC_OS_X_VERSION_MAJOR from MACOSX_DEPLOYMENT_TARGET rather than from MAC_OS_X_VERSION_MAJOR

Modified: trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp (198500 => 198501)


--- trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp	2016-03-21 22:07:33 UTC (rev 198500)
+++ trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp	2016-03-21 22:22:16 UTC (rev 198501)
@@ -928,11 +928,52 @@
     viewPrivate->executeCoreCommandByName(nameBSTR, valueBSTR);
 }
 
-bool TestRunner::findString(JSContextRef /* context */, JSStringRef /* target */, JSObjectRef /* optionsArray */)
+bool TestRunner::findString(JSContextRef context, JSStringRef target, JSObjectRef optionsArray)
 {
-    // FIXME: Implement
-    printf("ERROR: TestRunner::findString(...) not implemented\n");
-    return false;
+    COMPtr<IWebView> webView;
+    if (FAILED(frame->webView(&webView)))
+        return false;
+
+    COMPtr<IWebViewPrivate3> viewPrivate;
+    if (FAILED(webView->QueryInterface(&viewPrivate)))
+        return false;
+
+    unsigned char options = 0;
+
+    JSRetainPtr<JSStringRef> lengthPropertyName(Adopt, JSStringCreateWithUTF8CString("length"));
+    JSValueRef lengthValue = JSObjectGetProperty(context, optionsArray, lengthPropertyName.get(), nullptr);
+    if (!JSValueIsNumber(context, lengthValue))
+        return false;
+
+    _bstr_t targetBSTR(JSStringCopyBSTR(target), false);
+
+    size_t length = static_cast<size_t>(JSValueToNumber(context, lengthValue, nullptr));
+    for (size_t i = 0; i < length; ++i) {
+        JSValueRef value = JSObjectGetPropertyAtIndex(context, optionsArray, i, nullptr);
+        if (!JSValueIsString(context, value))
+            continue;
+
+        JSRetainPtr<JSStringRef> optionName(Adopt, JSValueToStringCopy(context, value, nullptr));
+
+        if (JSStringIsEqualToUTF8CString(optionName.get(), "CaseInsensitive"))
+            options |= WebFindOptionsCaseInsensitive;
+        else if (JSStringIsEqualToUTF8CString(optionName.get(), "AtWordStarts"))
+            options |= WebFindOptionsAtWordStarts;
+        else if (JSStringIsEqualToUTF8CString(optionName.get(), "TreatMedialCapitalAsWordStart"))
+            options |= WebFindOptionsTreatMedialCapitalAsWordStart;
+        else if (JSStringIsEqualToUTF8CString(optionName.get(), "Backwards"))
+            options |= WebFindOptionsBackwards;
+        else if (JSStringIsEqualToUTF8CString(optionName.get(), "WrapAround"))
+            options |= WebFindOptionsWrapAround;
+        else if (JSStringIsEqualToUTF8CString(optionName.get(), "StartInSelection"))
+            options |= WebFindOptionsStartInSelection;
+    }
+
+    BOOL found = FALSE;
+    if (FAILED(viewPrivate->findString(targetBSTR, static_cast<WebFindOptions>(options), &found)))
+        return false;
+
+    return found;
 }
 
 void TestRunner::setCacheModel(int cacheModel)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to