| 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_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1595 GetTextInputManager()->GetActiveWidget()->UpdateTextDirection( | 1595 GetTextInputManager()->GetActiveWidget()->UpdateTextDirection( |
| 1596 direction == base::i18n::RIGHT_TO_LEFT | 1596 direction == base::i18n::RIGHT_TO_LEFT |
| 1597 ? blink::WebTextDirectionRightToLeft | 1597 ? blink::WebTextDirectionRightToLeft |
| 1598 : blink::WebTextDirectionLeftToRight); | 1598 : blink::WebTextDirectionLeftToRight); |
| 1599 GetTextInputManager()->GetActiveWidget()->NotifyTextDirection(); | 1599 GetTextInputManager()->GetActiveWidget()->NotifyTextDirection(); |
| 1600 return true; | 1600 return true; |
| 1601 } | 1601 } |
| 1602 | 1602 |
| 1603 void RenderWidgetHostViewAura::ExtendSelectionAndDelete( | 1603 void RenderWidgetHostViewAura::ExtendSelectionAndDelete( |
| 1604 size_t before, size_t after) { | 1604 size_t before, size_t after) { |
| 1605 RenderFrameHostImpl* rfh = GetFocusedFrame(); | 1605 host_->ExtendSelectionAndDelete(before, after); |
| 1606 if (rfh) | |
| 1607 rfh->ExtendSelectionAndDelete(before, after); | |
| 1608 } | 1606 } |
| 1609 | 1607 |
| 1610 void RenderWidgetHostViewAura::EnsureCaretInRect(const gfx::Rect& rect) { | 1608 void RenderWidgetHostViewAura::EnsureCaretInRect(const gfx::Rect& rect) { |
| 1611 gfx::Rect intersected_rect( | 1609 gfx::Rect intersected_rect( |
| 1612 gfx::IntersectRects(rect, window_->GetBoundsInScreen())); | 1610 gfx::IntersectRects(rect, window_->GetBoundsInScreen())); |
| 1613 | 1611 |
| 1614 if (intersected_rect.IsEmpty()) | 1612 if (intersected_rect.IsEmpty()) |
| 1615 return; | 1613 return; |
| 1616 | 1614 |
| 1617 host_->ScrollFocusedEditableNodeIntoRect( | 1615 host_->ScrollFocusedEditableNodeIntoRect( |
| (...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2975 const TextInputState* state = text_input_manager_->GetTextInputState(); | 2973 const TextInputState* state = text_input_manager_->GetTextInputState(); |
| 2976 if (state && state->show_ime_if_needed && | 2974 if (state && state->show_ime_if_needed && |
| 2977 state->type != ui::TEXT_INPUT_TYPE_NONE) { | 2975 state->type != ui::TEXT_INPUT_TYPE_NONE) { |
| 2978 GetInputMethod()->ShowImeIfNeeded(); | 2976 GetInputMethod()->ShowImeIfNeeded(); |
| 2979 // Start monitoring the composition information if the focused node is | 2977 // Start monitoring the composition information if the focused node is |
| 2980 // editable. | 2978 // editable. |
| 2981 RenderWidgetHostImpl* last_active_widget = | 2979 RenderWidgetHostImpl* last_active_widget = |
| 2982 text_input_manager_->GetActiveWidget(); | 2980 text_input_manager_->GetActiveWidget(); |
| 2983 last_active_widget_routing_id_ = last_active_widget->GetRoutingID(); | 2981 last_active_widget_routing_id_ = last_active_widget->GetRoutingID(); |
| 2984 last_active_widget_process_id_ = last_active_widget->GetProcess()->GetID(); | 2982 last_active_widget_process_id_ = last_active_widget->GetProcess()->GetID(); |
| 2985 last_active_widget->Send(new InputMsg_RequestCompositionUpdate( | 2983 last_active_widget->Send(new InputMsg_ImeRequestCompositionUpdate( |
| 2986 last_active_widget->GetRoutingID(), false /* immediate request */, | 2984 last_active_widget->GetRoutingID(), false /* immediate request */, |
| 2987 true /* monitor request */)); | 2985 true /* monitor request */)); |
| 2988 } else { | 2986 } else { |
| 2989 // Stop monitoring the composition information if the focused node is not | 2987 // Stop monitoring the composition information if the focused node is not |
| 2990 // editable. | 2988 // editable. |
| 2991 RenderWidgetHostImpl* last_active_widget = RenderWidgetHostImpl::FromID( | 2989 RenderWidgetHostImpl* last_active_widget = RenderWidgetHostImpl::FromID( |
| 2992 last_active_widget_process_id_, last_active_widget_routing_id_); | 2990 last_active_widget_process_id_, last_active_widget_routing_id_); |
| 2993 if (last_active_widget) { | 2991 if (last_active_widget) { |
| 2994 last_active_widget->Send(new InputMsg_RequestCompositionUpdate( | 2992 last_active_widget->Send(new InputMsg_ImeRequestCompositionUpdate( |
| 2995 last_active_widget->GetRoutingID(), false /* immediate request */, | 2993 last_active_widget->GetRoutingID(), false /* immediate request */, |
| 2996 false /* monitor request */)); | 2994 false /* monitor request */)); |
| 2997 } | 2995 } |
| 2998 last_active_widget_routing_id_ = MSG_ROUTING_NONE; | 2996 last_active_widget_routing_id_ = MSG_ROUTING_NONE; |
| 2999 last_active_widget_process_id_ = ChildProcessHost::kInvalidUniqueID; | 2997 last_active_widget_process_id_ = ChildProcessHost::kInvalidUniqueID; |
| 3000 } | 2998 } |
| 3001 } | 2999 } |
| 3002 | 3000 |
| 3003 void RenderWidgetHostViewAura::OnImeCancelComposition( | 3001 void RenderWidgetHostViewAura::OnImeCancelComposition( |
| 3004 TextInputManager* text_input_manager, | 3002 TextInputManager* text_input_manager, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3044 ->GetTextSelection(focused_view) | 3042 ->GetTextSelection(focused_view) |
| 3045 ->GetSelectedText(&selected_text)) { | 3043 ->GetSelectedText(&selected_text)) { |
| 3046 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 3044 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
| 3047 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); | 3045 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
| 3048 clipboard_writer.WriteText(selected_text); | 3046 clipboard_writer.WriteText(selected_text); |
| 3049 } | 3047 } |
| 3050 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 3048 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
| 3051 } | 3049 } |
| 3052 | 3050 |
| 3053 } // namespace content | 3051 } // namespace content |
| OLD | NEW |