| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 if (!close_button_bounds_.IsEmpty()) { | 806 if (!close_button_bounds_.IsEmpty()) { |
| 807 gtk_fixed_move(GTK_FIXED(tab_.get()), close_button_->widget(), | 807 gtk_fixed_move(GTK_FIXED(tab_.get()), close_button_->widget(), |
| 808 close_button_bounds_.x(), close_button_bounds_.y()); | 808 close_button_bounds_.x(), close_button_bounds_.y()); |
| 809 gtk_widget_show(close_button_->widget()); | 809 gtk_widget_show(close_button_->widget()); |
| 810 } else { | 810 } else { |
| 811 gtk_widget_hide(close_button_->widget()); | 811 gtk_widget_hide(close_button_->widget()); |
| 812 } | 812 } |
| 813 } | 813 } |
| 814 | 814 |
| 815 void TabRendererGtk::PaintTab(GtkWidget* widget, GdkEventExpose* event) { | 815 void TabRendererGtk::PaintTab(GtkWidget* widget, GdkEventExpose* event) { |
| 816 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); | 816 cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(widget)); |
| 817 gdk_cairo_rectangle(cr, &event->area); | 817 gdk_cairo_rectangle(cr, &event->area); |
| 818 cairo_clip(cr); | 818 cairo_clip(cr); |
| 819 | 819 |
| 820 // The tab is rendered into a windowless widget whose offset is at the | 820 // The tab is rendered into a windowless widget whose offset is at the |
| 821 // coordinate event->area. Translate by these offsets so we can render at | 821 // coordinate event->area. Translate by these offsets so we can render at |
| 822 // (0,0) to match Windows' rendering metrics. | 822 // (0,0) to match Windows' rendering metrics. |
| 823 cairo_matrix_t cairo_matrix; | 823 cairo_matrix_t cairo_matrix; |
| 824 cairo_matrix_init_translate(&cairo_matrix, event->area.x, event->area.y); | 824 cairo_matrix_init_translate(&cairo_matrix, event->area.x, event->area.y); |
| 825 cairo_set_matrix(cr, &cairo_matrix); | 825 cairo_set_matrix(cr, &cairo_matrix); |
| 826 | 826 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 | 1122 |
| 1123 close_button_width_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->width(); | 1123 close_button_width_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->width(); |
| 1124 close_button_height_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->height(); | 1124 close_button_height_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->height(); |
| 1125 | 1125 |
| 1126 const gfx::Font& base_font = rb.GetFont(ui::ResourceBundle::BaseFont); | 1126 const gfx::Font& base_font = rb.GetFont(ui::ResourceBundle::BaseFont); |
| 1127 title_font_ = new gfx::Font(base_font.GetFontName(), kFontPixelSize); | 1127 title_font_ = new gfx::Font(base_font.GetFontName(), kFontPixelSize); |
| 1128 title_font_height_ = title_font_->GetHeight(); | 1128 title_font_height_ = title_font_->GetHeight(); |
| 1129 | 1129 |
| 1130 initialized_ = true; | 1130 initialized_ = true; |
| 1131 } | 1131 } |
| OLD | NEW |