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 <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 bool custom_image; | 401 bool custom_image; |
402 const int bg_id = tab_strip_->GetBackgroundResourceId(&custom_image); | 402 const int bg_id = tab_strip_->GetBackgroundResourceId(&custom_image); |
403 | 403 |
404 // Draw the fill background image. | 404 // Draw the fill background image. |
405 const gfx::Size size(GetNewTabButtonSize()); | 405 const gfx::Size size(GetNewTabButtonSize()); |
406 ui::ThemeProvider* theme_provider = GetThemeProvider(); | 406 ui::ThemeProvider* theme_provider = GetThemeProvider(); |
407 gfx::ImageSkia* background = theme_provider->GetImageSkiaNamed(bg_id); | 407 gfx::ImageSkia* background = theme_provider->GetImageSkiaNamed(bg_id); |
408 // For custom tab backgrounds the background starts at the top of the tab | 408 // For custom tab backgrounds the background starts at the top of the tab |
409 // strip. Otherwise the background starts at the top of the frame. | 409 // strip. Otherwise the background starts at the top of the frame. |
410 const int offset_y = theme_provider->HasCustomImage(bg_id) ? | 410 const int offset_y = theme_provider->HasCustomImage(bg_id) ? |
411 0 : background_offset_.y(); | 411 -GetLayoutConstant(TAB_TOP_EXCLUSION_HEIGHT) : background_offset_.y(); |
412 | 412 |
413 // The new tab background is mirrored in RTL mode, but the theme background | 413 // The new tab background is mirrored in RTL mode, but the theme background |
414 // should never be mirrored. Mirror it here to compensate. | 414 // should never be mirrored. Mirror it here to compensate. |
415 float x_scale = 1.0f; | 415 float x_scale = 1.0f; |
416 int x = GetMirroredX() + background_offset_.x(); | 416 int x = GetMirroredX() + background_offset_.x(); |
417 if (base::i18n::IsRTL()) { | 417 if (base::i18n::IsRTL()) { |
418 x_scale = -1.0f; | 418 x_scale = -1.0f; |
419 // Offset by |width| such that the same region is painted as if there was | 419 // Offset by |width| such that the same region is painted as if there was |
420 // no flip. | 420 // no flip. |
421 x += size.width(); | 421 x += size.width(); |
(...skipping 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2681 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); | 2681 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); |
2682 if (view) | 2682 if (view) |
2683 return view; | 2683 return view; |
2684 } | 2684 } |
2685 Tab* tab = FindTabForEvent(point); | 2685 Tab* tab = FindTabForEvent(point); |
2686 if (tab) | 2686 if (tab) |
2687 return ConvertPointToViewAndGetEventHandler(this, tab, point); | 2687 return ConvertPointToViewAndGetEventHandler(this, tab, point); |
2688 } | 2688 } |
2689 return this; | 2689 return this; |
2690 } | 2690 } |
OLD | NEW |