| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 settings.check_tile_priority_inversion), | 240 settings.check_tile_priority_inversion), |
| 241 pinch_gesture_active_(false), | 241 pinch_gesture_active_(false), |
| 242 pinch_gesture_end_should_clear_scrolling_layer_(false), | 242 pinch_gesture_end_should_clear_scrolling_layer_(false), |
| 243 fps_counter_( | 243 fps_counter_( |
| 244 FrameRateCounter::Create(task_runner_provider_->HasImplThread())), | 244 FrameRateCounter::Create(task_runner_provider_->HasImplThread())), |
| 245 memory_history_(MemoryHistory::Create()), | 245 memory_history_(MemoryHistory::Create()), |
| 246 debug_rect_history_(DebugRectHistory::Create()), | 246 debug_rect_history_(DebugRectHistory::Create()), |
| 247 max_memory_needed_bytes_(0), | 247 max_memory_needed_bytes_(0), |
| 248 resourceless_software_draw_(false), | 248 resourceless_software_draw_(false), |
| 249 mutator_host_(std::move(mutator_host)), | 249 mutator_host_(std::move(mutator_host)), |
| 250 captured_scrollbar_animation_controller_(nullptr), |
| 250 rendering_stats_instrumentation_(rendering_stats_instrumentation), | 251 rendering_stats_instrumentation_(rendering_stats_instrumentation), |
| 251 micro_benchmark_controller_(this), | 252 micro_benchmark_controller_(this), |
| 252 task_graph_runner_(task_graph_runner), | 253 task_graph_runner_(task_graph_runner), |
| 253 id_(id), | 254 id_(id), |
| 254 requires_high_res_to_draw_(false), | 255 requires_high_res_to_draw_(false), |
| 255 is_likely_to_require_a_draw_(false), | 256 is_likely_to_require_a_draw_(false), |
| 256 has_valid_compositor_frame_sink_(false), | 257 has_valid_compositor_frame_sink_(false), |
| 257 mutator_(nullptr) { | 258 mutator_(nullptr) { |
| 258 DCHECK(mutator_host_); | 259 DCHECK(mutator_host_); |
| 259 mutator_host_->SetMutatorHostClient(this); | 260 mutator_host_->SetMutatorHostClient(this); |
| (...skipping 2968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3228 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect( | 3229 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect( |
| 3229 layer_impl->ScreenSpaceTransform(), gfx::RectF(layer_impl_bounds)); | 3230 layer_impl->ScreenSpaceTransform(), gfx::RectF(layer_impl_bounds)); |
| 3230 | 3231 |
| 3231 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( | 3232 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( |
| 3232 device_viewport_point); | 3233 device_viewport_point); |
| 3233 } | 3234 } |
| 3234 | 3235 |
| 3235 void LayerTreeHostImpl::MouseDown() { | 3236 void LayerTreeHostImpl::MouseDown() { |
| 3236 ScrollbarAnimationController* animation_controller = | 3237 ScrollbarAnimationController* animation_controller = |
| 3237 ScrollbarAnimationControllerForId(scroll_layer_id_mouse_currently_over_); | 3238 ScrollbarAnimationControllerForId(scroll_layer_id_mouse_currently_over_); |
| 3238 if (animation_controller) | 3239 if (animation_controller) { |
| 3239 animation_controller->DidMouseDown(); | 3240 animation_controller->DidMouseDown(); |
| 3241 captured_scrollbar_animation_controller_ = animation_controller; |
| 3242 } |
| 3240 } | 3243 } |
| 3241 | 3244 |
| 3242 void LayerTreeHostImpl::MouseUp() { | 3245 void LayerTreeHostImpl::MouseUp() { |
| 3243 ScrollbarAnimationController* animation_controller = | 3246 if (captured_scrollbar_animation_controller_) { |
| 3244 ScrollbarAnimationControllerForId(scroll_layer_id_mouse_currently_over_); | 3247 captured_scrollbar_animation_controller_->DidMouseUp(); |
| 3245 if (animation_controller) | 3248 captured_scrollbar_animation_controller_ = nullptr; |
| 3246 animation_controller->DidMouseUp(); | 3249 } |
| 3247 } | 3250 } |
| 3248 | 3251 |
| 3249 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { | 3252 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
| 3250 gfx::PointF device_viewport_point = gfx::ScalePoint( | 3253 gfx::PointF device_viewport_point = gfx::ScalePoint( |
| 3251 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); | 3254 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); |
| 3252 LayerImpl* layer_impl = | 3255 LayerImpl* layer_impl = |
| 3253 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | 3256 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); |
| 3254 | 3257 |
| 3255 // Check if mouse is over a scrollbar or not. | 3258 // Check if mouse is over a scrollbar or not. |
| 3256 // TODO(sahel): get rid of this extera checking when | 3259 // TODO(sahel): get rid of this extera checking when |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4085 worker_context_visibility_ = | 4088 worker_context_visibility_ = |
| 4086 worker_context->CacheController()->ClientBecameVisible(); | 4089 worker_context->CacheController()->ClientBecameVisible(); |
| 4087 } else { | 4090 } else { |
| 4088 worker_context->CacheController()->ClientBecameNotVisible( | 4091 worker_context->CacheController()->ClientBecameNotVisible( |
| 4089 std::move(worker_context_visibility_)); | 4092 std::move(worker_context_visibility_)); |
| 4090 } | 4093 } |
| 4091 } | 4094 } |
| 4092 } | 4095 } |
| 4093 | 4096 |
| 4094 } // namespace cc | 4097 } // namespace cc |
| OLD | NEW |