diff options
author | Leon Clarke <leonclarke@google.com> | 2010-06-03 14:33:32 +0100 |
---|---|---|
committer | Leon Clarke <leonclarke@google.com> | 2010-06-08 12:24:51 +0100 |
commit | 5af96e2c7b73ebc627c6894727826a7576d31758 (patch) | |
tree | f9d5e6f6175ccd7e3d14de9b290f08937a0d17ba /WebKit/gtk | |
parent | 8cc4fcf4f6adcbc0e0aebfc24fbad9a4cddf2cfb (diff) | |
download | external_webkit-5af96e2c7b73ebc627c6894727826a7576d31758.zip external_webkit-5af96e2c7b73ebc627c6894727826a7576d31758.tar.gz external_webkit-5af96e2c7b73ebc627c6894727826a7576d31758.tar.bz2 |
Merge webkit.org at r60469 : Initial merge by git.
Change-Id: I66a0047aa2af802f66bb0c7f2a8b02247a596234
Diffstat (limited to 'WebKit/gtk')
-rw-r--r-- | WebKit/gtk/ChangeLog | 82 | ||||
-rw-r--r-- | WebKit/gtk/NEWS | 19 | ||||
-rw-r--r-- | WebKit/gtk/docs/webkitgtk-docs.sgml | 3 | ||||
-rw-r--r-- | WebKit/gtk/docs/webkitgtk-sections.txt | 2 | ||||
-rw-r--r-- | WebKit/gtk/tests/testcopyandpaste.c | 165 | ||||
-rw-r--r-- | WebKit/gtk/tests/testdomdomwindow.c | 166 | ||||
-rw-r--r-- | WebKit/gtk/webkit/webkitwebbackforwardlist.cpp | 2 | ||||
-rw-r--r-- | WebKit/gtk/webkit/webkitwebview.cpp | 23 |
8 files changed, 455 insertions, 7 deletions
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog index 9db2729..ec1727d 100644 --- a/WebKit/gtk/ChangeLog +++ b/WebKit/gtk/ChangeLog @@ -1,3 +1,85 @@ +2010-05-31 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Gustavo Noronha Silva. + + [GTK] Text copied from a WebView cannot be pasted into gnome-terminal + https://bugs.webkit.org/show_bug.cgi?id=39827 + + Add a test to prevent regressions for this issue. + + * tests/testcopyandpaste.c: Added. + (test_info_new): + (test_info_destroy): + (copy_and_paste_fixture_setup): + (copy_and_paste_fixture_teardown): + (load_status_cb): + (map_event_cb): + (test_copy_and_paste): + (main): + +2010-05-27 Gustavo Noronha Silva <gns@gnome.org> + + Update documentation control files, and fix Since tags for 1.3.1. + + * docs/webkitgtk-docs.sgml: + * docs/webkitgtk-sections.txt: + * webkit/webkitwebbackforwardlist.cpp: + * webkit/webkitwebview.cpp: + +2010-05-27 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Update for 1.3.1 release. + + * NEWS: + +2010-05-27 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Dragging onto the desktop causes a critical GLib warning + https://bugs.webkit.org/show_bug.cgi?id=39718 + + Only increment the window reference count if it is not null during drag-end + signal processing. + + * webkit/webkitwebview.cpp: + (webkit_web_view_drag_end): Guard against null window values. + +2010-05-26 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] Add support for DOM events in the GObject DOM bindings + https://bugs.webkit.org/show_bug.cgi?id=38844 + + Test DOMWindow signals. + + * tests/testdomdomwindow.c: Added. + (finish_loading): + (dom_domview_fixture_setup): + (dom_domview_fixture_teardown): + (loadedCallback): + (clickedCallback): + (map_event_cb): + (load_event_callback): + (test_dom_domview_signals): + (main): + +2010-05-24 Darin Adler <darin@apple.com> + + Reviewed by Eric Seidel. + + Move view-related functions from Frame to FrameView + https://bugs.webkit.org/show_bug.cgi?id=39366 + + * webkit/webkitwebview.cpp: + (webkit_web_view_set_editable): Remove call to empty function + removeEditngStyleFromBodyElement. + (webkit_web_view_get_zoom_level): Call functions on FrameView. + (webkit_web_view_apply_zoom_level): Ditto. + 2010-05-22 Martin Robinson <mrobinson@igalia.com> Reviewed by Xan Lopez. diff --git a/WebKit/gtk/NEWS b/WebKit/gtk/NEWS index 45e3121..fc87b35 100644 --- a/WebKit/gtk/NEWS +++ b/WebKit/gtk/NEWS @@ -1,3 +1,22 @@ +================ +WebKitGTK+ 1.3.1 +================ + +What's new in WebKitGTK+ 1.3.1? + + - Initial support for GObject DOM bindings. Present in this release + is a substantial subset of the basic DOM APIs (Document, HTML + elements, Node, etc) including access to the DOM events through + GObject signals. Keep in mind that all the APIs are still + unstable, and will probably be subject to changes before the next + stable release. + - Add webkit_web_back_forward_list_clear, to completely clear the + BackForward list. + - Lots of improvements in DOM clipboard and drag-drop access. + - Add support for GTK+ key themes. + - Significant improvements in a11y, including improved role support + and many bugfixes. + ================= WebKitGTK+ 1.1.90 ================= diff --git a/WebKit/gtk/docs/webkitgtk-docs.sgml b/WebKit/gtk/docs/webkitgtk-docs.sgml index fb9ae09..6201ca5 100644 --- a/WebKit/gtk/docs/webkitgtk-docs.sgml +++ b/WebKit/gtk/docs/webkitgtk-docs.sgml @@ -107,4 +107,7 @@ <index id="index-1.1.23" role="1.1.23"> <title>Index of new symbols in 1.1.23</title> </index> + <index id="index-1.3.1" role="1.3.1"> + <title>Index of new symbols in 1.3.1</title> + </index> </book> diff --git a/WebKit/gtk/docs/webkitgtk-sections.txt b/WebKit/gtk/docs/webkitgtk-sections.txt index 7f37484..864b991 100644 --- a/WebKit/gtk/docs/webkitgtk-sections.txt +++ b/WebKit/gtk/docs/webkitgtk-sections.txt @@ -25,6 +25,7 @@ WebKitWebSettingsClass <TITLE>WebKitWebBackForwardList</TITLE> WebKitWebBackForwardList webkit_web_back_forward_list_add_item +webkit_web_back_forward_list_clear webkit_web_back_forward_list_contains_item webkit_web_back_forward_list_get_back_item webkit_web_back_forward_list_get_back_length @@ -436,6 +437,7 @@ webkit_web_view_execute_script webkit_web_view_get_back_forward_list webkit_web_view_get_copy_target_list webkit_web_view_get_custom_encoding +webkit_web_view_get_dom_document webkit_web_view_get_editable webkit_web_view_get_encoding webkit_web_view_get_focused_frame diff --git a/WebKit/gtk/tests/testcopyandpaste.c b/WebKit/gtk/tests/testcopyandpaste.c new file mode 100644 index 0000000..034a429 --- /dev/null +++ b/WebKit/gtk/tests/testcopyandpaste.c @@ -0,0 +1,165 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2,1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include <errno.h> +#include <unistd.h> +#include <string.h> +#include <glib/gstdio.h> +#include <webkit/webkit.h> +#include <JavaScriptCore/JSStringRef.h> +#include <JavaScriptCore/JSContextRef.h> + + +#if GTK_CHECK_VERSION(2, 14, 0) + +typedef struct { + char* page; + char* expectedPlainText; +} TestInfo; + +typedef struct { + GtkWidget* window; + WebKitWebView* webView; + GMainLoop* loop; + TestInfo* info; +} CopyAndPasteFixture; + +TestInfo* +test_info_new(const char* page, const char* expectedPlainText) +{ + TestInfo* info; + info = g_slice_new0(TestInfo); + info->page = g_strdup(page); + if (expectedPlainText) + info->expectedPlainText = g_strdup(expectedPlainText); + return info; +} + +void +test_info_destroy(TestInfo* info) +{ + g_free(info->page); + g_free(info->expectedPlainText); + g_slice_free(TestInfo, info); +} + +static void copy_and_paste_fixture_setup(CopyAndPasteFixture* fixture, gconstpointer data) +{ + fixture->loop = g_main_loop_new(NULL, TRUE); + + fixture->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + fixture->webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); + + gtk_container_add(GTK_CONTAINER(fixture->window), GTK_WIDGET(fixture->webView)); +} + +static void copy_and_paste_fixture_teardown(CopyAndPasteFixture* fixture, gconstpointer data) +{ + gtk_widget_destroy(fixture->window); + g_main_loop_unref(fixture->loop); + test_info_destroy(fixture->info); +} + +static void load_status_cb(WebKitWebView* webView, GParamSpec* spec, gpointer data) +{ + CopyAndPasteFixture* fixture = (CopyAndPasteFixture*)data; + WebKitLoadStatus status = webkit_web_view_get_load_status(webView); + if (status != WEBKIT_LOAD_FINISHED) + return; + + GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); + gtk_clipboard_clear(clipboard); + + webkit_web_view_copy_clipboard(webView); + + gchar* text = gtk_clipboard_wait_for_text(clipboard); + g_assert(text || !fixture->info->expectedPlainText); + g_assert(!text || !strcmp(text, fixture->info->expectedPlainText)); + g_free(text); + + g_assert(!gtk_clipboard_wait_is_uris_available(clipboard)); + g_assert(!gtk_clipboard_wait_is_image_available(clipboard)); + + g_main_loop_quit(fixture->loop); +} + +gboolean map_event_cb(GtkWidget *widget, GdkEvent* event, gpointer data) +{ + gtk_widget_grab_focus(widget); + CopyAndPasteFixture* fixture = (CopyAndPasteFixture*)data; + webkit_web_view_load_string(fixture->webView, fixture->info->page, + "text/html", "utf-8", "file://"); + return FALSE; +} + +static void test_copy_and_paste(CopyAndPasteFixture* fixture, gconstpointer data) +{ + fixture->info = (TestInfo*)data; + g_signal_connect(fixture->window, "map-event", + G_CALLBACK(map_event_cb), fixture); + + gtk_widget_show(fixture->window); + gtk_widget_show(GTK_WIDGET(fixture->webView)); + gtk_window_present(GTK_WINDOW(fixture->window)); + + g_signal_connect(fixture->webView, "notify::load-status", + G_CALLBACK(load_status_cb), fixture); + + g_main_loop_run(fixture->loop); +} + +int main(int argc, char** argv) +{ + g_thread_init(NULL); + gtk_test_init(&argc, &argv, NULL); + + g_test_bug_base("https://bugs.webkit.org/"); + const char* selected_span_html = "<html><body>" + "<span id=\"mainspan\">All work and no play <span>make Jack a dull</span> boy.</span>" + "<script>document.getSelection().collapse();\n" + "document.getSelection().selectAllChildren(document.getElementById('mainspan'));\n" + "</script></body></html>"; + const char* no_selection_html = "<html><body>" + "<span id=\"mainspan\">All work and no play <span>make Jack a dull</span> boy</span>" + "<script>document.getSelection().collapse();\n" + "</script></body></html>"; + + g_test_add("/webkit/copyandpaste/selection", CopyAndPasteFixture, + test_info_new(selected_span_html, "All work and no play make Jack a dull boy."), + copy_and_paste_fixture_setup, + test_copy_and_paste, + copy_and_paste_fixture_teardown); + g_test_add("/webkit/copyandpaste/no-selection", CopyAndPasteFixture, + test_info_new(no_selection_html, 0), + copy_and_paste_fixture_setup, + test_copy_and_paste, + copy_and_paste_fixture_teardown); + + return g_test_run(); +} + +#else + +int main(int argc, char** argv) +{ + g_critical("You will need at least GTK+ 2.14.0 to run the unit tests."); + return 0; +} + +#endif diff --git a/WebKit/gtk/tests/testdomdomwindow.c b/WebKit/gtk/tests/testdomdomwindow.c new file mode 100644 index 0000000..1796057 --- /dev/null +++ b/WebKit/gtk/tests/testdomdomwindow.c @@ -0,0 +1,166 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "test_utils.h" + +#include <glib.h> +#include <glib/gstdio.h> +#include <gtk/gtk.h> +#include <webkit/webkit.h> + +#if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0) + +#define HTML_DOCUMENT "<html><head><title>This is the title</title></head><body></body></html>" + +typedef struct { + GtkWidget* webView; + GtkWidget* window; + WebKitDOMDOMWindow* domWindow; + GMainLoop* loop; + + gboolean loaded; + gboolean clicked; + gconstpointer data; +} DomDomviewFixture; + +static gboolean finish_loading(DomDomviewFixture* fixture) +{ + if (g_main_loop_is_running(fixture->loop)) + g_main_loop_quit(fixture->loop); + + return FALSE; +} + +static void dom_domview_fixture_setup(DomDomviewFixture* fixture, gconstpointer data) +{ + fixture->loop = g_main_loop_new(NULL, TRUE); + fixture->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + fixture->webView = webkit_web_view_new(); + fixture->data = data; + + gtk_container_add(GTK_CONTAINER(fixture->window), GTK_WIDGET(fixture->webView)); +} + +static void dom_domview_fixture_teardown(DomDomviewFixture* fixture, gconstpointer data) +{ + gtk_widget_destroy(fixture->window); + g_main_loop_unref(fixture->loop); +} + +static gboolean loadedCallback(WebKitDOMDOMWindow* view, WebKitDOMEvent* event, DomDomviewFixture* fixture) +{ + g_assert(fixture->loaded == FALSE); + fixture->loaded = TRUE; + + return FALSE; +} + +static gboolean clickedCallback(WebKitDOMDOMWindow* view, WebKitDOMEvent* event, DomDomviewFixture* fixture) +{ + WebKitDOMEventTarget* target; + gushort phase; + + g_assert(event); + g_assert(WEBKIT_DOM_IS_EVENT(event)); + + // We should catch this in the bubbling up phase, since we are connecting to the toplevel object + phase = webkit_dom_event_get_event_phase(event); + g_assert_cmpint(phase, ==, 3); + + target = webkit_dom_event_get_current_target(event); + g_assert(target == WEBKIT_DOM_EVENT_TARGET(view)); + + g_assert(fixture->clicked == FALSE); + fixture->clicked = TRUE; + + finish_loading(fixture); + + return FALSE; +} + +gboolean map_event_cb(GtkWidget *widget, GdkEvent* event, DomDomviewFixture* fixture) +{ + webkit_web_view_load_string(WEBKIT_WEB_VIEW (fixture->webView), (const char*)fixture->data, NULL, NULL, NULL); + + return FALSE; +} + +static void load_event_callback(WebKitWebView* webView, GParamSpec* spec, DomDomviewFixture* fixture) +{ + WebKitLoadStatus status = webkit_web_view_get_load_status(webView); + if (status == WEBKIT_LOAD_FINISHED) { + g_signal_connect(fixture->domWindow, "click-event", G_CALLBACK(clickedCallback), fixture); + + g_assert(fixture->clicked == FALSE); + gtk_test_widget_click (GTK_WIDGET(fixture->webView), 1, 0); + } + +} + +static void test_dom_domview_signals(DomDomviewFixture* fixture, gconstpointer data) +{ + g_assert(fixture); + WebKitWebView* view = (WebKitWebView*)fixture->webView; + g_assert(view); + WebKitDOMDocument* document = webkit_web_view_get_dom_document(view); + g_assert(document); + WebKitDOMDOMWindow* domWindow = webkit_dom_document_get_default_view(document); + g_assert(domWindow); + + fixture->domWindow = domWindow; + + g_signal_connect(fixture->domWindow, "load-event", G_CALLBACK(loadedCallback), fixture); + g_signal_connect(fixture->window, "map-event", G_CALLBACK(map_event_cb), fixture); + g_signal_connect(fixture->webView, "notify::load-status", G_CALLBACK(load_event_callback), fixture); + + gtk_widget_show_all(fixture->window); + gtk_window_present(GTK_WINDOW(fixture->window)); + + g_main_loop_run (fixture->loop); + + g_assert(fixture->loaded); + g_assert(fixture->clicked); +} + +int main(int argc, char** argv) +{ + if (!g_thread_supported()) + g_thread_init(NULL); + + gtk_test_init(&argc, &argv, NULL); + + g_test_bug_base("https://bugs.webkit.org/"); + + g_test_add("/webkit/domdomview/signals", + DomDomviewFixture, HTML_DOCUMENT, + dom_domview_fixture_setup, + test_dom_domview_signals, + dom_domview_fixture_teardown); + + return g_test_run(); +} + +#else +int main(int argc, char** argv) +{ + g_critical("You will need at least glib-2.16.0 and gtk-2.14.0 to run the unit tests. Doing nothing now."); + return 0; +} + +#endif diff --git a/WebKit/gtk/webkit/webkitwebbackforwardlist.cpp b/WebKit/gtk/webkit/webkitwebbackforwardlist.cpp index b23aeb9..70fdea5 100644 --- a/WebKit/gtk/webkit/webkitwebbackforwardlist.cpp +++ b/WebKit/gtk/webkit/webkitwebbackforwardlist.cpp @@ -445,7 +445,7 @@ void webkit_web_back_forward_list_add_item(WebKitWebBackForwardList *webBackForw * Clears the @webBackForwardList by removing all its elements. Note that not even * the current page is kept in list when cleared so you would have to add it later. * - * Since: 1.1.30 + * Since: 1.3.1 **/ void webkit_web_back_forward_list_clear(WebKitWebBackForwardList* webBackForwardList) { diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp index f3bb5e6..2c95558 100644 --- a/WebKit/gtk/webkit/webkitwebview.cpp +++ b/WebKit/gtk/webkit/webkitwebview.cpp @@ -1257,7 +1257,11 @@ static void webkit_web_view_drag_end(GtkWidget* widget, GdkDragContext* context) GdkDisplay* display = gdk_display_get_default(); gdk_display_get_pointer(display, 0, &xRoot, &yRoot, &modifiers); - event->button.window = static_cast<GdkWindow*>(g_object_ref(gdk_display_get_window_at_pointer(display, &x, &y))); + GdkWindow* window = gdk_display_get_window_at_pointer(display, &x, &y); + if (window) { + g_object_ref(window); + event->button.window = window; + } event->button.x = x; event->button.y = y; event->button.x_root = xRoot; @@ -3636,8 +3640,7 @@ void webkit_web_view_set_editable(WebKitWebView* webView, gboolean flag) // TODO: If the WebKitWebView is made editable and the selection is empty, set it to something. //if (!webkit_web_view_get_selected_dom_range(webView)) // mainFrame->setSelectionFromNone(); - } else - frame->removeEditingStyleFromBodyElement(); + } g_object_notify(G_OBJECT(webView), "editable"); } @@ -3761,7 +3764,11 @@ gfloat webkit_web_view_get_zoom_level(WebKitWebView* webView) if (!frame) return 1.0f; - return frame->zoomFactor(); + FrameView* view = frame->view(); + if (!view) + return 1; + + return view->zoomFactor(); } static void webkit_web_view_apply_zoom_level(WebKitWebView* webView, gfloat zoomLevel) @@ -3770,8 +3777,12 @@ static void webkit_web_view_apply_zoom_level(WebKitWebView* webView, gfloat zoom if (!frame) return; + FrameView* view = frame->view(); + if (!view) + return; + WebKitWebViewPrivate* priv = webView->priv; - frame->setZoomFactor(zoomLevel, priv->zoomFullContent ? ZoomPage : ZoomTextOnly); + view->setZoomFactor(zoomLevel, priv->zoomFullContent ? ZoomPage : ZoomTextOnly); } /** @@ -4370,7 +4381,7 @@ WebKitCacheModel webkit_get_cache_model() * * Returns: the #WebKitDOMDocument currently loaded in the @webView * - * Since: 1.3.0 + * Since: 1.3.1 **/ WebKitDOMDocument* webkit_web_view_get_dom_document(WebKitWebView* webView) |