| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_INPUT_INPUT_HANDLER_H_ | 5 #ifndef CC_INPUT_INPUT_HANDLER_H_ |
| 6 #define CC_INPUT_INPUT_HANDLER_H_ | 6 #define CC_INPUT_INPUT_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
| 12 #include "cc/input/main_thread_scrolling_reason.h" |
| 12 #include "cc/input/scroll_state.h" | 13 #include "cc/input/scroll_state.h" |
| 13 #include "cc/input/scrollbar.h" | 14 #include "cc/input/scrollbar.h" |
| 14 #include "cc/trees/swap_promise_monitor.h" | 15 #include "cc/trees/swap_promise_monitor.h" |
| 15 | 16 |
| 16 namespace gfx { | 17 namespace gfx { |
| 17 class Point; | 18 class Point; |
| 18 class PointF; | 19 class PointF; |
| 19 class ScrollOffset; | 20 class ScrollOffset; |
| 20 class SizeF; | 21 class SizeF; |
| 21 class Vector2d; | 22 class Vector2d; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // interface and bind it to the handler on the compositor thread. | 76 // interface and bind it to the handler on the compositor thread. |
| 76 class CC_EXPORT InputHandler { | 77 class CC_EXPORT InputHandler { |
| 77 public: | 78 public: |
| 78 // Note these are used in a histogram. Do not reorder or delete existing | 79 // Note these are used in a histogram. Do not reorder or delete existing |
| 79 // entries. | 80 // entries. |
| 80 enum ScrollThread { | 81 enum ScrollThread { |
| 81 SCROLL_ON_MAIN_THREAD = 0, | 82 SCROLL_ON_MAIN_THREAD = 0, |
| 82 SCROLL_ON_IMPL_THREAD, | 83 SCROLL_ON_IMPL_THREAD, |
| 83 SCROLL_IGNORED, | 84 SCROLL_IGNORED, |
| 84 SCROLL_UNKNOWN, | 85 SCROLL_UNKNOWN, |
| 85 // This must be the last entry. | 86 LAST_SCROLL_STATUS = SCROLL_UNKNOWN |
| 86 ScrollStatusCount | |
| 87 }; | |
| 88 | |
| 89 // Ensure this stays in sync with MainThreadScrollingReason in histograms.xml, | |
| 90 // and that this extends ScrollingCoordinator::MainThreadScrollingReason. | |
| 91 // ScrollingCoordinator::MainThreadScrollingReason contains the flags | |
| 92 // which are associated with a layer. The flags only contained in | |
| 93 // InputHandler::MainThreadScrollingReason are computed for each scroll | |
| 94 // begin. | |
| 95 enum MainThreadScrollingReason { | |
| 96 NOT_SCROLLING_ON_MAIN = 0, | |
| 97 HAS_BACKGROUND_ATTACHMENT_FIXED_OBJECTS = 1 << 0, | |
| 98 HAS_NON_LAYER_VIEWPORT_CONSTRAINED_OBJECTS = 1 << 1, | |
| 99 THREADED_SCROLLING_DISABLED = 1 << 2, | |
| 100 SCROLL_BAR_SCROLLING = 1 << 3, | |
| 101 PAGE_OVERLAY = 1 << 4, | |
| 102 MaxNonTransientScrollingReason = PAGE_OVERLAY, | |
| 103 NON_FAST_SCROLLABLE_REGION = 1 << 5, | |
| 104 EVENT_HANDLERS = 1 << 6, | |
| 105 FAILED_HIT_TEST = 1 << 7, | |
| 106 NO_SCROLLING_LAYER = 1 << 8, | |
| 107 NOT_SCROLLABLE = 1 << 9, | |
| 108 CONTINUING_MAIN_THREAD_SCROLL = 1 << 10, | |
| 109 NON_INVERTIBLE_TRANSFORM = 1 << 11, | |
| 110 MainThreadScrollingReasonCount = 13 | |
| 111 }; | 87 }; |
| 112 | 88 |
| 113 struct ScrollStatus { | 89 struct ScrollStatus { |
| 114 ScrollStatus() | 90 ScrollStatus() |
| 115 : thread(SCROLL_ON_IMPL_THREAD), | 91 : thread(SCROLL_ON_IMPL_THREAD), |
| 116 main_thread_scrolling_reasons(NOT_SCROLLING_ON_MAIN) {} | 92 main_thread_scrolling_reasons( |
| 117 ScrollStatus(ScrollThread thread, | 93 MainThreadScrollingReason::kNotScrollingOnMain) {} |
| 118 MainThreadScrollingReason main_thread_scrolling_reasons) | 94 ScrollStatus(ScrollThread thread, uint32_t main_thread_scrolling_reasons) |
| 119 : thread(thread), | 95 : thread(thread), |
| 120 main_thread_scrolling_reasons(main_thread_scrolling_reasons) {} | 96 main_thread_scrolling_reasons(main_thread_scrolling_reasons) {} |
| 121 ScrollThread thread; | 97 ScrollThread thread; |
| 122 MainThreadScrollingReason main_thread_scrolling_reasons; | 98 uint32_t main_thread_scrolling_reasons; |
| 123 }; | 99 }; |
| 124 | 100 |
| 125 enum ScrollInputType { GESTURE, WHEEL, ANIMATED_WHEEL, NON_BUBBLING_GESTURE }; | 101 enum ScrollInputType { GESTURE, WHEEL, ANIMATED_WHEEL, NON_BUBBLING_GESTURE }; |
| 126 | 102 |
| 127 // Binds a client to this handler to receive notifications. Only one client | 103 // Binds a client to this handler to receive notifications. Only one client |
| 128 // can be bound to an InputHandler. The client must live at least until the | 104 // can be bound to an InputHandler. The client must live at least until the |
| 129 // handler calls WillShutdown() on the client. | 105 // handler calls WillShutdown() on the client. |
| 130 virtual void BindToClient(InputHandlerClient* client) = 0; | 106 virtual void BindToClient(InputHandlerClient* client) = 0; |
| 131 | 107 |
| 132 // Selects a layer to be scrolled using the |scroll_state| start position. | 108 // Selects a layer to be scrolled using the |scroll_state| start position. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 virtual ScrollElasticityHelper* CreateScrollElasticityHelper() = 0; | 187 virtual ScrollElasticityHelper* CreateScrollElasticityHelper() = 0; |
| 212 | 188 |
| 213 protected: | 189 protected: |
| 214 InputHandler() {} | 190 InputHandler() {} |
| 215 virtual ~InputHandler() {} | 191 virtual ~InputHandler() {} |
| 216 | 192 |
| 217 private: | 193 private: |
| 218 DISALLOW_COPY_AND_ASSIGN(InputHandler); | 194 DISALLOW_COPY_AND_ASSIGN(InputHandler); |
| 219 }; | 195 }; |
| 220 | 196 |
| 221 inline const InputHandler::MainThreadScrollingReason& operator|=( | |
| 222 InputHandler::MainThreadScrollingReason& a, | |
| 223 InputHandler::MainThreadScrollingReason b) { | |
| 224 return a = static_cast<InputHandler::MainThreadScrollingReason>( | |
| 225 static_cast<unsigned>(a) | static_cast<unsigned>(b)); | |
| 226 } | |
| 227 | |
| 228 } // namespace cc | 197 } // namespace cc |
| 229 | 198 |
| 230 #endif // CC_INPUT_INPUT_HANDLER_H_ | 199 #endif // CC_INPUT_INPUT_HANDLER_H_ |
| OLD | NEW |