| Index: third_party/WebKit/Source/core/page/scrolling/ChildViewportScrollCallback.cpp
|
| diff --git a/third_party/WebKit/Source/core/page/scrolling/ChildViewportScrollCallback.cpp b/third_party/WebKit/Source/core/page/scrolling/ChildViewportScrollCallback.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3d0fb271454dee99147c650b5b8fbba8eba5455b
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/page/scrolling/ChildViewportScrollCallback.cpp
|
| @@ -0,0 +1,50 @@
|
| +// Copyright 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 "core/page/scrolling/ChildViewportScrollCallback.h"
|
| +
|
| +#include "core/page/scrolling/ScrollState.h"
|
| +#include "platform/geometry/FloatSize.h"
|
| +#include "platform/scroll/ScrollTypes.h"
|
| +#include "platform/scroll/ScrollableArea.h"
|
| +
|
| +namespace blink {
|
| +
|
| +ChildViewportScrollCallback::ChildViewportScrollCallback()
|
| +{
|
| +}
|
| +
|
| +ChildViewportScrollCallback::~ChildViewportScrollCallback()
|
| +{
|
| +}
|
| +
|
| +DEFINE_TRACE(ChildViewportScrollCallback)
|
| +{
|
| + visitor->trace(m_scroller);
|
| + ViewportScrollCallback::trace(visitor);
|
| +}
|
| +
|
| +
|
| +void ChildViewportScrollCallback::handleEvent(ScrollState* state)
|
| +{
|
| + if (!m_scroller)
|
| + return;
|
| +
|
| + FloatSize delta(state->deltaX(), state->deltaY());
|
| + ScrollGranularity granularity =
|
| + ScrollGranularity(static_cast<int>(state->deltaGranularity()));
|
| +
|
| + ScrollResult result = m_scroller->userScroll(granularity, delta);
|
| +
|
| + state->consumeDeltaNative(
|
| + delta.width() - result.unusedScrollDeltaX,
|
| + delta.height() - result.unusedScrollDeltaY);
|
| +}
|
| +
|
| +void ChildViewportScrollCallback::setScroller(ScrollableArea* scroller)
|
| +{
|
| + m_scroller = scroller;
|
| +}
|
| +
|
| +} // namespace blink
|
|
|