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

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: 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
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 2202 matching lines...) Expand 10 before | Expand all | Expand 10 after
2213 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), 2213 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
2214 "LayerTreeHostImpl::SetLayerTreeMutator"); 2214 "LayerTreeHostImpl::SetLayerTreeMutator");
2215 mutator_ = std::move(mutator); 2215 mutator_ = std::move(mutator);
2216 mutator_->SetClient(this); 2216 mutator_->SetClient(this);
2217 } 2217 }
2218 2218
2219 LayerImpl* LayerTreeHostImpl::ViewportMainScrollLayer() { 2219 LayerImpl* LayerTreeHostImpl::ViewportMainScrollLayer() {
2220 return viewport()->MainScrollLayer(); 2220 return viewport()->MainScrollLayer();
2221 } 2221 }
2222 2222
2223 void LayerTreeHostImpl::SetScrollbarsHidden(int layer_id, bool hidden) {
2224 scrollbars_hidden_map_[layer_id] = hidden;
2225 client_->SetNeedsCommitOnImplThread();
aelias_OOO_until_Jul13 2016/10/26 19:01:03 Please check if any of the map entries changed and
bokan 2016/10/27 20:56:46 The map is cleared on each commit so that it conta
aelias_OOO_until_Jul13 2016/10/27 21:22:09 OK. Though with that bit added to LayerImpl, the
2226 }
2227
2223 void LayerTreeHostImpl::CleanUpTileManagerAndUIResources() { 2228 void LayerTreeHostImpl::CleanUpTileManagerAndUIResources() {
2224 ClearUIResources(); 2229 ClearUIResources();
2225 tile_manager_.FinishTasksAndCleanUp(); 2230 tile_manager_.FinishTasksAndCleanUp();
2226 resource_pool_ = nullptr; 2231 resource_pool_ = nullptr;
2227 single_thread_synchronous_task_graph_runner_ = nullptr; 2232 single_thread_synchronous_task_graph_runner_ = nullptr;
2228 image_decode_controller_ = nullptr; 2233 image_decode_controller_ = nullptr;
2229 2234
2230 // We've potentially just freed a large number of resources on our various 2235 // We've potentially just freed a large number of resources on our various
2231 // contexts. Flushing now helps ensure these are cleaned up quickly 2236 // contexts. Flushing now helps ensure these are cleaned up quickly
2232 // preventing driver cache growth. See crbug.com/643251 2237 // preventing driver cache growth. See crbug.com/643251
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
3339 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, 3344 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info,
3340 LayerTreeImpl* tree_impl) { 3345 LayerTreeImpl* tree_impl) {
3341 if (tree_impl->LayerListIsEmpty()) 3346 if (tree_impl->LayerListIsEmpty())
3342 return; 3347 return;
3343 3348
3344 int inner_viewport_layer_id = 3349 int inner_viewport_layer_id =
3345 tree_impl->InnerViewportScrollLayer() 3350 tree_impl->InnerViewportScrollLayer()
3346 ? tree_impl->InnerViewportScrollLayer()->id() 3351 ? tree_impl->InnerViewportScrollLayer()->id()
3347 : Layer::INVALID_ID; 3352 : Layer::INVALID_ID;
3348 3353
3349 return tree_impl->property_trees()->scroll_tree.CollectScrollDeltas( 3354 tree_impl->property_trees()->scroll_tree.CollectScrollDeltas(
3350 scroll_info, inner_viewport_layer_id); 3355 scroll_info, inner_viewport_layer_id);
3351 } 3356 }
3352 3357
3358 static void CollectScrollbarUpdates(
3359 ScrollAndScaleSet* scroll_info,
3360 std::unordered_map<int, bool>* scrollbars_hidden_map) {
3361 scroll_info->scrollbars.reserve(scrollbars_hidden_map->size());
3362 for (auto& pair : *scrollbars_hidden_map) {
3363 scroll_info->scrollbars.push_back(
3364 LayerTreeHostCommon::ScrollbarsUpdateInfo(pair.first, pair.second));
3365 }
3366 scrollbars_hidden_map->clear();
3367 }
3368
3353 std::unique_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { 3369 std::unique_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() {
3354 std::unique_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); 3370 std::unique_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet());
3355 3371
3356 CollectScrollDeltas(scroll_info.get(), active_tree_.get()); 3372 CollectScrollDeltas(scroll_info.get(), active_tree_.get());
3373 CollectScrollbarUpdates(scroll_info.get(), &scrollbars_hidden_map_);
3357 scroll_info->page_scale_delta = 3374 scroll_info->page_scale_delta =
3358 active_tree_->page_scale_factor()->PullDeltaForMainThread(); 3375 active_tree_->page_scale_factor()->PullDeltaForMainThread();
3359 scroll_info->top_controls_delta = 3376 scroll_info->top_controls_delta =
3360 active_tree()->top_controls_shown_ratio()->PullDeltaForMainThread(); 3377 active_tree()->top_controls_shown_ratio()->PullDeltaForMainThread();
3361 scroll_info->elastic_overscroll_delta = 3378 scroll_info->elastic_overscroll_delta =
3362 active_tree_->elastic_overscroll()->PullDeltaForMainThread(); 3379 active_tree_->elastic_overscroll()->PullDeltaForMainThread();
3363 scroll_info->swap_promises.swap(swap_promises_for_main_thread_scroll_update_); 3380 scroll_info->swap_promises.swap(swap_promises_for_main_thread_scroll_update_);
3364 3381
3365 return scroll_info; 3382 return scroll_info;
3366 } 3383 }
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
4084 if (is_visible) { 4101 if (is_visible) {
4085 worker_context_visibility_ = 4102 worker_context_visibility_ =
4086 worker_context->CacheController()->ClientBecameVisible(); 4103 worker_context->CacheController()->ClientBecameVisible();
4087 } else { 4104 } else {
4088 worker_context->CacheController()->ClientBecameNotVisible( 4105 worker_context->CacheController()->ClientBecameNotVisible(
4089 std::move(worker_context_visibility_)); 4106 std::move(worker_context_visibility_));
4090 } 4107 }
4091 } 4108 }
4092 4109
4093 } // namespace cc 4110 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698