Commit 9442dd04 authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Unified: Change timing of stacking counter

This CL changes timing of stacking notification counter to appear in
UnifiedSystemTray. Combined with https://crrev.com/c/1215507, it fixes
top corner artifact of ARC++ notifications in UnifiedSystemTray.

TEST=manual
BUG=866777

Change-Id: I57f0ca846b129c18e7500d7738375644ff82157b
Reviewed-on: https://chromium-review.googlesource.com/1215602
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Reviewed-by: default avatarYoshiki Iguchi <yoshiki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590177}
parent 7dd9bf7c
...@@ -343,7 +343,7 @@ void MessageListView::SetBorderPadding() { ...@@ -343,7 +343,7 @@ void MessageListView::SetBorderPadding() {
gfx::Insets(message_center::kMarginBetweenItemsInList))); gfx::Insets(message_center::kMarginBetweenItemsInList)));
} }
int MessageListView::GetCountAboveVisibleRect() const { int MessageListView::GetCountAboveVisibleRect(int y_offset) const {
DCHECK(scroller_); DCHECK(scroller_);
int height = 0; int height = 0;
...@@ -358,7 +358,7 @@ int MessageListView::GetCountAboveVisibleRect() const { ...@@ -358,7 +358,7 @@ int MessageListView::GetCountAboveVisibleRect() const {
height += child->bounds().height() + padding; height += child->bounds().height() + padding;
padding = GetMarginBetweenItems(); padding = GetMarginBetweenItems();
if (height >= scroller_->GetVisibleRect().y()) if (height >= scroller_->GetVisibleRect().y() + y_offset)
return i; return i;
} }
return child_count(); return child_count();
......
...@@ -75,7 +75,7 @@ class ASH_EXPORT MessageListView ...@@ -75,7 +75,7 @@ class ASH_EXPORT MessageListView
void SetBorderPadding(); void SetBorderPadding();
// Get the number of notifications above ScrollView's visible rect. // Get the number of notifications above ScrollView's visible rect.
int GetCountAboveVisibleRect() const; int GetCountAboveVisibleRect(int y_offset) const;
// Get the distance from the bottom of ScrollView's visible rect to the bottom // Get the distance from the bottom of ScrollView's visible rect to the bottom
// of the notification list. // of the notification list.
......
...@@ -193,7 +193,9 @@ void UnifiedMessageCenterView::LayoutInternal(bool force) { ...@@ -193,7 +193,9 @@ void UnifiedMessageCenterView::LayoutInternal(bool force) {
scroller_->SetBoundsRect(GetContentsBounds()); scroller_->SetBoundsRect(GetContentsBounds());
bool was_visible = stacking_counter_->visible(); bool was_visible = stacking_counter_->visible();
stacking_counter_->SetCount(message_list_view_->GetCountAboveVisibleRect()); int y_offset = was_visible ? 0 : kStackingNotificationCounterHeight;
stacking_counter_->SetCount(
message_list_view_->GetCountAboveVisibleRect(y_offset));
// Only do the actual layout if counter visibility is changed or forced. // Only do the actual layout if counter visibility is changed or forced.
if (was_visible != stacking_counter_->visible() || force) { if (was_visible != stacking_counter_->visible() || force) {
......
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