diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-23 17:03:15 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-23 17:03:15 +0200 |
commit | a73d1c176f2f3e0458861de8590dc20321a501ae (patch) | |
tree | d897fc5974797c3cb300d7f5916f258df765401f /Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp | |
parent | c311cf639cc1d6570d67b0a80a8ba04dc992a658 (diff) | |
download | qtwebkit-a73d1c176f2f3e0458861de8590dc20321a501ae.tar.gz |
Imported WebKit commit a5ae8a56a48e44ebfb9b81aaa5488affaffdb175 (http://svn.webkit.org/repository/webkit/trunk@126420)
New snapshot with OS X 10.6 build fix
Diffstat (limited to 'Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp index 5ae62c6fd..39f402227 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp @@ -29,8 +29,6 @@ #if ENABLE(SPELLCHECK) #include "WebKitPrivate.h" -#include <wtf/Vector.h> -#include <wtf/text/CString.h> using namespace WebKit; @@ -140,15 +138,25 @@ void WebKitTextChecker::setSpellCheckingEnabled(bool enabled) WKTextCheckerContinuousSpellCheckingEnabledStateChanged(enabled); } -const CString& WebKitTextChecker::getSpellCheckingLanguages() +const char* const* WebKitTextChecker::getSpellCheckingLanguages() { - String spellCheckingLanguages = m_textChecker->getSpellCheckingLanguages(); - m_spellCheckingLanguages = spellCheckingLanguages.isEmpty() ? CString() : spellCheckingLanguages.utf8(); - return m_spellCheckingLanguages; + Vector<String> spellCheckingLanguages = m_textChecker->getSpellCheckingLanguages(); + 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 CString& languages) +void WebKitTextChecker::setSpellCheckingLanguages(const char* const* languages) { - m_textChecker->updateSpellCheckingLanguages(String::fromUTF8(languages.data())); + Vector<String> spellCheckingLanguages; + for (size_t i = 0; languages[i]; ++i) + spellCheckingLanguages.append(String::fromUTF8(languages[i])); + m_textChecker->updateSpellCheckingLanguages(spellCheckingLanguages); } #endif // ENABLE(SPELLCHECK) |