| 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 #include "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 content_is_suitable_for_gpu_rasterization_(true), | 202 content_is_suitable_for_gpu_rasterization_(true), |
| 203 has_gpu_rasterization_trigger_(false), | 203 has_gpu_rasterization_trigger_(false), |
| 204 use_gpu_rasterization_(false), | 204 use_gpu_rasterization_(false), |
| 205 use_msaa_(false), | 205 use_msaa_(false), |
| 206 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), | 206 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), |
| 207 input_handler_client_(NULL), | 207 input_handler_client_(NULL), |
| 208 did_lock_scrolling_layer_(false), | 208 did_lock_scrolling_layer_(false), |
| 209 wheel_scrolling_(false), | 209 wheel_scrolling_(false), |
| 210 scroll_affects_scroll_handler_(false), | 210 scroll_affects_scroll_handler_(false), |
| 211 scroll_layer_id_when_mouse_over_scrollbar_(Layer::INVALID_ID), | 211 scroll_layer_id_when_mouse_over_scrollbar_(Layer::INVALID_ID), |
| 212 captured_scrollbar_layer_id_(Layer::INVALID_ID), |
| 212 tile_priorities_dirty_(false), | 213 tile_priorities_dirty_(false), |
| 213 settings_(settings), | 214 settings_(settings), |
| 214 visible_(false), | 215 visible_(false), |
| 215 cached_managed_memory_policy_(settings.gpu_memory_policy), | 216 cached_managed_memory_policy_(settings.gpu_memory_policy), |
| 216 is_synchronous_single_threaded_(!task_runner_provider->HasImplThread() && | 217 is_synchronous_single_threaded_(!task_runner_provider->HasImplThread() && |
| 217 !settings.single_thread_proxy_scheduler), | 218 !settings.single_thread_proxy_scheduler), |
| 218 // Must be initialized after is_synchronous_single_threaded_ and | 219 // Must be initialized after is_synchronous_single_threaded_ and |
| 219 // task_runner_provider_. | 220 // task_runner_provider_. |
| 220 tile_manager_(this, | 221 tile_manager_(this, |
| 221 GetTaskRunner(), | 222 GetTaskRunner(), |
| (...skipping 2999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3221 | 3222 |
| 3222 gfx::Rect layer_impl_bounds(layer_impl->bounds()); | 3223 gfx::Rect layer_impl_bounds(layer_impl->bounds()); |
| 3223 | 3224 |
| 3224 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect( | 3225 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect( |
| 3225 layer_impl->ScreenSpaceTransform(), gfx::RectF(layer_impl_bounds)); | 3226 layer_impl->ScreenSpaceTransform(), gfx::RectF(layer_impl_bounds)); |
| 3226 | 3227 |
| 3227 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( | 3228 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( |
| 3228 device_viewport_point); | 3229 device_viewport_point); |
| 3229 } | 3230 } |
| 3230 | 3231 |
| 3232 void LayerTreeHostImpl::MouseDown() { |
| 3233 if (scroll_layer_id_when_mouse_over_scrollbar_ == Layer::INVALID_ID) |
| 3234 return; |
| 3235 |
| 3236 captured_scrollbar_layer_id_ = scroll_layer_id_when_mouse_over_scrollbar_; |
| 3237 ScrollbarAnimationController* animation_controller = |
| 3238 ScrollbarAnimationControllerForId(captured_scrollbar_layer_id_); |
| 3239 if (animation_controller) |
| 3240 animation_controller->DidCaptureScrollbarBegin(); |
| 3241 } |
| 3242 |
| 3243 void LayerTreeHostImpl::MouseUp() { |
| 3244 if (captured_scrollbar_layer_id_ == Layer::INVALID_ID) |
| 3245 return; |
| 3246 |
| 3247 ScrollbarAnimationController* animation_controller = |
| 3248 ScrollbarAnimationControllerForId(captured_scrollbar_layer_id_); |
| 3249 if (animation_controller) |
| 3250 animation_controller->DidCaptureScrollbarEnd(); |
| 3251 captured_scrollbar_layer_id_ = Layer::INVALID_ID; |
| 3252 } |
| 3253 |
| 3231 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { | 3254 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
| 3232 gfx::PointF device_viewport_point = gfx::ScalePoint( | 3255 gfx::PointF device_viewport_point = gfx::ScalePoint( |
| 3233 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); | 3256 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); |
| 3234 LayerImpl* layer_impl = | 3257 LayerImpl* layer_impl = |
| 3235 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | 3258 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); |
| 3236 HandleMouseOverScrollbar(layer_impl); | 3259 HandleMouseOverScrollbar(layer_impl); |
| 3237 if (scroll_layer_id_when_mouse_over_scrollbar_ != Layer::INVALID_ID) | 3260 if (scroll_layer_id_when_mouse_over_scrollbar_ != Layer::INVALID_ID) |
| 3238 return; | 3261 return; |
| 3239 | 3262 |
| 3240 bool scroll_on_main_thread = false; | 3263 bool scroll_on_main_thread = false; |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4160 if (is_visible) { | 4183 if (is_visible) { |
| 4161 worker_context_visibility_ = | 4184 worker_context_visibility_ = |
| 4162 worker_context->CacheController()->ClientBecameVisible(); | 4185 worker_context->CacheController()->ClientBecameVisible(); |
| 4163 } else { | 4186 } else { |
| 4164 worker_context->CacheController()->ClientBecameNotVisible( | 4187 worker_context->CacheController()->ClientBecameNotVisible( |
| 4165 std::move(worker_context_visibility_)); | 4188 std::move(worker_context_visibility_)); |
| 4166 } | 4189 } |
| 4167 } | 4190 } |
| 4168 | 4191 |
| 4169 } // namespace cc | 4192 } // namespace cc |
| OLD | NEW |