Commit 6d4ce3ab authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Eliminate ViewStack::Layout().

This is really a bounds change handler.

Bug: 1005568
Change-Id: I1e33f4e44ae517257e52b44a9cfcaa4abe5a487e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1817292
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698717}
parent 47c735e4
......@@ -97,21 +97,6 @@ bool ViewStack::CanProcessEventsWithinSubtree() const {
!slide_out_animator_->IsAnimating();
}
void ViewStack::Layout() {
views::View::Layout();
// If this view's bounds changed since the beginning of an animation, the
// animator's targets have to be changed as well.
gfx::Rect in_new_destination = bounds();
in_new_destination.set_origin(gfx::Point(0, 0));
UpdateAnimatorBounds(slide_in_animator_.get(), in_new_destination);
gfx::Rect out_new_destination = bounds();
out_new_destination.set_origin(gfx::Point(width(), 0));
UpdateAnimatorBounds(slide_out_animator_.get(), out_new_destination);
}
void ViewStack::RequestFocus() {
// The view can only be focused if it has a widget already. It's possible that
// this isn't the case if some views are pushed before the stack is added to a
......@@ -120,6 +105,11 @@ void ViewStack::RequestFocus() {
top()->RequestFocus();
}
void ViewStack::OnBoundsChanged(const gfx::Rect& previous_bounds) {
UpdateAnimatorBounds(slide_in_animator_.get(), GetLocalBounds());
UpdateAnimatorBounds(slide_out_animator_.get(), {{width(), 0}, View::size()});
}
void ViewStack::HideCoveredViews() {
// Iterate through all but the last (topmost) view.
for (size_t i = 0; i + 1 < size(); i++) {
......
......@@ -49,8 +49,8 @@ class ViewStack : public views::BoundsAnimatorObserver,
// The children of this view must not be able to process events when the views
// are being animated so this returns false when an animation is in progress.
bool CanProcessEventsWithinSubtree() const override;
void Layout() override;
void RequestFocus() override;
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
// Returns the top state of the stack.
views::View* top() { return stack_.back().get(); }
......
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