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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 | 342 |
343 UpdateSyncTreeAfterCommitOrImplSideInvalidation(); | 343 UpdateSyncTreeAfterCommitOrImplSideInvalidation(); |
344 micro_benchmark_controller_.DidCompleteCommit(); | 344 micro_benchmark_controller_.DidCompleteCommit(); |
345 } | 345 } |
346 | 346 |
347 void LayerTreeHostImpl::UpdateSyncTreeAfterCommitOrImplSideInvalidation() { | 347 void LayerTreeHostImpl::UpdateSyncTreeAfterCommitOrImplSideInvalidation() { |
348 sync_tree()->InvalidateRegionForImages( | 348 sync_tree()->InvalidateRegionForImages( |
349 tile_manager_.TakeImagesToInvalidateOnSyncTree()); | 349 tile_manager_.TakeImagesToInvalidateOnSyncTree()); |
350 | 350 |
351 if (CommitToActiveTree()) { | 351 if (CommitToActiveTree()) { |
352 active_tree_->ShowScrollbars(); | |
bokan
2017/04/25 22:56:48
I was a little confused until I checked the ShowSc
skobes
2017/04/27 00:46:31
Renamed to HandleScrollbarShowRequestsFromMain.
| |
353 | |
352 // We have to activate animations here or "IsActive()" is true on the layers | 354 // We have to activate animations here or "IsActive()" is true on the layers |
353 // but the animations aren't activated yet so they get ignored by | 355 // but the animations aren't activated yet so they get ignored by |
354 // UpdateDrawProperties. | 356 // UpdateDrawProperties. |
355 ActivateAnimations(); | 357 ActivateAnimations(); |
356 } | 358 } |
357 | 359 |
358 // Start animations before UpdateDrawProperties and PrepareTiles, as they can | 360 // Start animations before UpdateDrawProperties and PrepareTiles, as they can |
359 // change the results. When doing commit to the active tree, this must happen | 361 // change the results. When doing commit to the active tree, this must happen |
360 // after ActivateAnimations() in order for this ticking to be propogated to | 362 // after ActivateAnimations() in order for this ticking to be propogated to |
361 // layers on the active tree. | 363 // layers on the active tree. |
(...skipping 2911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3273 browser_controls_offset_manager_->ControlsTopOffset(); | 3275 browser_controls_offset_manager_->ControlsTopOffset(); |
3274 | 3276 |
3275 scroll_state->set_delta_consumed_for_scroll_sequence( | 3277 scroll_state->set_delta_consumed_for_scroll_sequence( |
3276 did_lock_scrolling_layer_); | 3278 did_lock_scrolling_layer_); |
3277 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); | 3279 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); |
3278 scroll_state->set_current_native_scrolling_node( | 3280 scroll_state->set_current_native_scrolling_node( |
3279 active_tree()->property_trees()->scroll_tree.CurrentlyScrollingNode()); | 3281 active_tree()->property_trees()->scroll_tree.CurrentlyScrollingNode()); |
3280 | 3282 |
3281 DistributeScrollDelta(scroll_state); | 3283 DistributeScrollDelta(scroll_state); |
3282 | 3284 |
3283 active_tree_->SetCurrentlyScrollingNode( | 3285 ScrollNode* current_scrolling_node = |
3284 scroll_state->current_native_scrolling_node()); | 3286 scroll_state->current_native_scrolling_node(); |
3287 active_tree_->SetCurrentlyScrollingNode(current_scrolling_node); | |
3285 did_lock_scrolling_layer_ = | 3288 did_lock_scrolling_layer_ = |
3286 scroll_state->delta_consumed_for_scroll_sequence(); | 3289 scroll_state->delta_consumed_for_scroll_sequence(); |
3287 | 3290 |
3288 bool did_scroll_x = scroll_state->caused_scroll_x(); | 3291 bool did_scroll_x = scroll_state->caused_scroll_x(); |
3289 bool did_scroll_y = scroll_state->caused_scroll_y(); | 3292 bool did_scroll_y = scroll_state->caused_scroll_y(); |
3290 bool did_scroll_content = did_scroll_x || did_scroll_y; | 3293 bool did_scroll_content = did_scroll_x || did_scroll_y; |
3291 if (did_scroll_content) { | 3294 if (did_scroll_content) { |
3295 ShowScrollbarsForImplScroll(current_scrolling_node->element_id); | |
3296 | |
3292 // If we are scrolling with an active scroll handler, forward latency | 3297 // If we are scrolling with an active scroll handler, forward latency |
3293 // tracking information to the main thread so the delay introduced by the | 3298 // tracking information to the main thread so the delay introduced by the |
3294 // handler is accounted for. | 3299 // handler is accounted for. |
3295 if (scroll_affects_scroll_handler()) | 3300 if (scroll_affects_scroll_handler()) |
3296 NotifySwapPromiseMonitorsOfForwardingToMainThread(); | 3301 NotifySwapPromiseMonitorsOfForwardingToMainThread(); |
3297 client_->SetNeedsCommitOnImplThread(); | 3302 client_->SetNeedsCommitOnImplThread(); |
3298 SetNeedsRedraw(); | 3303 SetNeedsRedraw(); |
3299 client_->RenewTreePriority(); | 3304 client_->RenewTreePriority(); |
3300 } | 3305 } |
3301 | 3306 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3342 void LayerTreeHostImpl::RequestUpdateForSynchronousInputHandler() { | 3347 void LayerTreeHostImpl::RequestUpdateForSynchronousInputHandler() { |
3343 UpdateRootLayerStateForSynchronousInputHandler(); | 3348 UpdateRootLayerStateForSynchronousInputHandler(); |
3344 } | 3349 } |
3345 | 3350 |
3346 void LayerTreeHostImpl::SetSynchronousInputHandlerRootScrollOffset( | 3351 void LayerTreeHostImpl::SetSynchronousInputHandlerRootScrollOffset( |
3347 const gfx::ScrollOffset& root_offset) { | 3352 const gfx::ScrollOffset& root_offset) { |
3348 bool changed = active_tree_->DistributeRootScrollOffset(root_offset); | 3353 bool changed = active_tree_->DistributeRootScrollOffset(root_offset); |
3349 if (!changed) | 3354 if (!changed) |
3350 return; | 3355 return; |
3351 | 3356 |
3357 ShowScrollbarsForImplScroll(OuterViewportScrollLayer()->element_id()); | |
3352 client_->SetNeedsCommitOnImplThread(); | 3358 client_->SetNeedsCommitOnImplThread(); |
3353 // After applying the synchronous input handler's scroll offset, tell it what | 3359 // After applying the synchronous input handler's scroll offset, tell it what |
3354 // we ended up with. | 3360 // we ended up with. |
3355 UpdateRootLayerStateForSynchronousInputHandler(); | 3361 UpdateRootLayerStateForSynchronousInputHandler(); |
3356 SetFullViewportDamage(); | 3362 SetFullViewportDamage(); |
3357 SetNeedsRedraw(); | 3363 SetNeedsRedraw(); |
3358 } | 3364 } |
3359 | 3365 |
3360 void LayerTreeHostImpl::ClearCurrentlyScrollingNode() { | 3366 void LayerTreeHostImpl::ClearCurrentlyScrollingNode() { |
3361 active_tree_->ClearCurrentlyScrollingNode(); | 3367 active_tree_->ClearCurrentlyScrollingNode(); |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4143 recycle_tree()->SetTransformMutated(element_id, transform); | 4149 recycle_tree()->SetTransformMutated(element_id, transform); |
4144 } | 4150 } |
4145 } | 4151 } |
4146 | 4152 |
4147 void LayerTreeHostImpl::SetElementScrollOffsetMutated( | 4153 void LayerTreeHostImpl::SetElementScrollOffsetMutated( |
4148 ElementId element_id, | 4154 ElementId element_id, |
4149 ElementListType list_type, | 4155 ElementListType list_type, |
4150 const gfx::ScrollOffset& scroll_offset) { | 4156 const gfx::ScrollOffset& scroll_offset) { |
4151 if (list_type == ElementListType::ACTIVE) { | 4157 if (list_type == ElementListType::ACTIVE) { |
4152 SetTreeLayerScrollOffsetMutated(element_id, active_tree(), scroll_offset); | 4158 SetTreeLayerScrollOffsetMutated(element_id, active_tree(), scroll_offset); |
4159 ShowScrollbarsForImplScroll(element_id); | |
4153 } else { | 4160 } else { |
4154 SetTreeLayerScrollOffsetMutated(element_id, pending_tree(), scroll_offset); | 4161 SetTreeLayerScrollOffsetMutated(element_id, pending_tree(), scroll_offset); |
4155 SetTreeLayerScrollOffsetMutated(element_id, recycle_tree(), scroll_offset); | 4162 SetTreeLayerScrollOffsetMutated(element_id, recycle_tree(), scroll_offset); |
4156 } | 4163 } |
4157 } | 4164 } |
4158 | 4165 |
4159 void LayerTreeHostImpl::ElementIsAnimatingChanged( | 4166 void LayerTreeHostImpl::ElementIsAnimatingChanged( |
4160 ElementId element_id, | 4167 ElementId element_id, |
4161 ElementListType list_type, | 4168 ElementListType list_type, |
4162 const PropertyAnimationState& mask, | 4169 const PropertyAnimationState& mask, |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4295 } | 4302 } |
4296 } | 4303 } |
4297 | 4304 |
4298 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { | 4305 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { |
4299 if (is_wheel_scroll) | 4306 if (is_wheel_scroll) |
4300 has_scrolled_by_wheel_ = true; | 4307 has_scrolled_by_wheel_ = true; |
4301 else | 4308 else |
4302 has_scrolled_by_touch_ = true; | 4309 has_scrolled_by_touch_ = true; |
4303 } | 4310 } |
4304 | 4311 |
4312 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { | |
4313 if (!element_id) | |
4314 return; | |
4315 if (ScrollbarAnimationController* animation_controller = | |
4316 ScrollbarAnimationControllerForElementId(element_id)) | |
4317 animation_controller->DidScrollUpdate(); | |
4318 } | |
4319 | |
4305 } // namespace cc | 4320 } // namespace cc |
OLD | NEW |