diff options
Diffstat (limited to 'WebKit/gtk/WebCoreSupport')
| -rw-r--r-- | WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp | 5 | ||||
| -rw-r--r-- | WebKit/gtk/WebCoreSupport/EditorClientGtk.h | 1 | ||||
| -rw-r--r-- | WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp | 29 | ||||
| -rw-r--r-- | WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp | 26 |
4 files changed, 36 insertions, 25 deletions
diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp index 7121163..6ec6baf 100644 --- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp @@ -615,6 +615,10 @@ void EditorClient::learnWord(const String& text) void EditorClient::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength) { + GSList* langs = webkit_web_settings_get_spell_languages(m_webView); + if (!langs) + return; + gchar* ctext = g_utf16_to_utf8(const_cast<gunichar2*>(text), length, 0, 0, 0); int utflen = g_utf8_strlen(ctext, -1); @@ -632,7 +636,6 @@ void EditorClient::checkSpellingOfString(const UChar* text, int length, int* mis int start = i; int end = i; int wordLength; - GSList* langs = webkit_web_settings_get_spell_languages(m_webView); while (attrs[end].is_word_end < 1) end++; diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.h b/WebKit/gtk/WebCoreSupport/EditorClientGtk.h index 68034cf..9292651 100644 --- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.h @@ -118,6 +118,7 @@ namespace WebKit { virtual void getGuessesForWord(const WebCore::String&, WTF::Vector<WebCore::String>& guesses); virtual void setInputMethodState(bool enabled); + private: WebKitWebView* m_webView; }; } diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp index 1cf9aee..d53df88 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2007 Christian Dywan <christian@twotoasts.de> * Copyright (C) 2008, 2009 Collabora Ltd. All rights reserved. * Copyright (C) 2009 Gustavo Noronha Silva <gns@gnome.org> + * Copyright (C) Research In Motion Limited 2009. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -490,24 +491,7 @@ PassRefPtr<Widget> FrameLoaderClient::createJavaAppletWidget(const IntSize&, HTM ObjectContentType FrameLoaderClient::objectContentType(const KURL& url, const String& mimeType) { - String type = mimeType; - // We don't use MIMETypeRegistry::getMIMETypeForPath() because it returns "application/octet-stream" upon failure - if (type.isEmpty()) - type = MIMETypeRegistry::getMIMETypeForExtension(url.path().substring(url.path().reverseFind('.') + 1)); - - if (type.isEmpty()) - return WebCore::ObjectContentFrame; - - if (MIMETypeRegistry::isSupportedImageMIMEType(type)) - return WebCore::ObjectContentImage; - - if (PluginDatabase::installedPlugins()->isMIMETypeRegistered(mimeType)) - return WebCore::ObjectContentNetscapePlugin; - - if (MIMETypeRegistry::isSupportedNonImageMIMEType(type)) - return WebCore::ObjectContentFrame; - - return WebCore::ObjectContentNone; + return FrameLoader::defaultObjectContentType(url, mimeType); } String FrameLoaderClient::overrideMediaType() const @@ -530,8 +514,8 @@ void FrameLoaderClient::windowObjectCleared() // TODO: Consider using g_signal_has_handler_pending() to avoid the overhead // when there are no handlers. - JSGlobalContextRef context = toGlobalRef(coreFrame->script()->globalObject()->globalExec()); - JSObjectRef windowObject = toRef(coreFrame->script()->globalObject()); + JSGlobalContextRef context = toGlobalRef(coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec()); + JSObjectRef windowObject = toRef(coreFrame->script()->globalObject(mainThreadNormalWorld())); ASSERT(windowObject); WebKitWebView* webView = getViewFromFrame(m_frame); @@ -847,6 +831,11 @@ void FrameLoaderClient::dispatchDidFinishLoading(WebCore::DocumentLoader* loader GOwnPtr<gchar> identifierString(toString(identifier)); WebKitWebResource* webResource = webkit_web_view_get_resource(webView, identifierString.get()); + // A NULL WebResource means the load has been interrupted, and + // replaced by another one while this resource was being loaded. + if (!webResource) + return; + const char* uri = webkit_web_resource_get_uri(webResource); RefPtr<ArchiveResource> coreResource(loader->subresource(KURL(KURL(), uri))); diff --git a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp index fef07c1..78f5543 100644 --- a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp @@ -97,9 +97,17 @@ Page* InspectorClient::createPage() g_signal_connect(m_webView, "destroy", G_CALLBACK(notifyWebViewDestroyed), (gpointer)this); - gchar* inspectorURI = g_filename_to_uri(DATA_DIR"/webkit-1.0/webinspector/inspector.html", NULL, NULL); - webkit_web_view_load_uri(m_webView, inspectorURI); - g_free(inspectorURI); + GOwnPtr<gchar> inspectorURI; + + // Make the Web Inspector work when running tests + if (g_file_test("WebCore/inspector/front-end/inspector.html", G_FILE_TEST_EXISTS)) { + GOwnPtr<gchar> currentDirectory(g_get_current_dir()); + GOwnPtr<gchar> fullPath(g_strdup_printf("%s/WebCore/inspector/front-end/inspector.html", currentDirectory.get())); + inspectorURI.set(g_filename_to_uri(fullPath.get(), NULL, NULL)); + } else + inspectorURI.set(g_filename_to_uri(DATA_DIR"/webkit-1.0/webinspector/inspector.html", NULL, NULL)); + + webkit_web_view_load_uri(m_webView, inspectorURI.get()); gtk_widget_show(GTK_WIDGET(m_webView)); @@ -108,8 +116,18 @@ Page* InspectorClient::createPage() String InspectorClient::localizedStringsURL() { + GOwnPtr<gchar> URL; + + // Make the Web Inspector work when running tests + if (g_file_test("WebCore/English.lproj/localizedStrings.js", G_FILE_TEST_EXISTS)) { + GOwnPtr<gchar> currentDirectory(g_get_current_dir()); + GOwnPtr<gchar> fullPath(g_strdup_printf("%s/WebCore/English.lproj/localizedStrings.js", currentDirectory.get())); + URL.set(g_filename_to_uri(fullPath.get(), NULL, NULL)); + } else + URL.set(g_filename_to_uri(DATA_DIR"/webkit-1.0/webinspector/localizedStrings.js", NULL, NULL)); + // FIXME: support l10n of localizedStrings.js - return String::fromUTF8(g_filename_to_uri(DATA_DIR"/webkit-1.0/webinspector/localizedStrings.js", NULL, NULL)); + return String::fromUTF8(URL.get()); } String InspectorClient::hiddenPanels() |
