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 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 const gfx::PointF& base, | 1309 const gfx::PointF& base, |
1310 const gfx::PointF& extent) { | 1310 const gfx::PointF& extent) { |
1311 DCHECK(content_view_core_); | 1311 DCHECK(content_view_core_); |
1312 content_view_core_->SelectBetweenCoordinates(base, extent); | 1312 content_view_core_->SelectBetweenCoordinates(base, extent); |
1313 } | 1313 } |
1314 | 1314 |
1315 void RenderWidgetHostViewAndroid::OnSelectionEvent( | 1315 void RenderWidgetHostViewAndroid::OnSelectionEvent( |
1316 ui::SelectionEventType event) { | 1316 ui::SelectionEventType event) { |
1317 DCHECK(content_view_core_); | 1317 DCHECK(content_view_core_); |
1318 DCHECK(selection_controller_); | 1318 DCHECK(selection_controller_); |
1319 // Showing the selection action bar can alter the current View coordinates in | |
1320 // such a way that the current MotionEvent stream is suddenly shifted in | |
1321 // space. Avoid the associated scroll jump by pre-emptively cancelling gesture | |
1322 // detection; scrolling after the selection is activated is unnecessary. | |
1323 if (event == ui::SelectionEventType::SELECTION_SHOWN) | |
1324 ResetGestureDetection(); | |
1325 content_view_core_->OnSelectionEvent( | 1319 content_view_core_->OnSelectionEvent( |
1326 event, selection_controller_->GetStartPosition(), | 1320 event, selection_controller_->GetStartPosition(), |
1327 GetSelectionRect(*selection_controller_)); | 1321 GetSelectionRect(*selection_controller_)); |
1328 } | 1322 } |
1329 | 1323 |
1330 scoped_ptr<ui::TouchHandleDrawable> | 1324 scoped_ptr<ui::TouchHandleDrawable> |
1331 RenderWidgetHostViewAndroid::CreateDrawable() { | 1325 RenderWidgetHostViewAndroid::CreateDrawable() { |
1332 DCHECK(content_view_core_); | 1326 DCHECK(content_view_core_); |
1333 if (!using_browser_compositor_) | 1327 if (!using_browser_compositor_) |
1334 return content_view_core_->CreatePopupTouchHandleDrawable(); | 1328 return content_view_core_->CreatePopupTouchHandleDrawable(); |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 if (overscroll_controller_) | 1630 if (overscroll_controller_) |
1637 overscroll_controller_->OnGestureEventAck(event, ack_result); | 1631 overscroll_controller_->OnGestureEventAck(event, ack_result); |
1638 | 1632 |
1639 if (content_view_core_) | 1633 if (content_view_core_) |
1640 content_view_core_->OnGestureEventAck(event, ack_result); | 1634 content_view_core_->OnGestureEventAck(event, ack_result); |
1641 } | 1635 } |
1642 | 1636 |
1643 InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent( | 1637 InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent( |
1644 const blink::WebInputEvent& input_event) { | 1638 const blink::WebInputEvent& input_event) { |
1645 if (selection_controller_) { | 1639 if (selection_controller_) { |
1646 switch (input_event.type) { | 1640 if (input_event.type == blink::WebInputEvent::GestureLongPress) { |
1647 case blink::WebInputEvent::GestureLongPress: | 1641 const blink::WebGestureEvent& longpress = |
1648 selection_controller_->OnLongPressEvent(); | 1642 static_cast<const blink::WebGestureEvent&>(input_event); |
1649 break; | 1643 selection_controller_->OnLongPressEvent( |
1650 case blink::WebInputEvent::GestureTap: | 1644 base::TimeTicks() + |
1651 selection_controller_->OnTapEvent(); | 1645 base::TimeDelta::FromSecondsD(input_event.timeStampSeconds), |
1652 break; | 1646 gfx::PointF(longpress.x, longpress.y)); |
1653 default: | 1647 } else if (input_event.type == blink::WebInputEvent::GestureTap) { |
1654 break; | 1648 selection_controller_->OnTapEvent(); |
1655 } | 1649 } |
1656 } | 1650 } |
1657 | 1651 |
1658 if (overscroll_controller_ && | 1652 if (overscroll_controller_ && |
1659 blink::WebInputEvent::isGestureEventType(input_event.type) && | 1653 blink::WebInputEvent::isGestureEventType(input_event.type) && |
1660 overscroll_controller_->WillHandleGestureEvent( | 1654 overscroll_controller_->WillHandleGestureEvent( |
1661 static_cast<const blink::WebGestureEvent&>(input_event))) { | 1655 static_cast<const blink::WebGestureEvent&>(input_event))) { |
1662 return INPUT_EVENT_ACK_STATE_CONSUMED; | 1656 return INPUT_EVENT_ACK_STATE_CONSUMED; |
1663 } | 1657 } |
1664 | 1658 |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2076 results->orientationAngle = display.RotationAsDegree(); | 2070 results->orientationAngle = display.RotationAsDegree(); |
2077 results->orientationType = | 2071 results->orientationType = |
2078 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2072 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
2079 gfx::DeviceDisplayInfo info; | 2073 gfx::DeviceDisplayInfo info; |
2080 results->depth = info.GetBitsPerPixel(); | 2074 results->depth = info.GetBitsPerPixel(); |
2081 results->depthPerComponent = info.GetBitsPerComponent(); | 2075 results->depthPerComponent = info.GetBitsPerComponent(); |
2082 results->isMonochrome = (results->depthPerComponent == 0); | 2076 results->isMonochrome = (results->depthPerComponent == 0); |
2083 } | 2077 } |
2084 | 2078 |
2085 } // namespace content | 2079 } // namespace content |
OLD | NEW |