diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/gtk/tab_contents_container_gtk.cc | 45 | ||||
-rw-r--r-- | chrome/browser/gtk/tab_contents_container_gtk.h | 17 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents_view_gtk.cc | 2 |
3 files changed, 11 insertions, 53 deletions
diff --git a/chrome/browser/gtk/tab_contents_container_gtk.cc b/chrome/browser/gtk/tab_contents_container_gtk.cc index 9425194..c106ace 100644 --- a/chrome/browser/gtk/tab_contents_container_gtk.cc +++ b/chrome/browser/gtk/tab_contents_container_gtk.cc @@ -12,24 +12,6 @@ #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" #include "chrome/common/notification_service.h" -namespace { - -// Allocates all normal tab contents views to the size of the passed in -// |allocation|. -void ResizeChildren(GtkWidget* widget, void* param) { - GtkAllocation* allocation = reinterpret_cast<GtkAllocation*>(param); - if (!GTK_WIDGET_VISIBLE(widget)) - return; - - if (widget->allocation.width != allocation->width || - widget->allocation.height != allocation->height) { - gtk_widget_set_size_request(widget, allocation->width, - allocation->height); - } -} - -} // namespace - TabContentsContainerGtk::TabContentsContainerGtk(StatusBubbleGtk* status_bubble) : tab_contents_(NULL), status_bubble_(status_bubble) { @@ -44,7 +26,7 @@ void TabContentsContainerGtk::Init() { // A high level overview of the TabContentsContainer: // // +- GtkFloatingContainer |floating_| -------------------------------+ - // |+- GtkFixedContainer |fixed_| -----------------------------------+| + // |+- GtkVBox |container_| -----------------------------------------+| // || || // || || // || || @@ -57,10 +39,8 @@ void TabContentsContainerGtk::Init() { floating_.Own(gtk_floating_container_new()); gtk_widget_set_name(floating_.get(), "chrome-tab-contents-container"); - fixed_ = gtk_fixed_new(); - g_signal_connect(fixed_, "size-allocate", - G_CALLBACK(OnFixedSizeAllocate), this); - gtk_container_add(GTK_CONTAINER(floating_.get()), fixed_); + container_ = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(floating_.get()), container_); if (status_bubble_) { gtk_floating_container_add_floating(GTK_FLOATING_CONTAINER(floating_.get()), @@ -69,7 +49,7 @@ void TabContentsContainerGtk::Init() { G_CALLBACK(OnSetFloatingPosition), this); } - gtk_widget_show(fixed_); + gtk_widget_show(container_); gtk_widget_show(floating_.get()); ViewIDUtil::SetDelegateForWidget(widget(), this); @@ -105,8 +85,8 @@ void TabContentsContainerGtk::SetTabContents(TabContents* tab_contents) { gfx::NativeView widget = tab_contents_->GetNativeView(); if (widget) { - if (widget->parent != fixed_) - gtk_fixed_put(GTK_FIXED(fixed_), widget, 0, 0); + if (widget->parent != container_) + gtk_container_add(GTK_CONTAINER(container_), widget); gtk_widget_show(widget); } @@ -127,8 +107,8 @@ void TabContentsContainerGtk::DetachTabContents(TabContents* tab_contents) { // It is possible to detach an unrealized, unparented TabContents if you // slow things down enough in valgrind. Might happen in the real world, too. if (widget && widget->parent) { - DCHECK_EQ(widget->parent, fixed_); - gtk_container_remove(GTK_CONTAINER(fixed_), widget); + DCHECK_EQ(widget->parent, container_); + gtk_container_remove(GTK_CONTAINER(container_), widget); } } @@ -176,15 +156,6 @@ GtkWidget* TabContentsContainerGtk::GetWidgetForViewID(ViewID view_id) { // ----------------------------------------------------------------------------- // static -void TabContentsContainerGtk::OnFixedSizeAllocate( - GtkWidget* fixed, - GtkAllocation* allocation, - TabContentsContainerGtk* container) { - // Set all the tab contents GtkWidgets to the size of the allocation. - gtk_container_foreach(GTK_CONTAINER(fixed), ResizeChildren, allocation); -} - -// static void TabContentsContainerGtk::OnSetFloatingPosition( GtkFloatingContainer* floating_container, GtkAllocation* allocation, TabContentsContainerGtk* tab_contents_container) { diff --git a/chrome/browser/gtk/tab_contents_container_gtk.h b/chrome/browser/gtk/tab_contents_container_gtk.h index 8a7a8c7..6e1ad2a 100644 --- a/chrome/browser/gtk/tab_contents_container_gtk.h +++ b/chrome/browser/gtk/tab_contents_container_gtk.h @@ -58,15 +58,6 @@ class TabContentsContainerGtk : public NotificationObserver, // get notified. void TabContentsDestroyed(TabContents* contents); - // Implements our hack around a GtkFixed. The entire size of the GtkFixed is - // allocated to normal tab contents views, while the status bubble is - // informed of its parent and its parent's allocation (it makes a decision - // about layout later.) - static void OnFixedSizeAllocate( - GtkWidget* fixed, - GtkAllocation* allocation, - TabContentsContainerGtk* container); - // Handler for |floating_|'s "set-floating-position" signal. During this // callback, we manually set the position of the status bubble. static void OnSetFloatingPosition( @@ -87,11 +78,9 @@ class TabContentsContainerGtk : public NotificationObserver, // their positions manually set in OnSetFloatingPosition. OwnedWidgetGtk floating_; - // We insert and remove TabContents GtkWidgets into this fixed_. This should - // not be a GtkVBox since there were errors with timing where the vbox was - // horizontally split with the top half displaying the current TabContents - // and bottom half displaying the loading page. - GtkWidget* fixed_; + // We insert TabContentsViewGtks into this container_. We only show one + // TabVontentsViewGtk at a time, so we can use a vbox or an hbox. + GtkWidget* container_; DISALLOW_COPY_AND_ASSIGN(TabContentsContainerGtk); }; diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/tab_contents/tab_contents_view_gtk.cc index a51aa10..715d573 100644 --- a/chrome/browser/tab_contents/tab_contents_view_gtk.cc +++ b/chrome/browser/tab_contents/tab_contents_view_gtk.cc @@ -398,8 +398,6 @@ gboolean TabContentsViewGtk::OnSizeAllocate(GtkWidget* widget, TabContentsViewGtk* view) { int width = allocation->width; int height = allocation->height; - view->requested_size_.set_width(width); - view->requested_size_.set_height(height); // |delegate()| can be NULL here during browser teardown. if (view->tab_contents()->delegate()) height += view->tab_contents()->delegate()->GetExtraRenderViewHeight(); |