Chromium Code Reviews| 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 0deb2ab983f17cbdd38b2b9af36bf49068edb8e2..38331b0045afb5264607c8efec03eae0fff7192b 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_); |
| @@ -921,6 +922,8 @@ void RenderWidgetHostViewAura::Focus() { |
| void RenderWidgetHostViewAura::Blur() { |
| window_->Blur(); |
| + if (touch_editing_client_) |
|
sky
2013/04/12 16:09:52
Isn't this handled on 2518?
varunjain
2013/04/12 17:35:19
Done.
|
| + touch_editing_client_->EndTouchEditing(); |
| } |
| bool RenderWidgetHostViewAura::HasFocus() const { |
| @@ -989,6 +992,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_); |
| } |
| } |
| @@ -1104,6 +1109,11 @@ void RenderWidgetHostViewAura::SelectionBoundsChanged( |
| if (GetInputMethod()) |
| GetInputMethod()->OnCaretBoundsChanged(this); |
| + |
| + if (touch_editing_client_) { |
| + touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, |
|
sky
2013/04/12 16:09:52
TouchEditingClient seems to have a mix of function
varunjain
2013/04/12 17:35:19
The input event and ack are used to determine if t
|
| + selection_focus_rect_); |
| + } |
| } |
| void RenderWidgetHostViewAura::ScrollOffsetChanged() { |
| @@ -1708,6 +1718,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; |
| @@ -2049,6 +2064,8 @@ bool RenderWidgetHostViewAura::CanFocus() { |
| void RenderWidgetHostViewAura::OnCaptureLost() { |
| host_->LostCapture(); |
| + if (touch_editing_client_) |
| + touch_editing_client_->EndTouchEditing(); |
|
sky
2013/04/12 16:09:52
Does the client need to differentiate between a ca
varunjain
2013/04/12 17:35:19
The effect of cancel or end is the same, ie, hide
|
| } |
| void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { |
| @@ -2168,6 +2185,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()) |
| @@ -2217,6 +2237,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 = |
| @@ -2317,6 +2340,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; |
| @@ -2341,6 +2367,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_); |
| @@ -2371,6 +2400,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(); |
| @@ -2482,6 +2514,8 @@ void RenderWidgetHostViewAura::OnWindowFocused(aura::Window* gained_focus, |
| in_shutdown_ = true; |
| host_->Shutdown(); |
| } |
| + if (touch_editing_client_) |
| + touch_editing_client_->EndTouchEditing(); |
| } |
| } |
| @@ -2620,6 +2654,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_); |