summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
commit3749d61e1f7a59f5ec5067e560af1eb610c82015 (patch)
tree73dc228333948738bbe02976cacca8cd382bc978 /Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
parentb32b4dcd9a51ab8de6afc53d9e17f8707e1f7a5e (diff)
downloadqtwebkit-3749d61e1f7a59f5ec5067e560af1eb610c82015.tar.gz
Imported WebKit commit a77350243e054f3460d1137301d8b3faee3d2052 (http://svn.webkit.org/repository/webkit/trunk@125365)
New snapshot with build fixes for latest API changes in Qt and all WK1 Win MSVC fixes upstream
Diffstat (limited to 'Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp')
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
index 4008e865f..fe9df9f75 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
@@ -77,7 +77,6 @@ struct _WebKitWebContextPrivate {
#endif
#if ENABLE(SPELLCHECK)
OwnPtr<WebKitTextChecker> textChecker;
- GOwnPtr<gchar> spellCheckingLanguages;
#endif
};
@@ -125,7 +124,7 @@ static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass
static gpointer createDefaultWebContext(gpointer)
{
static GRefPtr<WebKitWebContext> webContext = adoptGRef(WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT, NULL)));
- webContext->priv->context = WKContextGetSharedProcessContext();
+ webContext->priv->context = WKContextCreate();
webContext->priv->requestManager = WKContextGetSoupRequestManager(webContext->priv->context.get());
WKContextSetCacheModel(webContext->priv->context.get(), kWKCacheModelPrimaryWebBrowser);
attachDownloadClientToContext(webContext.get());
@@ -432,7 +431,7 @@ void webkit_web_context_register_uri_scheme(WebKitWebContext* context, const cha
* webkit_web_context_get_spell_checking_enabled:
* @context: a #WebKitWebContext
*
- * Get the current status of the spell checking feature.
+ * Get whether spell checking feature is currently enabled.
*
* Returns: %TRUE If spell checking is enabled, or %FALSE otherwise.
*/
@@ -468,18 +467,24 @@ void webkit_web_context_set_spell_checking_enabled(WebKitWebContext* context, gb
* @context: a #WebKitWebContext
*
* Get the the list of spell checking languages associated with
- * @context, separated by commas. See
- * webkit_web_context_set_spell_checking_languages() for more details
- * on the format of the languages in the list.
+ * @context separated by commas, or %NULL if no languages have been
+ * previously set.
+
+ * See webkit_web_context_set_spell_checking_languages() for more
+ * details on the format of the languages in the list.
*
- * Returns: (transfer none): A comma separated list of languages.
+ * Returns: (transfer none): A comma separated list of languages if
+ * available, or %NULL otherwise.
*/
const gchar* webkit_web_context_get_spell_checking_languages(WebKitWebContext* context)
{
g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), 0);
#if ENABLE(SPELLCHECK)
- return context->priv->spellCheckingLanguages.get();
+ CString spellCheckingLanguages = context->priv->textChecker->getSpellCheckingLanguages();
+ if (spellCheckingLanguages.isNull())
+ return 0;
+ return spellCheckingLanguages.data();
#else
return 0;
#endif
@@ -488,25 +493,28 @@ const gchar* webkit_web_context_get_spell_checking_languages(WebKitWebContext* c
/**
* webkit_web_context_set_spell_checking_languages:
* @context: a #WebKitWebContext
- * @languages: (allow-none): new list of spell checking
- * languages separated by commas, or %NULL
+ * @languages: new list of spell checking languages separated by
+ * commas
*
* Set the list of spell checking languages to be used for spell
- * checking, separated by commas. In case %NULL is passed, the default
- * value as returned by gtk_get_default_language() will be used.
+ * checking, separated by commas.
*
* The locale string typically is in the form lang_COUNTRY, where lang
* is an ISO-639 language code, and COUNTRY is an ISO-3166 country code.
* For instance, sv_FI for Swedish as written in Finland or pt_BR
* for Portuguese as written in Brazil.
+ *
+ * You need to call this function with a valid list of languages at
+ * least once in order to properly enable the spell checking feature
+ * in WebKit.
*/
void webkit_web_context_set_spell_checking_languages(WebKitWebContext* context, const gchar* languages)
{
g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
+ g_return_if_fail(languages);
#if ENABLE(SPELLCHECK)
- context->priv->textChecker->setSpellCheckingLanguages(String(languages));
- context->priv->spellCheckingLanguages.set(g_strdup(languages));
+ context->priv->textChecker->setSpellCheckingLanguages(languages);
#endif
}