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

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

Issue 2569773002: Fix SysTray focus rect position (Closed)
Patch Set: Remove GetFocusBounds() 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 | « ash/common/system/tray/tray_background_view.h ('k') | 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 } 561 }
562 562
563 void TrayBackgroundView::HandlePerformActionResult(bool action_performed, 563 void TrayBackgroundView::HandlePerformActionResult(bool action_performed,
564 const ui::Event& event) { 564 const ui::Event& event) {
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 void TrayBackgroundView::OnPaintFocus(gfx::Canvas* canvas) {
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 gfx::RectF paint_bounds(MaterialDesignController::IsShelfMaterial()
Evan Stade 2016/12/15 21:53:11 nit: instead of multiple ternaries I'd just use if
Greg Levin 2016/12/15 23:46:36 Heh... I wrote that version, then switched it back
576 } 576 ? GetBackgroundBounds()
577 577 : GetContentsBounds());
578 void TrayBackgroundView::OnPaintFocus(gfx::Canvas* canvas) { 578 paint_bounds.Inset(gfx::Insets(MaterialDesignController::IsShelfMaterial()
579 gfx::RectF paint_bounds(GetFocusBounds()); 579 ? -kFocusBorderThickness
580 paint_bounds.Inset(gfx::Insets(2, -2)); 580 : 1));
581 canvas->DrawSolidFocusRect(paint_bounds, kFocusBorderColor, 581 canvas->DrawSolidFocusRect(paint_bounds, kFocusBorderColor,
582 kFocusBorderThickness); 582 kFocusBorderThickness);
583 } 583 }
584 584
585 void TrayBackgroundView::OnPaint(gfx::Canvas* canvas) { 585 void TrayBackgroundView::OnPaint(gfx::Canvas* canvas) {
586 ActionableView::OnPaint(canvas); 586 ActionableView::OnPaint(canvas);
587 if (!MaterialDesignController::IsShelfMaterial() || 587 if (!MaterialDesignController::IsShelfMaterial() ||
588 shelf()->GetBackgroundType() == 588 shelf()->GetBackgroundType() ==
589 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT || 589 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT ||
590 !is_separator_visible_) { 590 !is_separator_visible_) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 } 637 }
638 638
639 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { 639 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const {
640 gfx::Insets insets = GetBackgroundInsets(); 640 gfx::Insets insets = GetBackgroundInsets();
641 gfx::Rect bounds = GetLocalBounds(); 641 gfx::Rect bounds = GetLocalBounds();
642 bounds.Inset(insets); 642 bounds.Inset(insets);
643 return bounds; 643 return bounds;
644 } 644 }
645 645
646 } // namespace ash 646 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/tray_background_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698