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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 12321005: Enable touch based selection and editing for webpages behind a flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index f83188dc0bda7149957bcbfc27424e04a689666c..5ce12a7c58f5fa5719d58f92ea89617cf8ac4200 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -632,7 +632,8 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host)
accelerated_compositing_state_changed_(false),
can_lock_compositor_(YES),
paint_observer_(NULL),
- accessible_parent_(NULL) {
+ accessible_parent_(NULL),
+ touch_editing_client_(NULL) {
host_->SetView(this);
window_observer_.reset(new WindowObserver(this));
aura::client::SetTooltipText(window_, &tooltip_);
@@ -999,6 +1000,8 @@ void RenderWidgetHostViewAura::TextInputStateChanged(
can_compose_inline_ = params.can_compose_inline;
if (GetInputMethod())
GetInputMethod()->OnTextInputTypeChanged(this);
+ if (touch_editing_client_)
+ touch_editing_client_->OnTextInputTypeChanged(text_input_type_);
}
}
@@ -1114,6 +1117,11 @@ void RenderWidgetHostViewAura::SelectionBoundsChanged(
if (GetInputMethod())
GetInputMethod()->OnCaretBoundsChanged(this);
+
+ if (touch_editing_client_) {
+ touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_,
+ selection_focus_rect_);
+ }
}
void RenderWidgetHostViewAura::ScrollOffsetChanged() {
@@ -1721,6 +1729,11 @@ gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() {
return window_->GetToplevelWindow()->GetBoundsInScreen();
}
+void RenderWidgetHostViewAura::GestureEventAck(int gesture_event_type) {
+ if (touch_editing_client_)
+ touch_editing_client_->GestureEventAck(gesture_event_type);
+}
+
void RenderWidgetHostViewAura::ProcessAckedTouchEvent(
const WebKit::WebTouchEvent& touch_event, InputEventAckState ack_result) {
ScopedVector<ui::TouchEvent> events;
@@ -2062,6 +2075,8 @@ bool RenderWidgetHostViewAura::CanFocus() {
void RenderWidgetHostViewAura::OnCaptureLost() {
host_->LostCapture();
+ if (touch_editing_client_)
+ touch_editing_client_->EndTouchEditing();
}
void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) {
@@ -2181,6 +2196,9 @@ scoped_refptr<ui::Texture> RenderWidgetHostViewAura::CopyTexture() {
void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) {
TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnKeyEvent");
+ if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event))
+ return;
+
if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) {
popup_child_host_view_->OnKeyEvent(event);
if (event->handled())
@@ -2230,6 +2248,9 @@ void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) {
void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) {
TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnMouseEvent");
+ if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event))
+ return;
+
if (mouse_locked_) {
// Hide the cursor if someone else has shown it.
aura::client::CursorClient* cursor_client =
@@ -2334,6 +2355,9 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) {
void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) {
TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnScrollEvent");
+ if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event))
+ return;
+
if (event->type() == ui::ET_SCROLL) {
if (event->finger_count() != 2)
return;
@@ -2358,6 +2382,9 @@ void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) {
void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) {
TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnTouchEvent");
+ if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event))
+ return;
+
// Update the touch event first.
WebKit::WebTouchPoint* point = UpdateWebTouchEventFromUIEvent(*event,
&touch_event_);
@@ -2388,6 +2415,9 @@ void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) {
return;
}
+ if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event))
+ return;
+
RenderViewHostDelegate* delegate = NULL;
if (popup_type_ == WebKit::WebPopupTypeNone && !is_fullscreen_)
delegate = RenderViewHost::From(host_)->GetDelegate();
@@ -2505,6 +2535,8 @@ void RenderWidgetHostViewAura::OnWindowFocused(aura::Window* gained_focus,
in_shutdown_ = true;
host_->Shutdown();
}
+ if (touch_editing_client_)
+ touch_editing_client_->EndTouchEditing();
}
}
@@ -2643,6 +2675,8 @@ void RenderWidgetHostViewAura::OnLostResources() {
RenderWidgetHostViewAura::~RenderWidgetHostViewAura() {
if (paint_observer_)
paint_observer_->OnViewDestroyed();
+ if (touch_editing_client_)
+ touch_editing_client_->OnViewDestroyed();
if (!shared_surface_handle_.is_null()) {
ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
factory->DestroySharedSurfaceHandle(shared_surface_handle_);

Powered by Google App Engine
This is Rietveld 408576698