Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 2453553003: Disable overlay scrollbars in Blink when hidden by the compositor. (Closed)
Patch Set: Rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_in_process.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2197 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), 2208 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
2209 "LayerTreeHostImpl::SetLayerTreeMutator"); 2209 "LayerTreeHostImpl::SetLayerTreeMutator");
2210 mutator_ = std::move(mutator); 2210 mutator_ = std::move(mutator);
2211 mutator_->SetClient(this); 2211 mutator_->SetClient(this);
2212 } 2212 }
2213 2213
2214 LayerImpl* LayerTreeHostImpl::ViewportMainScrollLayer() { 2214 LayerImpl* LayerTreeHostImpl::ViewportMainScrollLayer() {
2215 return viewport()->MainScrollLayer(); 2215 return viewport()->MainScrollLayer();
2216 } 2216 }
2217 2217
2218 void LayerTreeHostImpl::DidChangeScrollbarVisibility() {
2219 client_->SetNeedsCommitOnImplThread();
2220 }
2221
2218 void LayerTreeHostImpl::CleanUpTileManagerAndUIResources() { 2222 void LayerTreeHostImpl::CleanUpTileManagerAndUIResources() {
2219 ClearUIResources(); 2223 ClearUIResources();
2220 tile_manager_.FinishTasksAndCleanUp(); 2224 tile_manager_.FinishTasksAndCleanUp();
2221 resource_pool_ = nullptr; 2225 resource_pool_ = nullptr;
2222 single_thread_synchronous_task_graph_runner_ = nullptr; 2226 single_thread_synchronous_task_graph_runner_ = nullptr;
2223 image_decode_controller_ = nullptr; 2227 image_decode_controller_ = nullptr;
2224 2228
2225 // We've potentially just freed a large number of resources on our various 2229 // We've potentially just freed a large number of resources on our various
2226 // contexts. Flushing now helps ensure these are cleaned up quickly 2230 // contexts. Flushing now helps ensure these are cleaned up quickly
2227 // preventing driver cache growth. See crbug.com/643251 2231 // preventing driver cache growth. See crbug.com/643251
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
3336 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, 3340 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info,
3337 LayerTreeImpl* tree_impl) { 3341 LayerTreeImpl* tree_impl) {
3338 if (tree_impl->LayerListIsEmpty()) 3342 if (tree_impl->LayerListIsEmpty())
3339 return; 3343 return;
3340 3344
3341 int inner_viewport_layer_id = 3345 int inner_viewport_layer_id =
3342 tree_impl->InnerViewportScrollLayer() 3346 tree_impl->InnerViewportScrollLayer()
3343 ? tree_impl->InnerViewportScrollLayer()->id() 3347 ? tree_impl->InnerViewportScrollLayer()->id()
3344 : Layer::INVALID_ID; 3348 : Layer::INVALID_ID;
3345 3349
3346 return tree_impl->property_trees()->scroll_tree.CollectScrollDeltas( 3350 tree_impl->property_trees()->scroll_tree.CollectScrollDeltas(
3347 scroll_info, inner_viewport_layer_id); 3351 scroll_info, inner_viewport_layer_id);
3348 } 3352 }
3349 3353
3354 static void CollectScrollbarUpdates(
3355 ScrollAndScaleSet* scroll_info,
3356 std::unordered_map<int, std::unique_ptr<ScrollbarAnimationController>>*
3357 controllers) {
3358 scroll_info->scrollbars.reserve(controllers->size());
3359 for (auto& pair : *controllers) {
3360 scroll_info->scrollbars.push_back(LayerTreeHostCommon::ScrollbarsUpdateInfo(
3361 pair.first, pair.second->ScrollbarsHidden()));
3362 }
3363 }
3364
3350 std::unique_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { 3365 std::unique_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() {
3351 std::unique_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); 3366 std::unique_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet());
3352 3367
3353 CollectScrollDeltas(scroll_info.get(), active_tree_.get()); 3368 CollectScrollDeltas(scroll_info.get(), active_tree_.get());
3369 CollectScrollbarUpdates(scroll_info.get(), &scrollbar_animation_controllers_);
3354 scroll_info->page_scale_delta = 3370 scroll_info->page_scale_delta =
3355 active_tree_->page_scale_factor()->PullDeltaForMainThread(); 3371 active_tree_->page_scale_factor()->PullDeltaForMainThread();
3356 scroll_info->top_controls_delta = 3372 scroll_info->top_controls_delta =
3357 active_tree()->top_controls_shown_ratio()->PullDeltaForMainThread(); 3373 active_tree()->top_controls_shown_ratio()->PullDeltaForMainThread();
3358 scroll_info->elastic_overscroll_delta = 3374 scroll_info->elastic_overscroll_delta =
3359 active_tree_->elastic_overscroll()->PullDeltaForMainThread(); 3375 active_tree_->elastic_overscroll()->PullDeltaForMainThread();
3360 scroll_info->swap_promises.swap(swap_promises_for_main_thread_scroll_update_); 3376 scroll_info->swap_promises.swap(swap_promises_for_main_thread_scroll_update_);
3361 3377
3362 return scroll_info; 3378 return scroll_info;
3363 } 3379 }
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
4081 if (is_visible) { 4097 if (is_visible) {
4082 worker_context_visibility_ = 4098 worker_context_visibility_ =
4083 worker_context->CacheController()->ClientBecameVisible(); 4099 worker_context->CacheController()->ClientBecameVisible();
4084 } else { 4100 } else {
4085 worker_context->CacheController()->ClientBecameNotVisible( 4101 worker_context->CacheController()->ClientBecameNotVisible(
4086 std::move(worker_context_visibility_)); 4102 std::move(worker_context_visibility_));
4087 } 4103 }
4088 } 4104 }
4089 4105
4090 } // namespace cc 4106 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_in_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698