diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-23 19:20:49 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-23 19:20:49 +0000 |
commit | f6017e4335b3ca6a13b64325cfab48291f84514a (patch) | |
tree | 2080982d2f4ec9226db7d633850799c7711bdbf3 /views/widget/widget_gtk.cc | |
parent | cf61462348b622940a74a73d024e17415217cfd4 (diff) | |
download | chromium_src-f6017e4335b3ca6a13b64325cfab48291f84514a.zip chromium_src-f6017e4335b3ca6a13b64325cfab48291f84514a.tar.gz chromium_src-f6017e4335b3ca6a13b64325cfab48291f84514a.tar.bz2 |
Fix NativeViewHostGtk clipping.
Basically, I introduce an additional GtkFixed into the GtkWidget hierarchy. When clipping is required, this is re-created with a X Window and clipping is performed. For some reason, Gtk+Cairo won't clip rendering to the parent GtkWidget if there isn't an associated X Window.
This also fixes the GetPreferredSize implementation for NativeButtonGtk which would return ever increasing values of size each time it was called.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/159153
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21423 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget/widget_gtk.cc')
-rw-r--r-- | views/widget/widget_gtk.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc index e2d0c81..a77bd14 100644 --- a/views/widget/widget_gtk.cc +++ b/views/widget/widget_gtk.cc @@ -206,7 +206,11 @@ void WidgetGtk::AddChild(GtkWidget* child) { } void WidgetGtk::RemoveChild(GtkWidget* child) { - gtk_container_remove(GTK_CONTAINER(window_contents_), child); + // We can be called after the contents widget has been destroyed, e.g. any + // NativeViewHost not removed from the view hierarchy before the window is + // closed. + if (GTK_IS_CONTAINER(window_contents_)) + gtk_container_remove(GTK_CONTAINER(window_contents_), child); } void WidgetGtk::ReparentChild(GtkWidget* child) { @@ -533,7 +537,7 @@ void WidgetGtk::OnGrabNotify(GtkWidget* widget, gboolean was_grabbed) { HandleGrabBroke(); } -void WidgetGtk::OnDestroy(GtkWidget* widget) { +void WidgetGtk::OnDestroy() { widget_ = window_contents_ = NULL; root_view_->OnWidgetDestroyed(); if (delete_on_destroy_) @@ -773,10 +777,8 @@ void WidgetGtk::CallGrabNotify(GtkWidget* widget, gboolean was_grabbed) { // static void WidgetGtk::CallDestroy(GtkObject* object) { WidgetGtk* widget_gtk = GetViewForNative(GTK_WIDGET(object)); - if (!widget_gtk) - return; - - return widget_gtk->OnDestroy(GTK_WIDGET(object)); + if (widget_gtk) + widget_gtk->OnDestroy(); } // static |