WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-144648-20150506104425.patch (text/plain), 37.45 KB, created by
Martin Robinson
on 2015-05-06 10:45:42 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Martin Robinson
Created:
2015-05-06 10:45:42 PDT
Size:
37.45 KB
patch
obsolete
>Subversion Revision: 183875 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index a6a553d2be89acde479179443bce6b4247d6adfa..f56c425a4547d5f9a9bc05ee8d128836ee593745 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,12 @@ >+2015-05-06 Martin Robinson <mrobinson@igalia.com> >+ >+ [GTK] All spell checking layout tests fail >+ https://bugs.webkit.org/show_bug.cgi?id=144648 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/Platform.h: Activate UNIFIED_TEXT_CHECKING for GTK+. >+ > 2015-05-05 Carlos Garcia Campos <cgarcia@igalia.com> > > [GTK] Async operations running in the WorkQueue thread should schedule their sources to the WorkQueue main lopp >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index c965976e00681febb8a2273dd0ec09d1f5ab20a4..51854f000ae2307c80ac999a6389421678dbb64d 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,32 @@ >+2015-05-06 Martin Robinson <mrobinson@igalia.com> >+ >+ [GTK] All spell checking layout tests fail >+ https://bugs.webkit.org/show_bug.cgi?id=144648 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Simplify and complete the GTK+ spell-checking implementation. Instead of using >+ the EFL/GTK+ only WKTextChecker interface, directly implement Enchant spell-checking >+ in TextCheckerGtk. The per-context spell checking API is an illusion, since all >+ WKTextChecker implementations will adjust the same singleton. This can be a first step >+ toward removing it entirely. >+ >+ Also complete the implementation of the TextChecker interface by duplicating the EFL code, >+ which reuses other methods in the same class. Eventually this duplication will collapse, >+ once GTK+ and EFL can share an Enchant implementation. >+ >+ * PlatformGTK.cmake: >+ * UIProcess/API/gtk/WebKitPrivate.h: >+ * UIProcess/API/gtk/WebKitTextChecker.cpp: Removed. >+ * UIProcess/API/gtk/WebKitTextChecker.h: Removed. >+ * UIProcess/API/gtk/WebKitWebContext.cpp: Remove WebTextChecker usage and >+ replace it with calls directly to the TextChecker singleton via static methods. >+ * UIProcess/TextChecker.h: >+ * UIProcess/gtk/TextCheckerGtk.cpp: Move the WebTextChecker enchant implementation >+ here and reuse the EFL version of WebKit::TextChecker::requestCheckingOfString. >+ Also initialize languages properly when building for developer builds. This >+ allows WebKitTestRunner to work even when it doesn't explicitly set the languages. >+ > 2015-05-05 Carlos Garcia Campos <cgarcia@igalia.com> > > [GTK][WK2] The WebKit network disk cache is not enabled >diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h >index 7f804c0585d5f2e227748a1d965db301caa91332..87594cb6d09e8ddeab856f0e5c803503fec14375 100644 >--- a/Source/WTF/wtf/Platform.h >+++ b/Source/WTF/wtf/Platform.h >@@ -1052,7 +1052,7 @@ > > #define USE_GRAMMAR_CHECKING 1 > >-#if PLATFORM(COCOA) || PLATFORM(EFL) >+#if PLATFORM(COCOA) || PLATFORM(EFL) || PLATFORM(GTK) > #define USE_UNIFIED_TEXT_CHECKING 1 > #endif > #if PLATFORM(MAC) >diff --git a/Source/WebKit2/PlatformGTK.cmake b/Source/WebKit2/PlatformGTK.cmake >index eef184279b01cb5f999fb42cf10658f38e7676e3..8bbaa4e5ddc31f01861f87605b8c056aea9b86e3 100644 >--- a/Source/WebKit2/PlatformGTK.cmake >+++ b/Source/WebKit2/PlatformGTK.cmake >@@ -214,8 +214,6 @@ list(APPEND WebKit2_SOURCES > UIProcess/API/gtk/WebKitSettings.cpp > UIProcess/API/gtk/WebKitSettings.h > UIProcess/API/gtk/WebKitSettingsPrivate.h >- UIProcess/API/gtk/WebKitTextChecker.cpp >- UIProcess/API/gtk/WebKitTextChecker.h > UIProcess/API/gtk/WebKitUIClient.cpp > UIProcess/API/gtk/WebKitUIClient.h > UIProcess/API/gtk/WebKitURIRequest.cpp >diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h >index 4ce1ab7cf74342bd5e6b7d9d81164bdb4bb3bc60..0f8908cf8735f2125bdd7f8ed320aff149bf9987 100644 >--- a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h >+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h >@@ -41,7 +41,6 @@ > #include <WebKit/WKSerializedScriptValue.h> > #include <WebKit/WKSoupCustomProtocolRequestManager.h> > #include <WebKit/WKString.h> >-#include <WebKit/WKTextChecker.h> > #include <WebKit/WKUserMediaPermissionRequest.h> > #include <WebKit/WebKit2_C.h> > #include <glib.h> >diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp >deleted file mode 100644 >index feeb71beb8de17d152f12a97af9044c9d3707ff3..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp >+++ /dev/null >@@ -1,164 +0,0 @@ >-/* >- * Copyright (C) 2012 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 "WebKitTextChecker.h" >- >-#if ENABLE(SPELLCHECK) >- >-#include "WebKitPrivate.h" >- >-using namespace WebKit; >- >-static inline WebKitTextChecker* toTextChecker(const void* clientInfo) >-{ >- return static_cast<WebKitTextChecker*>(const_cast<void*>(clientInfo)); >-} >- >-static bool continuousSpellCheckingEnabledCallback(const void* clientInfo) >-{ >- return toTextChecker(clientInfo)->isSpellCheckingEnabled(); >-} >- >-static void setContinuousSpellCheckingEnabledCallback(bool enabled, const void* clientInfo) >-{ >- toTextChecker(clientInfo)->setSpellCheckingEnabled(enabled); >-} >- >-static void checkSpellingOfStringCallback(uint64_t /* tag */, WKStringRef text, int32_t* misspellingLocation, int32_t* misspellingLength, const void* clientInfo) >-{ >- toTextChecker(clientInfo)->checkSpellingOfString(toImpl(text)->string(), *misspellingLocation, *misspellingLength); >-} >- >-static WKArrayRef guessesForWordCallback(uint64_t /* tag */, WKStringRef word, const void* clientInfo) >-{ >- Vector<String> guesses = toTextChecker(clientInfo)->getGuessesForWord(toImpl(word)->string()); >- if (guesses.isEmpty()) >- return 0; >- >- WKMutableArrayRef wkSuggestions = WKMutableArrayCreate(); >- for (Vector<String>::const_iterator iter = guesses.begin(); iter != guesses.end(); ++iter) { >- WKRetainPtr<WKStringRef> wkSuggestion(AdoptWK, WKStringCreateWithUTF8CString(iter->utf8().data())); >- WKArrayAppendItem(wkSuggestions, wkSuggestion.get()); >- } >- >- return wkSuggestions; >-} >- >-static void learnWordCallback(uint64_t /* tag */, WKStringRef word, const void* clientInfo) >-{ >- toTextChecker(clientInfo)->learnWord(toImpl(word)->string()); >-} >- >-static void ignoreWordCallback(uint64_t /* tag */, WKStringRef word, const void* clientInfo) >-{ >- toTextChecker(clientInfo)->ignoreWord(toImpl(word)->string()); >-} >- >-WebKitTextChecker::~WebKitTextChecker() >-{ >-} >- >-WebKitTextChecker::WebKitTextChecker() >- : m_textChecker(std::make_unique<WebCore::TextCheckerEnchant>()) >- , m_spellCheckingEnabled(false) >-{ >- WKTextCheckerClientV0 wkTextCheckerClient = { >- { >- 0, // version >- this, // clientInfo >- }, >- 0, // continuousSpellCheckingAllowed >- continuousSpellCheckingEnabledCallback, >- setContinuousSpellCheckingEnabledCallback, >- 0, // grammarCheckingEnabled >- 0, // setGrammarCheckingEnabled >- 0, // uniqueSpellDocumentTag >- 0, // closeSpellDocumentWithTag >- checkSpellingOfStringCallback, >- 0, // checkGrammarOfString >- 0, // spellingUIIsShowing >- 0, // toggleSpellingUIIsShowing >- 0, // updateSpellingUIWithMisspelledWord >- 0, // updateSpellingUIWithGrammarString >- guessesForWordCallback, >- learnWordCallback, >- ignoreWordCallback, >- }; >- WKTextCheckerSetClient(&wkTextCheckerClient.base); >-} >- >-void WebKitTextChecker::checkSpellingOfString(const String& string, int& misspellingLocation, int& misspellingLength) >-{ >- m_textChecker->checkSpellingOfString(string, misspellingLocation, misspellingLength); >-} >- >-Vector<String> WebKitTextChecker::getGuessesForWord(const String& word) >-{ >- return m_textChecker->getGuessesForWord(word); >-} >- >-void WebKitTextChecker::learnWord(const String& word) >-{ >- m_textChecker->learnWord(word); >-} >- >-void WebKitTextChecker::ignoreWord(const String& word) >-{ >- m_textChecker->ignoreWord(word); >-} >- >-void WebKitTextChecker::setSpellCheckingEnabled(bool enabled) >-{ >- if (m_spellCheckingEnabled == enabled) >- return; >- m_spellCheckingEnabled = enabled; >- >- // We need to notify the Web process that this has changed. >- WKTextCheckerContinuousSpellCheckingEnabledStateChanged(enabled); >-} >- >-const char* const* WebKitTextChecker::getSpellCheckingLanguages() >-{ >- Vector<String> spellCheckingLanguages = m_textChecker->loadedSpellCheckingLanguages(); >- if (spellCheckingLanguages.isEmpty()) >- return 0; >- >- m_spellCheckingLanguages = adoptGRef(g_ptr_array_new_with_free_func(g_free)); >- for (size_t i = 0; i < spellCheckingLanguages.size(); ++i) >- g_ptr_array_add(m_spellCheckingLanguages.get(), g_strdup(spellCheckingLanguages[i].utf8().data())); >- g_ptr_array_add(m_spellCheckingLanguages.get(), 0); >- >- return reinterpret_cast<char**>(m_spellCheckingLanguages->pdata); >-} >- >-void WebKitTextChecker::setSpellCheckingLanguages(const char* const* languages) >-{ >- Vector<String> spellCheckingLanguages; >- for (size_t i = 0; languages[i]; ++i) >- spellCheckingLanguages.append(String::fromUTF8(languages[i])); >- m_textChecker->updateSpellCheckingLanguages(spellCheckingLanguages); >-} >-#endif // ENABLE(SPELLCHECK) >diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.h b/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.h >deleted file mode 100644 >index 608f323e717d840f1d6dc5b153c794a4dbb6c976..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.h >+++ /dev/null >@@ -1,58 +0,0 @@ >-/* >- * Copyright (C) 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#ifndef WebKitTextChecker_h >-#define WebKitTextChecker_h >- >-#if ENABLE(SPELLCHECK) >- >-#include <WebCore/TextCheckerEnchant.h> >-#include <wtf/FastMalloc.h> >-#include <wtf/Vector.h> >-#include <wtf/gobject/GRefPtr.h> >-#include <wtf/text/CString.h> >- >-class WebKitTextChecker { >- WTF_MAKE_FAST_ALLOCATED; >- >-public: >- WebKitTextChecker(); >- ~WebKitTextChecker(); >- >- // For implementing TextCheckerClient. >- bool isSpellCheckingEnabled() { return m_spellCheckingEnabled; } >- void setSpellCheckingEnabled(bool enabled); >- void checkSpellingOfString(const String& string, int& misspellingLocation, int& misspellingLength); >- Vector<String> getGuessesForWord(const String& word); >- void learnWord(const String& word); >- void ignoreWord(const String& word); >- >- // To be called from WebKitWebContext only. >- const char* const* getSpellCheckingLanguages(); >- void setSpellCheckingLanguages(const char* const* spellCheckingLanguages); >- >-private: >- std::unique_ptr<WebCore::TextCheckerEnchant> m_textChecker; >- GRefPtr<GPtrArray> m_spellCheckingLanguages; >- bool m_spellCheckingEnabled; >-}; >- >-#endif // ENABLE(SPELLCHECK) >- >-#endif // WebKitTextChecker_h >diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp >index c827246c992c32d0f412a5c60f442787fce0d613..bf203824b49172cf1cde32c793ebd9d88f74752e 100644 >--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp >+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp >@@ -23,6 +23,8 @@ > #include "APIDownloadClient.h" > #include "APIProcessPoolConfiguration.h" > #include "APIString.h" >+#include "TextChecker.h" >+#include "TextCheckerState.h" > #include "WebBatteryManagerProxy.h" > #include "WebCertificateInfo.h" > #include "WebCookieManagerProxy.h" >@@ -40,7 +42,6 @@ > #include "WebKitRequestManagerClient.h" > #include "WebKitSecurityManagerPrivate.h" > #include "WebKitSettingsPrivate.h" >-#include "WebKitTextChecker.h" > #include "WebKitURISchemeRequestPrivate.h" > #include "WebKitUserContentManagerPrivate.h" > #include "WebKitWebContextPrivate.h" >@@ -172,9 +173,6 @@ struct _WebKitWebContextPrivate { > #if ENABLE(NOTIFICATIONS) > RefPtr<WebKitNotificationProvider> notificationProvider; > #endif >-#if ENABLE(SPELLCHECK) >- std::unique_ptr<WebKitTextChecker> textChecker; >-#endif > CString faviconDatabaseDirectory; > WebKitTLSErrorsPolicy tlsErrorsPolicy; > >@@ -290,9 +288,6 @@ static void webkitWebContextConstructed(GObject* object) > #if ENABLE(NOTIFICATIONS) > priv->notificationProvider = WebKitNotificationProvider::create(priv->context->supplement<WebNotificationManagerProxy>()); > #endif >-#if ENABLE(SPELLCHECK) >- priv->textChecker = std::make_unique<WebKitTextChecker>(); >-#endif > } > > static void webkitWebContextDispose(GObject* object) >@@ -802,7 +797,7 @@ gboolean webkit_web_context_get_spell_checking_enabled(WebKitWebContext* context > g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), FALSE); > > #if ENABLE(SPELLCHECK) >- return context->priv->textChecker->isSpellCheckingEnabled(); >+ return TextChecker::state().isContinuousSpellCheckingEnabled; > #else > return false; > #endif >@@ -820,7 +815,7 @@ void webkit_web_context_set_spell_checking_enabled(WebKitWebContext* context, gb > g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context)); > > #if ENABLE(SPELLCHECK) >- context->priv->textChecker->setSpellCheckingEnabled(enabled); >+ TextChecker::setContinuousSpellCheckingEnabled(enabled); > #endif > } > >@@ -839,10 +834,20 @@ void webkit_web_context_set_spell_checking_enabled(WebKitWebContext* context, gb > */ > const gchar* const* webkit_web_context_get_spell_checking_languages(WebKitWebContext* context) > { >- g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), 0); >+ g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), nullptr); > > #if ENABLE(SPELLCHECK) >- return context->priv->textChecker->getSpellCheckingLanguages(); >+ Vector<String> spellCheckingLanguages = WTF::move(TextChecker::loadedSpellCheckingLanguages()); >+ if (spellCheckingLanguages.isEmpty()) >+ return nullptr; >+ >+ static GRefPtr<GPtrArray> languagesToReturn; >+ languagesToReturn = adoptGRef(g_ptr_array_new_with_free_func(g_free)); >+ for (const auto& language : spellCheckingLanguages) >+ g_ptr_array_add(languagesToReturn.get(), g_strdup(language.utf8().data())); >+ g_ptr_array_add(languagesToReturn.get(), nullptr); >+ >+ return reinterpret_cast<char**>(languagesToReturn->pdata); > #else > return 0; > #endif >@@ -871,7 +876,10 @@ void webkit_web_context_set_spell_checking_languages(WebKitWebContext* context, > g_return_if_fail(languages); > > #if ENABLE(SPELLCHECK) >- context->priv->textChecker->setSpellCheckingLanguages(languages); >+ Vector<String> spellCheckingLanguages; >+ for (size_t i = 0; languages[i]; ++i) >+ spellCheckingLanguages.append(String::fromUTF8(languages[i])); >+ TextChecker::setSpellCheckingLanguages(spellCheckingLanguages); > #endif > } > >diff --git a/Source/WebKit2/UIProcess/TextChecker.h b/Source/WebKit2/UIProcess/TextChecker.h >index 411928aaa4e500111ec1501ac41d288dc0d71b34..5f1d7101cbef8baa6dfd0a555294fe883388c908 100644 >--- a/Source/WebKit2/UIProcess/TextChecker.h >+++ b/Source/WebKit2/UIProcess/TextChecker.h >@@ -62,6 +62,11 @@ public: > static void toggleSubstitutionsPanelIsShowing(); > #endif > >+#if PLATFORM(GTK) >+ static void setSpellCheckingLanguages(const Vector<String>&); >+ static Vector<String> loadedSpellCheckingLanguages(); >+#endif >+ > static void continuousSpellCheckingEnabledStateChanged(bool); > static void grammarCheckingEnabledStateChanged(bool); > static int64_t uniqueSpellDocumentTag(WebPageProxy*); >diff --git a/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp b/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp >index 4ff824469de0a7b70614841e43afbcb4f94662ea..b814bc2ad4ee862107001f5b48fcd63226b12438 100644 >--- a/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp >+++ b/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2010 Apple Inc. All rights reserved. > * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. >+ * Copyright (C) 2011-2013 Samsung Electronics > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -27,120 +28,229 @@ > #include "config.h" > #include "TextChecker.h" > >+#include "TextBreakIterator.h" > #include "TextCheckerState.h" >+#include "WebProcessPool.h" > #include "WebTextChecker.h" > #include <WebCore/NotImplemented.h> >+#include <WebCore/TextCheckerEnchant.h> >+#include <wtf/NeverDestroyed.h> > > using namespace WebCore; >- >-namespace WebKit { > >-static TextCheckerState textCheckerState; >+namespace WebKit { > >-const TextCheckerState& TextChecker::state() >+static WebCore::TextCheckerEnchant& enchantTextChecker() > { >- static bool didInitializeState = false; >- if (didInitializeState) >- return textCheckerState; >+ static NeverDestroyed<WebCore::TextCheckerEnchant> checker; > >- WebTextCheckerClient& client = WebTextChecker::singleton()->client(); >- textCheckerState.isContinuousSpellCheckingEnabled = client.continuousSpellCheckingEnabled(); >- textCheckerState.isGrammarCheckingEnabled = client.grammarCheckingEnabled(); >+#if defined(DEVELOPMENT_BUILD) >+ // 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, [] { >+ Vector<String> languages; >+ languages.append("en_US"); >+ checker.get().updateSpellCheckingLanguages(languages); >+ }); >+#endif >+ >+ return checker; >+} > >- didInitializeState = true; >+TextCheckerState& checkerState() >+{ >+ static TextCheckerState textCheckerState; >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ textCheckerState.isContinuousSpellCheckingEnabled = false;; >+ textCheckerState.isGrammarCheckingEnabled = false;; >+ }); > > return textCheckerState; > } >- >+ >+const TextCheckerState& TextChecker::state() >+{ >+ return checkerState(); >+} >+ >+static void updateStateForAllContexts() >+{ >+ const Vector<WebProcessPool*>& contexts = WebProcessPool::allProcessPools(); >+ for (size_t i = 0; i < contexts.size(); ++i) >+ contexts[i]->textCheckerStateChanged(); >+} >+ > bool TextChecker::isContinuousSpellCheckingAllowed() > { >- return WebTextChecker::singleton()->client().continuousSpellCheckingAllowed(); >+ return true; > } > > void TextChecker::setContinuousSpellCheckingEnabled(bool isContinuousSpellCheckingEnabled) > { >- if (state().isContinuousSpellCheckingEnabled == isContinuousSpellCheckingEnabled) >+ if (checkerState().isContinuousSpellCheckingEnabled == isContinuousSpellCheckingEnabled) > return; >- textCheckerState.isContinuousSpellCheckingEnabled = isContinuousSpellCheckingEnabled; >- WebTextChecker::singleton()->client().setContinuousSpellCheckingEnabled(isContinuousSpellCheckingEnabled); >+ checkerState().isContinuousSpellCheckingEnabled = isContinuousSpellCheckingEnabled; >+ updateStateForAllContexts(); > } > > void TextChecker::setGrammarCheckingEnabled(bool isGrammarCheckingEnabled) > { >- if (state().isGrammarCheckingEnabled == isGrammarCheckingEnabled) >+ if (checkerState().isGrammarCheckingEnabled == isGrammarCheckingEnabled) > return; >- textCheckerState.isGrammarCheckingEnabled = isGrammarCheckingEnabled; >- WebTextChecker::singleton()->client().setGrammarCheckingEnabled(isGrammarCheckingEnabled); >+ checkerState().isGrammarCheckingEnabled = isGrammarCheckingEnabled; >+ updateStateForAllContexts(); > } > > void TextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled) > { >- textCheckerState.isContinuousSpellCheckingEnabled = enabled; >+ checkerState().isContinuousSpellCheckingEnabled = enabled; > } > > void TextChecker::grammarCheckingEnabledStateChanged(bool enabled) > { >- textCheckerState.isGrammarCheckingEnabled = enabled; >+ checkerState().isGrammarCheckingEnabled = enabled; > } > >-int64_t TextChecker::uniqueSpellDocumentTag(WebPageProxy* page) >+int64_t TextChecker::uniqueSpellDocumentTag(WebPageProxy*) > { >- return WebTextChecker::singleton()->client().uniqueSpellDocumentTag(page); >+ return 0; > } > >-void TextChecker::closeSpellDocumentWithTag(int64_t tag) >+void TextChecker::closeSpellDocumentWithTag(int64_t /* tag */) > { >- WebTextChecker::singleton()->client().closeSpellDocumentWithTag(tag); > } > >-void TextChecker::checkSpellingOfString(int64_t spellDocumentTag, StringView text, int32_t& misspellingLocation, int32_t& misspellingLength) >+void TextChecker::checkSpellingOfString(int64_t /* spellDocumentTag */, StringView text, int32_t& misspellingLocation, int32_t& misspellingLength) > { >- WebTextChecker::singleton()->client().checkSpellingOfString(spellDocumentTag, text.toStringWithoutCopying(), misspellingLocation, misspellingLength); >+ misspellingLocation = -1; >+ misspellingLength = 0; >+ enchantTextChecker().checkSpellingOfString(text.toStringWithoutCopying(), misspellingLocation, misspellingLength); > } > >-void TextChecker::checkGrammarOfString(int64_t spellDocumentTag, StringView text, Vector<WebCore::GrammarDetail>& grammarDetails, int32_t& badGrammarLocation, int32_t& badGrammarLength) >+void TextChecker::checkGrammarOfString(int64_t /* spellDocumentTag */, StringView /* text */, Vector<WebCore::GrammarDetail>& /* grammarDetails */, int32_t& /* badGrammarLocation */, int32_t& /* badGrammarLength */) > { >- WebTextChecker::singleton()->client().checkGrammarOfString(spellDocumentTag, text.toStringWithoutCopying(), grammarDetails, badGrammarLocation, badGrammarLength); > } > > bool TextChecker::spellingUIIsShowing() > { >- return WebTextChecker::singleton()->client().spellingUIIsShowing(); >+ return false; > } > > void TextChecker::toggleSpellingUIIsShowing() > { >- WebTextChecker::singleton()->client().toggleSpellingUIIsShowing(); > } > >-void TextChecker::updateSpellingUIWithMisspelledWord(int64_t spellDocumentTag, const String& misspelledWord) >+void TextChecker::updateSpellingUIWithMisspelledWord(int64_t /* spellDocumentTag */, const String& /* misspelledWord */) > { >- WebTextChecker::singleton()->client().updateSpellingUIWithMisspelledWord(spellDocumentTag, misspelledWord); > } > >-void TextChecker::updateSpellingUIWithGrammarString(int64_t spellDocumentTag, const String& badGrammarPhrase, const GrammarDetail& grammarDetail) >+void TextChecker::updateSpellingUIWithGrammarString(int64_t /* spellDocumentTag */, const String& /* badGrammarPhrase */, const GrammarDetail& /* grammarDetail */) > { >- WebTextChecker::singleton()->client().updateSpellingUIWithGrammarString(spellDocumentTag, badGrammarPhrase, grammarDetail); > } > >-void TextChecker::getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& /* context */, Vector<String>& guesses) >+void TextChecker::getGuessesForWord(int64_t /* spellDocumentTag */, const String& word, const String& /* context */, Vector<String>& guesses) > { >- WebTextChecker::singleton()->client().guessesForWord(spellDocumentTag, word, guesses); >+ guesses = WTF::move(enchantTextChecker().getGuessesForWord(word)); > } > >-void TextChecker::learnWord(int64_t spellDocumentTag, const String& word) >+void TextChecker::learnWord(int64_t /* spellDocumentTag */, const String& word) > { >- WebTextChecker::singleton()->client().learnWord(spellDocumentTag, word); >+ enchantTextChecker().learnWord(word); > } > > void TextChecker::ignoreWord(int64_t spellDocumentTag, const String& word) > { >- WebTextChecker::singleton()->client().ignoreWord(spellDocumentTag, word); >+ enchantTextChecker().ignoreWord(word); >+} >+ >+void TextChecker::requestCheckingOfString(PassRefPtr<TextCheckerCompletion> completion) >+{ >+ if (!completion) >+ return; >+ >+ TextCheckingRequestData request = completion->textCheckingRequestData(); >+ ASSERT(request.sequence() != unrequestedTextCheckingSequence); >+ ASSERT(request.mask() != TextCheckingTypeNone); >+ >+ completion->didFinishCheckingText(checkTextOfParagraph(completion->spellDocumentTag(), request.text(), request.mask())); >+} >+ >+#if USE(UNIFIED_TEXT_CHECKING) >+static unsigned nextWordOffset(StringView text, unsigned currentOffset) >+{ >+ // FIXME: avoid creating textIterator object here, it could be passed as a parameter. >+ // isTextBreak() leaves the iterator pointing to the first boundary position at >+ // or after "offset" (ubrk_isBoundary side effect). >+ // For many word separators, the method doesn't properly determine the boundaries >+ // without resetting the iterator. >+ TextBreakIterator* textIterator = wordBreakIterator(text); >+ if (!textIterator) >+ return currentOffset; >+ >+ unsigned wordOffset = currentOffset; >+ while (wordOffset < text.length() && isTextBreak(textIterator, wordOffset)) >+ ++wordOffset; >+ >+ // Do not treat the word's boundary as a separator. >+ if (!currentOffset && wordOffset == 1) >+ return currentOffset; >+ >+ // Omit multiple separators. >+ if ((wordOffset - currentOffset) > 1) >+ --wordOffset; >+ >+ return wordOffset; >+} >+ >+Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, StringView text, uint64_t checkingTypes) >+{ >+ if (!(checkingTypes & TextCheckingTypeSpelling)) >+ return Vector<TextCheckingResult>(); >+ >+ TextBreakIterator* textIterator = wordBreakIterator(text); >+ if (!textIterator) >+ return Vector<TextCheckingResult>(); >+ >+ // Omit the word separators at the beginning/end of the text to don't unnecessarily >+ // involve the client to check spelling for them. >+ unsigned offset = nextWordOffset(text, 0); >+ unsigned lengthStrip = text.length(); >+ while (lengthStrip > 0 && isTextBreak(textIterator, lengthStrip - 1)) >+ --lengthStrip; >+ >+ Vector<TextCheckingResult> paragraphCheckingResult; >+ while (offset < lengthStrip) { >+ int32_t misspellingLocation = -1; >+ int32_t misspellingLength = 0; >+ checkSpellingOfString(spellDocumentTag, text.substring(offset, lengthStrip - offset), misspellingLocation, misspellingLength); >+ if (!misspellingLength) >+ break; >+ >+ TextCheckingResult misspellingResult; >+ misspellingResult.type = TextCheckingTypeSpelling; >+ misspellingResult.location = offset + misspellingLocation; >+ misspellingResult.length = misspellingLength; >+ paragraphCheckingResult.append(misspellingResult); >+ offset += misspellingLocation + misspellingLength; >+ // Generally, we end up checking at the word separator, move to the adjacent word. >+ offset = nextWordOffset(text.substring(0, lengthStrip), offset); >+ } >+ return paragraphCheckingResult; >+} >+#endif >+ >+void TextChecker::setSpellCheckingLanguages(const Vector<String>& languages) >+{ >+ enchantTextChecker().updateSpellCheckingLanguages(languages); > } > >-void TextChecker::requestCheckingOfString(PassRefPtr<TextCheckerCompletion>) >+Vector<String> TextChecker::loadedSpellCheckingLanguages() > { >- notImplemented(); >+ return enchantTextChecker().loadedSpellCheckingLanguages(); > } > > } // namespace WebKit >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index a31c9873914138d2e02456b5aa507a2c51efe0a4..53dcdb49eb6311c2f9f3a66caa105a06b744fe04 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2015-05-06 Martin Robinson <mrobinson@igalia.com> >+ >+ [GTK] All spell checking layout tests fail >+ https://bugs.webkit.org/show_bug.cgi?id=144648 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * platform/gtk/TestExpectations: Unskip and reclassify previously failing tests. >+ * platform/gtk/editing/spelling/spellcheck-paste-expected.txt: Removed. >+ > 2015-05-06 Alexey Proskuryakov <ap@apple.com> > > Update expectations for fast/forms/button-line-height.html >diff --git a/LayoutTests/platform/gtk/TestExpectations b/LayoutTests/platform/gtk/TestExpectations >index 8632d264d5028f2430e9f470d08f09505c9141fa..6e23051db0ad980d8c5ed5cd05a7bfdb73e17324 100644 >--- a/LayoutTests/platform/gtk/TestExpectations >+++ b/LayoutTests/platform/gtk/TestExpectations >@@ -627,11 +627,6 @@ Bug(GTK) editing/spelling/inline-spelling-markers.html [ Skip ] > Bug(GTK) editing/spelling/inline-spelling-markers-hidpi.html [ Skip ] > Bug(GTK) editing/spelling/markers.html [ Skip ] > >-# Missing asynchronous spellchecking implementation. >-Bug(GTK) editing/spelling/design-mode-spellcheck-off.html [ Skip ] >-Bug(GTK) editing/spelling/spelling-insert-html.html [ Skip ] >-Bug(GTK) editing/spelling/spelling-hasspellingmarker.html [ Skip ] >- > # Requires ENABLE(MEDIA_CAPTURE) > webkit.org/b/85958 fast/forms/file/file-input-capture.html [ Failure ] > >@@ -1283,11 +1278,6 @@ webkit.org/b/122571 inspector-protocol/page/frameScheduledNavigation.html [ Time > webkit.org/b/122571 inspector-protocol/page/setEmulatedMedia.html [ Timeout Pass ] > webkit.org/b/122571 inspector-protocol/css/getSupportedCSSProperties.html [ Timeout Pass ] > >-webkit.org/b/130411 editing/spelling/spellcheck-paste.html [ Timeout ] >-webkit.org/b/130411 editing/spelling/spelling-changed-text.html [ Timeout ] >-webkit.org/b/130411 editing/spelling/spellcheck-paste-disabled.html [ Timeout ] >-webkit.org/b/130411 editing/spelling/spellcheck-paste-continuous-disabled.html [ Timeout ] >- > Bug(GTK) plugins/reloadplugins-and-pages.html [ Timeout ] > > Bug(GTK) fast/forms/select/menulist-popup-crash.html [ Timeout ] >@@ -1479,26 +1469,6 @@ webkit.org/b/93980 http/tests/appcache/load-from-appcache-defer-resume-crash.htm > webkit.org/b/42194 fast/events/5056619.html [ Failure ] > webkit.org/b/42194 http/tests/security/drag-drop-same-unique-origin.html [ Failure ] > >-# Missing TextChecker::requestCheckingOfString() implementation for Gtk. >-webkit.org/b/73003 editing/spelling/delete-into-misspelled-word.html [ Skip ] >-webkit.org/b/73003 editing/spelling/editing-multiple-words-with-markers.html [ Skip ] >-webkit.org/b/73003 editing/spelling/editing-word-with-marker-2.html [ Skip ] >-webkit.org/b/73003 editing/spelling/move-cursor-around-misspelled-word.html [ Skip ] >-webkit.org/b/73003 editing/spelling/spellcheck-async-mutation.html [ Skip ] >-webkit.org/b/73003 editing/spelling/spellcheck-async-remove-frame.html [ Skip ] >-webkit.org/b/73003 editing/spelling/spellcheck-async.html [ Skip ] >-webkit.org/b/73003 editing/spelling/spellcheck-queue.html [ Skip ] >-webkit.org/b/73003 editing/spelling/spellcheck-sequencenum.html [ Skip ] >-webkit.org/b/73003 editing/spelling/spelling-backward.html [ Skip ] >-webkit.org/b/73003 editing/spelling/spelling-marker-description.html [ Skip ] >- >-# Spellcheck tests don't seem to work. >-Bug(GTK) editing/spelling/spelling-backspace-between-lines.html [ Skip ] >-Bug(GTK) editing/spelling/spellcheck-attribute.html [ Skip ] >-Bug(GTK) editing/spelling/spelling-attribute-at-child.html [ Skip ] >-Bug(GTK) editing/spelling/spelling-attribute-change.html [ Skip ] >-Bug(GTK) editing/spelling/spelling-linebreak.html [ Skip ] >- > # Context menu problems. > webkit.org/b/120401 fast/events [ Skip ] > webkit.org/b/120401 editing/selection [ Skip ] >@@ -1581,9 +1551,6 @@ Bug(GTK) plugins/resize-from-plugin.html [ Failure ] > Bug(GTK) editing/selection/context-menu-text-selection.html [ Failure Pass ] > Bug(GTK) editing/selection/context-menu-text-selection-lookup.html [ Failure Pass ] > >-# An oncontextmenu attribute is not called. >-Bug(GTK) editing/spelling/spellcheck-input-search-crash.html [ Failure ] >- > Bug(GTK) http/tests/misc/iframe-beforeunload-dialog-matching-ancestor-securityorigin.html [ Failure ] > > Bug(GTK) http/tests/misc/will-send-request-returns-null-on-redirect.html [ Failure ] >@@ -1718,9 +1685,6 @@ Bug(GTK) fast/events/platform-wheelevent-paging-y-in-scrolling-page.html [ Failu > # Need to add functionality to DumpRenderTree to handle scrollbar policy changes > Bug(GTK) fast/overflow/scrollbar-restored-and-then-locked.html [ Failure ] > >-# DRT doesn't dispatch an event for the second call eventSender.contextClick(). >-webkit.org/b/39102 editing/spelling/context-menu-suggestions.html [ Failure ] >- > # Some input type=range tests fail because of the size > # of the slider thumb in GTK+ themes. > Bug(GTK) fast/forms/range/slider-mouse-events.html [ Failure ] >@@ -1800,8 +1764,6 @@ webkit.org/b/105693 http/tests/multipart/multipart-wait-before-boundary.html [ S > # Does not render the rectangle as it should, even though the multiple parts seem to work > webkit.org/b/54251 http/tests/multipart/invalid-image-data.html [ Failure ] > >-webkit.org/b/72248 editing/spelling/spelling-unified-emulation.html [ Failure ] >- > webkit.org/b/62204 svg/custom/relative-sized-use-without-attributes-on-symbol.xhtml [ Failure ] > webkit.org/b/62204 svg/custom/use-on-symbol-inside-pattern.svg [ Failure ] > webkit.org/b/62204 svg/W3C-SVG-1.1/animate-elem-04-t.svg [ Failure ] >@@ -1909,14 +1871,6 @@ webkit.org/b/103927 http/tests/w3c/webperf/submission/Google/resource-timing/htm > webkit.org/b/103927 http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_initiator_types.html [ Failure ] > webkit.org/b/103927 http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_redirects.html [ Failure ] > >-# Spellchecker behavior tests. >-webkit.org/b/108370 editing/spelling/context-menu-suggestions-multiword-selection.html [ Skip ] >-webkit.org/b/108370 editing/spelling/context-menu-suggestions-subword-selection.html [ Skip ] >-webkit.org/b/108370 editing/spelling/spelling-double-clicked-word.html [ Skip ] >-webkit.org/b/108370 editing/spelling/spelling-exactly-selected-word.html [ Skip ] >-webkit.org/b/108370 editing/spelling/spelling-with-punctuation-selection.html [ Skip ] >-webkit.org/b/108370 editing/spelling/spelling-with-whitespace-selection.html [ Skip ] >- > webkit.org/b/107118 fast/canvas/canvas-quadratic-same-endpoint.html [ Failure ] > > webkit.org/b/108973 fast/css/negative-text-indent-in-inline-block.html [ ImageOnlyFailure ] >@@ -2375,6 +2329,14 @@ webkit.org/b/144576 editing/execCommand/nsresponder-outdent.html [ Failure ] > > webkit.org/b/144673 fast/forms/button-line-height.html [ ImageOnlyFailure ] > >+webkit.org/b/144690 editing/spelling/context-menu-suggestions-multiword-selection.html [ Timeout ] >+webkit.org/b/144690 editing/spelling/context-menu-suggestions-subword-selection.html [ Timeout ] >+webkit.org/b/144690 editing/spelling/spelling-exactly-selected-word.html [ Timeout ] >+webkit.org/b/144690 editing/spelling/spelling-with-punctuation-selection.html [ Timeout ] >+webkit.org/b/144690 editing/spelling/context-menu-suggestions.html [ Failure ] >+webkit.org/b/144690 editing/spelling/spelling-double-clicked-word.html [ Failure ] >+webkit.org/b/144690 editing/spelling/delete-into-misspelled-word.html [ Timeout Pass ] >+ > #//////////////////////////////////////////////////////////////////////////////////////// > # End of Tests failing > #//////////////////////////////////////////////////////////////////////////////////////// >diff --git a/LayoutTests/platform/gtk/editing/spelling/spellcheck-paste-expected.txt b/LayoutTests/platform/gtk/editing/spelling/spellcheck-paste-expected.txt >deleted file mode 100644 >index 8cd042a7e58d5c5c0cecc4541614f175922b0ae3..0000000000000000000000000000000000000000 >--- a/LayoutTests/platform/gtk/editing/spelling/spellcheck-paste-expected.txt >+++ /dev/null >@@ -1,18 +0,0 @@ >-For Bug 40092: Spell checking for pasted text. >- >-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >- >- >-FAIL INPUT should have a marker on 'zz apple' >-FAIL INPUT should have a marker on 'z<b>z appl</b>e' >-FAIL INPUT should have a marker on 'zz zz zz' >-FAIL TEXTAREA should have a marker on 'zz apple' >-FAIL TEXTAREA should have a marker on 'z<b>z appl</b>e' >-FAIL TEXTAREA should have a marker on 'zz zz zz' >-FAIL DIV should have a marker on 'zz apple' >-FAIL DIV should have a marker on 'z<b>z appl</b>e' >-FAIL DIV should have a marker on 'zz zz zz' >-PASS successfullyParsed is true >- >-TEST COMPLETE >-
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 144648
:
252490
|
252506