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

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: Review comments 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 1435 // We pass false for |lcd_text_requires_opaque_layer| so that background
danakj 2015/12/11 22:44:02 Ya this works :)
1436 // with Mike Reed to fix, or else convert to passing the tabs a memory 1436 // tab titles will get LCD AA. These are rendered opaquely on an opaque tab
1437 // canvas to paint on and then manually compositing. 1437 // background before the layer is composited, so this is safe.
1438 ui::CompositingRecorder opacity_recorder(context, size(), 1438 ui::CompositingRecorder opacity_recorder(context, size(),
1439 GetInactiveAlpha(false)); 1439 GetInactiveAlpha(false), false);
1440 1440
1441 PaintClosingTabs(tab_count(), context); 1441 PaintClosingTabs(tab_count(), context);
1442 1442
1443 int active_tab_index = -1; 1443 int active_tab_index = -1;
1444 for (int i = tab_count() - 1; i >= 0; --i) { 1444 for (int i = tab_count() - 1; i >= 0; --i) {
1445 Tab* tab = tab_at(i); 1445 Tab* tab = tab_at(i);
1446 if (tab->dragging() && !stacked_layout_) { 1446 if (tab->dragging() && !stacked_layout_) {
1447 is_dragging = true; 1447 is_dragging = true;
1448 if (tab->IsActive()) { 1448 if (tab->IsActive()) {
1449 active_tab = tab; 1449 active_tab = tab;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 1486
1487 // Next comes the active tab. 1487 // Next comes the active tab.
1488 if (active_tab && !is_dragging) 1488 if (active_tab && !is_dragging)
1489 active_tab->Paint(context); 1489 active_tab->Paint(context);
1490 1490
1491 // Paint the New Tab button. 1491 // Paint the New Tab button.
1492 const bool md = ui::MaterialDesignController::IsModeMaterial(); 1492 const bool md = ui::MaterialDesignController::IsModeMaterial();
1493 if (md && (newtab_button_->state() != views::CustomButton::STATE_PRESSED)) { 1493 if (md && (newtab_button_->state() != views::CustomButton::STATE_PRESSED)) {
1494 // Match the inactive tab opacity for non-pressed states. See comments in 1494 // 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. 1495 // NewTabButton::PaintFill() for why we don't do this for the pressed state.
1496 // This call doesn't need to set |lcd_text_requires_opaque_layer| to false
1497 // because no text will be drawn.
1496 ui::CompositingRecorder opacity_recorder(context, size(), 1498 ui::CompositingRecorder opacity_recorder(context, size(),
1497 GetInactiveAlpha(true)); 1499 GetInactiveAlpha(true), true);
1498 newtab_button_->Paint(context); 1500 newtab_button_->Paint(context);
1499 } else { 1501 } else {
1500 newtab_button_->Paint(context); 1502 newtab_button_->Paint(context);
1501 } 1503 }
1502 1504
1503 // And the dragged tabs. 1505 // And the dragged tabs.
1504 for (size_t i = 0; i < tabs_dragging.size(); ++i) 1506 for (size_t i = 0; i < tabs_dragging.size(); ++i)
1505 tabs_dragging[i]->Paint(context); 1507 tabs_dragging[i]->Paint(context);
1506 1508
1507 // If the active tab is being dragged, it goes last. 1509 // 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); 2852 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point);
2851 if (view) 2853 if (view)
2852 return view; 2854 return view;
2853 } 2855 }
2854 Tab* tab = FindTabForEvent(point); 2856 Tab* tab = FindTabForEvent(point);
2855 if (tab) 2857 if (tab)
2856 return ConvertPointToViewAndGetEventHandler(this, tab, point); 2858 return ConvertPointToViewAndGetEventHandler(this, tab, point);
2857 } 2859 }
2858 return this; 2860 return this;
2859 } 2861 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698