| Index: third_party/WebKit/Source/platform/scroll/ProgrammaticScrollCoordinator.cpp
|
| diff --git a/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollCoordinator.cpp b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollCoordinator.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4f48ecb290444765951d43bb82416d53acb7c272
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollCoordinator.cpp
|
| @@ -0,0 +1,48 @@
|
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +#include "platform/scroll/ProgrammaticScrollCoordinator.h"
|
| +
|
| +#include "platform/scroll/ProgrammaticScrollAnimator.h"
|
| +#include "platform/scroll/ScrollableArea.h"
|
| +
|
| +namespace blink {
|
| +
|
| +ProgrammaticScrollCoordinator* ProgrammaticScrollCoordinator::create() {
|
| + return new ProgrammaticScrollCoordinator();
|
| +}
|
| +
|
| +ProgrammaticScrollCoordinator::ProgrammaticScrollCoordinator() {}
|
| +
|
| +ProgrammaticScrollCoordinator::~ProgrammaticScrollCoordinator() {}
|
| +
|
| +void ProgrammaticScrollCoordinator::queueAnimation(ScrollableArea* scrollable,
|
| + ScrollOffset offset) {
|
| + ScrollerAndOffsetPair scrollerOffset(scrollable, offset);
|
| + m_queue.push_back(scrollerOffset);
|
| +}
|
| +
|
| +void ProgrammaticScrollCoordinator::runQueuedAnimations() {
|
| + if (!m_queue.empty()) {
|
| + ScrollerAndOffsetPair scrollerOffset = m_queue.back();
|
| + ScrollableArea* scrollable = scrollerOffset.first;
|
| + ScrollOffset offset = scrollerOffset.second;
|
| + scrollable->programmaticScrollAnimator().animateToOffset(offset);
|
| + }
|
| +}
|
| +
|
| +void ProgrammaticScrollCoordinator::notifyAnimationFinished() {
|
| + m_queue.pop_back();
|
| + if (!m_queue.empty()) {
|
| + ScrollerAndOffsetPair scrollerOffset = m_queue.back();
|
| + ScrollableArea* scrollable = scrollerOffset.first;
|
| + ScrollOffset offset = scrollerOffset.second;
|
| + scrollable->programmaticScrollAnimator().animateToOffset(offset);
|
| + }
|
| +}
|
| +
|
| +void ProgrammaticScrollCoordinator::abortAnimations() {
|
| + m_queue.clear();
|
| +}
|
| +
|
| +} // namespace blink
|
|
|