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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
568 | 568 |
569 void TabContentsViewGtk::OnTabCrashed() { | 569 void TabContentsViewGtk::OnTabCrashed() { |
570 if (!sad_tab_.get()) { | 570 if (!sad_tab_.get()) { |
571 sad_tab_.reset(new SadTabGtk); | 571 sad_tab_.reset(new SadTabGtk); |
572 InsertIntoContentArea(sad_tab_->widget()); | 572 InsertIntoContentArea(sad_tab_->widget()); |
573 gtk_widget_show(sad_tab_->widget()); | 573 gtk_widget_show(sad_tab_->widget()); |
574 } | 574 } |
575 } | 575 } |
576 | 576 |
577 void TabContentsViewGtk::SizeContents(const gfx::Size& size) { | 577 void TabContentsViewGtk::SizeContents(const gfx::Size& size) { |
578 // This function is a hack and should go away. In any case we don't manually | 578 // We don't normally need to manually set the size of of widgets in GTK+, |
579 // control the size of the contents on linux, so do nothing. | 579 // but this is used when creating background tabs. When a tab is created in |
580 // the background, we need to set the size so WebKit can properly compute | |
581 // the scrolling offset if a #ref is provided. | |
582 if (tab_contents()->render_widget_host_view()) { | |
Nate Chapin
2009/08/13 18:24:36
I don't have a great understanding of this layer o
Evan Stade
2009/08/13 18:30:52
The tab contents view doesn't own the RWHV, so no.
| |
583 GtkWidget* widget = | |
584 tab_contents()->render_widget_host_view()->GetNativeView(); | |
585 widget->allocation.width = size.width(); | |
586 widget->allocation.height = size.height(); | |
587 } | |
580 } | 588 } |
581 | 589 |
582 void TabContentsViewGtk::Focus() { | 590 void TabContentsViewGtk::Focus() { |
583 if (tab_contents()->showing_interstitial_page()) { | 591 if (tab_contents()->showing_interstitial_page()) { |
584 tab_contents()->interstitial_page()->Focus(); | 592 tab_contents()->interstitial_page()->Focus(); |
585 } else { | 593 } else { |
586 GtkWidget* widget = GetContentNativeView(); | 594 GtkWidget* widget = GetContentNativeView(); |
587 if (widget) | 595 if (widget) |
588 gtk_widget_grab_focus(widget); | 596 gtk_widget_grab_focus(widget); |
589 } | 597 } |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
758 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 766 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
759 widget, "x", &value); | 767 widget, "x", &value); |
760 | 768 |
761 int child_y = std::max(half_view_height - (requisition.height / 2), 0); | 769 int child_y = std::max(half_view_height - (requisition.height / 2), 0); |
762 g_value_set_int(&value, child_y); | 770 g_value_set_int(&value, child_y); |
763 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 771 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
764 widget, "y", &value); | 772 widget, "y", &value); |
765 g_value_unset(&value); | 773 g_value_unset(&value); |
766 } | 774 } |
767 } | 775 } |
OLD | NEW |