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

Unified Diff: cc/trees/property_tree.cc

Issue 2511473003: Round the scroll offset synced back to main instead of flooring. (Closed)
Patch Set: Wait for scroll animation to complete before checking main thread scrolling reasons. Created 4 years, 1 month 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
Index: cc/trees/property_tree.cc
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc
index 3e67f101ae2dd4a51ab9b9775683829758f646fa..e469c549005aaa923f8fa04d11c5532ef61f969e 100644
--- a/cc/trees/property_tree.cc
+++ b/cc/trees/property_tree.cc
@@ -1220,18 +1220,16 @@ const gfx::ScrollOffset ScrollTree::current_scroll_offset(int layer_id) const {
gfx::ScrollOffset ScrollTree::PullDeltaForMainThread(
SyncedScrollOffset* scroll_offset) {
- // TODO(miletus): Remove all this temporary flooring machinery when
- // Blink fully supports fractional scrolls.
+ // 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.
gfx::ScrollOffset current_offset =
scroll_offset->Current(property_trees()->is_active);
- 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 rounded_offset =
+ gfx::ScrollOffset(roundf(current_offset.x()), roundf(current_offset.y()));
+ scroll_offset->SetCurrent(rounded_offset);
gfx::ScrollOffset delta = scroll_offset->PullDeltaForMainThread();
scroll_offset->SetCurrent(current_offset);
return delta;

Powered by Google App Engine
This is Rietveld 408576698