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

Unified Diff: chrome/browser/ui/views/payments/view_stack.cc

Issue 2942943002: [WebPayments] Setting hidden views in view stack invisible (Closed)
Patch Set: Created 3 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698