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

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

Issue 2918753002: Prevent create ScrollbarAnimationController for Mac Overlay Scrollbar (Closed)
Patch Set: Prevent create ScrollbarAnimationController for Mac Overlay Scrollbar Created 3 years, 6 months 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_impl.h" 5 #include "cc/trees/layer_tree_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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 else 503 else
504 target_tree->set_hud_layer(NULL); 504 target_tree->set_hud_layer(NULL);
505 505
506 target_tree->has_ever_been_drawn_ = false; 506 target_tree->has_ever_been_drawn_ = false;
507 507
508 // Note: this needs to happen after SetPropertyTrees. 508 // Note: this needs to happen after SetPropertyTrees.
509 target_tree->HandleScrollbarShowRequestsFromMain(); 509 target_tree->HandleScrollbarShowRequestsFromMain();
510 } 510 }
511 511
512 void LayerTreeImpl::HandleScrollbarShowRequestsFromMain() { 512 void LayerTreeImpl::HandleScrollbarShowRequestsFromMain() {
513 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [this]( 513 LayerTreeHostCommon::CallFunctionForEveryLayer(
514 LayerImpl* layer) { 514 this, [this](LayerImpl* layer) {
aelias_OOO_until_Jul13 2017/06/02 22:02:23 Please omit this unrelated whitespace change.
515 if (!layer->needs_show_scrollbars()) 515 if (!layer->needs_show_scrollbars())
516 return; 516 return;
517 ScrollbarAnimationController* controller = 517 ScrollbarAnimationController* controller =
518 layer_tree_host_impl_->ScrollbarAnimationControllerForElementId( 518 layer_tree_host_impl_->ScrollbarAnimationControllerForElementId(
519 layer->element_id()); 519 layer->element_id());
520 if (controller) { 520 if (controller) {
521 controller->DidRequestShowFromMainThread(); 521 controller->DidRequestShowFromMainThread();
522 layer->set_needs_show_scrollbars(false); 522 layer->set_needs_show_scrollbars(false);
523 } 523 }
524 }); 524 });
525 } 525 }
526 526
527 void LayerTreeImpl::MoveChangeTrackingToLayers() { 527 void LayerTreeImpl::MoveChangeTrackingToLayers() {
528 // We need to update the change tracking on property trees before we move it 528 // We need to update the change tracking on property trees before we move it
529 // onto the layers. 529 // onto the layers.
530 property_trees_.UpdateChangeTracking(); 530 property_trees_.UpdateChangeTracking();
531 for (auto* layer : *this) { 531 for (auto* layer : *this) {
532 if (layer->LayerPropertyChanged()) 532 if (layer->LayerPropertyChanged())
533 layer->NoteLayerPropertyChanged(); 533 layer->NoteLayerPropertyChanged();
534 } 534 }
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 if (scrollbar_layer->orientation() == HORIZONTAL) { 1698 if (scrollbar_layer->orientation() == HORIZONTAL) {
1699 DCHECK_EQ(scrollbar_ids.horizontal, Layer::INVALID_ID) 1699 DCHECK_EQ(scrollbar_ids.horizontal, Layer::INVALID_ID)
1700 << "Existing scrollbar should have been unregistered."; 1700 << "Existing scrollbar should have been unregistered.";
1701 scrollbar_ids.horizontal = scrollbar_layer->id(); 1701 scrollbar_ids.horizontal = scrollbar_layer->id();
1702 } else { 1702 } else {
1703 DCHECK_EQ(scrollbar_ids.vertical, Layer::INVALID_ID) 1703 DCHECK_EQ(scrollbar_ids.vertical, Layer::INVALID_ID)
1704 << "Existing scrollbar should have been unregistered."; 1704 << "Existing scrollbar should have been unregistered.";
1705 scrollbar_ids.vertical = scrollbar_layer->id(); 1705 scrollbar_ids.vertical = scrollbar_layer->id();
1706 } 1706 }
1707 1707
1708 if (IsActiveTree() && scrollbar_layer->is_overlay_scrollbar()) { 1708 // Because we assigned settings().scrollbar_animator = Android for default, Here
1709 // we check IsSolidColorScrollbarLayerImpl(mobile emulator) to prevent creating
1710 // ScrollbarAnimationController for Mac Overlay Scrollbar.
1711 #if defined(OS_MACOSX)
aelias_OOO_until_Jul13 2017/06/02 22:02:23 Please find a way to avoid OS_MACOSX. How about e
1712 if (IsActiveTree() && scrollbar_layer->is_overlay_scrollbar() &&
1713 settings().scrollbar_animator != LayerTreeSettings::NO_ANIMATOR &&
1714 scrollbar_layer->IsSolidColorScrollbarLayerImpl()) {
1715 #else
1716 if (IsActiveTree() && scrollbar_layer->is_overlay_scrollbar() &&
1717 settings().scrollbar_animator != LayerTreeSettings::NO_ANIMATOR) {
1718 #endif
1709 layer_tree_host_impl_->RegisterScrollbarAnimationController( 1719 layer_tree_host_impl_->RegisterScrollbarAnimationController(
1710 scroll_element_id, scrollbar_layer->Opacity()); 1720 scroll_element_id, scrollbar_layer->Opacity());
1711 } 1721 }
1712 1722
1713 // TODO(pdr): Refactor DidUpdateScrollState to use ElementIds instead of 1723 // TODO(pdr): Refactor DidUpdateScrollState to use ElementIds instead of
1714 // layer ids and remove this use of LayerIdByElementId. 1724 // layer ids and remove this use of LayerIdByElementId.
1715 DidUpdateScrollState(LayerIdByElementId(scroll_element_id)); 1725 DidUpdateScrollState(LayerIdByElementId(scroll_element_id));
1716 } 1726 }
1717 1727
1718 void LayerTreeImpl::UnregisterScrollbar( 1728 void LayerTreeImpl::UnregisterScrollbar(
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
2132 2142
2133 void LayerTreeImpl::ResetAllChangeTracking() { 2143 void LayerTreeImpl::ResetAllChangeTracking() {
2134 layers_that_should_push_properties_.clear(); 2144 layers_that_should_push_properties_.clear();
2135 // Iterate over all layers, including masks. 2145 // Iterate over all layers, including masks.
2136 for (auto& layer : *layers_) 2146 for (auto& layer : *layers_)
2137 layer->ResetChangeTracking(); 2147 layer->ResetChangeTracking();
2138 property_trees_.ResetAllChangeTracking(); 2148 property_trees_.ResetAllChangeTracking();
2139 } 2149 }
2140 2150
2141 } // namespace cc 2151 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698