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

Unified Diff: cc/input/scroll_state.cc

Issue 1215183004: Arrange compositor scrolling into scroll customization format (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nit. Created 5 years, 5 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 | « cc/input/scroll_state.h ('k') | cc/input/scroll_state_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/input/scroll_state.cc
diff --git a/cc/input/scroll_state.cc b/cc/input/scroll_state.cc
new file mode 100644
index 0000000000000000000000000000000000000000..52a0cca694325a1ef1eb85e4bd4fa75e4f38f776
--- /dev/null
+++ b/cc/input/scroll_state.cc
@@ -0,0 +1,46 @@
+// Copyright 2015 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 "cc/input/scroll_state.h"
+
+#include "cc/layers/layer_impl.h"
+
+namespace cc {
+
+ScrollState::ScrollState(double delta_x,
+ double delta_y,
+ int start_position_x,
+ int start_position_y,
+ bool should_propagate,
+ bool delta_consumed_for_scroll_sequence,
+ bool is_direct_manipulation)
+ : delta_x_(delta_x),
+ delta_y_(delta_y),
+ start_position_x_(start_position_x),
+ start_position_y_(start_position_y),
+ should_propagate_(should_propagate),
+ delta_consumed_for_scroll_sequence_(delta_consumed_for_scroll_sequence),
+ is_direct_manipulation_(is_direct_manipulation),
+ caused_scroll_x_(false),
+ caused_scroll_y_(false) {}
+
+ScrollState::~ScrollState() {}
+
+void ScrollState::ConsumeDelta(double x, double y) {
+ delta_x_ -= x;
+ delta_y_ -= y;
+
+ if (x || y)
+ delta_consumed_for_scroll_sequence_ = true;
+}
+
+void ScrollState::DistributeToScrollChainDescendant() {
+ if (!scroll_chain_.empty()) {
+ LayerImpl* next = scroll_chain_.front();
+ scroll_chain_.pop_front();
+ next->DistributeScroll(this);
+ }
+}
+
+} // namespace cc
« no previous file with comments | « cc/input/scroll_state.h ('k') | cc/input/scroll_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698