Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: chrome/browser/ui/views/tabs/tab_strip.cc

Issue 1506203008: Allow background tab titles to use LCD AA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use new Skia API name Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 void TabStrip::PaintChildren(const ui::PaintContext& context) { 1425 void TabStrip::PaintChildren(const ui::PaintContext& context) {
1426 // The view order doesn't match the paint order (tabs_ contains the tab 1426 // The view order doesn't match the paint order (tabs_ contains the tab
1427 // ordering). Additionally we need to paint the tabs that are closing in 1427 // ordering). Additionally we need to paint the tabs that are closing in
1428 // |tabs_closing_map_|. 1428 // |tabs_closing_map_|.
1429 bool is_dragging = false; 1429 bool is_dragging = false;
1430 Tab* active_tab = NULL; 1430 Tab* active_tab = NULL;
1431 Tabs tabs_dragging; 1431 Tabs tabs_dragging;
1432 Tabs selected_tabs; 1432 Tabs selected_tabs;
1433 1433
1434 { 1434 {
1435 // TODO(pkasting): This results in greyscale AA for the tab titles. Work
1436 // with Mike Reed to fix, or else convert to passing the tabs a memory
1437 // canvas to paint on and then manually compositing.
1438 ui::CompositingRecorder opacity_recorder(context, size(), 1435 ui::CompositingRecorder opacity_recorder(context, size(),
1439 GetInactiveAlpha(false)); 1436 GetInactiveAlpha(false), true);
1440 1437
1441 PaintClosingTabs(tab_count(), context); 1438 PaintClosingTabs(tab_count(), context);
1442 1439
1443 int active_tab_index = -1; 1440 int active_tab_index = -1;
1444 for (int i = tab_count() - 1; i >= 0; --i) { 1441 for (int i = tab_count() - 1; i >= 0; --i) {
1445 Tab* tab = tab_at(i); 1442 Tab* tab = tab_at(i);
1446 if (tab->dragging() && !stacked_layout_) { 1443 if (tab->dragging() && !stacked_layout_) {
1447 is_dragging = true; 1444 is_dragging = true;
1448 if (tab->IsActive()) { 1445 if (tab->IsActive()) {
1449 active_tab = tab; 1446 active_tab = tab;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 // Next comes the active tab. 1484 // Next comes the active tab.
1488 if (active_tab && !is_dragging) 1485 if (active_tab && !is_dragging)
1489 active_tab->Paint(context); 1486 active_tab->Paint(context);
1490 1487
1491 // Paint the New Tab button. 1488 // Paint the New Tab button.
1492 const bool md = ui::MaterialDesignController::IsModeMaterial(); 1489 const bool md = ui::MaterialDesignController::IsModeMaterial();
1493 if (md && (newtab_button_->state() != views::CustomButton::STATE_PRESSED)) { 1490 if (md && (newtab_button_->state() != views::CustomButton::STATE_PRESSED)) {
1494 // Match the inactive tab opacity for non-pressed states. See comments in 1491 // Match the inactive tab opacity for non-pressed states. See comments in
1495 // NewTabButton::PaintFill() for why we don't do this for the pressed state. 1492 // NewTabButton::PaintFill() for why we don't do this for the pressed state.
1496 ui::CompositingRecorder opacity_recorder(context, size(), 1493 ui::CompositingRecorder opacity_recorder(context, size(),
1497 GetInactiveAlpha(true)); 1494 GetInactiveAlpha(true), false);
1498 newtab_button_->Paint(context); 1495 newtab_button_->Paint(context);
1499 } else { 1496 } else {
1500 newtab_button_->Paint(context); 1497 newtab_button_->Paint(context);
1501 } 1498 }
1502 1499
1503 // And the dragged tabs. 1500 // And the dragged tabs.
1504 for (size_t i = 0; i < tabs_dragging.size(); ++i) 1501 for (size_t i = 0; i < tabs_dragging.size(); ++i)
1505 tabs_dragging[i]->Paint(context); 1502 tabs_dragging[i]->Paint(context);
1506 1503
1507 // If the active tab is being dragged, it goes last. 1504 // If the active tab is being dragged, it goes last.
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
2850 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); 2847 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point);
2851 if (view) 2848 if (view)
2852 return view; 2849 return view;
2853 } 2850 }
2854 Tab* tab = FindTabForEvent(point); 2851 Tab* tab = FindTabForEvent(point);
2855 if (tab) 2852 if (tab)
2856 return ConvertPointToViewAndGetEventHandler(this, tab, point); 2853 return ConvertPointToViewAndGetEventHandler(this, tab, point);
2857 } 2854 }
2858 return this; 2855 return this;
2859 } 2856 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698