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

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

Issue 2569773002: Fix SysTray focus rect position (Closed)
Patch Set: Rearrange MD checks 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;
576 } 576 if (MaterialDesignController::IsShelfMaterial()) {
577 577 paint_bounds = gfx::RectF(GetBackgroundBounds());
578 void TrayBackgroundView::OnPaintFocus(gfx::Canvas* canvas) { 578 paint_bounds.Inset(gfx::Insets(-kFocusBorderThickness));
579 gfx::RectF paint_bounds(GetFocusBounds()); 579 } else {
580 paint_bounds.Inset(gfx::Insets(2, -2)); 580 paint_bounds = gfx::RectF(GetContentsBounds());
581 paint_bounds.Inset(gfx::Insets(1));
582 }
581 canvas->DrawSolidFocusRect(paint_bounds, kFocusBorderColor, 583 canvas->DrawSolidFocusRect(paint_bounds, kFocusBorderColor,
582 kFocusBorderThickness); 584 kFocusBorderThickness);
583 } 585 }
584 586
585 void TrayBackgroundView::OnPaint(gfx::Canvas* canvas) { 587 void TrayBackgroundView::OnPaint(gfx::Canvas* canvas) {
586 ActionableView::OnPaint(canvas); 588 ActionableView::OnPaint(canvas);
587 if (!MaterialDesignController::IsShelfMaterial() || 589 if (!MaterialDesignController::IsShelfMaterial() ||
588 shelf()->GetBackgroundType() == 590 shelf()->GetBackgroundType() ==
589 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT || 591 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT ||
590 !is_separator_visible_) { 592 !is_separator_visible_) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 } 639 }
638 640
639 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { 641 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const {
640 gfx::Insets insets = GetBackgroundInsets(); 642 gfx::Insets insets = GetBackgroundInsets();
641 gfx::Rect bounds = GetLocalBounds(); 643 gfx::Rect bounds = GetLocalBounds();
642 bounds.Inset(insets); 644 bounds.Inset(insets);
643 return bounds; 645 return bounds;
644 } 646 }
645 647
646 } // namespace ash 648 } // 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