| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" | 5 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
| 8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 GdkEventButton* event, TabContentsViewGtk* view) { | 391 GdkEventButton* event, TabContentsViewGtk* view) { |
| 392 view->last_mouse_down_ = *event; | 392 view->last_mouse_down_ = *event; |
| 393 return FALSE; | 393 return FALSE; |
| 394 } | 394 } |
| 395 | 395 |
| 396 gboolean TabContentsViewGtk::OnSizeAllocate(GtkWidget* widget, | 396 gboolean TabContentsViewGtk::OnSizeAllocate(GtkWidget* widget, |
| 397 GtkAllocation* allocation, | 397 GtkAllocation* allocation, |
| 398 TabContentsViewGtk* view) { | 398 TabContentsViewGtk* view) { |
| 399 int width = allocation->width; | 399 int width = allocation->width; |
| 400 int height = allocation->height; | 400 int height = allocation->height; |
| 401 view->requested_size_.set_width(width); | |
| 402 view->requested_size_.set_height(height); | |
| 403 // |delegate()| can be NULL here during browser teardown. | 401 // |delegate()| can be NULL here during browser teardown. |
| 404 if (view->tab_contents()->delegate()) | 402 if (view->tab_contents()->delegate()) |
| 405 height += view->tab_contents()->delegate()->GetExtraRenderViewHeight(); | 403 height += view->tab_contents()->delegate()->GetExtraRenderViewHeight(); |
| 406 gfx::Size size(width, height); | 404 gfx::Size size(width, height); |
| 407 view->requested_size_ = size; | 405 view->requested_size_ = size; |
| 408 gtk_container_foreach(GTK_CONTAINER(widget), SetSizeRequest, &size); | 406 gtk_container_foreach(GTK_CONTAINER(widget), SetSizeRequest, &size); |
| 409 | 407 |
| 408 // We manually tell our RWHV to resize the renderer content. This avoids |
| 409 // spurious resizes from GTK+. |
| 410 if (view->tab_contents()->render_widget_host_view()) |
| 411 view->tab_contents()->render_widget_host_view()->SetSize(size); |
| 412 if (view->tab_contents()->interstitial_page()) |
| 413 view->tab_contents()->interstitial_page()->SetSize(size); |
| 414 |
| 410 return FALSE; | 415 return FALSE; |
| 411 } | 416 } |
| 412 | 417 |
| 413 // static | 418 // static |
| 414 void TabContentsViewGtk::OnSetFloatingPosition( | 419 void TabContentsViewGtk::OnSetFloatingPosition( |
| 415 GtkFloatingContainer* floating_container, GtkAllocation* allocation, | 420 GtkFloatingContainer* floating_container, GtkAllocation* allocation, |
| 416 TabContentsViewGtk* tab_contents_view) { | 421 TabContentsViewGtk* tab_contents_view) { |
| 417 if (tab_contents_view->popup_view_) { | 422 if (tab_contents_view->popup_view_) { |
| 418 GtkWidget* widget = tab_contents_view->popup_view_->widget(); | 423 GtkWidget* widget = tab_contents_view->popup_view_->widget(); |
| 419 | 424 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 467 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
| 463 widget, "x", &value); | 468 widget, "x", &value); |
| 464 | 469 |
| 465 int child_y = std::max(half_view_height - (requisition.height / 2), 0); | 470 int child_y = std::max(half_view_height - (requisition.height / 2), 0); |
| 466 g_value_set_int(&value, child_y); | 471 g_value_set_int(&value, child_y); |
| 467 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 472 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
| 468 widget, "y", &value); | 473 widget, "y", &value); |
| 469 g_value_unset(&value); | 474 g_value_unset(&value); |
| 470 } | 475 } |
| 471 } | 476 } |
| OLD | NEW |