| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 resourceless_software_draw_(false), | 233 resourceless_software_draw_(false), |
| 234 animation_host_(std::move(animation_host)), | 234 animation_host_(std::move(animation_host)), |
| 235 rendering_stats_instrumentation_(rendering_stats_instrumentation), | 235 rendering_stats_instrumentation_(rendering_stats_instrumentation), |
| 236 micro_benchmark_controller_(this), | 236 micro_benchmark_controller_(this), |
| 237 shared_bitmap_manager_(shared_bitmap_manager), | 237 shared_bitmap_manager_(shared_bitmap_manager), |
| 238 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), | 238 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), |
| 239 task_graph_runner_(task_graph_runner), | 239 task_graph_runner_(task_graph_runner), |
| 240 id_(id), | 240 id_(id), |
| 241 requires_high_res_to_draw_(false), | 241 requires_high_res_to_draw_(false), |
| 242 is_likely_to_require_a_draw_(false), | 242 is_likely_to_require_a_draw_(false), |
| 243 mutator_(nullptr) { | 243 mutator_(nullptr), |
| 244 captured_scrollbar_layer_id_(Layer::INVALID_ID) { |
| 244 DCHECK(animation_host_); | 245 DCHECK(animation_host_); |
| 245 animation_host_->SetMutatorHostClient(this); | 246 animation_host_->SetMutatorHostClient(this); |
| 246 | 247 |
| 247 DCHECK(task_runner_provider_->IsImplThread()); | 248 DCHECK(task_runner_provider_->IsImplThread()); |
| 248 DidVisibilityChange(this, visible_); | 249 DidVisibilityChange(this, visible_); |
| 249 | 250 |
| 250 SetDebugState(settings.initial_debug_state); | 251 SetDebugState(settings.initial_debug_state); |
| 251 | 252 |
| 252 // LTHI always has an active tree. | 253 // LTHI always has an active tree. |
| 253 active_tree_ = base::MakeUnique<LayerTreeImpl>( | 254 active_tree_ = base::MakeUnique<LayerTreeImpl>( |
| (...skipping 3012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3266 | 3267 |
| 3267 gfx::Rect layer_impl_bounds(layer_impl->bounds()); | 3268 gfx::Rect layer_impl_bounds(layer_impl->bounds()); |
| 3268 | 3269 |
| 3269 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect( | 3270 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect( |
| 3270 layer_impl->ScreenSpaceTransform(), gfx::RectF(layer_impl_bounds)); | 3271 layer_impl->ScreenSpaceTransform(), gfx::RectF(layer_impl_bounds)); |
| 3271 | 3272 |
| 3272 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( | 3273 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( |
| 3273 device_viewport_point); | 3274 device_viewport_point); |
| 3274 } | 3275 } |
| 3275 | 3276 |
| 3277 void LayerTreeHostImpl::MouseDownAt(const gfx::Point& viewport_point) { |
| 3278 if (scroll_layer_id_when_mouse_over_scrollbar_ != Layer::INVALID_ID) { |
| 3279 captured_scrollbar_layer_id_ = scroll_layer_id_when_mouse_over_scrollbar_; |
| 3280 ScrollbarAnimationController* animation_controller = |
| 3281 ScrollbarAnimationControllerForId(captured_scrollbar_layer_id_); |
| 3282 if (animation_controller) |
| 3283 animation_controller->DidCaptureScrollbarBegin(); |
| 3284 } |
| 3285 } |
| 3286 |
| 3287 void LayerTreeHostImpl::MouseUp() { |
| 3288 if (captured_scrollbar_layer_id_ != Layer::INVALID_ID) { |
| 3289 ScrollbarAnimationController* animation_controller = |
| 3290 ScrollbarAnimationControllerForId(captured_scrollbar_layer_id_); |
| 3291 if (animation_controller) |
| 3292 animation_controller->DidCaptureScrollbarEnd(); |
| 3293 |
| 3294 captured_scrollbar_layer_id_ = Layer::INVALID_ID; |
| 3295 } |
| 3296 } |
| 3297 |
| 3276 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { | 3298 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
| 3277 gfx::PointF device_viewport_point = gfx::ScalePoint( | 3299 gfx::PointF device_viewport_point = gfx::ScalePoint( |
| 3278 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); | 3300 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); |
| 3279 LayerImpl* layer_impl = | 3301 LayerImpl* layer_impl = |
| 3280 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | 3302 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); |
| 3281 HandleMouseOverScrollbar(layer_impl); | 3303 HandleMouseOverScrollbar(layer_impl); |
| 3282 if (scroll_layer_id_when_mouse_over_scrollbar_ != Layer::INVALID_ID) | 3304 if (scroll_layer_id_when_mouse_over_scrollbar_ != Layer::INVALID_ID) |
| 3283 return; | 3305 return; |
| 3284 | 3306 |
| 3285 bool scroll_on_main_thread = false; | 3307 bool scroll_on_main_thread = false; |
| (...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4201 if (is_visible) { | 4223 if (is_visible) { |
| 4202 worker_context_visibility_ = | 4224 worker_context_visibility_ = |
| 4203 worker_context->CacheController()->ClientBecameVisible(); | 4225 worker_context->CacheController()->ClientBecameVisible(); |
| 4204 } else { | 4226 } else { |
| 4205 worker_context->CacheController()->ClientBecameNotVisible( | 4227 worker_context->CacheController()->ClientBecameNotVisible( |
| 4206 std::move(worker_context_visibility_)); | 4228 std::move(worker_context_visibility_)); |
| 4207 } | 4229 } |
| 4208 } | 4230 } |
| 4209 | 4231 |
| 4210 } // namespace cc | 4232 } // namespace cc |
| OLD | NEW |