Chromium Code Reviews| Index: chrome/browser/ui/views/payments/view_stack.cc |
| diff --git a/chrome/browser/ui/views/payments/view_stack.cc b/chrome/browser/ui/views/payments/view_stack.cc |
| index 6551307e045c4acc5bdb874c61e0c001091d14ae..acc8af4e5d387a7525bfcb0643e76301ac5de88e 100644 |
| --- a/chrome/browser/ui/views/payments/view_stack.cc |
| +++ b/chrome/browser/ui/views/payments/view_stack.cc |
| @@ -49,6 +49,12 @@ void ViewStack::Push(std::unique_ptr<views::View> view, bool animate) { |
| } |
| view->set_owned_by_client(); |
| + |
| + // If we're pushing on top of an existing view, that view should be marked as |
| + // invisible. |
| + if (size()) |
|
anthonyvd
2017/06/16 15:48:21
Doesn't this make the view invisible before the an
|
| + stack_.back()->SetVisible(false); |
| + |
| // Add the new view to the stack so it can be popped later when navigating |
| // back to the previous screen. |
| stack_.push_back(std::move(view)); |
| @@ -56,9 +62,15 @@ void ViewStack::Push(std::unique_ptr<views::View> view, bool animate) { |
| } |
| void ViewStack::Pop() { |
| + DCHECK_LT(1u, size()); // There must be at least one view left after popping. |
| + |
| gfx::Rect destination = bounds(); |
| destination.set_origin(gfx::Point(width(), 0)); |
| + // Set the second-to-last view as visible, since it is about to be revealed |
| + // when the last view animates out. |
| + stack_[size() - 2]->SetVisible(true); |
| + |
| slide_out_animator_->AnimateViewTo( |
| stack_.back().get(), destination); |
| } |