| 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/gtk/tabs/tab_renderer_gtk.h" | 5 #include "chrome/browser/gtk/tabs/tab_renderer_gtk.h" |
| 6 | 6 |
| 7 #include "app/gfx/canvas_paint.h" | 7 #include "app/gfx/canvas_paint.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 gtk_widget_hide(close_button_->widget()); | 508 gtk_widget_hide(close_button_->widget()); |
| 509 } | 509 } |
| 510 } | 510 } |
| 511 | 511 |
| 512 void TabRendererGtk::PaintTab(GdkEventExpose* event) { | 512 void TabRendererGtk::PaintTab(GdkEventExpose* event) { |
| 513 gfx::CanvasPaint canvas(event, false); | 513 gfx::CanvasPaint canvas(event, false); |
| 514 if (canvas.is_empty()) | 514 if (canvas.is_empty()) |
| 515 return; | 515 return; |
| 516 | 516 |
| 517 // The tab is rendered into a windowless widget whose offset is at the | 517 // The tab is rendered into a windowless widget whose offset is at the |
| 518 // coordinate [x(), y()]. Additionally, the parent widget is windowless, and | 518 // coordinate event->area. Translate by these offsets so we can render at |
| 519 // it has an offset of event->area. Translate by these offsets so we can | 519 // (0,0) to match Windows' rendering metrics. |
| 520 // render at (0,0) to match windows rendering metrics. | 520 canvas.TranslateInt(event->area.x, event->area.y); |
| 521 canvas.TranslateInt(x(), y() + event->area.y); | |
| 522 Paint(&canvas); | 521 Paint(&canvas); |
| 523 } | 522 } |
| 524 | 523 |
| 525 void TabRendererGtk::PaintTabBackground(gfx::Canvas* canvas) { | 524 void TabRendererGtk::PaintTabBackground(gfx::Canvas* canvas) { |
| 526 if (IsSelected()) { | 525 if (IsSelected()) { |
| 527 // Sometimes detaching a tab quickly can result in the model reporting it | 526 // Sometimes detaching a tab quickly can result in the model reporting it |
| 528 // as not being selected, so is_drag_clone_ ensures that we always paint | 527 // as not being selected, so is_drag_clone_ ensures that we always paint |
| 529 // the active representation for the dragged tab. | 528 // the active representation for the dragged tab. |
| 530 PaintActiveTabBackground(canvas); | 529 PaintActiveTabBackground(canvas); |
| 531 } else { | 530 } else { |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 gfx::Font base_font = rb.GetFont(ResourceBundle::BaseFont); | 741 gfx::Font base_font = rb.GetFont(ResourceBundle::BaseFont); |
| 743 title_font_ = new gfx::Font(gfx::Font::CreateFont(base_font.FontName(), 10)); | 742 title_font_ = new gfx::Font(gfx::Font::CreateFont(base_font.FontName(), 10)); |
| 744 title_font_height_ = title_font_->height(); | 743 title_font_height_ = title_font_->height(); |
| 745 | 744 |
| 746 InitializeLoadingAnimationData(&rb, &loading_animation_data); | 745 InitializeLoadingAnimationData(&rb, &loading_animation_data); |
| 747 | 746 |
| 748 crashed_fav_icon = rb.GetBitmapNamed(IDR_SAD_FAVICON); | 747 crashed_fav_icon = rb.GetBitmapNamed(IDR_SAD_FAVICON); |
| 749 | 748 |
| 750 initialized_ = true; | 749 initialized_ = true; |
| 751 } | 750 } |
| OLD | NEW |