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

Side by Side Diff: ash/common/system/tray/tray_background_view.cc

Issue 2569773002: Fix SysTray focus rect position (Closed)
Patch Set: Remove magic numbers (mostly), Merge Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/common/system/tray/tray_background_view.h" 5 #include "ash/common/system/tray/tray_background_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/common/ash_constants.h" 9 #include "ash/common/ash_constants.h"
10 #include "ash/common/material_design/material_design_controller.h" 10 #include "ash/common/material_design/material_design_controller.h"
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 // When an action is performed, ink drop ripple is handled in SetIsActive(). 565 // When an action is performed, ink drop ripple is handled in SetIsActive().
566 if (action_performed) 566 if (action_performed)
567 return; 567 return;
568 ActionableView::HandlePerformActionResult(action_performed, event); 568 ActionableView::HandlePerformActionResult(action_performed, event);
569 } 569 }
570 570
571 gfx::Rect TrayBackgroundView::GetFocusBounds() { 571 gfx::Rect TrayBackgroundView::GetFocusBounds() {
572 // The tray itself expands to the right and bottom edge of the screen to make 572 // The tray itself expands to the right and bottom edge of the screen to make
573 // sure clicking on the edges brings up the popup. However, the focus border 573 // sure clicking on the edges brings up the popup. However, the focus border
574 // should be only around the container. 574 // should be only around the container.
575 return GetContentsBounds(); 575 return MaterialDesignController::IsShelfMaterial() ? GetBackgroundBounds()
576 : GetContentsBounds();
576 } 577 }
577 578
578 void TrayBackgroundView::OnPaintFocus(gfx::Canvas* canvas) { 579 void TrayBackgroundView::OnPaintFocus(gfx::Canvas* canvas) {
579 gfx::RectF paint_bounds(GetFocusBounds()); 580 gfx::RectF paint_bounds(GetFocusBounds());
580 paint_bounds.Inset(gfx::Insets(2, -2)); 581 paint_bounds.Inset(gfx::Insets(MaterialDesignController::IsShelfMaterial()
582 ? -kFocusBorderThickness
Evan Stade 2016/12/15 17:38:00 this looks much better, but GetFocusBounds is stil
Greg Levin 2016/12/15 21:08:57 Done. Also got rid of ActionableView::GetFocusBou
583 : 1));
581 canvas->DrawSolidFocusRect(paint_bounds, kFocusBorderColor, 584 canvas->DrawSolidFocusRect(paint_bounds, kFocusBorderColor,
582 kFocusBorderThickness); 585 kFocusBorderThickness);
583 } 586 }
584 587
585 void TrayBackgroundView::OnPaint(gfx::Canvas* canvas) { 588 void TrayBackgroundView::OnPaint(gfx::Canvas* canvas) {
586 ActionableView::OnPaint(canvas); 589 ActionableView::OnPaint(canvas);
587 if (!MaterialDesignController::IsShelfMaterial() || 590 if (!MaterialDesignController::IsShelfMaterial() ||
588 shelf()->GetBackgroundType() == 591 shelf()->GetBackgroundType() ==
589 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT || 592 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT ||
590 !is_separator_visible_) { 593 !is_separator_visible_) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 } 640 }
638 641
639 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { 642 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const {
640 gfx::Insets insets = GetBackgroundInsets(); 643 gfx::Insets insets = GetBackgroundInsets();
641 gfx::Rect bounds = GetLocalBounds(); 644 gfx::Rect bounds = GetLocalBounds();
642 bounds.Inset(insets); 645 bounds.Inset(insets);
643 return bounds; 646 return bounds;
644 } 647 }
645 648
646 } // namespace ash 649 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698