diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
commit | 9364f22aed35e1a1e9d07c121510f80be3ab0502 (patch) | |
tree | d49911209b132da58d838efa852daf28d516df21 /WebKit/gtk/webkit | |
parent | 87eb0cb35bad8784770ebc807e6c982432e47107 (diff) | |
download | external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.zip external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.tar.gz external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.tar.bz2 |
Initial Contribution
Diffstat (limited to 'WebKit/gtk/webkit')
-rw-r--r-- | WebKit/gtk/webkit/webkitprivate.cpp | 6 | ||||
-rw-r--r-- | WebKit/gtk/webkit/webkitprivate.h | 6 | ||||
-rw-r--r-- | WebKit/gtk/webkit/webkitwebframe.cpp | 34 | ||||
-rw-r--r-- | WebKit/gtk/webkit/webkitwebhistoryitem.cpp | 2 | ||||
-rw-r--r-- | WebKit/gtk/webkit/webkitwebview.cpp | 107 | ||||
-rw-r--r-- | WebKit/gtk/webkit/webkitwebview.h | 10 |
6 files changed, 30 insertions, 135 deletions
diff --git a/WebKit/gtk/webkit/webkitprivate.cpp b/WebKit/gtk/webkit/webkitprivate.cpp index 9ec51ba..88be6c8 100644 --- a/WebKit/gtk/webkit/webkitprivate.cpp +++ b/WebKit/gtk/webkit/webkitprivate.cpp @@ -24,10 +24,10 @@ #include "FrameLoader.h" #include "FrameLoaderClientGtk.h" #include "Logging.h" -#include "MainThread.h" #include "NotImplemented.h" #include "Pasteboard.h" #include "PasteboardHelperGtk.h" +#include "Threading.h" #if ENABLE(DATABASE) #include "DatabaseTracker.h" @@ -49,7 +49,7 @@ WebCore::Frame* core(WebKitWebFrame* frame) return 0; WebKitWebFramePrivate* priv = frame->priv; - return priv ? priv->coreFrame.get() : 0; + return priv ? priv->coreFrame : 0; } WebKitWebFrame* kit(WebCore::Frame* coreFrame) @@ -90,7 +90,7 @@ void webkit_init() return; isInitialized = true; - WebCore::initializeThreadingAndMainThread(); + WebCore::initializeThreading(); WebCore::InitializeLoggingChannelsIfNecessary(); #if ENABLE(DATABASE) diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h index 5c75928..2dda422 100644 --- a/WebKit/gtk/webkit/webkitprivate.h +++ b/WebKit/gtk/webkit/webkitprivate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008 Holger Hans Peter Freyther + * Copyright (C) 2007 Holger Hans Peter Freyther * Copyrifht (C) 2008 Jan Michael C. Alonzo * * This library is free software; you can redistribute it and/or @@ -84,14 +84,12 @@ extern "C" { GtkTargetList* copy_target_list; GtkTargetList* paste_target_list; - - gboolean transparent; }; #define WEBKIT_WEB_FRAME_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_FRAME, WebKitWebFramePrivate)) typedef struct _WebKitWebFramePrivate WebKitWebFramePrivate; struct _WebKitWebFramePrivate { - WTF::RefPtr<WebCore::Frame> coreFrame; + WebCore::Frame* coreFrame; WebCore::FrameLoaderClient* client; WebKitWebView* webView; diff --git a/WebKit/gtk/webkit/webkitwebframe.cpp b/WebKit/gtk/webkit/webkitwebframe.cpp index 0201f5c..4ae0def 100644 --- a/WebKit/gtk/webkit/webkitwebframe.cpp +++ b/WebKit/gtk/webkit/webkitwebframe.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008 Holger Hans Peter Freyther + * Copyright (C) 2007 Holger Hans Peter Freyther * Copyright (C) 2007 Alp Toker <alp@atoker.com> * Copyright (C) 2007 Apple Inc. * Copyright (C) 2008 Christian Dywan <christian@imendio.com> @@ -43,7 +43,6 @@ using namespace WebKit; using namespace WebCore; -using namespace std; extern "C" { @@ -94,11 +93,10 @@ static void webkit_web_frame_finalize(GObject* object) WebKitWebFramePrivate* priv = frame->priv; priv->coreFrame->loader()->cancelAndClear(); - priv->coreFrame = 0; - g_free(priv->name); g_free(priv->title); g_free(priv->uri); + delete priv->coreFrame; G_OBJECT_CLASS(webkit_web_frame_parent_class)->finalize(object); } @@ -219,12 +217,11 @@ WebKitWebFrame* webkit_web_frame_new(WebKitWebView* webView) priv->client = new WebKit::FrameLoaderClient(frame); priv->coreFrame = new Frame(viewPriv->corePage, 0, priv->client); - FrameView* frameView = new FrameView(priv->coreFrame.get()); + FrameView* frameView = new FrameView(priv->coreFrame); frameView->setContainingWindow(GTK_CONTAINER(webView)); frameView->setGtkAdjustments(GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)), GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0))); priv->coreFrame->setView(frameView); - frameView->deref(); priv->coreFrame->init(); priv->webView = webView; @@ -240,7 +237,7 @@ WebKitWebFrame* webkit_web_frame_init_with_web_view(WebKitWebView* webView, HTML priv->client = new WebKit::FrameLoaderClient(frame); priv->coreFrame = new Frame(viewPriv->corePage, element, priv->client); - FrameView* frameView = new FrameView(priv->coreFrame.get()); + FrameView* frameView = new FrameView(priv->coreFrame); frameView->setContainingWindow(GTK_CONTAINER(webView)); priv->coreFrame->setView(frameView); frameView->deref(); @@ -319,7 +316,7 @@ const gchar* webkit_web_frame_get_name(WebKitWebFrame* frame) return priv->name; Frame* coreFrame = core(frame); - ASSERT(coreFrame); + g_return_val_if_fail(coreFrame, NULL); String string = coreFrame->tree()->name(); priv->name = g_strdup(string.utf8().data()); @@ -339,7 +336,7 @@ WebKitWebFrame* webkit_web_frame_get_parent(WebKitWebFrame* frame) g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); Frame* coreFrame = core(frame); - ASSERT(coreFrame); + g_return_val_if_fail(coreFrame, NULL); return kit(coreFrame->tree()->parent()); } @@ -361,10 +358,10 @@ void webkit_web_frame_load_request(WebKitWebFrame* frame, WebKitNetworkRequest* g_return_if_fail(WEBKIT_IS_NETWORK_REQUEST(request)); Frame* coreFrame = core(frame); - ASSERT(coreFrame); + g_return_if_fail(coreFrame); // TODO: Use the ResourceRequest carried by WebKitNetworkRequest when it is implemented. - String string = String::fromUTF8(webkit_network_request_get_uri(request)); + DeprecatedString string = DeprecatedString::fromUtf8(webkit_network_request_get_uri(request)); coreFrame->loader()->load(ResourceRequest(KURL(string))); } @@ -379,7 +376,7 @@ void webkit_web_frame_stop_loading(WebKitWebFrame* frame) g_return_if_fail(WEBKIT_IS_WEB_FRAME(frame)); Frame* coreFrame = core(frame); - ASSERT(coreFrame); + g_return_if_fail(coreFrame); coreFrame->loader()->stopAllLoaders(); } @@ -395,7 +392,7 @@ void webkit_web_frame_reload(WebKitWebFrame* frame) g_return_if_fail(WEBKIT_IS_WEB_FRAME(frame)); Frame* coreFrame = core(frame); - ASSERT(coreFrame); + g_return_if_fail(coreFrame); coreFrame->loader()->reload(); } @@ -423,7 +420,7 @@ WebKitWebFrame* webkit_web_frame_find_frame(WebKitWebFrame* frame, const gchar* g_return_val_if_fail(name, NULL); Frame* coreFrame = core(frame); - ASSERT(coreFrame); + g_return_val_if_fail(coreFrame, NULL); String nameString = String::fromUTF8(name); return kit(coreFrame->tree()->find(AtomicString(nameString))); @@ -443,7 +440,7 @@ JSGlobalContextRef webkit_web_frame_get_global_context(WebKitWebFrame* frame) g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); Frame* coreFrame = core(frame); - ASSERT(coreFrame); + g_return_val_if_fail(coreFrame, NULL); return toGlobalRef(coreFrame->scriptProxy()->globalObject()->globalExec()); } @@ -458,10 +455,9 @@ GSList* webkit_web_frame_get_children(WebKitWebFrame* frame) { g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); + GSList* children = NULL; Frame* coreFrame = core(frame); - ASSERT(coreFrame); - GSList* children = NULL; for (Frame* child = coreFrame->tree()->firstChild(); child; child = child->tree()->nextSibling()) { FrameLoader* loader = child->loader(); WebKit::FrameLoaderClient* client = static_cast<WebKit::FrameLoaderClient*>(loader->client()); @@ -483,8 +479,6 @@ gchar* webkit_web_frame_get_inner_text(WebKitWebFrame* frame) g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); Frame* coreFrame = core(frame); - ASSERT(coreFrame); - FrameView* view = coreFrame->view(); if (view->layoutPending()) @@ -653,8 +647,6 @@ void webkit_web_frame_print(WebKitWebFrame* frame) topLevel = NULL; Frame* coreFrame = core(frame); - ASSERT(coreFrame); - PrintContext printContext(coreFrame); GtkPrintOperation* op = gtk_print_operation_new(); diff --git a/WebKit/gtk/webkit/webkitwebhistoryitem.cpp b/WebKit/gtk/webkit/webkitwebhistoryitem.cpp index d9c8cd0..5fbf8c1 100644 --- a/WebKit/gtk/webkit/webkitwebhistoryitem.cpp +++ b/WebKit/gtk/webkit/webkitwebhistoryitem.cpp @@ -123,10 +123,10 @@ static void webkit_web_history_item_init(WebKitWebHistoryItem* webHistoryItem) WebKitWebHistoryItem* webkit_web_history_item_new_with_core_item(WebCore::HistoryItem* item) { WebKitWebHistoryItem* webHistoryItem = kit(item); + WebKitWebHistoryItemPrivate* priv = webHistoryItem->priv; if (!webHistoryItem) { webHistoryItem = WEBKIT_WEB_HISTORY_ITEM(g_object_new(WEBKIT_TYPE_WEB_HISTORY_ITEM, NULL)); - WebKitWebHistoryItemPrivate* priv = webHistoryItem->priv; priv->historyItem = item; webkit_history_item_add(webHistoryItem, priv->historyItem); } diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp index 81b196c..d5834db 100644 --- a/WebKit/gtk/webkit/webkitwebview.cpp +++ b/WebKit/gtk/webkit/webkitwebview.cpp @@ -56,8 +56,6 @@ #include <gdk/gdkkeysyms.h> -static const double defaultDPI = 96.0; - using namespace WebKit; using namespace WebCore; @@ -94,8 +92,7 @@ enum { PROP_COPY_TARGET_LIST, PROP_PASTE_TARGET_LIST, PROP_EDITABLE, - PROP_SETTINGS, - PROP_TRANSPARENT + PROP_SETTINGS }; static guint webkit_web_view_signals[LAST_SIGNAL] = { 0, }; @@ -213,9 +210,6 @@ static void webkit_web_view_get_property(GObject* object, guint prop_id, GValue* case PROP_SETTINGS: g_value_set_object(value, webkit_web_view_get_settings(webView)); break; - case PROP_TRANSPARENT: - g_value_set_boolean(value, webkit_web_view_get_transparent(webView)); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); } @@ -232,9 +226,6 @@ static void webkit_web_view_set_property(GObject* object, guint prop_id, const G case PROP_SETTINGS: webkit_web_view_set_settings(webView, WEBKIT_WEB_SETTINGS(g_value_get_object(value))); break; - case PROP_TRANSPARENT: - webkit_web_view_set_transparent(webView, g_value_get_boolean(value)); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); } @@ -243,7 +234,6 @@ static void webkit_web_view_set_property(GObject* object, guint prop_id, const G static gboolean webkit_web_view_expose_event(GtkWidget* widget, GdkEventExpose* event) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); - WebKitWebViewPrivate* priv = webView->priv; Frame* frame = core(webView)->mainFrame(); GdkRectangle clip; @@ -253,14 +243,6 @@ static gboolean webkit_web_view_expose_event(GtkWidget* widget, GdkEventExpose* ctx.setGdkExposeEvent(event); if (frame->renderer()) { frame->view()->layoutIfNeededRecursive(); - - if (priv->transparent) { - cairo_save(cr); - cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR); - cairo_paint(cr); - cairo_restore(cr); - } - frame->view()->paint(&ctx, clip); } cairo_destroy(cr); @@ -628,7 +610,6 @@ static void webkit_web_view_finalize(GObject* object) webkit_web_view_stop_loading(WEBKIT_WEB_VIEW(object)); - core(priv->mainFrame)->loader()->detachChildren(); delete priv->corePage; g_object_unref(priv->backForwardList); @@ -1095,13 +1076,6 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) FALSE, WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(objectClass, PROP_TRANSPARENT, - g_param_spec_boolean("transparent", - "Transparent", - "Whether content has a transparent background", - FALSE, - WEBKIT_PARAM_READWRITE)); - g_type_class_add_private(webViewClass, sizeof(WebKitWebViewPrivate)); } @@ -1120,17 +1094,13 @@ static void webkit_web_view_screen_changed(WebKitWebView* webView, GdkScreen* pr "minimum-logical-font-size", &minimumLogicalFontSize, NULL); - gdouble DPI = defaultDPI; -#if GTK_CHECK_VERSION(2,10,0) +#if GTK_CHECK_VERSION(2, 10, 0) GdkScreen* screen = gtk_widget_has_screen(GTK_WIDGET(webView)) ? gtk_widget_get_screen(GTK_WIDGET(webView)) : gdk_screen_get_default(); - if (screen) { - DPI = gdk_screen_get_resolution(screen); - // gdk_screen_get_resolution() returns -1 when no DPI is set. - if (DPI == -1) - DPI = defaultDPI; - } + gdouble DPI = gdk_screen_get_resolution(screen); +#else + gdouble DPI = 96; + g_warning("Cannot retrieve resolution, falling back to 96 DPI"); #endif - ASSERT(DPI > 0); settings->setDefaultFontSize(defaultFontSize / 72.0 * DPI); settings->setDefaultFixedFontSize(defaultMonospaceFontSize / 72.0 * DPI); settings->setMinimumFontSize(minimumFontSize / 72.0 * DPI); @@ -1176,7 +1146,7 @@ static void webkit_web_view_update_settings(WebKitWebView* webView) settings->setJavaScriptEnabled(enableScripts); settings->setPluginsEnabled(enablePlugins); settings->setTextAreasAreResizable(resizableTextAreas); - settings->setUserStyleSheetLocation(KURL(userStylesheetUri)); + settings->setUserStyleSheetLocation(userStylesheetUri); g_free(defaultEncoding); g_free(cursiveFontFamily); @@ -1234,7 +1204,7 @@ static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GPar else if (name == g_intern_string("resizable-text-areas")) settings->setTextAreasAreResizable(g_value_get_boolean(&value)); else if (name == g_intern_string("user-stylesheet-uri")) - settings->setUserStyleSheetLocation(KURL(g_value_get_string(&value))); + settings->setUserStyleSheetLocation(g_value_get_string(&value)); else g_warning("Unexpected setting '%s'", name); g_value_unset(&value); @@ -1497,7 +1467,8 @@ void webkit_web_view_open(WebKitWebView* webView, const gchar* uri) g_return_if_fail(uri); Frame* frame = core(webView)->mainFrame(); - frame->loader()->load(ResourceRequest(KURL(String::fromUTF8(uri)))); + DeprecatedString string = DeprecatedString::fromUtf8(uri); + frame->loader()->load(ResourceRequest(KURL(string))); } void webkit_web_view_reload(WebKitWebView* webView) @@ -1514,7 +1485,7 @@ void webkit_web_view_load_string(WebKitWebView* webView, const gchar* content, c Frame* frame = core(webView)->mainFrame(); - KURL url(baseUri ? String::fromUTF8(baseUri) : ""); + KURL url(baseUri ? DeprecatedString::fromUtf8(baseUri) : ""); RefPtr<SharedBuffer> sharedBuffer = new SharedBuffer(strdup(content), strlen(content)); SubstituteData substituteData(sharedBuffer.release(), contentMimeType ? String(contentMimeType) : "text/html", contentEncoding ? String(contentEncoding) : "UTF-8", KURL("about:blank"), url); @@ -1618,22 +1589,6 @@ WebKitWebFrame* webkit_web_view_get_main_frame(WebKitWebView* webView) return priv->mainFrame; } -/** - * webkit_web_view_get_focused_frame: - * @web_view: a #WebKitWebView - * - * Returns the frame that has focus or an active text selection. - * - * Return value: The focused #WebKitWebFrame or %NULL if no frame is focused - */ -WebKitWebFrame* webkit_web_view_get_focused_frame(WebKitWebView* webView) -{ - g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); - - Frame* focusedFrame = core(webView)->focusController()->focusedFrame(); - return kit(focusedFrame); -} - void webkit_web_view_execute_script(WebKitWebView* webView, const gchar* script) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); @@ -1895,44 +1850,4 @@ GtkTargetList* webkit_web_view_get_paste_target_list(WebKitWebView* webView) return priv->paste_target_list; } -/** - * webkit_web_view_get_transparent: - * @web_view: a #WebKitWebView - * - * Returns whether the #WebKitWebView has a transparent background. - * - * Return value: %FALSE when the #WebKitWebView draws a solid background - * (the default), otherwise %TRUE. - */ -gboolean webkit_web_view_get_transparent(WebKitWebView* webView) -{ - g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); - - WebKitWebViewPrivate* priv = webView->priv; - return priv->transparent; -} - -/** - * webkit_web_view_set_transparent: - * @web_view: a #WebKitWebView - * - * Sets whether the #WebKitWebView has a transparent background. - * - * Pass %FALSE to have the #WebKitWebView draw a solid background - * (the default), otherwise %TRUE. - */ -void webkit_web_view_set_transparent(WebKitWebView* webView, gboolean flag) -{ - g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); - - WebKitWebViewPrivate* priv = webView->priv; - priv->transparent = flag; - - // TODO: This needs to be made persistent or it could become a problem when - // the main frame is replaced. - Frame* frame = core(webView)->mainFrame(); - g_return_if_fail(frame); - frame->view()->setTransparent(flag); -} - } diff --git a/WebKit/gtk/webkit/webkitwebview.h b/WebKit/gtk/webkit/webkitwebview.h index 0c5a675..816b5e2 100644 --- a/WebKit/gtk/webkit/webkitwebview.h +++ b/WebKit/gtk/webkit/webkitwebview.h @@ -1,6 +1,5 @@ /* * Copyright (C) 2007 Holger Hans Peter Freyther - * Copyright (C) 2007, 2008 Alp Toker <alp@atoker.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -154,9 +153,6 @@ webkit_web_view_unmark_text_matches (WebKitWebView* web_view); WEBKIT_API WebKitWebFrame* webkit_web_view_get_main_frame (WebKitWebView* web_view); -WEBKIT_API WebKitWebFrame* -webkit_web_view_get_focused_frame (WebKitWebView* web_view); - WEBKIT_API void webkit_web_view_execute_script (WebKitWebView* web_view, const gchar* script); @@ -211,12 +207,6 @@ webkit_web_view_can_go_backward (WebKitWebView* web_view); WEBKIT_OBSOLETE_API void webkit_web_view_go_backward (WebKitWebView* web_view); -WEBKIT_API gboolean -webkit_web_view_get_transparent (WebKitWebView* web_view); - -WEBKIT_API void -webkit_web_view_set_transparent (WebKitWebView* web_view, gboolean flag); - G_END_DECLS #endif |