Commit d6abb31c authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

message center: Speculative fix for focus ring partially not shown win7.

This is a regression from my previous cl crrev.com/c/2099291. I don't
have access to a win7 but this speculative fix readds the MessageView
specific HighlightPathGenerator which insets the ring a bit.

On my cros-linux you can see the ring is now within the notification
bounds.

Test: manual
Bug: 1067594
Change-Id: Iddaf378dc864f2a438d5a64174592faa4bf66c73
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2136054Reviewed-by: default avatarTim Song <tengs@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756450}
parent cbc61810
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "ui/views/background.h" #include "ui/views/background.h"
#include "ui/views/border.h" #include "ui/views/border.h"
#include "ui/views/controls/button/image_button.h" #include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/controls/image_view.h" #include "ui/views/controls/image_view.h"
#include "ui/views/controls/scroll_view.h" #include "ui/views/controls/scroll_view.h"
#include "ui/views/focus/focus_manager.h" #include "ui/views/focus/focus_manager.h"
...@@ -69,19 +68,12 @@ bool ShouldShowAeroShadowBorder() { ...@@ -69,19 +68,12 @@ bool ShouldShowAeroShadowBorder() {
// static // static
const char MessageView::kViewClassName[] = "MessageView"; const char MessageView::kViewClassName[] = "MessageView";
class MessageView::HighlightPathGenerator MessageView::HighlightPathGenerator::HighlightPathGenerator() = default;
: public views::HighlightPathGenerator {
public:
HighlightPathGenerator() = default;
// views::HighlightPathGenerator: SkPath MessageView::HighlightPathGenerator::GetHighlightPath(
SkPath GetHighlightPath(const views::View* view) override { const views::View* view) {
return static_cast<const MessageView*>(view)->GetHighlightPath(); return static_cast<const MessageView*>(view)->GetHighlightPath();
} }
private:
DISALLOW_COPY_AND_ASSIGN(HighlightPathGenerator);
};
MessageView::MessageView(const Notification& notification) MessageView::MessageView(const Notification& notification)
: notification_id_(notification.id()), slide_out_controller_(this, this) { : notification_id_(notification.id()), slide_out_controller_(this, this) {
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "ui/views/animation/slide_out_controller.h" #include "ui/views/animation/slide_out_controller.h"
#include "ui/views/animation/slide_out_controller_delegate.h" #include "ui/views/animation/slide_out_controller_delegate.h"
#include "ui/views/controls/focus_ring.h" #include "ui/views/controls/focus_ring.h"
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/focus/focus_manager.h" #include "ui/views/focus/focus_manager.h"
#include "ui/views/view.h" #include "ui/views/view.h"
...@@ -165,6 +166,16 @@ class MESSAGE_CENTER_EXPORT MessageView ...@@ -165,6 +166,16 @@ class MESSAGE_CENTER_EXPORT MessageView
std::string notification_id() const { return notification_id_; } std::string notification_id() const { return notification_id_; }
protected: protected:
class HighlightPathGenerator : public views::HighlightPathGenerator {
public:
HighlightPathGenerator();
HighlightPathGenerator(const HighlightPathGenerator&) = delete;
HighlightPathGenerator& operator=(const HighlightPathGenerator&) = delete;
// views::HighlightPathGenerator:
SkPath GetHighlightPath(const views::View* view) override;
};
virtual void UpdateControlButtonsVisibility(); virtual void UpdateControlButtonsVisibility();
// Changes the background color and schedules a paint. // Changes the background color and schedules a paint.
...@@ -174,15 +185,15 @@ class MESSAGE_CENTER_EXPORT MessageView ...@@ -174,15 +185,15 @@ class MESSAGE_CENTER_EXPORT MessageView
views::ScrollView* scroller() { return scroller_; } views::ScrollView* scroller() { return scroller_; }
base::ObserverList<Observer>::Unchecked* observers() { return &observers_; }
bool is_nested() const { return is_nested_; } bool is_nested() const { return is_nested_; }
base::ObserverList<Observer>::Unchecked* observers() { return &observers_; } views::FocusRing* focus_ring() { return focus_ring_.get(); }
private: private:
friend class test::MessagePopupCollectionTest; friend class test::MessagePopupCollectionTest;
class HighlightPathGenerator;
// Gets the highlight path for the notification based on bounds and corner // Gets the highlight path for the notification based on bounds and corner
// radii. // radii.
SkPath GetHighlightPath() const; SkPath GetHighlightPath() const;
......
...@@ -644,6 +644,10 @@ NotificationViewMD::NotificationViewMD(const Notification& notification) ...@@ -644,6 +644,10 @@ NotificationViewMD::NotificationViewMD(const Notification& notification)
views::HighlightPathGenerator::Install(this, views::HighlightPathGenerator::Install(this,
std::move(highlight_path_generator)); std::move(highlight_path_generator));
DCHECK(focus_ring());
focus_ring()->SetPathGenerator(
std::make_unique<MessageView::HighlightPathGenerator>());
UpdateCornerRadius(kNotificationCornerRadius, kNotificationCornerRadius); UpdateCornerRadius(kNotificationCornerRadius, kNotificationCornerRadius);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment