[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.22-985-g3c00f00
mrobinson at webkit.org
mrobinson at webkit.org
Wed Mar 17 17:58:58 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 6ceeaa289bf83b3819d9bbb3797c2a56437995fc
Author: mrobinson at webkit.org <mrobinson at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Feb 25 06:28:59 2010 +0000
2010-02-24 Krzysztof Kotlenga <pocek at users.sf.net>
Reviewed by Gustavo Noronha Silva.
[Gtk] Creation of a WebkitWebView widget is very slow
https://bugs.webkit.org/show_bug.cgi?id=30032
* WebCoreSupport/EditorClientGtk.cpp:
(WebKit::EditorClient::ignoreWordInSpellDocument): Change 'langs' to 'dicts'
to reflect the fact that the list just holds Enchant dictionaries now.
(WebKit::EditorClient::learnWord): Ditto.
(WebKit::EditorClient::checkSpellingOfString): Ditto.
(WebKit::EditorClient::getGuessesForWord): Ditto.
* webkit/webkitprivate.h: Remove the now unused SpellLanguage struct.
* webkit/webkitwebsettings.cpp: Change function call to reflect new
webkit_web_settings_get_enchant_dicts name.
(get_enchant_broker): Add this method which returns the enchant broker singleton.
(free_spell_checking_language): The list contents have changed, so change
the way each element is freed.
(webkit_web_settings_finalize): Change to reflect 'spell_checking_languages_list'
to 'enchant_dicts' member name change.
(webkit_web_settings_set_property): Use the broker singleton here instead of making
a new one for each language. The Enchant dictionary is now the list payload.
(webkit_web_settings_copy): More name-change updates.
(webkit_web_settings_get_enchant_dicts): Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55222 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 73599da..aac23a4 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,29 @@
+2010-02-24 Krzysztof Kotlenga <pocek at users.sf.net>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [Gtk] Creation of a WebkitWebView widget is very slow
+ https://bugs.webkit.org/show_bug.cgi?id=30032
+
+ * WebCoreSupport/EditorClientGtk.cpp:
+ (WebKit::EditorClient::ignoreWordInSpellDocument): Change 'langs' to 'dicts'
+ to reflect the fact that the list just holds Enchant dictionaries now.
+ (WebKit::EditorClient::learnWord): Ditto.
+ (WebKit::EditorClient::checkSpellingOfString): Ditto.
+ (WebKit::EditorClient::getGuessesForWord): Ditto.
+ * webkit/webkitprivate.h: Remove the now unused SpellLanguage struct.
+ * webkit/webkitwebsettings.cpp: Change function call to reflect new
+ webkit_web_settings_get_enchant_dicts name.
+ (get_enchant_broker): Add this method which returns the enchant broker singleton.
+ (free_spell_checking_language): The list contents have changed, so change
+ the way each element is freed.
+ (webkit_web_settings_finalize): Change to reflect 'spell_checking_languages_list'
+ to 'enchant_dicts' member name change.
+ (webkit_web_settings_set_property): Use the broker singleton here instead of making
+ a new one for each language. The Enchant dictionary is now the list payload.
+ (webkit_web_settings_copy): More name-change updates.
+ (webkit_web_settings_get_enchant_dicts): Ditto.
+
2010-02-23 Leandro Pereira <leandro at profusion.mobi>
Reviewed by Gustavo Noronha Silva.
diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
index 02d1a53..0700939 100644
--- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
@@ -571,30 +571,30 @@ void EditorClient::textDidChangeInTextArea(Element*)
void EditorClient::ignoreWordInSpellDocument(const String& text)
{
- GSList* langs = webkit_web_settings_get_spell_languages(m_webView);
+ GSList* dicts = webkit_web_settings_get_enchant_dicts(m_webView);
- for (; langs; langs = langs->next) {
- SpellLanguage* lang = static_cast<SpellLanguage*>(langs->data);
+ for (; dicts; dicts = dicts->next) {
+ EnchantDict* dict = static_cast<EnchantDict*>(dicts->data);
- enchant_dict_add_to_session(lang->speller, text.utf8().data(), -1);
+ enchant_dict_add_to_session(dict, text.utf8().data(), -1);
}
}
void EditorClient::learnWord(const String& text)
{
- GSList* langs = webkit_web_settings_get_spell_languages(m_webView);
+ GSList* dicts = webkit_web_settings_get_enchant_dicts(m_webView);
- for (; langs; langs = langs->next) {
- SpellLanguage* lang = static_cast<SpellLanguage*>(langs->data);
+ for (; dicts; dicts = dicts->next) {
+ EnchantDict* dict = static_cast<EnchantDict*>(dicts->data);
- enchant_dict_add_to_personal(lang->speller, text.utf8().data(), -1);
+ enchant_dict_add_to_personal(dict, text.utf8().data(), -1);
}
}
void EditorClient::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength)
{
- GSList* langs = webkit_web_settings_get_spell_languages(m_webView);
- if (!langs)
+ GSList* dicts = webkit_web_settings_get_enchant_dicts(m_webView);
+ if (!dicts)
return;
gchar* ctext = g_utf16_to_utf8(const_cast<gunichar2*>(text), length, 0, 0, 0);
@@ -623,8 +623,8 @@ void EditorClient::checkSpellingOfString(const UChar* text, int length, int* mis
// check characters twice.
i = end;
- for (; langs; langs = langs->next) {
- SpellLanguage* lang = static_cast<SpellLanguage*>(langs->data);
+ for (; dicts; dicts = dicts->next) {
+ EnchantDict* dict = static_cast<EnchantDict*>(dicts->data);
gchar* cstart = g_utf8_offset_to_pointer(ctext, start);
gint bytes = static_cast<gint>(g_utf8_offset_to_pointer(ctext, end) - cstart);
gchar* word = g_new0(gchar, bytes+1);
@@ -632,7 +632,7 @@ void EditorClient::checkSpellingOfString(const UChar* text, int length, int* mis
g_utf8_strncpy(word, cstart, end - start);
- result = enchant_dict_check(lang->speller, word, -1);
+ result = enchant_dict_check(dict, word, -1);
g_free(word);
if (result) {
*misspellingLocation = start;
@@ -686,21 +686,21 @@ bool EditorClient::spellingUIIsShowing()
void EditorClient::getGuessesForWord(const String& word, WTF::Vector<String>& guesses)
{
- GSList* langs = webkit_web_settings_get_spell_languages(m_webView);
+ GSList* dicts = webkit_web_settings_get_enchant_dicts(m_webView);
guesses.clear();
- for (; langs; langs = langs->next) {
+ for (; dicts; dicts = dicts->next) {
size_t numberOfSuggestions;
size_t i;
- SpellLanguage* lang = static_cast<SpellLanguage*>(langs->data);
- gchar** suggestions = enchant_dict_suggest(lang->speller, word.utf8().data(), -1, &numberOfSuggestions);
+ EnchantDict* dict = static_cast<EnchantDict*>(dicts->data);
+ gchar** suggestions = enchant_dict_suggest(dict, word.utf8().data(), -1, &numberOfSuggestions);
for (i = 0; i < numberOfSuggestions && i < 10; i++)
guesses.append(String::fromUTF8(suggestions[i]));
if (numberOfSuggestions > 0)
- enchant_dict_free_suggestions(lang->speller, suggestions);
+ enchant_dict_free_suggestions(dict, suggestions);
}
}
diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h
index 046f33e..74861be 100644
--- a/WebKit/gtk/webkit/webkitprivate.h
+++ b/WebKit/gtk/webkit/webkitprivate.h
@@ -102,11 +102,6 @@ namespace WebKit {
WebKit::PasteboardHelperGtk* pasteboardHelperInstance();
}
-typedef struct {
- EnchantBroker* config;
- EnchantDict* speller;
-} SpellLanguage;
-
extern "C" {
void webkit_init();
@@ -335,7 +330,7 @@ extern "C" {
webkit_web_settings_add_extra_plugin_directory (WebKitWebView *web_view, const gchar* directory);
GSList*
- webkit_web_settings_get_spell_languages(WebKitWebView* web_view);
+ webkit_web_settings_get_enchant_dicts(WebKitWebView* web_view);
bool
webkit_web_view_use_primary_for_paste(WebKitWebView* web_view);
diff --git a/WebKit/gtk/webkit/webkitwebsettings.cpp b/WebKit/gtk/webkit/webkitwebsettings.cpp
index 4ff4a8e..456eff9 100644
--- a/WebKit/gtk/webkit/webkitwebsettings.cpp
+++ b/WebKit/gtk/webkit/webkitwebsettings.cpp
@@ -88,7 +88,7 @@ struct _WebKitWebSettingsPrivate {
gboolean enable_private_browsing;
gboolean enable_spell_checking;
gchar* spell_checking_languages;
- GSList* spell_checking_languages_list;
+ GSList* enchant_dicts;
gboolean enable_caret_browsing;
gboolean enable_html5_database;
gboolean enable_html5_local_storage;
@@ -827,16 +827,21 @@ static void webkit_web_settings_init(WebKitWebSettings* web_settings)
web_settings->priv = WEBKIT_WEB_SETTINGS_GET_PRIVATE(web_settings);
}
+static EnchantBroker* get_enchant_broker()
+{
+ static EnchantBroker* broker = 0;
+ if (!broker)
+ broker = enchant_broker_init();
+
+ return broker;
+}
+
static void free_spell_checking_language(gpointer data, gpointer user_data)
{
- SpellLanguage* language = static_cast<SpellLanguage*>(data);
- if (language->config) {
- if (language->speller)
- enchant_broker_free_dict(language->config, language->speller);
+ EnchantDict* dict = static_cast<EnchantDict*>(data);
+ EnchantBroker* broker = get_enchant_broker();
- enchant_broker_free(language->config);
- }
- g_slice_free(SpellLanguage, language);
+ enchant_broker_free_dict(broker, dict);
}
static void webkit_web_settings_finalize(GObject* object)
@@ -854,8 +859,8 @@ static void webkit_web_settings_finalize(GObject* object)
g_free(priv->user_stylesheet_uri);
g_free(priv->spell_checking_languages);
- g_slist_foreach(priv->spell_checking_languages_list, free_spell_checking_language, NULL);
- g_slist_free(priv->spell_checking_languages_list);
+ g_slist_foreach(priv->enchant_dicts, free_spell_checking_language, 0);
+ g_slist_free(priv->enchant_dicts);
g_free(priv->user_agent);
@@ -867,8 +872,8 @@ static void webkit_web_settings_set_property(GObject* object, guint prop_id, con
WebKitWebSettings* web_settings = WEBKIT_WEB_SETTINGS(object);
WebKitWebSettingsPrivate* priv = web_settings->priv;
EnchantBroker* broker;
- SpellLanguage* lang;
- GSList* spellLanguages = NULL;
+ EnchantDict* dict;
+ GSList* spellDictionaries = 0;
switch(prop_id) {
case PROP_DEFAULT_ENCODING:
@@ -958,37 +963,29 @@ static void webkit_web_settings_set_property(GObject* object, guint prop_id, con
priv->enable_spell_checking = g_value_get_boolean(value);
break;
case PROP_SPELL_CHECKING_LANGUAGES:
+ g_free(priv->spell_checking_languages);
priv->spell_checking_languages = g_strdup(g_value_get_string(value));
- broker = enchant_broker_init();
+ broker = get_enchant_broker();
if (priv->spell_checking_languages) {
char** langs = g_strsplit(priv->spell_checking_languages, ",", -1);
for (int i = 0; langs[i]; i++) {
if (enchant_broker_dict_exists(broker, langs[i])) {
- lang = g_slice_new0(SpellLanguage);
- lang->config = enchant_broker_init();
- lang->speller = enchant_broker_request_dict(lang->config, langs[i]);
-
- spellLanguages = g_slist_append(spellLanguages, lang);
+ dict = enchant_broker_request_dict(broker, langs[i]);
+ spellDictionaries = g_slist_append(spellDictionaries, dict);
}
}
-
g_strfreev(langs);
} else {
const char* language = pango_language_to_string(gtk_get_default_language());
-
if (enchant_broker_dict_exists(broker, language)) {
- lang = g_slice_new0(SpellLanguage);
- lang->config = enchant_broker_init();
- lang->speller = enchant_broker_request_dict(lang->config, language);
-
- spellLanguages = g_slist_append(spellLanguages, lang);
+ dict = enchant_broker_request_dict(broker, language);
+ spellDictionaries = g_slist_append(spellDictionaries, dict);
}
}
- enchant_broker_free(broker);
- g_slist_foreach(priv->spell_checking_languages_list, free_spell_checking_language, NULL);
- g_slist_free(priv->spell_checking_languages_list);
- priv->spell_checking_languages_list = spellLanguages;
+ g_slist_foreach(priv->enchant_dicts, free_spell_checking_language, 0);
+ g_slist_free(priv->enchant_dicts);
+ priv->enchant_dicts = spellDictionaries;
break;
case PROP_ENABLE_XSS_AUDITOR:
priv->enable_xss_auditor = g_value_get_boolean(value);
@@ -1225,7 +1222,6 @@ WebKitWebSettings* webkit_web_settings_copy(WebKitWebSettings* web_settings)
"enable-private-browsing", priv->enable_private_browsing,
"enable-spell-checking", priv->enable_spell_checking,
"spell-checking-languages", priv->spell_checking_languages,
- "spell-checking-languages-list", priv->spell_checking_languages_list,
"enable-caret-browsing", priv->enable_caret_browsing,
"enable-html5-database", priv->enable_html5_database,
"enable-html5-local-storage", priv->enable_html5_local_storage,
@@ -1265,23 +1261,21 @@ void webkit_web_settings_add_extra_plugin_directory(WebKitWebView* webView, cons
}
/**
- * webkit_web_settings_get_spell_languages:
+ * webkit_web_settings_get_enchant_dicts:
* @web_view: a #WebKitWebView
*
- * Internal use only. Retrieves a GSList of SpellLanguages from the
+ * Internal use only. Retrieves a GSList of EnchantDicts from the
* #WebKitWebSettings of @web_view.
*
- * Since: 1.1.6
+ * Since: 1.1.22
*/
-GSList* webkit_web_settings_get_spell_languages(WebKitWebView *web_view)
+GSList* webkit_web_settings_get_enchant_dicts(WebKitWebView* webView)
{
- g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(web_view), 0);
+ g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
- WebKitWebSettings* settings = webkit_web_view_get_settings(web_view);
- WebKitWebSettingsPrivate* priv = settings->priv;
- GSList* list = priv->spell_checking_languages_list;
+ WebKitWebSettings* settings = webkit_web_view_get_settings(webView);
- return list;
+ return settings->priv->enchant_dicts;
}
/**
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list