| 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 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 // |tabs_closing_map_|. | 1467 // |tabs_closing_map_|. |
| 1468 bool is_dragging = false; | 1468 bool is_dragging = false; |
| 1469 Tab* active_tab = NULL; | 1469 Tab* active_tab = NULL; |
| 1470 Tabs tabs_dragging; | 1470 Tabs tabs_dragging; |
| 1471 Tabs selected_tabs; | 1471 Tabs selected_tabs; |
| 1472 | 1472 |
| 1473 { | 1473 { |
| 1474 // We pass false for |lcd_text_requires_opaque_layer| so that background | 1474 // We pass false for |lcd_text_requires_opaque_layer| so that background |
| 1475 // tab titles will get LCD AA. These are rendered opaquely on an opaque tab | 1475 // tab titles will get LCD AA. These are rendered opaquely on an opaque tab |
| 1476 // background before the layer is composited, so this is safe. | 1476 // background before the layer is composited, so this is safe. |
| 1477 ui::CompositingRecorder opacity_recorder(context, size(), | 1477 ui::CompositingRecorder opacity_recorder(context, GetInactiveAlpha(false), |
| 1478 GetInactiveAlpha(false), false); | 1478 false); |
| 1479 | 1479 |
| 1480 PaintClosingTabs(tab_count(), context); | 1480 PaintClosingTabs(tab_count(), context); |
| 1481 | 1481 |
| 1482 int active_tab_index = -1; | 1482 int active_tab_index = -1; |
| 1483 for (int i = tab_count() - 1; i >= 0; --i) { | 1483 for (int i = tab_count() - 1; i >= 0; --i) { |
| 1484 Tab* tab = tab_at(i); | 1484 Tab* tab = tab_at(i); |
| 1485 if (tab->dragging() && !stacked_layout_) { | 1485 if (tab->dragging() && !stacked_layout_) { |
| 1486 is_dragging = true; | 1486 is_dragging = true; |
| 1487 if (tab->IsActive()) { | 1487 if (tab->IsActive()) { |
| 1488 active_tab = tab; | 1488 active_tab = tab; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 if (active_tab && !is_dragging) | 1527 if (active_tab && !is_dragging) |
| 1528 active_tab->Paint(context); | 1528 active_tab->Paint(context); |
| 1529 | 1529 |
| 1530 // Paint the New Tab button. | 1530 // Paint the New Tab button. |
| 1531 const bool md = ui::MaterialDesignController::IsModeMaterial(); | 1531 const bool md = ui::MaterialDesignController::IsModeMaterial(); |
| 1532 if (md && (newtab_button_->state() != views::CustomButton::STATE_PRESSED)) { | 1532 if (md && (newtab_button_->state() != views::CustomButton::STATE_PRESSED)) { |
| 1533 // Match the inactive tab opacity for non-pressed states. See comments in | 1533 // Match the inactive tab opacity for non-pressed states. See comments in |
| 1534 // NewTabButton::PaintFill() for why we don't do this for the pressed state. | 1534 // NewTabButton::PaintFill() for why we don't do this for the pressed state. |
| 1535 // This call doesn't need to set |lcd_text_requires_opaque_layer| to false | 1535 // This call doesn't need to set |lcd_text_requires_opaque_layer| to false |
| 1536 // because no text will be drawn. | 1536 // because no text will be drawn. |
| 1537 ui::CompositingRecorder opacity_recorder(context, size(), | 1537 ui::CompositingRecorder opacity_recorder(context, GetInactiveAlpha(true), |
| 1538 GetInactiveAlpha(true), true); | 1538 true); |
| 1539 newtab_button_->Paint(context); | 1539 newtab_button_->Paint(context); |
| 1540 } else { | 1540 } else { |
| 1541 newtab_button_->Paint(context); | 1541 newtab_button_->Paint(context); |
| 1542 } | 1542 } |
| 1543 | 1543 |
| 1544 // And the dragged tabs. | 1544 // And the dragged tabs. |
| 1545 for (size_t i = 0; i < tabs_dragging.size(); ++i) | 1545 for (size_t i = 0; i < tabs_dragging.size(); ++i) |
| 1546 tabs_dragging[i]->Paint(context); | 1546 tabs_dragging[i]->Paint(context); |
| 1547 | 1547 |
| 1548 // If the active tab is being dragged, it goes last. | 1548 // If the active tab is being dragged, it goes last. |
| (...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2887 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); | 2887 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); |
| 2888 if (view) | 2888 if (view) |
| 2889 return view; | 2889 return view; |
| 2890 } | 2890 } |
| 2891 Tab* tab = FindTabForEvent(point); | 2891 Tab* tab = FindTabForEvent(point); |
| 2892 if (tab) | 2892 if (tab) |
| 2893 return ConvertPointToViewAndGetEventHandler(this, tab, point); | 2893 return ConvertPointToViewAndGetEventHandler(this, tab, point); |
| 2894 } | 2894 } |
| 2895 return this; | 2895 return this; |
| 2896 } | 2896 } |
| OLD | NEW |