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

Side by Side Diff: cc/trees/property_tree.cc

Issue 2629793003: Revert "Round the scroll offset synced back to main instead of flooring." (Closed)
Patch Set: Created 3 years, 11 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/trees/layer_tree_host_unittest_scroll.cc ('k') | content/child/runtime_features.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 1287
1288 const gfx::ScrollOffset ScrollTree::current_scroll_offset(int layer_id) const { 1288 const gfx::ScrollOffset ScrollTree::current_scroll_offset(int layer_id) const {
1289 return synced_scroll_offset(layer_id) 1289 return synced_scroll_offset(layer_id)
1290 ? synced_scroll_offset(layer_id)->Current( 1290 ? synced_scroll_offset(layer_id)->Current(
1291 property_trees()->is_active) 1291 property_trees()->is_active)
1292 : gfx::ScrollOffset(); 1292 : gfx::ScrollOffset();
1293 } 1293 }
1294 1294
1295 gfx::ScrollOffset ScrollTree::PullDeltaForMainThread( 1295 gfx::ScrollOffset ScrollTree::PullDeltaForMainThread(
1296 SyncedScrollOffset* scroll_offset) { 1296 SyncedScrollOffset* scroll_offset) {
1297 // TODO(flackr): We should pass the fractional scroll deltas when Blink fully 1297 // TODO(miletus): Remove all this temporary flooring machinery when
1298 // supports fractional scrolls. 1298 // Blink fully supports fractional scrolls.
1299 // TODO(flackr): We should ideally round the fractional scrolls in the same
1300 // direction as the scroll will be snapped but for common cases this is
1301 // equivalent to rounding to the nearest integer offset.
1302 gfx::ScrollOffset current_offset = 1299 gfx::ScrollOffset current_offset =
1303 scroll_offset->Current(property_trees()->is_active); 1300 scroll_offset->Current(property_trees()->is_active);
1304 gfx::ScrollOffset rounded_offset = 1301 gfx::ScrollOffset current_delta = property_trees()->is_active
1305 gfx::ScrollOffset(roundf(current_offset.x()), roundf(current_offset.y())); 1302 ? scroll_offset->Delta()
1306 scroll_offset->SetCurrent(rounded_offset); 1303 : scroll_offset->PendingDelta().get();
1304 gfx::ScrollOffset floored_delta(floor(current_delta.x()),
1305 floor(current_delta.y()));
1306 gfx::ScrollOffset diff_delta = floored_delta - current_delta;
1307 gfx::ScrollOffset tmp_offset = current_offset + diff_delta;
1308 scroll_offset->SetCurrent(tmp_offset);
1307 gfx::ScrollOffset delta = scroll_offset->PullDeltaForMainThread(); 1309 gfx::ScrollOffset delta = scroll_offset->PullDeltaForMainThread();
1308 scroll_offset->SetCurrent(current_offset); 1310 scroll_offset->SetCurrent(current_offset);
1309 return delta; 1311 return delta;
1310 } 1312 }
1311 1313
1312 void ScrollTree::CollectScrollDeltas(ScrollAndScaleSet* scroll_info, 1314 void ScrollTree::CollectScrollDeltas(ScrollAndScaleSet* scroll_info,
1313 int inner_viewport_layer_id) { 1315 int inner_viewport_layer_id) {
1314 for (auto map_entry : layer_id_to_scroll_offset_map_) { 1316 for (auto map_entry : layer_id_to_scroll_offset_map_) {
1315 gfx::ScrollOffset scroll_delta = 1317 gfx::ScrollOffset scroll_delta =
1316 PullDeltaForMainThread(map_entry.second.get()); 1318 PullDeltaForMainThread(map_entry.second.get());
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 2054
2053 const EffectNode* effect_node = effect_tree.Node(effect_id); 2055 const EffectNode* effect_node = effect_tree.Node(effect_id);
2054 2056
2055 bool success = GetFromTarget(transform_id, effect_id, transform); 2057 bool success = GetFromTarget(transform_id, effect_id, transform);
2056 transform->Scale(effect_node->surface_contents_scale.x(), 2058 transform->Scale(effect_node->surface_contents_scale.x(),
2057 effect_node->surface_contents_scale.y()); 2059 effect_node->surface_contents_scale.y());
2058 return success; 2060 return success;
2059 } 2061 }
2060 2062
2061 } // namespace cc 2063 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_scroll.cc ('k') | content/child/runtime_features.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698