Commit 914acaf6 authored by Adithya Srinivasan's avatar Adithya Srinivasan Committed by Commit Bot

Revert "Ash Tray: Add fade out animation for notification controls when sliding."

This reverts commit 7e9b4790.

Reason for revert: Causing test failure on Msan bot https://ci.chromium.org/p/chromium/builders/ci/Linux%20ChromiumOS%20MSan%20Tests/12589

Original change's description:
> Ash Tray: Add fade out animation for notification controls when sliding.
> 
> This change removes a double slide animation when the user flings to
> dismiss a notification.
> 
> TEST=manually verified, new unit test
> BUG=933640
> 
> Change-Id: I7f9f4e558dfa53e8acf0abdbd86cf4449c1ea891
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1583344
> Commit-Queue: Tim Song <tengs@chromium.org>
> Reviewed-by: Tetsui Ohkubo <tetsui@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#654564}

TBR=tengs@chromium.org,tetsui@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 933640
Change-Id: Idb4c0f5be2dfc764db01b702ccd7a938b565ed0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1588435Reviewed-by: default avatarAdithya Srinivasan <adithyas@chromium.org>
Commit-Queue: Adithya Srinivasan <adithyas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#654855}
parent 486045d9
...@@ -29,10 +29,6 @@ constexpr int kSwipeControlButtonHorizontalMargin = 8; ...@@ -29,10 +29,6 @@ constexpr int kSwipeControlButtonHorizontalMargin = 8;
constexpr SkColor kSwipeControlBackgroundColor = constexpr SkColor kSwipeControlBackgroundColor =
SkColorSetRGB(0xee, 0xee, 0xee); SkColorSetRGB(0xee, 0xee, 0xee);
// The ratio to multiply with the swipe control width to get the width to
// display at full opacity when swiping.
constexpr float kSwipeControlFullOpacityRatio = 1.5f;
} // namespace message_center_style } // namespace message_center_style
} // namespace ash } // namespace ash
......
...@@ -88,19 +88,6 @@ void NotificationSwipeControlView::UpdateButtonsVisibility() { ...@@ -88,19 +88,6 @@ void NotificationSwipeControlView::UpdateButtonsVisibility() {
message_center_style::kSwipeControlButtonHorizontalMargin * message_center_style::kSwipeControlButtonHorizontalMargin *
(control_button_count + 1); (control_button_count + 1);
message_view_->SetSlideButtonWidth(control_button_width); message_view_->SetSlideButtonWidth(control_button_width);
// Update opacity based on the swipe progress. The swipe controls should
// gradually disappear as the user swipes the notification away.
float full_opacity_width =
message_center_style::kSwipeControlFullOpacityRatio *
control_button_width;
float fade_out_width = message_view_->width() - full_opacity_width;
DCHECK(fade_out_width > 0);
float swipe_progress = std::max(
0.0f, (fabs(gesture_amount) - full_opacity_width) / fade_out_width);
float opacity = std::max(0.0f, 1.0f - swipe_progress);
layer()->SetOpacity(opacity);
} }
void NotificationSwipeControlView::UpdateCornerRadius(int top_radius, void NotificationSwipeControlView::UpdateCornerRadius(int top_radius,
......
...@@ -157,10 +157,6 @@ class UnifiedMessageListView::MessageViewContainer ...@@ -157,10 +157,6 @@ class UnifiedMessageListView::MessageViewContainer
control_view_->UpdateButtonsVisibility(); control_view_->UpdateButtonsVisibility();
} }
void OnSlideOut(const std::string& notification_id) override {
is_slid_out_by_user_ = true;
}
gfx::Rect start_bounds() const { return start_bounds_; } gfx::Rect start_bounds() const { return start_bounds_; }
gfx::Rect ideal_bounds() const { return ideal_bounds_; } gfx::Rect ideal_bounds() const { return ideal_bounds_; }
bool is_removed() const { return is_removed_; } bool is_removed() const { return is_removed_; }
...@@ -175,8 +171,6 @@ class UnifiedMessageListView::MessageViewContainer ...@@ -175,8 +171,6 @@ class UnifiedMessageListView::MessageViewContainer
void set_is_removed() { is_removed_ = true; } void set_is_removed() { is_removed_ = true; }
bool is_slid_out_by_user() { return is_slid_out_by_user_; }
private: private:
// The bounds that the container starts animating from. If not animating, it's // The bounds that the container starts animating from. If not animating, it's
// ignored. // ignored.
...@@ -190,9 +184,6 @@ class UnifiedMessageListView::MessageViewContainer ...@@ -190,9 +184,6 @@ class UnifiedMessageListView::MessageViewContainer
// Unused if |state_| is not SLIDE_OUT. // Unused if |state_| is not SLIDE_OUT.
bool is_removed_ = false; bool is_removed_ = false;
// True if the notification is slid out completely by the user.
bool is_slid_out_by_user_ = false;
MessageView* const message_view_; MessageView* const message_view_;
NotificationSwipeControlView* const control_view_; NotificationSwipeControlView* const control_view_;
...@@ -343,12 +334,9 @@ void UnifiedMessageListView::OnNotificationRemoved(const std::string& id, ...@@ -343,12 +334,9 @@ void UnifiedMessageListView::OnNotificationRemoved(const std::string& id,
if (child) if (child)
child->set_is_removed(); child->set_is_removed();
if (child->is_slid_out_by_user())
DeleteRemovedNotifications();
UpdateBounds(); UpdateBounds();
state_ = child->is_slid_out_by_user() ? State::MOVE_DOWN : State::SLIDE_OUT; state_ = State::SLIDE_OUT;
StartAnimation(); StartAnimation();
} }
......
...@@ -512,29 +512,4 @@ TEST_F(UnifiedMessageListViewTest, ClearAllWithPinnedNotifications) { ...@@ -512,29 +512,4 @@ TEST_F(UnifiedMessageListViewTest, ClearAllWithPinnedNotifications) {
EXPECT_EQ(1u, message_list_view()->children().size()); EXPECT_EQ(1u, message_list_view()->children().size());
} }
TEST_F(UnifiedMessageListViewTest, UserSwipesAwayNotification) {
// Show message list with two notifications.
AddNotification();
AddNotification();
CreateMessageListView();
// Start swiping the notification away.
GetMessageViewAt(1)->OnSlideStarted();
GetMessageViewAt(1)->OnSlideChanged(true);
EXPECT_EQ(2u, MessageCenter::Get()->GetVisibleNotifications().size());
EXPECT_EQ(2u, message_list_view()->children().size());
// Swiping away the notification should remove it both in the MessageCenter
// and the MessageListView.
GetMessageViewAt(1)->OnSlideOut();
EXPECT_EQ(1u, MessageCenter::Get()->GetVisibleNotifications().size());
EXPECT_EQ(1u, message_list_view()->children().size());
// The next and only animation should be the move down animation.
int previous_height = message_list_view()->GetPreferredSize().height();
AnimateToEnd();
EXPECT_GT(previous_height, message_list_view()->GetPreferredSize().height());
EXPECT_FALSE(message_list_view()->IsAnimating());
}
} // namespace ash } // namespace ash
...@@ -320,9 +320,6 @@ void MessageView::AddSlideObserver(MessageView::SlideObserver* observer) { ...@@ -320,9 +320,6 @@ void MessageView::AddSlideObserver(MessageView::SlideObserver* observer) {
} }
void MessageView::OnSlideOut() { void MessageView::OnSlideOut() {
for (auto* observer : slide_observers_)
observer->OnSlideOut(notification_id_);
MessageCenter::Get()->RemoveNotification(notification_id_, MessageCenter::Get()->RemoveNotification(notification_id_,
true /* by_user */); true /* by_user */);
} }
......
...@@ -54,7 +54,6 @@ class MESSAGE_CENTER_EXPORT MessageView : public views::InkDropHostView, ...@@ -54,7 +54,6 @@ class MESSAGE_CENTER_EXPORT MessageView : public views::InkDropHostView,
virtual void OnSlideStarted(const std::string& notification_id) {} virtual void OnSlideStarted(const std::string& notification_id) {}
virtual void OnSlideChanged(const std::string& notification_id) {} virtual void OnSlideChanged(const std::string& notification_id) {}
virtual void OnSlideOut(const std::string& notification_id) {}
}; };
enum class Mode { enum class Mode {
......
...@@ -132,11 +132,9 @@ void SlideOutController::RestoreVisualState() { ...@@ -132,11 +132,9 @@ void SlideOutController::RestoreVisualState() {
gesture_amount_ = 0.f; gesture_amount_ = 0.f;
break; break;
case SwipeControlOpenState::OPEN_ON_RIGHT: case SwipeControlOpenState::OPEN_ON_RIGHT:
gesture_amount_ = -swipe_control_width_;
transform.Translate(-swipe_control_width_, 0); transform.Translate(-swipe_control_width_, 0);
break; break;
case SwipeControlOpenState::OPEN_ON_LEFT: case SwipeControlOpenState::OPEN_ON_LEFT:
gesture_amount_ = swipe_control_width_;
transform.Translate(swipe_control_width_, 0); transform.Translate(swipe_control_width_, 0);
break; break;
} }
......
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