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/views/tabs/tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 float scale, | 520 float scale, |
521 const SkPath& fill, | 521 const SkPath& fill, |
522 gfx::Canvas* canvas) const { | 522 gfx::Canvas* canvas) const { |
523 // First we compute the background image coordinates and scale, in case we | 523 // First we compute the background image coordinates and scale, in case we |
524 // need to draw a custom background image. | 524 // need to draw a custom background image. |
525 const ui::ThemeProvider* tp = GetThemeProvider(); | 525 const ui::ThemeProvider* tp = GetThemeProvider(); |
526 bool custom_image; | 526 bool custom_image; |
527 const int bg_id = tab_strip_->GetBackgroundResourceId(&custom_image); | 527 const int bg_id = tab_strip_->GetBackgroundResourceId(&custom_image); |
528 // For custom tab backgrounds the background starts at the top of the tab | 528 // For custom tab backgrounds the background starts at the top of the tab |
529 // strip. Otherwise the background starts at the top of the frame. | 529 // strip. Otherwise the background starts at the top of the frame. |
530 const int offset_y = tp->HasCustomImage(bg_id) ? | 530 const int offset_y = tp->HasCustomImage(bg_id) ? 0 : background_offset_.y(); |
531 -GetLayoutConstant(TAB_TOP_EXCLUSION_HEIGHT) : background_offset_.y(); | |
532 // The new tab background is mirrored in RTL mode, but the theme background | 531 // The new tab background is mirrored in RTL mode, but the theme background |
533 // should never be mirrored. Mirror it here to compensate. | 532 // should never be mirrored. Mirror it here to compensate. |
534 float x_scale = 1.0f; | 533 float x_scale = 1.0f; |
535 int x = GetMirroredX() + background_offset_.x(); | 534 int x = GetMirroredX() + background_offset_.x(); |
536 const gfx::Size size(GetLayoutSize(NEW_TAB_BUTTON)); | 535 const gfx::Size size(GetLayoutSize(NEW_TAB_BUTTON)); |
537 if (base::i18n::IsRTL()) { | 536 if (base::i18n::IsRTL()) { |
538 x_scale = -1.0f; | 537 x_scale = -1.0f; |
539 // Offset by |width| such that the same region is painted as if there was no | 538 // Offset by |width| such that the same region is painted as if there was no |
540 // flip. | 539 // flip. |
541 x += size.width(); | 540 x += size.width(); |
(...skipping 2347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2889 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); | 2888 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); |
2890 if (view) | 2889 if (view) |
2891 return view; | 2890 return view; |
2892 } | 2891 } |
2893 Tab* tab = FindTabForEvent(point); | 2892 Tab* tab = FindTabForEvent(point); |
2894 if (tab) | 2893 if (tab) |
2895 return ConvertPointToViewAndGetEventHandler(this, tab, point); | 2894 return ConvertPointToViewAndGetEventHandler(this, tab, point); |
2896 } | 2895 } |
2897 return this; | 2896 return this; |
2898 } | 2897 } |
OLD | NEW |