| 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 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 const gfx::PointF& base, | 1323 const gfx::PointF& base, |
| 1324 const gfx::PointF& extent) { | 1324 const gfx::PointF& extent) { |
| 1325 DCHECK(content_view_core_); | 1325 DCHECK(content_view_core_); |
| 1326 content_view_core_->SelectBetweenCoordinates(base, extent); | 1326 content_view_core_->SelectBetweenCoordinates(base, extent); |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 void RenderWidgetHostViewAndroid::OnSelectionEvent( | 1329 void RenderWidgetHostViewAndroid::OnSelectionEvent( |
| 1330 ui::SelectionEventType event) { | 1330 ui::SelectionEventType event) { |
| 1331 DCHECK(content_view_core_); | 1331 DCHECK(content_view_core_); |
| 1332 DCHECK(selection_controller_); | 1332 DCHECK(selection_controller_); |
| 1333 // Showing the selection action bar can alter the current View coordinates in | |
| 1334 // such a way that the current MotionEvent stream is suddenly shifted in | |
| 1335 // space. Avoid the associated scroll jump by pre-emptively cancelling gesture | |
| 1336 // detection; scrolling after the selection is activated is unnecessary. | |
| 1337 if (event == ui::SelectionEventType::SELECTION_SHOWN) | |
| 1338 ResetGestureDetection(); | |
| 1339 content_view_core_->OnSelectionEvent( | 1333 content_view_core_->OnSelectionEvent( |
| 1340 event, selection_controller_->GetStartPosition(), | 1334 event, selection_controller_->GetStartPosition(), |
| 1341 GetSelectionRect(*selection_controller_)); | 1335 GetSelectionRect(*selection_controller_)); |
| 1342 } | 1336 } |
| 1343 | 1337 |
| 1344 scoped_ptr<ui::TouchHandleDrawable> | 1338 scoped_ptr<ui::TouchHandleDrawable> |
| 1345 RenderWidgetHostViewAndroid::CreateDrawable() { | 1339 RenderWidgetHostViewAndroid::CreateDrawable() { |
| 1346 DCHECK(content_view_core_); | 1340 DCHECK(content_view_core_); |
| 1347 if (!using_browser_compositor_) | 1341 if (!using_browser_compositor_) |
| 1348 return content_view_core_->CreatePopupTouchHandleDrawable(); | 1342 return content_view_core_->CreatePopupTouchHandleDrawable(); |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1646 if (overscroll_controller_) | 1640 if (overscroll_controller_) |
| 1647 overscroll_controller_->OnGestureEventAck(event, ack_result); | 1641 overscroll_controller_->OnGestureEventAck(event, ack_result); |
| 1648 | 1642 |
| 1649 if (content_view_core_) | 1643 if (content_view_core_) |
| 1650 content_view_core_->OnGestureEventAck(event, ack_result); | 1644 content_view_core_->OnGestureEventAck(event, ack_result); |
| 1651 } | 1645 } |
| 1652 | 1646 |
| 1653 InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent( | 1647 InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent( |
| 1654 const blink::WebInputEvent& input_event) { | 1648 const blink::WebInputEvent& input_event) { |
| 1655 if (selection_controller_) { | 1649 if (selection_controller_) { |
| 1656 switch (input_event.type) { | 1650 if (input_event.type == blink::WebInputEvent::GestureLongPress) { |
| 1657 case blink::WebInputEvent::GestureLongPress: | 1651 const blink::WebGestureEvent& longpress = |
| 1658 selection_controller_->OnLongPressEvent(); | 1652 static_cast<const blink::WebGestureEvent&>(input_event); |
| 1659 break; | 1653 selection_controller_->OnLongPressEvent( |
| 1660 case blink::WebInputEvent::GestureTap: | 1654 gfx::PointF(longpress.x, longpress.y)); |
| 1661 selection_controller_->OnTapEvent(); | 1655 } else if (input_event.type == blink::WebInputEvent::GestureTap) { |
| 1662 break; | 1656 selection_controller_->OnTapEvent(); |
| 1663 default: | |
| 1664 break; | |
| 1665 } | 1657 } |
| 1666 } | 1658 } |
| 1667 | 1659 |
| 1668 if (overscroll_controller_ && | 1660 if (overscroll_controller_ && |
| 1669 blink::WebInputEvent::isGestureEventType(input_event.type) && | 1661 blink::WebInputEvent::isGestureEventType(input_event.type) && |
| 1670 overscroll_controller_->WillHandleGestureEvent( | 1662 overscroll_controller_->WillHandleGestureEvent( |
| 1671 static_cast<const blink::WebGestureEvent&>(input_event))) { | 1663 static_cast<const blink::WebGestureEvent&>(input_event))) { |
| 1672 return INPUT_EVENT_ACK_STATE_CONSUMED; | 1664 return INPUT_EVENT_ACK_STATE_CONSUMED; |
| 1673 } | 1665 } |
| 1674 | 1666 |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2099 results->orientationAngle = display.RotationAsDegree(); | 2091 results->orientationAngle = display.RotationAsDegree(); |
| 2100 results->orientationType = | 2092 results->orientationType = |
| 2101 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2093 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 2102 gfx::DeviceDisplayInfo info; | 2094 gfx::DeviceDisplayInfo info; |
| 2103 results->depth = info.GetBitsPerPixel(); | 2095 results->depth = info.GetBitsPerPixel(); |
| 2104 results->depthPerComponent = info.GetBitsPerComponent(); | 2096 results->depthPerComponent = info.GetBitsPerComponent(); |
| 2105 results->isMonochrome = (results->depthPerComponent == 0); | 2097 results->isMonochrome = (results->depthPerComponent == 0); |
| 2106 } | 2098 } |
| 2107 | 2099 |
| 2108 } // namespace content | 2100 } // namespace content |
| OLD | NEW |