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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/property_tree.cc
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc
index 1b0b5954a547fef475042fc8985caa199747098d..735b168a6210fc4a58ae733aa8a3e5dbd02e6949 100644
--- a/cc/trees/property_tree.cc
+++ b/cc/trees/property_tree.cc
@@ -1294,16 +1294,18 @@ const gfx::ScrollOffset ScrollTree::current_scroll_offset(int layer_id) const {
gfx::ScrollOffset ScrollTree::PullDeltaForMainThread(
SyncedScrollOffset* scroll_offset) {
- // TODO(flackr): We should pass the fractional scroll deltas when Blink fully
- // supports fractional scrolls.
- // TODO(flackr): We should ideally round the fractional scrolls in the same
- // direction as the scroll will be snapped but for common cases this is
- // equivalent to rounding to the nearest integer offset.
+ // TODO(miletus): Remove all this temporary flooring machinery when
+ // Blink fully supports fractional scrolls.
gfx::ScrollOffset current_offset =
scroll_offset->Current(property_trees()->is_active);
- gfx::ScrollOffset rounded_offset =
- gfx::ScrollOffset(roundf(current_offset.x()), roundf(current_offset.y()));
- scroll_offset->SetCurrent(rounded_offset);
+ gfx::ScrollOffset current_delta = property_trees()->is_active
+ ? scroll_offset->Delta()
+ : scroll_offset->PendingDelta().get();
+ gfx::ScrollOffset floored_delta(floor(current_delta.x()),
+ floor(current_delta.y()));
+ gfx::ScrollOffset diff_delta = floored_delta - current_delta;
+ gfx::ScrollOffset tmp_offset = current_offset + diff_delta;
+ scroll_offset->SetCurrent(tmp_offset);
gfx::ScrollOffset delta = scroll_offset->PullDeltaForMainThread();
scroll_offset->SetCurrent(current_offset);
return delta;
« 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