OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/gtk/tabs/tab_renderer_gtk.h" | 5 #include "chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // The vertical and horizontal offset used to position the close button | 92 // The vertical and horizontal offset used to position the close button |
93 // in the tab. TODO(jhawkins): Ask pkasting what the Fuzz is about. | 93 // in the tab. TODO(jhawkins): Ask pkasting what the Fuzz is about. |
94 const int kCloseButtonVertFuzz = 0; | 94 const int kCloseButtonVertFuzz = 0; |
95 const int kCloseButtonHorzFuzz = 5; | 95 const int kCloseButtonHorzFuzz = 5; |
96 | 96 |
97 // Gets the bounds of |widget| relative to |parent|. | 97 // Gets the bounds of |widget| relative to |parent|. |
98 gfx::Rect GetWidgetBoundsRelativeToParent(GtkWidget* parent, | 98 gfx::Rect GetWidgetBoundsRelativeToParent(GtkWidget* parent, |
99 GtkWidget* widget) { | 99 GtkWidget* widget) { |
100 gfx::Point parent_pos = gtk_util::GetWidgetScreenPosition(parent); | 100 gfx::Point parent_pos = gtk_util::GetWidgetScreenPosition(parent); |
101 gfx::Point widget_pos = gtk_util::GetWidgetScreenPosition(widget); | 101 gfx::Point widget_pos = gtk_util::GetWidgetScreenPosition(widget); |
| 102 |
| 103 GtkAllocation allocation; |
| 104 gtk_widget_get_allocation(widget, &allocation); |
| 105 |
102 return gfx::Rect(widget_pos.x() - parent_pos.x(), | 106 return gfx::Rect(widget_pos.x() - parent_pos.x(), |
103 widget_pos.y() - parent_pos.y(), | 107 widget_pos.y() - parent_pos.y(), |
104 widget->allocation.width, widget->allocation.height); | 108 allocation.width, allocation.height); |
105 } | 109 } |
106 | 110 |
107 } // namespace | 111 } // namespace |
108 | 112 |
109 TabRendererGtk::LoadingAnimation::Data::Data( | 113 TabRendererGtk::LoadingAnimation::Data::Data( |
110 GtkThemeService* theme_service) { | 114 GtkThemeService* theme_service) { |
111 // The loading animation image is a strip of states. Each state must be | 115 // The loading animation image is a strip of states. Each state must be |
112 // square, so the height must divide the width evenly. | 116 // square, so the height must divide the width evenly. |
113 SkBitmap* loading_animation_frames = | 117 SkBitmap* loading_animation_frames = |
114 theme_service->GetBitmapNamed(IDR_THROBBER); | 118 theme_service->GetBitmapNamed(IDR_THROBBER); |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 | 1125 |
1122 close_button_width_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->width(); | 1126 close_button_width_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->width(); |
1123 close_button_height_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->height(); | 1127 close_button_height_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->height(); |
1124 | 1128 |
1125 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); | 1129 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); |
1126 title_font_ = new gfx::Font(base_font.GetFontName(), kFontPixelSize); | 1130 title_font_ = new gfx::Font(base_font.GetFontName(), kFontPixelSize); |
1127 title_font_height_ = title_font_->GetHeight(); | 1131 title_font_height_ = title_font_->GetHeight(); |
1128 | 1132 |
1129 initialized_ = true; | 1133 initialized_ = true; |
1130 } | 1134 } |
OLD | NEW |