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

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

Issue 1143233003: Fix viewport scroll bubbling of wheel events in CC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | cc/trees/layer_tree_host_impl_unittest.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 2566 matching lines...) Expand 10 before | Expand all | Expand 10 after
2577 static gfx::Vector2dF ScrollLayerWithLocalDelta( 2577 static gfx::Vector2dF ScrollLayerWithLocalDelta(
2578 LayerImpl* layer_impl, 2578 LayerImpl* layer_impl,
2579 const gfx::Vector2dF& local_delta, 2579 const gfx::Vector2dF& local_delta,
2580 float page_scale_factor) { 2580 float page_scale_factor) {
2581 gfx::ScrollOffset previous_offset = layer_impl->CurrentScrollOffset(); 2581 gfx::ScrollOffset previous_offset = layer_impl->CurrentScrollOffset();
2582 gfx::Vector2dF delta = local_delta; 2582 gfx::Vector2dF delta = local_delta;
2583 delta.Scale(1.f / page_scale_factor); 2583 delta.Scale(1.f / page_scale_factor);
2584 layer_impl->ScrollBy(delta); 2584 layer_impl->ScrollBy(delta);
2585 gfx::ScrollOffset scrolled = 2585 gfx::ScrollOffset scrolled =
2586 layer_impl->CurrentScrollOffset() - previous_offset; 2586 layer_impl->CurrentScrollOffset() - previous_offset;
2587 return gfx::Vector2dF(scrolled.x(), scrolled.y()); 2587 gfx::Vector2dF consumed_scroll(scrolled.x(), scrolled.y());
2588 consumed_scroll.Scale(page_scale_factor);
2589
2590 return consumed_scroll;
2588 } 2591 }
2589 2592
2590 gfx::Vector2dF LayerTreeHostImpl::ScrollLayer(LayerImpl* layer_impl, 2593 gfx::Vector2dF LayerTreeHostImpl::ScrollLayer(LayerImpl* layer_impl,
2591 const gfx::Vector2dF& delta, 2594 const gfx::Vector2dF& delta,
2592 const gfx::Point& viewport_point, 2595 const gfx::Point& viewport_point,
2593 bool is_wheel_scroll) { 2596 bool is_wheel_scroll) {
2594 // Gesture events need to be transformed from viewport coordinates to 2597 // Gesture events need to be transformed from viewport coordinates to
2595 // local layer coordinates so that the scrolling contents exactly follow 2598 // local layer coordinates so that the scrolling contents exactly follow
2596 // the user's finger. In contrast, wheel events represent a fixed amount 2599 // the user's finger. In contrast, wheel events represent a fixed amount
2597 // of scrolling so we can just apply them directly, but the page scale 2600 // of scrolling so we can just apply them directly, but the page scale
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
3433 new_target.SetToMin(layer_impl->MaxScrollOffset()); 3436 new_target.SetToMin(layer_impl->MaxScrollOffset());
3434 3437
3435 curve->UpdateTarget( 3438 curve->UpdateTarget(
3436 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) 3439 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time)
3437 .InSecondsF(), 3440 .InSecondsF(),
3438 new_target); 3441 new_target);
3439 3442
3440 return true; 3443 return true;
3441 } 3444 }
3442 } // namespace cc 3445 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698