summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-03 19:19:27 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-03 19:19:27 +0000
commit99d5f339101b38d3f0cd921768e24029882d4f17 (patch)
tree7ceae71831d0c90165705156f89425cd5d0fe224 /chrome
parent31771fa8acaa89d16e3ffad2974d67fba9c18f75 (diff)
downloadchromium_src-99d5f339101b38d3f0cd921768e24029882d4f17.zip
chromium_src-99d5f339101b38d3f0cd921768e24029882d4f17.tar.gz
chromium_src-99d5f339101b38d3f0cd921768e24029882d4f17.tar.bz2
Convert tabcontentscontainer to use a vbox instead of a fixed. The
comment in the code mentions that a vbox would cause a split screen, but looking at the code, it seems like that's not possible because we hide the old TCVG before adding new ones. These days the vbox contains all TCVGs and only shows one at a time (I think in the past we tried to remove them, but we don't have that problem now). This simplifies the code by not having to use our own size-allocate handler. Review URL: http://codereview.chromium.org/354018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30843 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/gtk/tab_contents_container_gtk.cc45
-rw-r--r--chrome/browser/gtk/tab_contents_container_gtk.h17
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_gtk.cc2
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();