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/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 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 808 | 808 |
| 809 return true; | 809 return true; |
| 810 } | 810 } |
| 811 | 811 |
| 812 bool RenderWidgetHostViewAndroid::OnTouchHandleEvent( | 812 bool RenderWidgetHostViewAndroid::OnTouchHandleEvent( |
| 813 const ui::MotionEvent& event) { | 813 const ui::MotionEvent& event) { |
| 814 return selection_controller_ && | 814 return selection_controller_ && |
| 815 selection_controller_->WillHandleTouchEvent(event); | 815 selection_controller_->WillHandleTouchEvent(event); |
| 816 } | 816 } |
| 817 | 817 |
| 818 void RenderWidgetHostViewAndroid::ResetGestureDetection() { | 818 void RenderWidgetHostViewAndroid::OnMainFrameNavigation() { |
| 819 const ui::MotionEvent* current_down_event = | 819 const ui::MotionEvent* current_down_event = |
| 820 gesture_provider_.GetCurrentDownEvent(); | 820 gesture_provider_.GetCurrentDownEvent(); |
| 821 if (current_down_event) { | 821 if (current_down_event) { |
| 822 scoped_ptr<ui::MotionEvent> cancel_event = current_down_event->Cancel(); | 822 scoped_ptr<ui::MotionEvent> cancel_event = current_down_event->Cancel(); |
| 823 OnTouchEvent(*cancel_event); | 823 OnTouchEvent(*cancel_event); |
| 824 } | 824 } |
| 825 | 825 |
| 826 // A hard reset ensures prevention of any timer-based events. | 826 // A hard reset ensures prevention of any timer-based events. |
| 827 gesture_provider_.ResetDetection(); | 827 gesture_provider_.ResetDetection(); |
| 828 } | 828 } |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1251 | 1251 |
| 1252 void RenderWidgetHostViewAndroid::OnSelectionEvent( | 1252 void RenderWidgetHostViewAndroid::OnSelectionEvent( |
| 1253 ui::SelectionEventType event, | 1253 ui::SelectionEventType event, |
| 1254 const gfx::PointF& position) { | 1254 const gfx::PointF& position) { |
| 1255 DCHECK(content_view_core_); | 1255 DCHECK(content_view_core_); |
| 1256 // Showing the selection action bar can alter the current View coordinates in | 1256 // Showing the selection action bar can alter the current View coordinates in |
| 1257 // such a way that the current MotionEvent stream is suddenly shifted in | 1257 // such a way that the current MotionEvent stream is suddenly shifted in |
| 1258 // space. Avoid the associated scroll jump by pre-emptively cancelling gesture | 1258 // space. Avoid the associated scroll jump by pre-emptively cancelling gesture |
| 1259 // detection; scrolling after the selection is activated is unnecessary. | 1259 // detection; scrolling after the selection is activated is unnecessary. |
| 1260 if (event == ui::SelectionEventType::SELECTION_SHOWN) | 1260 if (event == ui::SelectionEventType::SELECTION_SHOWN) |
| 1261 ResetGestureDetection(); | 1261 OnMainFrameNavigation(); |
|
sadrul
2015/02/03 01:26:16
This feels wrong? Perhaps have ResetGestureDetecto
lanwei
2015/02/04 21:10:05
Done.
| |
| 1262 content_view_core_->OnSelectionEvent(event, position); | 1262 content_view_core_->OnSelectionEvent(event, position); |
| 1263 } | 1263 } |
| 1264 | 1264 |
| 1265 scoped_ptr<ui::TouchHandleDrawable> | 1265 scoped_ptr<ui::TouchHandleDrawable> |
| 1266 RenderWidgetHostViewAndroid::CreateDrawable() { | 1266 RenderWidgetHostViewAndroid::CreateDrawable() { |
| 1267 DCHECK(content_view_core_); | 1267 DCHECK(content_view_core_); |
| 1268 if (!using_browser_compositor_) | 1268 if (!using_browser_compositor_) |
| 1269 return content_view_core_->CreatePopupTouchHandleDrawable(); | 1269 return content_view_core_->CreatePopupTouchHandleDrawable(); |
| 1270 | 1270 |
| 1271 return scoped_ptr<ui::TouchHandleDrawable>(new CompositedTouchHandleDrawable( | 1271 return scoped_ptr<ui::TouchHandleDrawable>(new CompositedTouchHandleDrawable( |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1916 results->orientationAngle = display.RotationAsDegree(); | 1916 results->orientationAngle = display.RotationAsDegree(); |
| 1917 results->orientationType = | 1917 results->orientationType = |
| 1918 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1918 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 1919 gfx::DeviceDisplayInfo info; | 1919 gfx::DeviceDisplayInfo info; |
| 1920 results->depth = info.GetBitsPerPixel(); | 1920 results->depth = info.GetBitsPerPixel(); |
| 1921 results->depthPerComponent = info.GetBitsPerComponent(); | 1921 results->depthPerComponent = info.GetBitsPerComponent(); |
| 1922 results->isMonochrome = (results->depthPerComponent == 0); | 1922 results->isMonochrome = (results->depthPerComponent == 0); |
| 1923 } | 1923 } |
| 1924 | 1924 |
| 1925 } // namespace content | 1925 } // namespace content |
| OLD | NEW |