diff options
Diffstat (limited to 'WebKit/gtk')
-rw-r--r-- | WebKit/gtk/ChangeLog | 242 | ||||
-rw-r--r-- | WebKit/gtk/JSCore.gir.in (renamed from WebKit/gtk/JSCore-1.0.gir) | 4 | ||||
-rw-r--r-- | WebKit/gtk/NEWS | 27 | ||||
-rw-r--r-- | WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp | 16 | ||||
-rw-r--r-- | WebKit/gtk/WebCoreSupport/DragClientGtk.cpp | 2 | ||||
-rw-r--r-- | WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp | 9 | ||||
-rw-r--r-- | WebKit/gtk/docs/GNUmakefile.am | 2 | ||||
-rw-r--r-- | WebKit/gtk/tests/testatk.c | 276 | ||||
-rw-r--r-- | WebKit/gtk/tests/testcopyandpaste.c | 109 | ||||
-rw-r--r-- | WebKit/gtk/tests/testdomnode.c | 54 | ||||
-rw-r--r-- | WebKit/gtk/tests/testdownload.c | 67 | ||||
-rw-r--r-- | WebKit/gtk/webkit.pc.in | 6 | ||||
-rw-r--r-- | WebKit/gtk/webkit/webkitprivate.h | 2 | ||||
-rw-r--r-- | WebKit/gtk/webkit/webkitsoupauthdialog.c | 9 | ||||
-rw-r--r-- | WebKit/gtk/webkit/webkitwebview.cpp | 23 | ||||
-rw-r--r-- | WebKit/gtk/webkitmarshal.list | 1 |
16 files changed, 792 insertions, 57 deletions
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog index e13e9ce..a33506c 100644 --- a/WebKit/gtk/ChangeLog +++ b/WebKit/gtk/ChangeLog @@ -1,3 +1,245 @@ +2010-06-23 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Gustavo Noronha Silva. + + [GTK] Separate DerivedSources per-project + https://bugs.webkit.org/show_bug.cgi?id=41109 + + Separate WebKitGTK+ DerivedSources into per-project subdirectories to prepare + for properly building WebKit2. + + * webkitmarshal.list: Touch this file to force a rebuild of the marshaling code. + +2010-07-01 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] Stop using GdkRegion in 3.x mode + https://bugs.webkit.org/show_bug.cgi?id=41463 + + Make us compile without using GdkRegion, since it's gone from GTK+ + 3.x. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::scroll): + * webkit/webkitwebview.cpp: + (webkit_web_view_expose_event): + +2010-07-01 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Convert WebKitWebView's private draggingDataObjects member to a pointer + https://bugs.webkit.org/show_bug.cgi?id=40333 + + Convert draggingDataObjects to a pointer. The constructor and destructor of the + HashMap should be called explicitly. GObject memory allocation does not do this. + + * WebCoreSupport/DragClientGtk.cpp: + (WebKit::DragClient::startDrag): + * webkit/webkitprivate.h: + * webkit/webkitwebview.cpp: + (webkit_web_view_dispose): + (webkit_web_view_drag_end): + (webkit_web_view_drag_data_get): + (webkit_web_view_init): + +2010-06-30 Martin Robinson <mrobinson@igalia.com> + + Unreviewed, rolling out r62226. + http://trac.webkit.org/changeset/62226 + https://bugs.webkit.org/show_bug.cgi?id=40333 + + This change caused 13 new crashers. + + * WebCoreSupport/DragClientGtk.cpp: + (WebKit::DragClient::startDrag): + * webkit/webkitprivate.h: + * webkit/webkitwebview.cpp: + (webkit_web_view_dispose): + (webkit_web_view_drag_end): + (webkit_web_view_drag_data_get): + (webkit_web_view_init): + +2010-06-30 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Convert WebKitWebView's private draggingDataObjects member to a pointer + https://bugs.webkit.org/show_bug.cgi?id=40333 + + Convert draggingDataObjects to a pointer. The constructor and destructor of the + HashMap should be called explicitly. GObject memory allocation does not do this. + + * WebCoreSupport/DragClientGtk.cpp: + (WebKit::DragClient::startDrag): + * webkit/webkitprivate.h: + * webkit/webkitwebview.cpp: + (webkit_web_view_dispose): + (webkit_web_view_drag_end): + (webkit_web_view_drag_data_get): + (webkit_web_view_init): + +2010-06-30 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] Unit test for DOM insertion methods + https://bugs.webkit.org/show_bug.cgi?id=40495 + + Add unit test for webkit_dom_node_remove_child. + + * tests/testdomnode.c: + (test_dom_node_insertion): + +2010-06-30 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] Unit test for DOM insertion methods + https://bugs.webkit.org/show_bug.cgi?id=40495 + + Add unit tests for node insertion and replacement methods. + + * tests/testdomnode.c: + (test_dom_node_insertion): + (main): + +2010-06-30 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Random failure on 'testdownload' unit test + https://bugs.webkit.org/show_bug.cgi?id=38256 + + Make sure the set_filename function is called after handling the + 'download-requested' signal for the asynchronous test. This change + is needed because it could happen, with the current code, that the + set_filename () function got called too early in the mainloop, + therefore screwing the tests because the 'theDownload' global + variable wouldn't be properly set yet. + + With this modification we ensure the set_filename() function gets + called always after handling the download-requested signal, + therefore avoiding potentialproblems. + + * tests/testdownload.c: + (set_filename): + (handle_download_requested_cb): + (download_requested_cb): + (download_requested_asynch_cb): + (test_webkit_download_perform): + +2010-06-30 José Millán Soto <jmillan@igalia.com> + + Reviewed by Xan Lopez. + + [Gtk] Text attributes not exposed + https://bugs.webkit.org/show_bug.cgi?id=25528 + + Added new tests for accessible text attributes + + * tests/testatk.c: + (compAtkAttribute): + (compAtkAttributeName): + (atkAttributeSetAttributeHasValue): + (atkAttributeSetAreEqual): + (testWebkitAtkTextAttributes): + (main): + +2010-06-28 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Update for 1.3.2. + + * NEWS: + +2010-06-28 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] Does not compile with -DGSEAL_ENABLE + https://bugs.webkit.org/show_bug.cgi?id=37851 + + Fix build with GSEAL enabled. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::transitionToCommittedForNewPage): + * webkit/webkitsoupauthdialog.c: + (show_auth_dialog): + +2010-06-28 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] Add support for GTK+3 + https://bugs.webkit.org/show_bug.cgi?id=41253 + + Adapt build system to 3.x support, allow the JSCore gir and webkit + pc files to be configurable at build time for different API + versions. + + * JSCore-1.0.gir: Removed. + * JSCore.gir.in: Added. + * docs/GNUmakefile.am: + * webkit.pc.in: + +2010-06-25 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Xan Lopez. + + [Gtk] Implement atk_table_get_column_header + https://bugs.webkit.org/show_bug.cgi?id=30896 + + Replace g_timeout_add() with g_idle_add(). + + * tests/testatk.c: + (test_webkit_atk_get_text_at_offset_forms): + (test_webkit_atk_get_text_at_offset): + (test_webkit_atk_get_text_at_offset_newlines): + (test_webkit_atk_get_text_at_offset_textarea): + (test_webkit_atk_get_text_at_offset_text_input): + (testWebkitAtkGetTextInParagraphAndBodySimple): + (testWebkitAtkGetTextInParagraphAndBodyModerate): + (testWebkitAtkGetTextInTable): + (testWebkitAtkGetHeadersInTable): + +2010-06-25 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Xan Lopez. + + [Gtk] Implement atk_table_get_column_header + https://bugs.webkit.org/show_bug.cgi?id=30896 + + Added new test to check whether the implementation of + get_column_headers() and get_row_headers() works ok. + + * tests/testatk.c: + (testWebkitAtkGetHeadersInTable): + (main): + +2010-06-25 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Pasteboard code does not take into account the nil character when getting and setting markup/netscape-url data + https://bugs.webkit.org/show_bug.cgi?id=41221 + + Add a test for this issue which simulates a paste keyboard event into an editable + body. The pasteboard should contain a markup portion containing a null terminator. + + * tests/testcopyandpaste.c: + (test_info_new): + (test_info_destroy): + (load_status_cb): + (runPasteTestCallback): + (window_object_cleared_callback): + (pasting_test_get_data_callback): + (pasting_test_clear_data_callback): + (test_pasting_markup): + (main): + 2010-06-24 Martin Robinson <mrobinson@igalia.com> Reviewed by Xan Lopez. diff --git a/WebKit/gtk/JSCore-1.0.gir b/WebKit/gtk/JSCore.gir.in index 2fb4d46..e979c33 100644 --- a/WebKit/gtk/JSCore-1.0.gir +++ b/WebKit/gtk/JSCore.gir.in @@ -1,8 +1,8 @@ <?xml version="1.0"?> -<repository version="1.0" +<repository version="1.1" xmlns="http://www.gtk.org/introspection/core/1.0" xmlns:c="http://www.gtk.org/introspection/c/1.0"> - <namespace name="JSCore" version="1.0" shared-library="webkit-1.0"> + <namespace name="JSCore" version="@WEBKITGTK_API_VERSION@" shared-library="webkitgtk-@WEBKITGTK_API_VERSION@"> <alias name="GlobalContextRef" target="none" c:type="JSGlobalContextRef"/> diff --git a/WebKit/gtk/NEWS b/WebKit/gtk/NEWS index fc87b35..eb6d8cc 100644 --- a/WebKit/gtk/NEWS +++ b/WebKit/gtk/NEWS @@ -1,4 +1,31 @@ ================ +WebKitGTK+ 1.3.2 +================ + +What's new in WebKitGTK+ 1.3.2? + +*** This release is an ABI break *** + +The library has been renamed to libwebkitgtk, so you'll need to +recompile your applications when upgrading to 1.3.2. + + - Add support for GTK+ 3.x. A new configure flag, --with-gtk, has + been added, which allows to control which GTK+ version you want to + build against. The default value is '2.0', for GTK+ 2.x + support. With '3.0' the library will be compiled against GTK+ 3.x + (2.90.4 or newer required). In the 3.x mode the .pc file has been + renamed from webkit-X.X.pc to webkitgtk-X.X.pc, so you'll need to + update your autotools setup accordingly. + - Many fixes for the DOM bindings, including support to dispatch + events to any Node through webkit_event_target_dispatch_event. + - Added a 'inner-node' property to WebKitHitTestResult, carrying the + DOM node where the hit test happened. + - Many DnD fixes, including a fix for the infamous hang-of-death + while dragging the mouse. + - Support for <input type="range">. + - Many other bugfixes. + +================ WebKitGTK+ 1.3.1 ================ diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp index fe5d9eb..bb469c5 100644 --- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp @@ -372,6 +372,7 @@ void ChromeClient::scroll(const IntSize& delta, const IntRect& rectToScroll, con sourceRect.x -= delta.width(); sourceRect.y -= delta.height(); +#ifdef GTK_API_VERSION_2 GdkRegion* invalidRegion = gdk_region_rectangle(&area); if (gdk_rectangle_intersect(&area, &sourceRect, &moveRect)) { @@ -384,6 +385,21 @@ void ChromeClient::scroll(const IntSize& delta, const IntRect& rectToScroll, con gdk_window_invalidate_region(window, invalidRegion, FALSE); gdk_region_destroy(invalidRegion); +#else + cairo_region_t* invalidRegion = cairo_region_create_rectangle(&area); + + if (gdk_rectangle_intersect(&area, &sourceRect, &moveRect)) { + cairo_region_t* moveRegion = cairo_region_create_rectangle(&moveRect); + gdk_window_move_region(window, moveRegion, delta.width(), delta.height()); + cairo_region_translate(moveRegion, delta.width(), delta.height()); + cairo_region_subtract(invalidRegion, moveRegion); + cairo_region_destroy(moveRegion); + } + + gdk_window_invalidate_region(window, invalidRegion, FALSE); + cairo_region_destroy(invalidRegion); +#endif + } // FIXME: this does not take into account the WM decorations diff --git a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp index 4bcc4c2..efce3dc 100644 --- a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp @@ -77,7 +77,7 @@ void DragClient::startDrag(DragImageRef image, const IntPoint& dragImageOrigin, GOwnPtr<GdkEvent> currentEvent(gtk_get_current_event()); GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(m_webView), targetList.get(), dragOperationToGdkDragActions(clipboard->sourceOperation()), 1, currentEvent.get()); - webView->priv->draggingDataObjects.set(context, dataObject); + webView->priv->draggingDataObjects->set(context, dataObject); // A drag starting should prevent a double-click from happening. This might // happen if a drag is followed very quickly by another click (like in the DRT). diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp index 17a3cd5..340b789 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp @@ -1164,8 +1164,13 @@ void FrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame* cached void FrameLoaderClient::transitionToCommittedForNewPage() { WebKitWebView* containingWindow = getViewFromFrame(m_frame); - IntSize size = IntSize(GTK_WIDGET(containingWindow)->allocation.width, - GTK_WIDGET(containingWindow)->allocation.height); + GtkAllocation allocation; +#if GTK_CHECK_VERSION(2, 18, 0) + gtk_widget_get_allocation(GTK_WIDGET(containingWindow), &allocation); +#else + allocation = GTK_WIDGET(containingWindow)->allocation; +#endif + IntSize size = IntSize(allocation.width, allocation.height); bool transparent = webkit_web_view_get_transparent(containingWindow); Color backgroundColor = transparent ? WebCore::Color::transparent : WebCore::Color::white; Frame* frame = core(m_frame); diff --git a/WebKit/gtk/docs/GNUmakefile.am b/WebKit/gtk/docs/GNUmakefile.am index 968b7f6..105e277 100644 --- a/WebKit/gtk/docs/GNUmakefile.am +++ b/WebKit/gtk/docs/GNUmakefile.am @@ -84,7 +84,7 @@ INCLUDES= \ $(GTK_CFLAGS) \ $(LIBSOUP_CFLAGS) GTKDOC_LIBS= \ - $(top_builddir)/libwebkit-1.0.la \ + $(top_builddir)/libwebkitgtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \ $(GLIB_LIBS) \ $(GTK_LIBS) \ $(LIBSOUP_LIBS) diff --git a/WebKit/gtk/tests/testatk.c b/WebKit/gtk/tests/testatk.c index 1f1ab0c..8f13a95 100644 --- a/WebKit/gtk/tests/testatk.c +++ b/WebKit/gtk/tests/testatk.c @@ -40,6 +40,10 @@ static const char* contentsInParagraphAndBodyModerate = "<html><body><p>This is static const char* contentsInTable = "<html><body><table><tr><td>foo</td><td>bar</td></tr></table></body></html>"; +static const char* contentsInTableWithHeaders = "<html><body><table><tr><th>foo</th><th>bar</th><th colspan='2'>baz</th></tr><tr><th>qux</th><td>1</td><td>2</td><td>3</td></tr><tr><th rowspan='2'>quux</th><td>4</td><td>5</td><td>6</td></tr><tr><td>6</td><td>7</td><td>8</td></tr><tr><th>corge</th><td>9</td><td>10</td><td>11</td></tr></table><table><tr><td>1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr></table></body></html>"; + +static const char* textWithAttributes = "<html><head><style>.st1 {font-family: monospace; color:rgb(120,121,122);} .st2 {text-decoration:underline; background-color:rgb(80,81,82);}</style></head><body><p style=\"font-size:14; text-align:right;\">This is the <i>first</i><b> sentence of this text.</b></p><p class=\"st1\">This sentence should have an style applied <span class=\"st2\">and this part should have another one</span>.</p><p>x<sub>1</sub><sup>2</sup>=x<sub>2</sub><sup>3</sup></p><p style=\"text-align:center;\">This sentence is the <strike>last</strike> one.</p></body></html>"; + static gboolean bail_out(GMainLoop* loop) { if (g_main_loop_is_running(loop)) @@ -219,7 +223,7 @@ static void test_webkit_atk_get_text_at_offset_forms(void) webkit_web_view_load_string(webView, contents, NULL, NULL, NULL); loop = g_main_loop_new(NULL, TRUE); - g_timeout_add(100, (GSourceFunc)bail_out, loop); + g_idle_add((GSourceFunc)bail_out, loop); g_main_loop_run(loop); /* Get to the inner AtkText object */ @@ -250,7 +254,7 @@ static void test_webkit_atk_get_text_at_offset(void) webkit_web_view_load_string(webView, contents, NULL, NULL, NULL); loop = g_main_loop_new(NULL, TRUE); - g_timeout_add(100, (GSourceFunc)bail_out, loop); + g_idle_add((GSourceFunc)bail_out, loop); g_main_loop_run(loop); /* Get to the inner AtkText object */ @@ -281,7 +285,7 @@ static void test_webkit_atk_get_text_at_offset_newlines(void) webkit_web_view_load_string(webView, contentsWithNewlines, NULL, NULL, NULL); loop = g_main_loop_new(NULL, TRUE); - g_timeout_add(100, (GSourceFunc)bail_out, loop); + g_idle_add((GSourceFunc)bail_out, loop); g_main_loop_run(loop); /* Get to the inner AtkText object */ @@ -312,7 +316,7 @@ static void test_webkit_atk_get_text_at_offset_textarea(void) webkit_web_view_load_string(webView, contentsInTextarea, NULL, NULL, NULL); loop = g_main_loop_new(NULL, TRUE); - g_timeout_add(100, (GSourceFunc)bail_out, loop); + g_idle_add((GSourceFunc)bail_out, loop); g_main_loop_run(loop); /* Get to the inner AtkText object */ @@ -345,7 +349,7 @@ static void test_webkit_atk_get_text_at_offset_text_input(void) webkit_web_view_load_string(webView, contentsInTextInput, NULL, NULL, NULL); loop = g_main_loop_new(NULL, TRUE); - g_timeout_add(100, (GSourceFunc)bail_out, loop); + g_idle_add((GSourceFunc)bail_out, loop); g_main_loop_run(loop); /* Get to the inner AtkText object */ @@ -381,7 +385,7 @@ static void testWebkitAtkGetTextInParagraphAndBodySimple(void) webkit_web_view_load_string(webView, contentsInParagraphAndBodySimple, NULL, NULL, NULL); loop = g_main_loop_new(NULL, TRUE); - g_timeout_add(100, (GSourceFunc)bail_out, loop); + g_idle_add((GSourceFunc)bail_out, loop); g_main_loop_run(loop); /* Get to the inner AtkText object */ @@ -425,7 +429,7 @@ static void testWebkitAtkGetTextInParagraphAndBodyModerate(void) webkit_web_view_load_string(webView, contentsInParagraphAndBodyModerate, NULL, NULL, NULL); loop = g_main_loop_new(NULL, TRUE); - g_timeout_add(100, (GSourceFunc)bail_out, loop); + g_idle_add((GSourceFunc)bail_out, loop); g_main_loop_run(loop); /* Get to the inner AtkText object */ @@ -465,7 +469,7 @@ static void testWebkitAtkGetTextInTable(void) webkit_web_view_load_string(webView, contentsInTable, NULL, NULL, NULL); loop = g_main_loop_new(NULL, TRUE); - g_timeout_add(100, (GSourceFunc)bail_out, loop); + g_idle_add((GSourceFunc)bail_out, loop); g_main_loop_run(loop); obj = gtk_widget_get_accessible(GTK_WIDGET(webView)); @@ -480,6 +484,260 @@ static void testWebkitAtkGetTextInTable(void) g_object_unref(webView); } +static void testWebkitAtkGetHeadersInTable(void) +{ + WebKitWebView* webView; + AtkObject* axWebView; + AtkObject* table; + AtkObject* colHeader; + AtkObject* rowHeader; + GMainLoop* loop; + + webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); + g_object_ref_sink(webView); + GtkAllocation alloc = { 0, 0, 800, 600 }; + gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc); + webkit_web_view_load_string(webView, contentsInTableWithHeaders, NULL, NULL, NULL); + loop = g_main_loop_new(NULL, TRUE); + + g_idle_add((GSourceFunc)bail_out, loop); + g_main_loop_run(loop); + + axWebView = gtk_widget_get_accessible(GTK_WIDGET(webView)); + g_assert(axWebView); + + // Check table with both column and row headers + table = atk_object_ref_accessible_child(axWebView, 0); + g_assert(table); + g_assert(atk_object_get_role(table) == ATK_ROLE_TABLE); + + colHeader = atk_table_get_column_header(ATK_TABLE(table), 0); + g_assert(colHeader); + g_assert(atk_object_get_role(colHeader) == ATK_ROLE_TABLE_CELL); + g_assert(atk_object_get_index_in_parent(colHeader) == 0); + + colHeader = atk_table_get_column_header(ATK_TABLE(table), 1); + g_assert(colHeader); + g_assert(atk_object_get_role(colHeader) == ATK_ROLE_TABLE_CELL); + g_assert(atk_object_get_index_in_parent(colHeader) == 1); + + colHeader = atk_table_get_column_header(ATK_TABLE(table), 2); + g_assert(colHeader); + g_assert(atk_object_get_role(colHeader) == ATK_ROLE_TABLE_CELL); + g_assert(atk_object_get_index_in_parent(colHeader) == 2); + + colHeader = atk_table_get_column_header(ATK_TABLE(table), 3); + g_assert(colHeader); + g_assert(atk_object_get_role(colHeader) == ATK_ROLE_TABLE_CELL); + g_assert(atk_object_get_index_in_parent(colHeader) == 2); + + rowHeader = atk_table_get_row_header(ATK_TABLE(table), 0); + g_assert(rowHeader); + g_assert(atk_object_get_role(rowHeader) == ATK_ROLE_TABLE_CELL); + g_assert(atk_object_get_index_in_parent(rowHeader) == 0); + + rowHeader = atk_table_get_row_header(ATK_TABLE(table), 1); + g_assert(rowHeader); + g_assert(atk_object_get_role(rowHeader) == ATK_ROLE_TABLE_CELL); + g_assert(atk_object_get_index_in_parent(rowHeader) == 3); + + rowHeader = atk_table_get_row_header(ATK_TABLE(table), 2); + g_assert(rowHeader); + g_assert(atk_object_get_role(rowHeader) == ATK_ROLE_TABLE_CELL); + g_assert(atk_object_get_index_in_parent(rowHeader) == 7); + + rowHeader = atk_table_get_row_header(ATK_TABLE(table), 3); + g_assert(rowHeader); + g_assert(atk_object_get_role(rowHeader) == ATK_ROLE_TABLE_CELL); + g_assert(atk_object_get_index_in_parent(rowHeader) == 7); + + g_object_unref(table); + + // Check table with no headers at all + table = atk_object_ref_accessible_child(axWebView, 1); + g_assert(table); + g_assert(atk_object_get_role(table) == ATK_ROLE_TABLE); + + colHeader = atk_table_get_column_header(ATK_TABLE(table), 0); + g_assert(colHeader == 0); + + colHeader = atk_table_get_column_header(ATK_TABLE(table), 1); + g_assert(colHeader == 0); + + rowHeader = atk_table_get_row_header(ATK_TABLE(table), 0); + g_assert(rowHeader == 0); + + rowHeader = atk_table_get_row_header(ATK_TABLE(table), 1); + g_assert(rowHeader == 0); + + g_object_unref(table); + g_object_unref(webView); +} + +static gint compAtkAttribute(AtkAttribute* a1, AtkAttribute* a2) +{ + gint strcmpVal; + strcmpVal = g_strcmp0(a1->name, a2->name); + if (strcmpVal) + return strcmpVal; + return g_strcmp0(a1->value, a2->value); +} + +static gint compAtkAttributeName(AtkAttribute* a1, AtkAttribute* a2) +{ + return g_strcmp0(a1->name, a2->name); +} + +static gboolean atkAttributeSetAttributeHasValue(AtkAttributeSet* set, AtkTextAttribute attribute, const gchar* value) +{ + GSList *element; + AtkAttribute at; + gboolean result; + at.name = (gchar *)atk_text_attribute_get_name(attribute); + element = g_slist_find_custom(set, &at, (GCompareFunc)compAtkAttributeName); + result = element && !g_strcmp0(((AtkAttribute*)(element->data))->value, value); + return result; +} + +static gboolean atkAttributeSetAreEqual(AtkAttributeSet* set1, AtkAttributeSet* set2) +{ + if (!set1) + return !set2; + + set1 = g_slist_sort(set1, (GCompareFunc)compAtkAttribute); + set2 = g_slist_sort(set2, (GCompareFunc)compAtkAttribute); + + while (set1) { + if (!set2 || compAtkAttribute(set1->data, set2->data)) + return FALSE; + + set1 = set1->next; + set2 = set2->next; + } + + return (!set2); +} + +static void testWebkitAtkTextAttributes(void) +{ + WebKitWebView* webView; + AtkObject* obj; + AtkObject* child; + GMainLoop* loop; + AtkText* childText; + AtkAttributeSet* set1; + AtkAttributeSet* set2; + AtkAttributeSet* set3; + AtkAttributeSet* set4; + gint startOffset, endOffset; + + webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); + g_object_ref_sink(webView); + GtkAllocation alloc = { 0, 0, 800, 600 }; + gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc); + + webkit_web_view_load_string(webView, textWithAttributes, NULL, NULL, NULL); + loop = g_main_loop_new(NULL, TRUE); + + g_idle_add((GSourceFunc)bail_out, loop); + g_main_loop_run(loop); + + obj = gtk_widget_get_accessible(GTK_WIDGET(webView)); + g_assert(obj); + + child = atk_object_ref_accessible_child(obj, 0); + g_assert(child && ATK_IS_TEXT(child)); + childText = ATK_TEXT(child); + set1 = atk_text_get_run_attributes(childText, 0, &startOffset, &endOffset); + g_assert_cmpint(startOffset, ==, 0); + g_assert_cmpint(endOffset, ==, 12); + g_assert(atkAttributeSetAreEqual(set1, NULL)); + + set2 = atk_text_get_run_attributes(childText, 15, &startOffset, &endOffset); + g_assert_cmpint(startOffset, ==, 12); + g_assert_cmpint(endOffset, ==, 17); + g_assert(atkAttributeSetAttributeHasValue(set2, ATK_TEXT_ATTR_STYLE, "italic")); + + set3 = atk_text_get_run_attributes(childText, 17, &startOffset, &endOffset); + g_assert_cmpint(startOffset, ==, 17); + g_assert_cmpint(endOffset, ==, 40); + g_assert(atkAttributeSetAttributeHasValue(set3, ATK_TEXT_ATTR_WEIGHT, "700")); + + set4 = atk_text_get_default_attributes(childText); + g_assert(atkAttributeSetAttributeHasValue(set4, ATK_TEXT_ATTR_STYLE, "normal")); + g_assert(atkAttributeSetAttributeHasValue(set4, ATK_TEXT_ATTR_JUSTIFICATION, "right")); + g_assert(atkAttributeSetAttributeHasValue(set4, ATK_TEXT_ATTR_SIZE, "14")); + atk_attribute_set_free(set1); + atk_attribute_set_free(set2); + atk_attribute_set_free(set3); + atk_attribute_set_free(set4); + + child = atk_object_ref_accessible_child(obj, 1); + g_assert(child && ATK_IS_TEXT(child)); + childText = ATK_TEXT(child); + + set1 = atk_text_get_default_attributes(childText); + g_assert(atkAttributeSetAttributeHasValue(set1, ATK_TEXT_ATTR_FAMILY_NAME, "monospace")); + g_assert(atkAttributeSetAttributeHasValue(set1, ATK_TEXT_ATTR_STYLE, "normal")); + g_assert(atkAttributeSetAttributeHasValue(set1, ATK_TEXT_ATTR_STRIKETHROUGH, "false")); + g_assert(atkAttributeSetAttributeHasValue(set1, ATK_TEXT_ATTR_WEIGHT, "400")); + g_assert(atkAttributeSetAttributeHasValue(set1, ATK_TEXT_ATTR_FG_COLOR, "120,121,122")); + + set2 = atk_text_get_run_attributes(childText, 43, &startOffset, &endOffset); + g_assert_cmpint(startOffset, ==, 43); + g_assert_cmpint(endOffset, ==, 80); + // Checks that default attributes of text are not returned when called to atk_text_get_run_attributes + g_assert(!atkAttributeSetAttributeHasValue(set2, ATK_TEXT_ATTR_FG_COLOR, "120,121,122")); + g_assert(atkAttributeSetAttributeHasValue(set2, ATK_TEXT_ATTR_UNDERLINE, "single")); + g_assert(atkAttributeSetAttributeHasValue(set2, ATK_TEXT_ATTR_BG_COLOR, "80,81,82")); + atk_attribute_set_free(set1); + atk_attribute_set_free(set2); + + child = atk_object_ref_accessible_child(obj, 2); + g_assert(child && ATK_IS_TEXT(child)); + childText = ATK_TEXT(child); + + set1 = atk_text_get_run_attributes(childText, 0, &startOffset, &endOffset); + set2 = atk_text_get_run_attributes(childText, 3, &startOffset, &endOffset); + g_assert(atkAttributeSetAreEqual(set1, set2)); + atk_attribute_set_free(set2); + + set2 = atk_text_get_run_attributes(childText, 1, &startOffset, &endOffset); + set3 = atk_text_get_run_attributes(childText, 5, &startOffset, &endOffset); + g_assert(atkAttributeSetAreEqual(set2, set3)); + g_assert(!atkAttributeSetAreEqual(set1, set2)); + atk_attribute_set_free(set3); + + set3 = atk_text_get_run_attributes(childText, 2, &startOffset, &endOffset); + set4 = atk_text_get_run_attributes(childText, 6, &startOffset, &endOffset); + g_assert(atkAttributeSetAreEqual(set3, set4)); + g_assert(!atkAttributeSetAreEqual(set1, set3)); + g_assert(!atkAttributeSetAreEqual(set2, set3)); + atk_attribute_set_free(set1); + atk_attribute_set_free(set2); + atk_attribute_set_free(set3); + atk_attribute_set_free(set4); + + child = atk_object_ref_accessible_child(obj, 3); + g_assert(child && ATK_IS_TEXT(child)); + childText = ATK_TEXT(child); + set1 = atk_text_get_run_attributes(childText, 24, &startOffset, &endOffset); + g_assert_cmpint(startOffset, ==, 21); + g_assert_cmpint(endOffset, ==, 25); + g_assert(atkAttributeSetAttributeHasValue(set1, ATK_TEXT_ATTR_STRIKETHROUGH, "true")); + + set2 = atk_text_get_run_attributes(childText, 25, &startOffset, &endOffset); + g_assert_cmpint(startOffset, ==, 25); + g_assert_cmpint(endOffset, ==, 30); + g_assert(atkAttributeSetAreEqual(set2, NULL)); + + set3 = atk_text_get_default_attributes(childText); + g_assert(atkAttributeSetAttributeHasValue(set3, ATK_TEXT_ATTR_JUSTIFICATION, "center")); + atk_attribute_set_free(set1); + atk_attribute_set_free(set2); + atk_attribute_set_free(set3); +} + int main(int argc, char** argv) { g_thread_init(NULL); @@ -494,6 +752,8 @@ int main(int argc, char** argv) g_test_add_func("/webkit/atk/getTextInParagraphAndBodySimple", testWebkitAtkGetTextInParagraphAndBodySimple); g_test_add_func("/webkit/atk/getTextInParagraphAndBodyModerate", testWebkitAtkGetTextInParagraphAndBodyModerate); g_test_add_func("/webkit/atk/getTextInTable", testWebkitAtkGetTextInTable); + g_test_add_func("/webkit/atk/getHeadersInTable", testWebkitAtkGetHeadersInTable); + g_test_add_func("/webkit/atk/textAttributes", testWebkitAtkTextAttributes); return g_test_run (); } diff --git a/WebKit/gtk/tests/testcopyandpaste.c b/WebKit/gtk/tests/testcopyandpaste.c index 034a429..0ef91d1 100644 --- a/WebKit/gtk/tests/testcopyandpaste.c +++ b/WebKit/gtk/tests/testcopyandpaste.c @@ -30,7 +30,7 @@ typedef struct { char* page; - char* expectedPlainText; + char* expectedContent; } TestInfo; typedef struct { @@ -41,13 +41,13 @@ typedef struct { } CopyAndPasteFixture; TestInfo* -test_info_new(const char* page, const char* expectedPlainText) +test_info_new(const char* page, const char* expectedContent) { TestInfo* info; info = g_slice_new0(TestInfo); info->page = g_strdup(page); - if (expectedPlainText) - info->expectedPlainText = g_strdup(expectedPlainText); + if (expectedContent) + info->expectedContent = g_strdup(expectedContent); return info; } @@ -55,7 +55,7 @@ void test_info_destroy(TestInfo* info) { g_free(info->page); - g_free(info->expectedPlainText); + g_free(info->expectedContent); g_slice_free(TestInfo, info); } @@ -89,8 +89,8 @@ static void load_status_cb(WebKitWebView* webView, GParamSpec* spec, gpointer da 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_assert(text || !fixture->info->expectedContent); + g_assert(!text || !strcmp(text, fixture->info->expectedContent)); g_free(text); g_assert(!gtk_clipboard_wait_is_uris_available(clipboard)); @@ -124,6 +124,92 @@ static void test_copy_and_paste(CopyAndPasteFixture* fixture, gconstpointer data g_main_loop_run(fixture->loop); } +static CopyAndPasteFixture* currentFixture; +static JSValueRef runPasteTestCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + // Simulate a paste keyboard sequence. + GdkEvent event; + memset(&event, 0, sizeof(event)); + event.key.keyval = gdk_unicode_to_keyval('v'); + event.key.state = GDK_CONTROL_MASK; + event.key.window = gtk_widget_get_window(GTK_WIDGET(currentFixture->webView)); + GdkKeymapKey* keys; + gint n_keys; + if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(), event.key.keyval, &keys, &n_keys)) { + event.key.hardware_keycode = keys[0].keycode; + g_free(keys); + } + event.key.type = GDK_KEY_PRESS; + gtk_main_do_event(&event); + event.key.type = GDK_KEY_RELEASE; + gtk_main_do_event(&event); + + JSStringRef scriptString = JSStringCreateWithUTF8CString("document.body.innerHTML;"); + JSValueRef value = JSEvaluateScript(context, scriptString, 0, 0, 0, 0); + JSStringRelease(scriptString); + + g_assert(JSValueIsString(context, value)); + JSStringRef actual = JSValueToStringCopy(context, value, exception); + g_assert(!exception || !*exception); + g_assert(currentFixture->info->expectedContent); + JSStringRef expected = JSStringCreateWithUTF8CString(currentFixture->info->expectedContent); + g_assert(JSStringIsEqual(expected, actual)); + + JSStringRelease(expected); + JSStringRelease(actual); + g_main_loop_quit(currentFixture->loop); + return JSValueMakeUndefined(context); +} + +static void window_object_cleared_callback(WebKitWebView* web_view, WebKitWebFrame* web_frame, JSGlobalContextRef context, JSObjectRef window_object, gpointer data) +{ + JSStringRef name = JSStringCreateWithUTF8CString("runTest"); + JSObjectRef testComplete = JSObjectMakeFunctionWithCallback(context, name, runPasteTestCallback); + JSObjectSetProperty(context, window_object, name, testComplete, kJSPropertyAttributeNone, 0); + JSStringRelease(name); +} + +static void pasting_test_get_data_callback(GtkClipboard* clipboard, GtkSelectionData* selection_data, guint info, gpointer data) +{ + gtk_selection_data_set(selection_data, gdk_atom_intern("text/html", FALSE), 8, (const guchar*) data, strlen((char*)data) + 1); +} + +static void pasting_test_clear_data_callback(GtkClipboard* clipboard, gpointer data) +{ + g_free(data); +} + +static void test_pasting_markup(CopyAndPasteFixture* fixture, gconstpointer data) +{ + fixture->info = (TestInfo*)data; + currentFixture = fixture; + + GtkTargetList* targetList = gtk_target_list_new(0, 0); + gtk_target_list_add(targetList, gdk_atom_intern("text/html", FALSE), 0, 0); + + int numberOfTargets = 1; + GtkTargetEntry* targetTable = gtk_target_table_new_from_list(targetList, &numberOfTargets); + gtk_clipboard_set_with_data(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), + targetTable, numberOfTargets, + pasting_test_get_data_callback, + pasting_test_clear_data_callback, + g_strdup(fixture->info->expectedContent)); + gtk_target_list_unref(targetList); + gtk_target_table_free(targetTable, numberOfTargets); + + g_signal_connect(fixture->window, "map-event", + G_CALLBACK(map_event_cb), fixture); + g_signal_connect(fixture->webView, "window-object-cleared", + G_CALLBACK(window_object_cleared_callback), fixture); + + gtk_widget_show(fixture->window); + gtk_widget_show(GTK_WIDGET(fixture->webView)); + gtk_window_present(GTK_WINDOW(fixture->window)); + + g_main_loop_run(fixture->loop); +} + + int main(int argc, char** argv) { g_thread_init(NULL); @@ -151,6 +237,15 @@ int main(int argc, char** argv) test_copy_and_paste, copy_and_paste_fixture_teardown); + const char* paste_test_html = "<html>" + "<body onLoad=\"document.body.focus(); runTest();\" contentEditable=\"true\">" + "</body></html>"; + g_test_add("/webkit/copyandpaste/paste-markup", CopyAndPasteFixture, + test_info_new(paste_test_html, "bobby"), + copy_and_paste_fixture_setup, + test_pasting_markup, + copy_and_paste_fixture_teardown); + return g_test_run(); } diff --git a/WebKit/gtk/tests/testdomnode.c b/WebKit/gtk/tests/testdomnode.c index 1050587..b253d1d 100644 --- a/WebKit/gtk/tests/testdomnode.c +++ b/WebKit/gtk/tests/testdomnode.c @@ -27,6 +27,7 @@ #if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0) #define HTML_DOCUMENT_HIERARCHY_NAVIGATION "<html><head><title>This is the title</title></head><body><p>1</p><p>2</p><p>3</p></body></html>" +#define HTML_DOCUMENT_NODE_INSERTION "<html><body></body></html>" typedef struct { GtkWidget* webView; @@ -119,6 +120,53 @@ static void test_dom_node_hierarchy_navigation(DomNodeFixture* fixture, gconstpo g_assert_cmpint(i, ==, 3); } +static void test_dom_node_insertion(DomNodeFixture* fixture, gconstpointer data) +{ + WebKitDOMDocument* document; + WebKitDOMHTMLElement* body; + WebKitDOMElement* p, *div; + WebKitDOMNodeList* list; + WebKitDOMNode* node; + + document = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(fixture->webView)); + g_assert(document); + body = webkit_dom_document_get_body(document); + g_assert(body); + g_assert(WEBKIT_DOM_IS_HTML_ELEMENT(body)); + + /* Body shouldn't have any children at this point */ + g_assert(webkit_dom_node_has_child_nodes(WEBKIT_DOM_NODE(body)) == FALSE); + + /* Insert one P element */ + p = webkit_dom_document_create_element(document, (char*)"P", NULL); + webkit_dom_node_append_child(WEBKIT_DOM_NODE(body), WEBKIT_DOM_NODE(p), NULL); + + /* Now it should have one, the same that we inserted */ + g_assert(webkit_dom_node_has_child_nodes(WEBKIT_DOM_NODE(body))); + list = webkit_dom_node_get_child_nodes(WEBKIT_DOM_NODE(body)); + g_assert_cmpint(webkit_dom_node_list_get_length(list), ==, 1); + node = webkit_dom_node_list_item(list, 0); + g_assert(node); + g_assert(webkit_dom_node_is_same_node(WEBKIT_DOM_NODE(p), node)); + + /* Replace the P tag with a DIV tag */ + div = webkit_dom_document_create_element(document, (char*)"DIV", NULL); + webkit_dom_node_replace_child(WEBKIT_DOM_NODE(body), WEBKIT_DOM_NODE(div), WEBKIT_DOM_NODE(p), NULL); + g_assert(webkit_dom_node_has_child_nodes(WEBKIT_DOM_NODE(body))); + list = webkit_dom_node_get_child_nodes(WEBKIT_DOM_NODE(body)); + g_assert_cmpint(webkit_dom_node_list_get_length(list), ==, 1); + node = webkit_dom_node_list_item(list, 0); + g_assert(node); + g_assert(webkit_dom_node_is_same_node(WEBKIT_DOM_NODE(div), node)); + + /* Now remove the tag */ + webkit_dom_node_remove_child(WEBKIT_DOM_NODE(body), node, NULL); + list = webkit_dom_node_get_child_nodes(WEBKIT_DOM_NODE(body)); + g_assert_cmpint(webkit_dom_node_list_get_length(list), ==, 0); + + /* TODO: insert_before, which does not seem to be working correctly */ +} + int main(int argc, char** argv) { if (!g_thread_supported()) @@ -134,6 +182,12 @@ int main(int argc, char** argv) test_dom_node_hierarchy_navigation, dom_node_fixture_teardown); + g_test_add("/webkit/domnode/test_insertion", + DomNodeFixture, HTML_DOCUMENT_NODE_INSERTION, + dom_node_fixture_setup, + test_dom_node_insertion, + dom_node_fixture_teardown); + return g_test_run(); } diff --git a/WebKit/gtk/tests/testdownload.c b/WebKit/gtk/tests/testdownload.c index c7985d5..f6ae865 100644 --- a/WebKit/gtk/tests/testdownload.c +++ b/WebKit/gtk/tests/testdownload.c @@ -84,40 +84,63 @@ notify_status_cb(GObject* object, GParamSpec* pspec, gpointer data) } static gboolean -download_requested_cb(WebKitWebView* web_view, - WebKitDownload* download, - gboolean* beenThere) +set_filename(gchar* filename) +{ + gchar *uri = g_filename_to_uri(filename, NULL, NULL); + + webkit_download_set_destination_uri(theDownload, uri); + g_free(uri); + + webkit_download_start(theDownload); + return FALSE; +} + +static void +handle_download_requested_cb(WebKitDownload* download, + gboolean* beenThere, + gboolean asynch) { theDownload = download; *beenThere = TRUE; + if (temporaryFilename) { - gchar *uri = g_filename_to_uri(temporaryFilename, NULL, NULL); - if (uri) - webkit_download_set_destination_uri(download, uri); - g_free(uri); + if (asynch) { + g_idle_add((GSourceFunc)set_filename, temporaryFilename); + } else { + gchar *uri = g_filename_to_uri(temporaryFilename, NULL, NULL); + if (uri) + webkit_download_set_destination_uri(download, uri); + g_free(uri); + } } g_signal_connect(download, "notify::status", G_CALLBACK(notify_status_cb), NULL); +} +static gboolean +download_requested_cb(WebKitWebView* web_view, + WebKitDownload* download, + gboolean* beenThere) +{ + handle_download_requested_cb(download, beenThere, FALSE); return TRUE; } static gboolean -set_filename(gchar* filename) +download_requested_asynch_cb(WebKitWebView* web_view, + WebKitDownload* download, + gboolean* beenThere) { - gchar *uri = g_filename_to_uri(filename, NULL, NULL); - webkit_download_set_destination_uri(theDownload, uri); - g_free(uri); - temporaryFilename = filename; - webkit_download_start(theDownload); - return FALSE; + handle_download_requested_cb(download, beenThere, TRUE); + return TRUE; } static void test_webkit_download_perform(gboolean asynch) { WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); + GCallback downloadRequestCallback = NULL; g_object_ref_sink(G_OBJECT(webView)); @@ -125,10 +148,14 @@ test_webkit_download_perform(gboolean asynch) G_CALLBACK(navigation_policy_decision_requested_cb), NULL); + if (asynch) + downloadRequestCallback = G_CALLBACK(download_requested_asynch_cb); + else + downloadRequestCallback = G_CALLBACK(download_requested_cb); + gboolean beenThere = FALSE; g_signal_connect(webView, "download-requested", - G_CALLBACK(download_requested_cb), - &beenThere); + downloadRequestCallback, &beenThere); /* Preparation; FIXME: we should move this code to a test * utilities file, because we have a very similar one in @@ -144,12 +171,8 @@ test_webkit_download_perform(gboolean asynch) if (g_unlink(filename) == -1) g_critical("Failed to delete the temporary file: %s.", g_strerror(errno)); - if (asynch) - g_idle_add((GSourceFunc)set_filename, filename); - else - temporaryFilename = filename; - theDownload = NULL; + temporaryFilename = filename; loop = g_main_loop_new(NULL, TRUE); webkit_web_view_load_uri(webView, "http://gnome.org/"); @@ -161,6 +184,8 @@ test_webkit_download_perform(gboolean asynch) g_unlink(temporaryFilename); g_free(temporaryFilename); + temporaryFilename = NULL; + g_main_loop_unref(loop); g_object_unref(webView); } diff --git a/WebKit/gtk/webkit.pc.in b/WebKit/gtk/webkit.pc.in index 895aa19..9bed0f3 100644 --- a/WebKit/gtk/webkit.pc.in +++ b/WebKit/gtk/webkit.pc.in @@ -6,6 +6,6 @@ includedir=@includedir@ Name: WebKit Description: Web content engine for GTK+ Version: @VERSION@ -Requires: glib-2.0 gtk+-2.0 libsoup-2.4 -Libs: -L${libdir} -lwebkit-1.0 -Cflags: -I${includedir}/webkit-1.0 +Requires: glib-2.0 gtk+-@GTK_API_VERSION@ libsoup-2.4 +Libs: -L${libdir} -lwebkitgtk-@WEBKITGTK_API_VERSION@ +Cflags: -I${includedir}/webkit-@WEBKITGTK_API_VERSION@ diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h index 556648d..fa74abc 100644 --- a/WebKit/gtk/webkit/webkitprivate.h +++ b/WebKit/gtk/webkit/webkitprivate.h @@ -158,7 +158,7 @@ extern "C" { guint previousClickButton; guint32 previousClickTime; - HashMap<GdkDragContext*, RefPtr<WebCore::DataObjectGtk> > draggingDataObjects; + HashMap<GdkDragContext*, RefPtr<WebCore::DataObjectGtk> >* draggingDataObjects; }; #define WEBKIT_WEB_FRAME_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_FRAME, WebKitWebFramePrivate)) diff --git a/WebKit/gtk/webkit/webkitsoupauthdialog.c b/WebKit/gtk/webkit/webkitsoupauthdialog.c index 15863b3..daecc73 100644 --- a/WebKit/gtk/webkit/webkitsoupauthdialog.c +++ b/WebKit/gtk/webkit/webkitsoupauthdialog.c @@ -25,6 +25,7 @@ #include <gtk/gtk.h> #include <libsoup/soup.h> +#include "GtkVersioning.h" #include "webkitmarshal.h" #include "webkitsoupauthdialog.h" @@ -214,9 +215,9 @@ static void show_auth_dialog(WebKitAuthData* authData, const char* login, const /* Set the dialog up with HIG properties */ gtk_dialog_set_has_separator(dialog, FALSE); gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); - gtk_box_set_spacing(GTK_BOX(dialog->vbox), 2); /* 2 * 5 + 2 = 12 */ - gtk_container_set_border_width(GTK_CONTAINER(dialog->action_area), 5); - gtk_box_set_spacing(GTK_BOX(dialog->action_area), 6); + gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(dialog)), 2); /* 2 * 5 + 2 = 12 */ + gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_action_area(dialog)), 5); + gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_action_area(dialog)), 6); gtk_window_set_resizable(window, FALSE); gtk_window_set_title(window, ""); @@ -233,7 +234,7 @@ static void show_auth_dialog(WebKitAuthData* authData, const char* login, const /* Build contents */ hbox = gtk_hbox_new(FALSE, 12); gtk_container_set_border_width(GTK_CONTAINER(hbox), 5); - gtk_box_pack_start(GTK_BOX(dialog->vbox), hbox, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(dialog)), hbox, TRUE, TRUE, 0); icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG); diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp index ce2bbc6..62997c5 100644 --- a/WebKit/gtk/webkit/webkitwebview.cpp +++ b/WebKit/gtk/webkit/webkitwebview.cpp @@ -517,10 +517,16 @@ static gboolean webkit_web_view_expose_event(GtkWidget* widget, GdkEventExpose* cairo_destroy(cr); ctx.setGdkExposeEvent(event); - GOwnPtr<GdkRectangle> rects; int rectCount; +#ifdef GTK_API_VERSION_2 + GOwnPtr<GdkRectangle> rects; gdk_region_get_rectangles(event->region, &rects.outPtr(), &rectCount); - +#else + rectCount = cairo_region_num_rectangles(event->region); + GOwnPtr<GdkRectangle> rects(g_new(GdkRectangle, rectCount)); + for (int i = 0; i < rectCount; i++) + cairo_region_get_rectangle(event->region, i, rects.get()+i); +#endif // Avoid recursing into the render tree excessively bool coalesce = shouldCoalesce(event->area, rects.get(), rectCount); @@ -1190,7 +1196,7 @@ static void webkit_web_view_dispose(GObject* object) priv->subResources = NULL; } - priv->draggingDataObjects.clear(); + priv->draggingDataObjects->clear(); G_OBJECT_CLASS(webkit_web_view_parent_class)->dispose(object); } @@ -1207,6 +1213,7 @@ static void webkit_web_view_finalize(GObject* object) g_free(priv->iconURI); delete priv->previousClickPoint; + delete priv->draggingDataObjects; G_OBJECT_CLASS(webkit_web_view_parent_class)->finalize(object); } @@ -1309,10 +1316,10 @@ static void webkit_web_view_drag_end(GtkWidget* widget, GdkDragContext* context) // This might happen if a drag is still in progress after a WebKitWebView // is disposed and before it is finalized. - if (!priv->draggingDataObjects.contains(context)) + if (!priv->draggingDataObjects->contains(context)) return; - priv->draggingDataObjects.remove(context); + priv->draggingDataObjects->remove(context); Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); if (!frame) @@ -1347,10 +1354,10 @@ static void webkit_web_view_drag_data_get(GtkWidget* widget, GdkDragContext* con // This might happen if a drag is still in progress after a WebKitWebView // is diposed and before it is finalized. - if (!priv->draggingDataObjects.contains(context)) + if (!priv->draggingDataObjects->contains(context)) return; - pasteboardHelperInstance()->fillSelectionData(selectionData, info, priv->draggingDataObjects.get(context).get()); + pasteboardHelperInstance()->fillSelectionData(selectionData, info, priv->draggingDataObjects->get(context).get()); } #if GTK_CHECK_VERSION(2, 12, 0) @@ -2928,6 +2935,8 @@ static void webkit_web_view_init(WebKitWebView* webView) priv->previousClickPoint = new IntPoint(0, 0); priv->previousClickButton = 0; priv->previousClickTime = 0; + + priv->draggingDataObjects = new HashMap<GdkDragContext*, RefPtr<WebCore::DataObjectGtk> >(); } GtkWidget* webkit_web_view_new(void) diff --git a/WebKit/gtk/webkitmarshal.list b/WebKit/gtk/webkitmarshal.list index d8caa4c..026a8af 100644 --- a/WebKit/gtk/webkitmarshal.list +++ b/WebKit/gtk/webkitmarshal.list @@ -19,3 +19,4 @@ VOID:OBJECT,POINTER,POINTER VOID:OBJECT,STRING VOID:STRING VOID:STRING,STRING + |