Title: [186175] trunk
Revision
186175
Author
mrobin...@webkit.org
Date
2015-07-01 07:51:28 -0700 (Wed, 01 Jul 2015)

Log Message

[GTK] REGRESSION(r183936): Test /webkit2/WebKitWebContext/spell-checker fails since r183936
https://bugs.webkit.org/show_bug.cgi?id=144828

Reviewed by Carlos Garcia Campos.

Source/WebKit2:

Instead of setting spell checking languages unconditionally when building int
developer mode, add some C API that allows setting them in WebKitTestRunner.

* PlatformGTK.cmake: Add the new C API file to the source list.
* UIProcess/API/C/gtk/WKTextCheckerGtk.cpp:
(WKTextCheckerSetSpellCheckingLanguages): Added this function which allows settings
the spell checking languages from the C API.
* UIProcess/API/C/gtk/WKTextCheckerGtk.h: Added.
* UIProcess/gtk/TextCheckerGtk.cpp:
(WebKit::enchantTextChecker): Remove the hack which sets the spell checking languages automatically
for development builds.

Tools:

* WebKitTestRunner/gtk/main.cpp:
(main): Use the new WKTextChecker API to set the spell checking languages
when the process is starting up.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (186174 => 186175)


--- trunk/Source/WebKit2/ChangeLog	2015-07-01 08:55:02 UTC (rev 186174)
+++ trunk/Source/WebKit2/ChangeLog	2015-07-01 14:51:28 UTC (rev 186175)
@@ -1,3 +1,22 @@
+2015-06-30  Martin Robinson  <mrobin...@igalia.com>
+
+        [GTK] REGRESSION(r183936): Test /webkit2/WebKitWebContext/spell-checker fails since r183936
+        https://bugs.webkit.org/show_bug.cgi?id=144828
+
+        Reviewed by Carlos Garcia Campos.
+
+        Instead of setting spell checking languages unconditionally when building int
+        developer mode, add some C API that allows setting them in WebKitTestRunner.
+
+        * PlatformGTK.cmake: Add the new C API file to the source list.
+        * UIProcess/API/C/gtk/WKTextCheckerGtk.cpp:
+        (WKTextCheckerSetSpellCheckingLanguages): Added this function which allows settings
+        the spell checking languages from the C API.
+        * UIProcess/API/C/gtk/WKTextCheckerGtk.h: Added.
+        * UIProcess/gtk/TextCheckerGtk.cpp:
+        (WebKit::enchantTextChecker): Remove the hack which sets the spell checking languages automatically
+        for development builds.
+
 2015-07-01  Joseph Pecoraro  <pecor...@apple.com>
 
         [Mac] Numerous CGColor leaks in swipe gestures

Modified: trunk/Source/WebKit2/PlatformGTK.cmake (186174 => 186175)


--- trunk/Source/WebKit2/PlatformGTK.cmake	2015-07-01 08:55:02 UTC (rev 186174)
+++ trunk/Source/WebKit2/PlatformGTK.cmake	2015-07-01 14:51:28 UTC (rev 186175)
@@ -91,6 +91,7 @@
 
     UIProcess/API/C/gtk/WKFullScreenClientGtk.cpp
     UIProcess/API/C/gtk/WKInspectorClientGtk.cpp
+    UIProcess/API/C/gtk/WKTextCheckerGtk.cpp
     UIProcess/API/C/gtk/WKView.cpp
 
     UIProcess/API/C/soup/WKCookieManagerSoup.cpp

Copied: trunk/Source/WebKit2/UIProcess/API/C/gtk/WKTextCheckerGtk.cpp (from rev 186174, trunk/Tools/WebKitTestRunner/gtk/main.cpp) (0 => 186175)


--- trunk/Source/WebKit2/UIProcess/API/C/gtk/WKTextCheckerGtk.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/C/gtk/WKTextCheckerGtk.cpp	2015-07-01 14:51:28 UTC (rev 186175)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "WKTextCheckerGtk.h"
+
+#include "TextChecker.h"
+
+void WKTextCheckerSetSpellCheckingLanguages(const char* const* languages)
+{
+#if ENABLE(SPELLCHECK)
+    Vector<String> spellCheckingLanguages;
+    for (size_t i = 0; languages[i]; ++i)
+        spellCheckingLanguages.append(String::fromUTF8(languages[i]));
+    WebKit::TextChecker::setSpellCheckingLanguages(spellCheckingLanguages);
+#endif
+}

Copied: trunk/Source/WebKit2/UIProcess/API/C/gtk/WKTextCheckerGtk.h (from rev 186174, trunk/Tools/WebKitTestRunner/gtk/main.cpp) (0 => 186175)


--- trunk/Source/WebKit2/UIProcess/API/C/gtk/WKTextCheckerGtk.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/C/gtk/WKTextCheckerGtk.h	2015-07-01 14:51:28 UTC (rev 186175)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * 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 WKTextCheckerGtk_h
+#define WKTextCheckerGtk_h
+
+#include <WebKit/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT void WKTextCheckerSetSpellCheckingLanguages(const char* const* languages);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKTextCheckerGtk_h */

Modified: trunk/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp (186174 => 186175)


--- trunk/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp	2015-07-01 08:55:02 UTC (rev 186174)
+++ trunk/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp	2015-07-01 14:51:28 UTC (rev 186175)
@@ -43,18 +43,6 @@
 static WebCore::TextCheckerEnchant& enchantTextChecker()
 {
     static NeverDestroyed<WebCore::TextCheckerEnchant> checker;
-
-#if ENABLE(DEVELOPER_MODE)
-    // This is a bit of a hack, but ensures that for testing purposes,
-    // spell checking is properly initialized in WebKitTestRunner while
-    // running layout tests. We should consider replacing this with some
-    // more accessible C API at some point.
-    static std::once_flag onceFlag;
-    std::call_once(onceFlag, [] {
-        checker.get().updateSpellCheckingLanguages(Vector<String> { "en_US" });
-    });
-#endif
-
     return checker;
 }
 

Modified: trunk/Tools/ChangeLog (186174 => 186175)


--- trunk/Tools/ChangeLog	2015-07-01 08:55:02 UTC (rev 186174)
+++ trunk/Tools/ChangeLog	2015-07-01 14:51:28 UTC (rev 186175)
@@ -1,3 +1,14 @@
+2015-06-30  Martin Robinson  <mrobin...@igalia.com>
+
+        [GTK] REGRESSION(r183936): Test /webkit2/WebKitWebContext/spell-checker fails since r183936
+        https://bugs.webkit.org/show_bug.cgi?id=144828
+
+        Reviewed by Carlos Garcia Campos.
+
+        * WebKitTestRunner/gtk/main.cpp:
+        (main): Use the new WKTextChecker API to set the spell checking languages
+        when the process is starting up.
+
 2015-06-30  Andy VanWagoner  <thetalecraf...@gmail.com>
 
         Implement ECMAScript Internationalization API

Modified: trunk/Tools/WebKitTestRunner/gtk/main.cpp (186174 => 186175)


--- trunk/Tools/WebKitTestRunner/gtk/main.cpp	2015-07-01 08:55:02 UTC (rev 186174)
+++ trunk/Tools/WebKitTestRunner/gtk/main.cpp	2015-07-01 14:51:28 UTC (rev 186175)
@@ -26,12 +26,21 @@
 #include "config.h"
 
 #include "TestController.h"
+#include <WebKit/WKTextCheckerGtk.h>
 #include <gtk/gtk.h>
+#include <wtf/glib/GRefPtr.h>
 
 int main(int argc, char** argv)
 {
     gtk_init(&argc, &argv);
+
+    GRefPtr<GPtrArray> languages = adoptGRef(g_ptr_array_new());
+    g_ptr_array_add(languages.get(), const_cast<gpointer>(static_cast<const void*>("en_US")));
+    g_ptr_array_add(languages.get(), nullptr);
+    WKTextCheckerSetSpellCheckingLanguages(reinterpret_cast<const char* const*>(languages->pdata));
+
     // Prefer the not installed web and plugin processes.
     WTR::TestController controller(argc, const_cast<const char**>(argv));
+
     return 0;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to