Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 2197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2208 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); | 2208 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); |
| 2209 } | 2209 } |
| 2210 #endif | 2210 #endif |
| 2211 } | 2211 } |
| 2212 | 2212 |
| 2213 void RenderWidget::didOverscroll( | 2213 void RenderWidget::didOverscroll( |
| 2214 const blink::WebFloatSize& unusedDelta, | 2214 const blink::WebFloatSize& unusedDelta, |
| 2215 const blink::WebFloatSize& accumulatedRootOverScroll, | 2215 const blink::WebFloatSize& accumulatedRootOverScroll, |
| 2216 const blink::WebFloatPoint& position, | 2216 const blink::WebFloatPoint& position, |
| 2217 const blink::WebFloatSize& velocity) { | 2217 const blink::WebFloatSize& velocity) { |
| 2218 if (compositor_deps_->IsElasticOverscrollEnabled()) { | |
| 2219 latest_overscroll_delta_ = | |
| 2220 gfx::Vector2dF(-unusedDelta.width, -unusedDelta.height); | |
| 2221 return; | |
| 2222 } | |
| 2223 | |
| 2218 DidOverscrollParams params; | 2224 DidOverscrollParams params; |
| 2219 // TODO(jdduke): Consider bundling the overscroll with the input event ack to | 2225 // TODO(jdduke): Consider bundling the overscroll with the input event ack to |
| 2220 // save an IPC. | 2226 // save an IPC. |
| 2221 params.accumulated_overscroll = gfx::Vector2dF( | 2227 params.accumulated_overscroll = gfx::Vector2dF( |
| 2222 accumulatedRootOverScroll.width, accumulatedRootOverScroll.height); | 2228 accumulatedRootOverScroll.width, accumulatedRootOverScroll.height); |
| 2223 params.latest_overscroll_delta = | 2229 params.latest_overscroll_delta = |
| 2224 gfx::Vector2dF(unusedDelta.width, unusedDelta.height); | 2230 gfx::Vector2dF(unusedDelta.width, unusedDelta.height); |
| 2225 // TODO(sataya.m): don't negate velocity once http://crbug.com/499743 is | 2231 // TODO(sataya.m): don't negate velocity once http://crbug.com/499743 is |
| 2226 // fixed. | 2232 // fixed. |
| 2227 params.current_fling_velocity = | 2233 params.current_fling_velocity = |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2286 void RenderWidget::ObserveWheelEventAndResult( | 2292 void RenderWidget::ObserveWheelEventAndResult( |
| 2287 const blink::WebMouseWheelEvent& wheel_event, | 2293 const blink::WebMouseWheelEvent& wheel_event, |
| 2288 bool event_processed) { | 2294 bool event_processed) { |
| 2289 if (!compositor_deps_->IsElasticOverscrollEnabled()) | 2295 if (!compositor_deps_->IsElasticOverscrollEnabled()) |
| 2290 return; | 2296 return; |
| 2291 | 2297 |
| 2292 // Blink does not accurately compute scroll bubbling or overscroll. For now, | 2298 // Blink does not accurately compute scroll bubbling or overscroll. For now, |
| 2293 // assume that an unprocessed event was entirely an overscroll, and that a | 2299 // assume that an unprocessed event was entirely an overscroll, and that a |
| 2294 // processed event was entirely scroll. | 2300 // processed event was entirely scroll. |
| 2295 // TODO(ccameron): Retrieve an accurate scroll result from Blink. | 2301 // TODO(ccameron): Retrieve an accurate scroll result from Blink. |
| 2296 // http://crbug.com/442859 | 2302 // http://crbug.com/442859 |
|
ccameron
2015/06/23 16:09:16
Even if event_processed is true, if you have a lat
| |
| 2297 cc::InputHandlerScrollResult scroll_result; | 2303 cc::InputHandlerScrollResult scroll_result; |
| 2298 if (event_processed) { | 2304 if (event_processed) { |
| 2299 scroll_result.did_scroll = true; | 2305 scroll_result.did_scroll = true; |
| 2300 } else { | 2306 } else { |
| 2301 scroll_result.did_overscroll_root = true; | 2307 scroll_result.did_overscroll_root = true; |
| 2302 scroll_result.unused_scroll_delta = | 2308 scroll_result.unused_scroll_delta = latest_overscroll_delta_; |
| 2303 gfx::Vector2dF(-wheel_event.deltaX, -wheel_event.deltaY); | 2309 latest_overscroll_delta_.set_x(0); |
| 2310 latest_overscroll_delta_.set_y(0); | |
| 2304 } | 2311 } |
| 2305 | 2312 |
| 2306 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 2313 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
| 2307 InputHandlerManager* input_handler_manager = | 2314 InputHandlerManager* input_handler_manager = |
| 2308 render_thread ? render_thread->input_handler_manager() : NULL; | 2315 render_thread ? render_thread->input_handler_manager() : NULL; |
| 2309 if (input_handler_manager) { | 2316 if (input_handler_manager) { |
| 2310 input_handler_manager->ObserveWheelEventAndResultOnMainThread( | 2317 input_handler_manager->ObserveWheelEventAndResultOnMainThread( |
| 2311 routing_id_, wheel_event, scroll_result); | 2318 routing_id_, wheel_event, scroll_result); |
| 2312 } | 2319 } |
| 2313 } | 2320 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2450 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2457 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2451 video_hole_frames_.AddObserver(frame); | 2458 video_hole_frames_.AddObserver(frame); |
| 2452 } | 2459 } |
| 2453 | 2460 |
| 2454 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2461 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2455 video_hole_frames_.RemoveObserver(frame); | 2462 video_hole_frames_.RemoveObserver(frame); |
| 2456 } | 2463 } |
| 2457 #endif // defined(VIDEO_HOLE) | 2464 #endif // defined(VIDEO_HOLE) |
| 2458 | 2465 |
| 2459 } // namespace content | 2466 } // namespace content |
| OLD | NEW |