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

Side by Side Diff: cc/layers/layer.cc

Issue 1385123003: Delete scrollCompensationAdjustment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again Created 4 years, 9 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 | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('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 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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/layers/layer.h" 5 #include "cc/layers/layer.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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 transform_node->data.needs_local_transform_update = true; 828 transform_node->data.needs_local_transform_update = true;
829 layer_tree_host_->property_trees()->transform_tree.set_needs_update(true); 829 layer_tree_host_->property_trees()->transform_tree.set_needs_update(true);
830 SetNeedsCommitNoRebuild(); 830 SetNeedsCommitNoRebuild();
831 return; 831 return;
832 } 832 }
833 } 833 }
834 834
835 SetNeedsCommit(); 835 SetNeedsCommit();
836 } 836 }
837 837
838 void Layer::SetScrollCompensationAdjustment(
839 const gfx::Vector2dF& scroll_compensation_adjustment) {
840 if (scroll_compensation_adjustment_ == scroll_compensation_adjustment)
841 return;
842 scroll_compensation_adjustment_ = scroll_compensation_adjustment;
843 SetNeedsCommit();
844 }
845
846 gfx::Vector2dF Layer::ScrollCompensationAdjustment() const {
847 return scroll_compensation_adjustment_;
848 }
849
850 void Layer::SetScrollOffsetFromImplSide( 838 void Layer::SetScrollOffsetFromImplSide(
851 const gfx::ScrollOffset& scroll_offset) { 839 const gfx::ScrollOffset& scroll_offset) {
852 DCHECK(IsPropertyChangeAllowed()); 840 DCHECK(IsPropertyChangeAllowed());
853 // This function only gets called during a BeginMainFrame, so there 841 // This function only gets called during a BeginMainFrame, so there
854 // is no need to call SetNeedsUpdate here. 842 // is no need to call SetNeedsUpdate here.
855 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); 843 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested());
856 if (scroll_offset_ == scroll_offset) 844 if (scroll_offset_ == scroll_offset)
857 return; 845 return;
858 scroll_offset_ = scroll_offset; 846 scroll_offset_ = scroll_offset;
859 SetNeedsPushProperties(); 847 SetNeedsPushProperties();
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 1264
1277 // When a scroll offset animation is interrupted the new scroll position on 1265 // When a scroll offset animation is interrupted the new scroll position on
1278 // the pending tree will clobber any impl-side scrolling occuring on the 1266 // the pending tree will clobber any impl-side scrolling occuring on the
1279 // active tree. To do so, avoid scrolling the pending tree along with it 1267 // active tree. To do so, avoid scrolling the pending tree along with it
1280 // instead of trying to undo that scrolling later. 1268 // instead of trying to undo that scrolling later.
1281 if (ScrollOffsetAnimationWasInterrupted()) 1269 if (ScrollOffsetAnimationWasInterrupted())
1282 layer_tree_host() 1270 layer_tree_host()
1283 ->property_trees() 1271 ->property_trees()
1284 ->scroll_tree.synced_scroll_offset(layer->id()) 1272 ->scroll_tree.synced_scroll_offset(layer->id())
1285 ->set_clobber_active_value(); 1273 ->set_clobber_active_value();
1286 layer->SetScrollCompensationAdjustment(ScrollCompensationAdjustment());
1287 1274
1288 { 1275 {
1289 TRACE_EVENT0("cc", "Layer::PushPropertiesTo::CopyOutputRequests"); 1276 TRACE_EVENT0("cc", "Layer::PushPropertiesTo::CopyOutputRequests");
1290 // Wrap the copy_requests_ in a PostTask to the main thread. 1277 // Wrap the copy_requests_ in a PostTask to the main thread.
1291 std::vector<scoped_ptr<CopyOutputRequest>> main_thread_copy_requests; 1278 std::vector<scoped_ptr<CopyOutputRequest>> main_thread_copy_requests;
1292 for (auto it = copy_requests_.begin(); it != copy_requests_.end(); ++it) { 1279 for (auto it = copy_requests_.begin(); it != copy_requests_.end(); ++it) {
1293 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = 1280 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner =
1294 layer_tree_host()->task_runner_provider()->MainThreadTaskRunner(); 1281 layer_tree_host()->task_runner_provider()->MainThreadTaskRunner();
1295 scoped_ptr<CopyOutputRequest> original_request = std::move(*it); 1282 scoped_ptr<CopyOutputRequest> original_request = std::move(*it);
1296 const CopyOutputRequest& original_request_ref = *original_request; 1283 const CopyOutputRequest& original_request_ref = *original_request;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 1509
1523 int clip_parent_id = clip_parent_ ? clip_parent_->id() : INVALID_ID; 1510 int clip_parent_id = clip_parent_ ? clip_parent_->id() : INVALID_ID;
1524 base->set_clip_parent_id(clip_parent_id); 1511 base->set_clip_parent_id(clip_parent_id);
1525 1512
1526 if (clip_children_) { 1513 if (clip_children_) {
1527 for (auto* child : *clip_children_) 1514 for (auto* child : *clip_children_)
1528 base->add_clip_children_ids(child->id()); 1515 base->add_clip_children_ids(child->id());
1529 } 1516 }
1530 1517
1531 ScrollOffsetToProto(scroll_offset_, base->mutable_scroll_offset()); 1518 ScrollOffsetToProto(scroll_offset_, base->mutable_scroll_offset());
1532 Vector2dFToProto(scroll_compensation_adjustment_,
1533 base->mutable_scroll_compensation_adjustment());
1534 1519
1535 // TODO(nyquist): Figure out what to do with CopyRequests. 1520 // TODO(nyquist): Figure out what to do with CopyRequests.
1536 // See crbug.com/570374. 1521 // See crbug.com/570374.
1537 1522
1538 RectToProto(update_rect_, base->mutable_update_rect()); 1523 RectToProto(update_rect_, base->mutable_update_rect());
1539 1524
1540 // TODO(nyquist): Figure out what to do with LayerAnimationController. 1525 // TODO(nyquist): Figure out what to do with LayerAnimationController.
1541 // See crbug.com/570376. 1526 // See crbug.com/570376.
1542 // TODO(nyquist): Figure out what to do with FrameTimingRequests. See 1527 // TODO(nyquist): Figure out what to do with FrameTimingRequests. See
1543 // crbug.com/570377. 1528 // crbug.com/570377.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 clip_children_->clear(); 1612 clip_children_->clear();
1628 else if (base.clip_children_ids_size() > 0) 1613 else if (base.clip_children_ids_size() > 0)
1629 clip_children_.reset(new std::set<Layer*>); 1614 clip_children_.reset(new std::set<Layer*>);
1630 for (int i = 0; i < base.clip_children_ids_size(); ++i) { 1615 for (int i = 0; i < base.clip_children_ids_size(); ++i) {
1631 int child_id = base.clip_children_ids(i); 1616 int child_id = base.clip_children_ids(i);
1632 scoped_refptr<Layer> child = layer_tree_host_->LayerById(child_id); 1617 scoped_refptr<Layer> child = layer_tree_host_->LayerById(child_id);
1633 clip_children_->insert(child.get()); 1618 clip_children_->insert(child.get());
1634 } 1619 }
1635 1620
1636 scroll_offset_ = ProtoToScrollOffset(base.scroll_offset()); 1621 scroll_offset_ = ProtoToScrollOffset(base.scroll_offset());
1637 scroll_compensation_adjustment_ =
1638 ProtoToVector2dF(base.scroll_compensation_adjustment());
1639 1622
1640 update_rect_.Union(ProtoToRect(base.update_rect())); 1623 update_rect_.Union(ProtoToRect(base.update_rect()));
1641 } 1624 }
1642 1625
1643 scoped_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) { 1626 scoped_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) {
1644 return LayerImpl::Create(tree_impl, layer_id_); 1627 return LayerImpl::Create(tree_impl, layer_id_);
1645 } 1628 }
1646 1629
1647 bool Layer::DrawsContent() const { 1630 bool Layer::DrawsContent() const {
1648 return draws_content_; 1631 return draws_content_;
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 this, layer_tree_host_->property_trees()->transform_tree); 1926 this, layer_tree_host_->property_trees()->transform_tree);
1944 } 1927 }
1945 1928
1946 gfx::Transform Layer::screen_space_transform() const { 1929 gfx::Transform Layer::screen_space_transform() const {
1947 DCHECK_NE(transform_tree_index_, -1); 1930 DCHECK_NE(transform_tree_index_, -1);
1948 return draw_property_utils::ScreenSpaceTransform( 1931 return draw_property_utils::ScreenSpaceTransform(
1949 this, layer_tree_host_->property_trees()->transform_tree); 1932 this, layer_tree_host_->property_trees()->transform_tree);
1950 } 1933 }
1951 1934
1952 } // namespace cc 1935 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698