Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 2201853002: Blink handle selection handle visibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: try running even rebaseline tests Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 9 #include <utility>
10 10
(...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 bool is_mobile_optimized = IsMobileOptimizedFrame(frame_metadata); 1314 bool is_mobile_optimized = IsMobileOptimizedFrame(frame_metadata);
1315 gesture_provider_.SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); 1315 gesture_provider_.SetDoubleTapSupportForPageEnabled(!is_mobile_optimized);
1316 1316
1317 if (!content_view_core_) 1317 if (!content_view_core_)
1318 return; 1318 return;
1319 1319
1320 if (overscroll_controller_) 1320 if (overscroll_controller_)
1321 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); 1321 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata);
1322 1322
1323 if (selection_controller_) { 1323 if (selection_controller_) {
1324 selection_controller_->OnSelectionEditable(
1325 frame_metadata.selection.is_editable);
1326 selection_controller_->OnSelectionEmpty(
1327 frame_metadata.selection.is_empty_text_form_control);
1328 selection_controller_->OnSelectionBoundsChanged( 1324 selection_controller_->OnSelectionBoundsChanged(
1329 frame_metadata.selection.start, frame_metadata.selection.end); 1325 frame_metadata.selection.start, frame_metadata.selection.end);
1330 1326
1331 // Set parameters for adaptive handle orientation. 1327 // Set parameters for adaptive handle orientation.
1332 gfx::SizeF viewport_size(frame_metadata.scrollable_viewport_size); 1328 gfx::SizeF viewport_size(frame_metadata.scrollable_viewport_size);
1333 viewport_size.Scale(frame_metadata.page_scale_factor); 1329 viewport_size.Scale(frame_metadata.page_scale_factor);
1334 gfx::RectF viewport_rect(0.0f, frame_metadata.top_controls_height * 1330 gfx::RectF viewport_rect(0.0f, frame_metadata.top_controls_height *
1335 frame_metadata.top_controls_shown_ratio, 1331 frame_metadata.top_controls_shown_ratio,
1336 viewport_size.width(), viewport_size.height()); 1332 viewport_size.width(), viewport_size.height());
1337 selection_controller_->OnViewportChanged(viewport_rect); 1333 selection_controller_->OnViewportChanged(viewport_rect);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 } 1542 }
1547 1543
1548 InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent( 1544 InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent(
1549 const blink::WebInputEvent& input_event) { 1545 const blink::WebInputEvent& input_event) {
1550 if (selection_controller_ && 1546 if (selection_controller_ &&
1551 blink::WebInputEvent::isGestureEventType(input_event.type)) { 1547 blink::WebInputEvent::isGestureEventType(input_event.type)) {
1552 const blink::WebGestureEvent& gesture_event = 1548 const blink::WebGestureEvent& gesture_event =
1553 static_cast<const blink::WebGestureEvent&>(input_event); 1549 static_cast<const blink::WebGestureEvent&>(input_event);
1554 switch (gesture_event.type) { 1550 switch (gesture_event.type) {
1555 case blink::WebInputEvent::GestureLongPress: 1551 case blink::WebInputEvent::GestureLongPress:
1556 if (selection_controller_->WillHandleLongPressEvent( 1552 selection_controller_->WillHandleLongPressEvent(
1557 base::TimeTicks() + 1553 base::TimeTicks() +
1558 base::TimeDelta::FromSecondsD(input_event.timeStampSeconds), 1554 base::TimeDelta::FromSecondsD(input_event.timeStampSeconds),
1559 gfx::PointF(gesture_event.x, gesture_event.y))) { 1555 gfx::PointF(gesture_event.x, gesture_event.y));
1560 return INPUT_EVENT_ACK_STATE_CONSUMED;
1561 }
1562 break; 1556 break;
1563 1557
1564 case blink::WebInputEvent::GestureTap: 1558 case blink::WebInputEvent::GestureTap:
1565 if (selection_controller_->WillHandleTapEvent( 1559 selection_controller_->WillHandleTapEvent(
1566 gfx::PointF(gesture_event.x, gesture_event.y), 1560 gfx::PointF(gesture_event.x, gesture_event.y),
1567 gesture_event.data.tap.tapCount)) { 1561 gesture_event.data.tap.tapCount);
1568 return INPUT_EVENT_ACK_STATE_CONSUMED;
1569 }
1570 break; 1562 break;
1571 1563
1572 case blink::WebInputEvent::GestureScrollBegin: 1564 case blink::WebInputEvent::GestureScrollBegin:
1573 selection_controller_->OnScrollBeginEvent(); 1565 selection_controller_->OnScrollBeginEvent();
1574 break; 1566 break;
1575 1567
1576 default: 1568 default:
1577 break; 1569 break;
1578 } 1570 }
1579 } 1571 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 1687
1696 // As the paste popup may be triggered *before* the bounds and editability 1688 // As the paste popup may be triggered *before* the bounds and editability
1697 // of the region have been updated, explicitly set the properties now. 1689 // of the region have been updated, explicitly set the properties now.
1698 // TODO(jdduke): Remove this workaround when auxiliary paste popup 1690 // TODO(jdduke): Remove this workaround when auxiliary paste popup
1699 // notifications are no longer required, crbug.com/398170. 1691 // notifications are no longer required, crbug.com/398170.
1700 gfx::SelectionBound insertion_bound; 1692 gfx::SelectionBound insertion_bound;
1701 insertion_bound.set_type(gfx::SelectionBound::CENTER); 1693 insertion_bound.set_type(gfx::SelectionBound::CENTER);
1702 insertion_bound.set_visible(true); 1694 insertion_bound.set_visible(true);
1703 insertion_bound.SetEdge(point, point); 1695 insertion_bound.SetEdge(point, point);
1704 selection_controller_->HideAndDisallowShowingAutomatically(); 1696 selection_controller_->HideAndDisallowShowingAutomatically();
1705 selection_controller_->OnSelectionEditable(true);
1706 selection_controller_->OnSelectionEmpty(true);
1707 selection_controller_->OnSelectionBoundsChanged(insertion_bound, 1697 selection_controller_->OnSelectionBoundsChanged(insertion_bound,
1708 insertion_bound); 1698 insertion_bound);
1709 selection_controller_->AllowShowingFromCurrentSelection();
1710 } 1699 }
1711 1700
1712 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { 1701 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const {
1713 return cached_background_color_; 1702 return cached_background_color_;
1714 } 1703 }
1715 1704
1716 void RenderWidgetHostViewAndroid::DidOverscroll( 1705 void RenderWidgetHostViewAndroid::DidOverscroll(
1717 const ui::DidOverscrollParams& params) { 1706 const ui::DidOverscrollParams& params) {
1718 if (sync_compositor_) 1707 if (sync_compositor_)
1719 sync_compositor_->DidOverscroll(params); 1708 sync_compositor_->DidOverscroll(params);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 float y0, 1925 float y0,
1937 float x1, 1926 float x1,
1938 float y1) { 1927 float y1) {
1939 SelectBetweenCoordinates(gfx::PointF(x0, y0), gfx::PointF(x1, y1)); 1928 SelectBetweenCoordinates(gfx::PointF(x0, y0), gfx::PointF(x1, y1));
1940 } 1929 }
1941 1930
1942 void RenderWidgetHostViewAndroid::OnStylusSelectUpdate(float x, float y) { 1931 void RenderWidgetHostViewAndroid::OnStylusSelectUpdate(float x, float y) {
1943 MoveRangeSelectionExtent(gfx::PointF(x, y)); 1932 MoveRangeSelectionExtent(gfx::PointF(x, y));
1944 } 1933 }
1945 1934
1946 void RenderWidgetHostViewAndroid::OnStylusSelectEnd() {
1947 if (selection_controller_)
1948 selection_controller_->AllowShowingFromCurrentSelection();
1949 }
1950
1951 void RenderWidgetHostViewAndroid::OnStylusSelectTap(base::TimeTicks time, 1935 void RenderWidgetHostViewAndroid::OnStylusSelectTap(base::TimeTicks time,
1952 float x, 1936 float x,
1953 float y) { 1937 float y) {
1954 // Treat the stylus tap as a long press, activating either a word selection or 1938 // Treat the stylus tap as a long press, activating either a word selection or
1955 // context menu depending on the targetted content. 1939 // context menu depending on the targetted content.
1956 blink::WebGestureEvent long_press = WebGestureEventBuilder::Build( 1940 blink::WebGestureEvent long_press = WebGestureEventBuilder::Build(
1957 blink::WebInputEvent::GestureLongPress, 1941 blink::WebInputEvent::GestureLongPress,
1958 (time - base::TimeTicks()).InSecondsF(), x, y); 1942 (time - base::TimeTicks()).InSecondsF(), x, y);
1959 SendGestureEvent(long_press); 1943 SendGestureEvent(long_press);
1960 } 1944 }
(...skipping 15 matching lines...) Expand all
1976 case ui::MotionEvent::ACTION_UP: 1960 case ui::MotionEvent::ACTION_UP:
1977 case ui::MotionEvent::ACTION_POINTER_UP: 1961 case ui::MotionEvent::ACTION_POINTER_UP:
1978 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", 1962 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED",
1979 delta.InMicroseconds(), 1, 1000000, 50); 1963 delta.InMicroseconds(), 1, 1000000, 50);
1980 default: 1964 default:
1981 return; 1965 return;
1982 } 1966 }
1983 } 1967 }
1984 1968
1985 } // namespace content 1969 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698