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/browser/renderer_host/render_widget_host_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 DCHECK(content_view_core); | 210 DCHECK(content_view_core); |
211 int tap_timeout_ms = gfx::ViewConfiguration::GetTapTimeoutInMs(); | 211 int tap_timeout_ms = gfx::ViewConfiguration::GetTapTimeoutInMs(); |
212 int touch_slop_pixels = gfx::ViewConfiguration::GetTouchSlopInPixels(); | 212 int touch_slop_pixels = gfx::ViewConfiguration::GetTouchSlopInPixels(); |
213 return make_scoped_ptr(new TouchSelectionController( | 213 return make_scoped_ptr(new TouchSelectionController( |
214 client, | 214 client, |
215 base::TimeDelta::FromMilliseconds(tap_timeout_ms), | 215 base::TimeDelta::FromMilliseconds(tap_timeout_ms), |
216 touch_slop_pixels / content_view_core->GetDpiScale())); | 216 touch_slop_pixels / content_view_core->GetDpiScale())); |
217 } | 217 } |
218 | 218 |
219 ui::GestureProvider::Config CreateGestureProviderConfig() { | 219 ui::GestureProvider::Config CreateGestureProviderConfig() { |
220 ui::GestureProvider::Config config = ui::DefaultGestureProviderConfig(); | 220 ui::GestureProvider::Config config = ui::GetGestureProviderConfig( |
| 221 ui::GestureProviderConfigType::CURRENT_PLATFORM); |
221 config.disable_click_delay = | 222 config.disable_click_delay = |
222 base::CommandLine::ForCurrentProcess()->HasSwitch( | 223 base::CommandLine::ForCurrentProcess()->HasSwitch( |
223 switches::kDisableClickDelay); | 224 switches::kDisableClickDelay); |
224 return config; | 225 return config; |
225 } | 226 } |
226 | 227 |
227 bool HasFixedPageScale(const cc::CompositorFrameMetadata& frame_metadata) { | 228 bool HasFixedPageScale(const cc::CompositorFrameMetadata& frame_metadata) { |
228 return frame_metadata.min_page_scale_factor == | 229 return frame_metadata.min_page_scale_factor == |
229 frame_metadata.max_page_scale_factor; | 230 frame_metadata.max_page_scale_factor; |
230 } | 231 } |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 selection_controller_->WillHandleTouchEvent(event)) | 707 selection_controller_->WillHandleTouchEvent(event)) |
707 return true; | 708 return true; |
708 | 709 |
709 if (gesture_text_selector_.OnTouchEvent(event)) | 710 if (gesture_text_selector_.OnTouchEvent(event)) |
710 return true; | 711 return true; |
711 | 712 |
712 if (!gesture_provider_.OnTouchEvent(event)) | 713 if (!gesture_provider_.OnTouchEvent(event)) |
713 return false; | 714 return false; |
714 | 715 |
715 if (host_->ShouldForwardTouchEvent()) { | 716 if (host_->ShouldForwardTouchEvent()) { |
716 blink::WebTouchEvent web_event = CreateWebTouchEventFromMotionEvent(event); | 717 bool event_may_cause_scrolling = |
| 718 gesture_provider_.LastTouchEventDidGenerateScroll(); |
| 719 blink::WebTouchEvent web_event = |
| 720 CreateWebTouchEventFromMotionEvent(event, event_may_cause_scrolling); |
717 host_->ForwardTouchEventWithLatencyInfo(web_event, | 721 host_->ForwardTouchEventWithLatencyInfo(web_event, |
718 CreateLatencyInfo(web_event)); | 722 CreateLatencyInfo(web_event)); |
719 } else { | 723 } else { |
720 const bool event_consumed = false; | 724 const bool event_consumed = false; |
721 gesture_provider_.OnTouchEventAck(event_consumed); | 725 gesture_provider_.OnTouchEventAck(event_consumed); |
722 } | 726 } |
723 | 727 |
724 // Send a proactive BeginFrame on the next vsync to reduce latency. | 728 // Send a proactive BeginFrame on the next vsync to reduce latency. |
725 // This is good enough as long as the first touch event has Begin semantics | 729 // This is good enough as long as the first touch event has Begin semantics |
726 // and the actual scroll happens on the next vsync. | 730 // and the actual scroll happens on the next vsync. |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1800 results->orientationAngle = display.RotationAsDegree(); | 1804 results->orientationAngle = display.RotationAsDegree(); |
1801 results->orientationType = | 1805 results->orientationType = |
1802 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1806 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1803 gfx::DeviceDisplayInfo info; | 1807 gfx::DeviceDisplayInfo info; |
1804 results->depth = info.GetBitsPerPixel(); | 1808 results->depth = info.GetBitsPerPixel(); |
1805 results->depthPerComponent = info.GetBitsPerComponent(); | 1809 results->depthPerComponent = info.GetBitsPerComponent(); |
1806 results->isMonochrome = (results->depthPerComponent == 0); | 1810 results->isMonochrome = (results->depthPerComponent == 0); |
1807 } | 1811 } |
1808 | 1812 |
1809 } // namespace content | 1813 } // namespace content |
OLD | NEW |