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

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: Add a test for the transform goop 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
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_->SetScrollParent(parent_clip_layer->cc_layer_);
Ian Vollick 2016/08/09 14:00:49 This should not be necessary. The concept of "scro
tapted 2016/08/10 05:39:04 Done.
762 cc_layer_->SetIsContainerForFixedPositionLayers(true);
Ian Vollick 2016/08/09 14:00:49 Do we used fixed pos layers in ui::?
tapted 2016/08/10 05:39:04 Ah, I must have added this in a very early iterati
763 cc_layer_->SetScrollClipLayerId(parent_clip_layer->cc_layer_->id());
764 cc_layer_->set_did_scroll_callback(on_scroll);
765 cc_layer_->SetUserScrollable(true, true);
766 }
767
768 gfx::ScrollOffset Layer::CurrentScrollOffset() const {
769 const Compositor* compositor = GetCompositor();
770 gfx::ScrollOffset offset;
771 if (compositor &&
772 compositor->GetScrollOffsetForLayer(cc_layer_->id(), &offset))
773 return offset;
774 return cc_layer_->scroll_offset();
775 }
776
777 void Layer::SetScrollOffset(const gfx::ScrollOffset& offset) {
778 Compositor* compositor = GetCompositor();
779 bool scrolled_on_impl_side =
780 compositor && compositor->ScrollLayerTo(cc_layer_->id(), offset);
781
782 if (!scrolled_on_impl_side)
783 cc_layer_->SetScrollOffset(offset);
784
785 DCHECK_EQ(offset.x(), CurrentScrollOffset().x());
786 DCHECK_EQ(offset.y(), CurrentScrollOffset().y());
787 }
788
759 void Layer::RequestCopyOfOutput( 789 void Layer::RequestCopyOfOutput(
760 std::unique_ptr<cc::CopyOutputRequest> request) { 790 std::unique_ptr<cc::CopyOutputRequest> request) {
761 cc_layer_->RequestCopyOfOutput(std::move(request)); 791 cc_layer_->RequestCopyOfOutput(std::move(request));
762 } 792 }
763 793
764 gfx::Rect Layer::PaintableRegion() { 794 gfx::Rect Layer::PaintableRegion() {
765 return gfx::Rect(size()); 795 return gfx::Rect(size());
766 } 796 }
767 797
768 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList( 798 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList(
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 if (animator_) { 1097 if (animator_) {
1068 animator_->ResetCompositor(compositor); 1098 animator_->ResetCompositor(compositor);
1069 animator_->RemoveFromCollection(collection); 1099 animator_->RemoveFromCollection(collection);
1070 } 1100 }
1071 1101
1072 for (auto* child : children_) 1102 for (auto* child : children_)
1073 child->ResetCompositorForAnimatorsInTree(compositor); 1103 child->ResetCompositorForAnimatorsInTree(compositor);
1074 } 1104 }
1075 1105
1076 } // namespace ui 1106 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698