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 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 const gfx::PointF& base, | 1290 const gfx::PointF& base, |
1291 const gfx::PointF& extent) { | 1291 const gfx::PointF& extent) { |
1292 DCHECK(content_view_core_); | 1292 DCHECK(content_view_core_); |
1293 content_view_core_->SelectBetweenCoordinates(base, extent); | 1293 content_view_core_->SelectBetweenCoordinates(base, extent); |
1294 } | 1294 } |
1295 | 1295 |
1296 void RenderWidgetHostViewAndroid::OnSelectionEvent( | 1296 void RenderWidgetHostViewAndroid::OnSelectionEvent( |
1297 ui::SelectionEventType event) { | 1297 ui::SelectionEventType event) { |
1298 DCHECK(content_view_core_); | 1298 DCHECK(content_view_core_); |
1299 DCHECK(selection_controller_); | 1299 DCHECK(selection_controller_); |
1300 // Showing the selection action bar can alter the current View coordinates in | |
1301 // such a way that the current MotionEvent stream is suddenly shifted in | |
1302 // space. Avoid the associated scroll jump by pre-emptively cancelling gesture | |
1303 // detection; scrolling after the selection is activated is unnecessary. | |
1304 if (event == ui::SelectionEventType::SELECTION_SHOWN) | |
1305 ResetGestureDetection(); | |
1306 content_view_core_->OnSelectionEvent( | 1300 content_view_core_->OnSelectionEvent( |
1307 event, selection_controller_->GetStartPosition(), | 1301 event, selection_controller_->GetStartPosition(), |
1308 GetSelectionRect(*selection_controller_)); | 1302 GetSelectionRect(*selection_controller_)); |
1309 } | 1303 } |
1310 | 1304 |
1311 scoped_ptr<ui::TouchHandleDrawable> | 1305 scoped_ptr<ui::TouchHandleDrawable> |
1312 RenderWidgetHostViewAndroid::CreateDrawable() { | 1306 RenderWidgetHostViewAndroid::CreateDrawable() { |
1313 DCHECK(content_view_core_); | 1307 DCHECK(content_view_core_); |
1314 if (!using_browser_compositor_) | 1308 if (!using_browser_compositor_) |
1315 return content_view_core_->CreatePopupTouchHandleDrawable(); | 1309 return content_view_core_->CreatePopupTouchHandleDrawable(); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 if (overscroll_controller_) | 1550 if (overscroll_controller_) |
1557 overscroll_controller_->OnGestureEventAck(event, ack_result); | 1551 overscroll_controller_->OnGestureEventAck(event, ack_result); |
1558 | 1552 |
1559 if (content_view_core_) | 1553 if (content_view_core_) |
1560 content_view_core_->OnGestureEventAck(event, ack_result); | 1554 content_view_core_->OnGestureEventAck(event, ack_result); |
1561 } | 1555 } |
1562 | 1556 |
1563 InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent( | 1557 InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent( |
1564 const blink::WebInputEvent& input_event) { | 1558 const blink::WebInputEvent& input_event) { |
1565 if (selection_controller_) { | 1559 if (selection_controller_) { |
1566 switch (input_event.type) { | 1560 if (input_event.type == blink::WebInputEvent::GestureLongPress) { |
1567 case blink::WebInputEvent::GestureLongPress: | 1561 const blink::WebGestureEvent& longpress = |
1568 selection_controller_->OnLongPressEvent(); | 1562 static_cast<const blink::WebGestureEvent&>(input_event); |
1569 break; | 1563 selection_controller_->OnLongPressEvent( |
1570 case blink::WebInputEvent::GestureTap: | 1564 base::TimeTicks() + |
1571 selection_controller_->OnTapEvent(); | 1565 base::TimeDelta::FromSecondsD(input_event.timeStampSeconds), |
1572 break; | 1566 gfx::PointF(longpress.x, longpress.y)); |
1573 default: | 1567 } else if (input_event.type == blink::WebInputEvent::GestureTap) { |
1574 break; | 1568 selection_controller_->OnTapEvent(); |
1575 } | 1569 } |
1576 } | 1570 } |
1577 | 1571 |
1578 if (overscroll_controller_ && | 1572 if (overscroll_controller_ && |
1579 blink::WebInputEvent::isGestureEventType(input_event.type) && | 1573 blink::WebInputEvent::isGestureEventType(input_event.type) && |
1580 overscroll_controller_->WillHandleGestureEvent( | 1574 overscroll_controller_->WillHandleGestureEvent( |
1581 static_cast<const blink::WebGestureEvent&>(input_event))) { | 1575 static_cast<const blink::WebGestureEvent&>(input_event))) { |
1582 return INPUT_EVENT_ACK_STATE_CONSUMED; | 1576 return INPUT_EVENT_ACK_STATE_CONSUMED; |
1583 } | 1577 } |
1584 | 1578 |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1968 results->orientationAngle = display.RotationAsDegree(); | 1962 results->orientationAngle = display.RotationAsDegree(); |
1969 results->orientationType = | 1963 results->orientationType = |
1970 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1964 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1971 gfx::DeviceDisplayInfo info; | 1965 gfx::DeviceDisplayInfo info; |
1972 results->depth = info.GetBitsPerPixel(); | 1966 results->depth = info.GetBitsPerPixel(); |
1973 results->depthPerComponent = info.GetBitsPerComponent(); | 1967 results->depthPerComponent = info.GetBitsPerComponent(); |
1974 results->isMonochrome = (results->depthPerComponent == 0); | 1968 results->isMonochrome = (results->depthPerComponent == 0); |
1975 } | 1969 } |
1976 | 1970 |
1977 } // namespace content | 1971 } // namespace content |
OLD | NEW |