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

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

Issue 877173002: Fixed position layer counter-scroll with main thread scroll offset fractional part (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unittests Created 5 years, 10 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 665
666 void Layer::SetScrollOffset(const gfx::ScrollOffset& scroll_offset) { 666 void Layer::SetScrollOffset(const gfx::ScrollOffset& scroll_offset) {
667 DCHECK(IsPropertyChangeAllowed()); 667 DCHECK(IsPropertyChangeAllowed());
668 668
669 if (scroll_offset_ == scroll_offset) 669 if (scroll_offset_ == scroll_offset)
670 return; 670 return;
671 scroll_offset_ = scroll_offset; 671 scroll_offset_ = scroll_offset;
672 SetNeedsCommit(); 672 SetNeedsCommit();
673 } 673 }
674 674
675 void Layer::SetScrollOffsetFractionalPart(
676 const gfx::Vector2dF& scroll_offset_fractional_part) {
677 if (scroll_offset_fractional_part_ == scroll_offset_fractional_part)
678 return;
679 scroll_offset_fractional_part_ = scroll_offset_fractional_part;
680 SetNeedsCommit();
681 }
682
683 gfx::Vector2dF Layer::MainScrollOffsetFractionalPart() const {
684 return scroll_offset_fractional_part_;
685 }
686
675 void Layer::SetScrollOffsetFromImplSide( 687 void Layer::SetScrollOffsetFromImplSide(
676 const gfx::ScrollOffset& scroll_offset) { 688 const gfx::ScrollOffset& scroll_offset) {
677 DCHECK(IsPropertyChangeAllowed()); 689 DCHECK(IsPropertyChangeAllowed());
678 // This function only gets called during a BeginMainFrame, so there 690 // This function only gets called during a BeginMainFrame, so there
679 // is no need to call SetNeedsUpdate here. 691 // is no need to call SetNeedsUpdate here.
680 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); 692 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested());
681 if (scroll_offset_ == scroll_offset) 693 if (scroll_offset_ == scroll_offset)
682 return; 694 return;
683 scroll_offset_ = scroll_offset; 695 scroll_offset_ = scroll_offset;
684 SetNeedsPushProperties(); 696 SetNeedsPushProperties();
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 } else { 986 } else {
975 if (layer_animation_controller_ 987 if (layer_animation_controller_
976 ->scroll_offset_animation_was_interrupted()) { 988 ->scroll_offset_animation_was_interrupted()) {
977 layer->SetScrollOffsetAndDelta(scroll_offset_, gfx::Vector2dF()); 989 layer->SetScrollOffsetAndDelta(scroll_offset_, gfx::Vector2dF());
978 } else { 990 } else {
979 layer->SetScrollOffsetAndDelta( 991 layer->SetScrollOffsetAndDelta(
980 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta()); 992 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta());
981 } 993 }
982 layer->SetSentScrollDelta(gfx::Vector2dF()); 994 layer->SetSentScrollDelta(gfx::Vector2dF());
983 } 995 }
996 layer->SetMainScrollOffsetFractionalPart(MainScrollOffsetFractionalPart());
984 997
985 // Wrap the copy_requests_ in a PostTask to the main thread. 998 // Wrap the copy_requests_ in a PostTask to the main thread.
986 ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests; 999 ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests;
987 for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin(); 1000 for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin();
988 it != copy_requests_.end(); 1001 it != copy_requests_.end();
989 ++it) { 1002 ++it) {
990 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = 1003 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner =
991 layer_tree_host()->proxy()->MainThreadTaskRunner(); 1004 layer_tree_host()->proxy()->MainThreadTaskRunner();
992 scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it); 1005 scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it);
993 const CopyOutputRequest& original_request_ref = *original_request; 1006 const CopyOutputRequest& original_request_ref = *original_request;
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 } 1307 }
1295 1308
1296 void Layer::SetFrameTimingRequests( 1309 void Layer::SetFrameTimingRequests(
1297 const std::vector<FrameTimingRequest>& requests) { 1310 const std::vector<FrameTimingRequest>& requests) {
1298 frame_timing_requests_ = requests; 1311 frame_timing_requests_ = requests;
1299 frame_timing_requests_dirty_ = true; 1312 frame_timing_requests_dirty_ = true;
1300 SetNeedsCommit(); 1313 SetNeedsCommit();
1301 } 1314 }
1302 1315
1303 } // namespace cc 1316 } // 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