Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1926)

Unified Diff: chrome/browser/gtk/tab_contents_container_gtk.cc

Issue 502073: Revert 34954 - Fix issue 11258: Linux: gracefully handle small browser window... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/gtk/tab_contents_container_gtk.h ('k') | chrome/browser/gtk/tabs/tab_strip_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/tab_contents_container_gtk.cc
===================================================================
--- chrome/browser/gtk/tab_contents_container_gtk.cc (revision 34954)
+++ chrome/browser/gtk/tab_contents_container_gtk.cc (working copy)
@@ -6,13 +6,30 @@
#include "app/gfx/native_widget_types.h"
#include "app/l10n_util.h"
-#include "chrome/browser/gtk/gtk_expanded_container.h"
#include "chrome/browser/gtk/gtk_floating_container.h"
#include "chrome/browser/gtk/status_bubble_gtk.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#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) {
@@ -27,7 +44,7 @@
// A high level overview of the TabContentsContainer:
//
// +- GtkFloatingContainer |floating_| -------------------------------+
- // |+- GtkExpandedContainer |expanded_| -----------------------------+|
+ // |+- GtkFixedContainer |fixed_| -----------------------------------+|
// || ||
// || ||
// || ||
@@ -40,8 +57,10 @@
floating_.Own(gtk_floating_container_new());
gtk_widget_set_name(floating_.get(), "chrome-tab-contents-container");
- expanded_ = gtk_expanded_container_new();
- gtk_container_add(GTK_CONTAINER(floating_.get()), expanded_);
+ fixed_ = gtk_fixed_new();
+ g_signal_connect(fixed_, "size-allocate",
+ G_CALLBACK(OnFixedSizeAllocate), this);
+ gtk_container_add(GTK_CONTAINER(floating_.get()), fixed_);
if (status_bubble_) {
gtk_floating_container_add_floating(GTK_FLOATING_CONTAINER(floating_.get()),
@@ -50,7 +69,7 @@
G_CALLBACK(OnSetFloatingPosition), this);
}
- gtk_widget_show(expanded_);
+ gtk_widget_show(fixed_);
gtk_widget_show(floating_.get());
ViewIDUtil::SetDelegateForWidget(widget(), this);
@@ -86,8 +105,8 @@
gfx::NativeView widget = tab_contents_->GetNativeView();
if (widget) {
- if (widget->parent != expanded_)
- gtk_container_add(GTK_CONTAINER(expanded_), widget);
+ if (widget->parent != fixed_)
+ gtk_fixed_put(GTK_FIXED(fixed_), widget, 0, 0);
gtk_widget_show(widget);
}
@@ -108,8 +127,8 @@
// 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, expanded_);
- gtk_container_remove(GTK_CONTAINER(expanded_), widget);
+ DCHECK_EQ(widget->parent, fixed_);
+ gtk_container_remove(GTK_CONTAINER(fixed_), widget);
}
}
@@ -157,6 +176,15 @@
// -----------------------------------------------------------------------------
// 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) {
« no previous file with comments | « chrome/browser/gtk/tab_contents_container_gtk.h ('k') | chrome/browser/gtk/tabs/tab_strip_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698