Chromium Code Reviews

Side by Side Diff: content/renderer/input/input_handler_proxy.cc

Issue 1418493003: Let LayerTreeHostImpl::ScrollAnimated scroll the outer viewport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile error for realz Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | content/renderer/input/input_handler_proxy_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/input/input_handler_proxy.h" 5 #include "content/renderer/input/input_handler_proxy.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 732 matching lines...)
743 "InputHandlerProxy::ExtendBoostedFlingTimeout", 743 "InputHandlerProxy::ExtendBoostedFlingTimeout",
744 TRACE_EVENT_SCOPE_THREAD); 744 TRACE_EVENT_SCOPE_THREAD);
745 deferred_fling_cancel_time_seconds_ = 745 deferred_fling_cancel_time_seconds_ =
746 event.timeStampSeconds + kFlingBoostTimeoutDelaySeconds; 746 event.timeStampSeconds + kFlingBoostTimeoutDelaySeconds;
747 last_fling_boost_event_ = event; 747 last_fling_boost_event_ = event;
748 } 748 }
749 749
750 void InputHandlerProxy::Animate(base::TimeTicks time) { 750 void InputHandlerProxy::Animate(base::TimeTicks time) {
751 // If using synchronous animate, then only expect Animate attempts started by 751 // If using synchronous animate, then only expect Animate attempts started by
752 // the synchronous system. Don't let the InputHandler try to Animate also. 752 // the synchronous system. Don't let the InputHandler try to Animate also.
753 DCHECK_IMPLIES(input_handler_->IsCurrentlyScrollingRoot(), 753 DCHECK_IMPLIES(input_handler_->IsCurrentlyScrollingInnerViewport(),
754 allow_root_animate_); 754 allow_root_animate_);
755 755
756 if (scroll_elasticity_controller_) 756 if (scroll_elasticity_controller_)
757 scroll_elasticity_controller_->Animate(time); 757 scroll_elasticity_controller_->Animate(time);
758 758
759 if (!fling_curve_) 759 if (!fling_curve_)
760 return; 760 return;
761 761
762 last_fling_animate_time_ = time; 762 last_fling_animate_time_ = time;
763 double monotonic_time_sec = InSecondsF(time); 763 double monotonic_time_sec = InSecondsF(time);
(...skipping 161 matching lines...)
925 } 925 }
926 } 926 }
927 927
928 return had_fling_animation; 928 return had_fling_animation;
929 } 929 }
930 930
931 void InputHandlerProxy::RequestAnimation() { 931 void InputHandlerProxy::RequestAnimation() {
932 // When a SynchronousInputHandler is present, root flings should go through 932 // When a SynchronousInputHandler is present, root flings should go through
933 // it to allow it to control when or if the root fling is animated. Non-root 933 // it to allow it to control when or if the root fling is animated. Non-root
934 // flings always go through the normal InputHandler. 934 // flings always go through the normal InputHandler.
935 if (synchronous_input_handler_ && input_handler_->IsCurrentlyScrollingRoot()) 935 if (synchronous_input_handler_ &&
936 input_handler_->IsCurrentlyScrollingInnerViewport())
936 synchronous_input_handler_->SetNeedsSynchronousAnimateInput(); 937 synchronous_input_handler_->SetNeedsSynchronousAnimateInput();
937 else 938 else
938 input_handler_->SetNeedsAnimateInput(); 939 input_handler_->SetNeedsAnimateInput();
939 } 940 }
940 941
941 bool InputHandlerProxy::TouchpadFlingScroll( 942 bool InputHandlerProxy::TouchpadFlingScroll(
942 const WebFloatSize& increment) { 943 const WebFloatSize& increment) {
943 WebMouseWheelEvent synthetic_wheel; 944 WebMouseWheelEvent synthetic_wheel;
944 synthetic_wheel.type = WebInputEvent::MouseWheel; 945 synthetic_wheel.type = WebInputEvent::MouseWheel;
945 synthetic_wheel.deltaX = increment.width; 946 synthetic_wheel.deltaX = increment.width;
(...skipping 82 matching lines...)
1028 // trigger a scroll, e.g., with a trivial time delta between fling updates. 1029 // trigger a scroll, e.g., with a trivial time delta between fling updates.
1029 // Return true in this case to prevent early fling termination. 1030 // Return true in this case to prevent early fling termination.
1030 if (std::abs(clipped_increment.width) < kScrollEpsilon && 1031 if (std::abs(clipped_increment.width) < kScrollEpsilon &&
1031 std::abs(clipped_increment.height) < kScrollEpsilon) 1032 std::abs(clipped_increment.height) < kScrollEpsilon)
1032 return true; 1033 return true;
1033 1034
1034 return did_scroll; 1035 return did_scroll;
1035 } 1036 }
1036 1037
1037 } // namespace content 1038 } // namespace content
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | content/renderer/input/input_handler_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine