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

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

Issue 867823007: Make the scroll_delta flooring behavior the same as before SyncedProperty change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "base/trace_event/trace_event_argument.h" 10 #include "base/trace_event/trace_event_argument.h"
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 } 1076 }
1077 1077
1078 void LayerImpl::PushScrollOffsetFromMainThread( 1078 void LayerImpl::PushScrollOffsetFromMainThread(
1079 const gfx::ScrollOffset& scroll_offset) { 1079 const gfx::ScrollOffset& scroll_offset) {
1080 PushScrollOffset(&scroll_offset); 1080 PushScrollOffset(&scroll_offset);
1081 } 1081 }
1082 1082
1083 gfx::ScrollOffset LayerImpl::PullDeltaForMainThread() { 1083 gfx::ScrollOffset LayerImpl::PullDeltaForMainThread() {
1084 RefreshFromScrollDelegate(); 1084 RefreshFromScrollDelegate();
1085 1085
1086 // TODO(aelias): Remove all this temporary flooring machinery when Blink 1086 // TODO(aelias, miletus): Remove all this temporary flooring machinery when
1087 // fully supports fractional scrolls. 1087 // Blink fully supports fractional scrolls.
1088 gfx::ScrollOffset current = CurrentScrollOffset(); 1088 gfx::ScrollOffset current_offset = CurrentScrollOffset();
1089 gfx::ScrollOffset floored(floor(current.x()), floor(current.y())); 1089 gfx::Vector2dF current_delta = ScrollDelta();
1090 scroll_offset_->SetCurrent(floored); 1090 gfx::Vector2dF floored_delta(floor(current_delta.x()),
1091 floor(current_delta.y()));
1092 gfx::Vector2dF diff_delta = floored_delta - current_delta;
1093 gfx::ScrollOffset tmp_offset = ScrollOffsetWithDelta(current_offset,
1094 diff_delta);
1095 scroll_offset_->SetCurrent(tmp_offset);
1091 gfx::ScrollOffset delta = scroll_offset_->PullDeltaForMainThread(); 1096 gfx::ScrollOffset delta = scroll_offset_->PullDeltaForMainThread();
1092 scroll_offset_->SetCurrent(current); 1097 scroll_offset_->SetCurrent(current_offset);
1093 return delta; 1098 return delta;
1094 } 1099 }
1095 1100
1096 void LayerImpl::RefreshFromScrollDelegate() { 1101 void LayerImpl::RefreshFromScrollDelegate() {
1097 if (scroll_offset_delegate_) { 1102 if (scroll_offset_delegate_) {
1098 SetCurrentScrollOffset( 1103 SetCurrentScrollOffset(
1099 gfx::ScrollOffset(scroll_offset_delegate_->GetCurrentScrollOffset())); 1104 gfx::ScrollOffset(scroll_offset_delegate_->GetCurrentScrollOffset()));
1100 } 1105 }
1101 } 1106 }
1102 1107
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 SetNeedsPushProperties(); 1538 SetNeedsPushProperties();
1534 layer_tree_impl()->set_needs_update_draw_properties(); 1539 layer_tree_impl()->set_needs_update_draw_properties();
1535 if (should_have_render_surface) { 1540 if (should_have_render_surface) {
1536 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this)); 1541 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this));
1537 return; 1542 return;
1538 } 1543 }
1539 render_surface_.reset(); 1544 render_surface_.reset();
1540 } 1545 }
1541 1546
1542 } // namespace cc 1547 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698