RESOLVED WONTFIX Bug 118363
[GTK] plugin widgets are not shown or hidden correctly
https://bugs.webkit.org/show_bug.cgi?id=118363
Summary [GTK] plugin widgets are not shown or hidden correctly
Robert Schroll
Reported 2013-07-03 10:37:11 PDT
Created attachment 206010 [details] Test case I've noticed that a plugin I insert into a WebKit-GTK WebView doesn't update correctly when widgets are shown or hidden. Although the visibility of the widgets is sometimes adjusted instantly, the space for the widgets isn't allocated or deallocated automatically. Resizing or scrolling the WebView is enough to trigger this reallocation. Attached is a test case program, which illustrates the problem with two examples. It creates a Gtk.Window that contains a WebView that contains an <embed> that contains a GTK GUI. There are two buttons. The top one creates a label directly below it, but it doesn't become visible until the window is resized. The lower button alternately shows and hides the label below itself. The visibility of the label gets updated immediately, but the space for it isn't added or removed until the window is resized. If I put this GUI directly in a top-level Gtk.Window, it works correctly. I've tried to force the UI to update with the force_redraw function. Right now, it's completely commented out. If you uncomment any of the first three bits of code, the UI will update correctly. The last two do not work, despite seeming that they might. I hope this is a clue as to what's going wrong. For the record, I'm using webkitgtk 1.10.2, the WebKit1 API, and Gtk 3.4.2, on Ubuntu 12.04. On the mailing list, it was suggested that this might be related to bug #106093.
Attachments
Test case (3.43 KB, text/x-csrc)
2013-07-03 10:37 PDT, Robert Schroll
no flags
Patch (2.56 KB, patch)
2013-10-08 00:23 PDT, Alberto Garcia
no flags
Alberto Garcia
Comment 1 2013-07-04 00:32:42 PDT
Thanks for the report and the test case. I'll try to take a look asap.
Alberto Garcia
Comment 2 2013-10-08 00:23:46 PDT
Created attachment 213670 [details] Patch Sorry for having taken so long to look into this. The problem is that the web view is not propagating the GTK size_allocate call to its children, so even if any of them needs it (in this case: a new label appears and needs to compute its size) it will not get its allocation. It works if you resize the window because changing the size of the frame will force a new allocation (via GtkPluginWidget::frameRectsChanged).
Carlos Garcia Campos
Comment 3 2013-10-08 00:59:39 PDT
Comment on attachment 213670 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=213670&action=review > Source/WebKit/gtk/webkit/webkitwebview.cpp:852 > + GtkAllocation* delayedAlloc = static_cast<GtkAllocation*>(g_object_get_data(G_OBJECT(child), "delayed-allocation")); delayedAlloc -> delayedAllocation > Source/WebKit/gtk/webkit/webkitwebview.cpp:859 > + GtkAllocation alloc; alloc -> allocation > Source/WebKit/gtk/webkit/webkitwebview.cpp:861 > + gtk_widget_get_allocation(child, &alloc); > + gtk_widget_size_allocate(child, &alloc); This looks weird to me. Shouldn't the view know the size and position to give to its children? Who set the current child allocation then?
Alberto Garcia
Comment 4 2013-10-08 01:19:28 PDT
(In reply to comment #3) > > Source/WebKit/gtk/webkit/webkitwebview.cpp:861 > > + gtk_widget_get_allocation(child, &alloc); > > + gtk_widget_size_allocate(child, &alloc); > > This looks weird to me. Shouldn't the view know the size and > position to give to its children? Who set the current child > allocation then? As far as I can see it's only set by GtkPluginWidget::frameRectsChanged() (via Widget::setFrameRect()).
Carlos Garcia Campos
Comment 5 2013-10-08 01:27:52 PDT
(In reply to comment #4) > (In reply to comment #3) > > > > Source/WebKit/gtk/webkit/webkitwebview.cpp:861 > > > + gtk_widget_get_allocation(child, &alloc); > > > + gtk_widget_size_allocate(child, &alloc); > > > > This looks weird to me. Shouldn't the view know the size and > > position to give to its children? Who set the current child > > allocation then? > > As far as I can see it's only set by GtkPluginWidget::frameRectsChanged() > (via Widget::setFrameRect()). Aha, so maybe GtkPluginWidget should set the delayed-allocation instead of calling set_size_request + size_allocate, so that is the container the one in charge of allocating its children.
Alberto Garcia
Comment 6 2013-10-08 01:55:50 PDT
(In reply to comment #5) > Aha, so maybe GtkPluginWidget should set the delayed-allocation > instead of calling set_size_request + size_allocate, so that is the > container the one in charge of allocating its children. The problem here is that the allocation of the plugin widget itself (a GtkBox in this case) doesn't change (because the frame size doesn't change). It's the contents of the GtkBox that need a new allocation.
Michael Catanzaro
Comment 7 2015-12-22 06:03:35 PST
Comment on attachment 213670 [details] Patch Hi Robert! We don't allow inserting widgets into webviews in WK2, so I guess this bug is obsolete. Certainly the patch is obsolete as it's written for WK1.
Note You need to log in before you can comment on or make changes to this bug.