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

Side by Side Diff: ui/compositor/layer.cc

Issue 2188133002: Scroll with Layers in views::ScrollView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20160728-MacViews-ScrollTrack
Patch Set: bugref, scale_delta DCHECK + comment Created 4 years, 4 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
« no previous file with comments | « ui/compositor/layer.h ('k') | ui/events/blink/input_handler_proxy_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 layer_mask_->OnDeviceScaleFactorChanged(device_scale_factor); 749 layer_mask_->OnDeviceScaleFactorChanged(device_scale_factor);
750 } 750 }
751 751
752 void Layer::OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) { 752 void Layer::OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) {
753 DCHECK(surface_layer_.get()); 753 DCHECK(surface_layer_.get());
754 if (!delegate_) 754 if (!delegate_)
755 return; 755 return;
756 delegate_->OnDelegatedFrameDamage(damage_rect_in_dip); 756 delegate_->OnDelegatedFrameDamage(damage_rect_in_dip);
757 } 757 }
758 758
759 void Layer::SetScrollable(Layer* parent_clip_layer,
760 const base::Closure& on_scroll) {
761 cc_layer_->SetScrollClipLayerId(parent_clip_layer->cc_layer_->id());
762 cc_layer_->set_did_scroll_callback(on_scroll);
763 cc_layer_->SetUserScrollable(true, true);
764 }
765
766 gfx::ScrollOffset Layer::CurrentScrollOffset() const {
767 const Compositor* compositor = GetCompositor();
768 gfx::ScrollOffset offset;
769 if (compositor &&
770 compositor->GetScrollOffsetForLayer(cc_layer_->id(), &offset))
771 return offset;
772 return cc_layer_->scroll_offset();
773 }
774
775 void Layer::SetScrollOffset(const gfx::ScrollOffset& offset) {
776 Compositor* compositor = GetCompositor();
777 bool scrolled_on_impl_side =
778 compositor && compositor->ScrollLayerTo(cc_layer_->id(), offset);
779
780 if (!scrolled_on_impl_side)
781 cc_layer_->SetScrollOffset(offset);
782
783 DCHECK_EQ(offset.x(), CurrentScrollOffset().x());
784 DCHECK_EQ(offset.y(), CurrentScrollOffset().y());
785 }
786
759 void Layer::RequestCopyOfOutput( 787 void Layer::RequestCopyOfOutput(
760 std::unique_ptr<cc::CopyOutputRequest> request) { 788 std::unique_ptr<cc::CopyOutputRequest> request) {
761 cc_layer_->RequestCopyOfOutput(std::move(request)); 789 cc_layer_->RequestCopyOfOutput(std::move(request));
762 } 790 }
763 791
764 gfx::Rect Layer::PaintableRegion() { 792 gfx::Rect Layer::PaintableRegion() {
765 return gfx::Rect(size()); 793 return gfx::Rect(size());
766 } 794 }
767 795
768 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList( 796 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList(
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 if (animator_) { 1095 if (animator_) {
1068 animator_->ResetCompositor(compositor); 1096 animator_->ResetCompositor(compositor);
1069 animator_->RemoveFromCollection(collection); 1097 animator_->RemoveFromCollection(collection);
1070 } 1098 }
1071 1099
1072 for (auto* child : children_) 1100 for (auto* child : children_)
1073 child->ResetCompositorForAnimatorsInTree(compositor); 1101 child->ResetCompositorForAnimatorsInTree(compositor);
1074 } 1102 }
1075 1103
1076 } // namespace ui 1104 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer.h ('k') | ui/events/blink/input_handler_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698