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 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 12 matching lines...) Expand all Loading... | |
23 #include "content/browser/accessibility/browser_accessibility_manager.h" | 23 #include "content/browser/accessibility/browser_accessibility_manager.h" |
24 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 24 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
25 #include "content/browser/bad_message.h" | 25 #include "content/browser/bad_message.h" |
26 #include "content/browser/frame_host/frame_tree.h" | 26 #include "content/browser/frame_host/frame_tree.h" |
27 #include "content/browser/frame_host/frame_tree_node.h" | 27 #include "content/browser/frame_host/frame_tree_node.h" |
28 #include "content/browser/frame_host/render_frame_host_impl.h" | 28 #include "content/browser/frame_host/render_frame_host_impl.h" |
29 #include "content/browser/gpu/compositor_util.h" | 29 #include "content/browser/gpu/compositor_util.h" |
30 #include "content/browser/renderer_host/compositor_resize_lock_aura.h" | 30 #include "content/browser/renderer_host/compositor_resize_lock_aura.h" |
31 #include "content/browser/renderer_host/dip_util.h" | 31 #include "content/browser/renderer_host/dip_util.h" |
32 #include "content/browser/renderer_host/input/synthetic_gesture_target_aura.h" | 32 #include "content/browser/renderer_host/input/synthetic_gesture_target_aura.h" |
33 #include "content/browser/renderer_host/input/ui_touch_selection_helper.h" | |
33 #include "content/browser/renderer_host/input/web_input_event_util.h" | 34 #include "content/browser/renderer_host/input/web_input_event_util.h" |
34 #include "content/browser/renderer_host/overscroll_controller.h" | 35 #include "content/browser/renderer_host/overscroll_controller.h" |
35 #include "content/browser/renderer_host/render_view_host_delegate.h" | 36 #include "content/browser/renderer_host/render_view_host_delegate.h" |
36 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 37 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
37 #include "content/browser/renderer_host/render_view_host_impl.h" | 38 #include "content/browser/renderer_host/render_view_host_impl.h" |
38 #include "content/browser/renderer_host/render_widget_host_impl.h" | 39 #include "content/browser/renderer_host/render_widget_host_impl.h" |
39 #include "content/browser/renderer_host/ui_events_helper.h" | 40 #include "content/browser/renderer_host/ui_events_helper.h" |
40 #include "content/browser/renderer_host/web_input_event_aura.h" | 41 #include "content/browser/renderer_host/web_input_event_aura.h" |
41 #include "content/common/gpu/client/gl_helper.h" | 42 #include "content/common/gpu/client/gl_helper.h" |
42 #include "content/common/gpu/gpu_messages.h" | 43 #include "content/common/gpu/gpu_messages.h" |
(...skipping 21 matching lines...) Expand all Loading... | |
64 #include "ui/aura/window_tree_host.h" | 65 #include "ui/aura/window_tree_host.h" |
65 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 66 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
66 #include "ui/base/hit_test.h" | 67 #include "ui/base/hit_test.h" |
67 #include "ui/base/ime/input_method.h" | 68 #include "ui/base/ime/input_method.h" |
68 #include "ui/base/ui_base_types.h" | 69 #include "ui/base/ui_base_types.h" |
69 #include "ui/compositor/compositor_vsync_manager.h" | 70 #include "ui/compositor/compositor_vsync_manager.h" |
70 #include "ui/compositor/dip_util.h" | 71 #include "ui/compositor/dip_util.h" |
71 #include "ui/events/blink/blink_event_util.h" | 72 #include "ui/events/blink/blink_event_util.h" |
72 #include "ui/events/event.h" | 73 #include "ui/events/event.h" |
73 #include "ui/events/event_utils.h" | 74 #include "ui/events/event_utils.h" |
75 #include "ui/events/gesture_detection/gesture_configuration.h" | |
74 #include "ui/events/gestures/gesture_recognizer.h" | 76 #include "ui/events/gestures/gesture_recognizer.h" |
75 #include "ui/gfx/canvas.h" | 77 #include "ui/gfx/canvas.h" |
76 #include "ui/gfx/display.h" | 78 #include "ui/gfx/display.h" |
77 #include "ui/gfx/geometry/rect_conversions.h" | 79 #include "ui/gfx/geometry/rect_conversions.h" |
78 #include "ui/gfx/geometry/size_conversions.h" | 80 #include "ui/gfx/geometry/size_conversions.h" |
79 #include "ui/gfx/screen.h" | 81 #include "ui/gfx/screen.h" |
80 #include "ui/gfx/skia_util.h" | 82 #include "ui/gfx/skia_util.h" |
83 #include "ui/touch_selection/touch_selection_controller.h" | |
81 #include "ui/wm/public/activation_client.h" | 84 #include "ui/wm/public/activation_client.h" |
82 #include "ui/wm/public/scoped_tooltip_disabler.h" | 85 #include "ui/wm/public/scoped_tooltip_disabler.h" |
83 #include "ui/wm/public/tooltip_client.h" | 86 #include "ui/wm/public/tooltip_client.h" |
84 #include "ui/wm/public/transient_window_client.h" | 87 #include "ui/wm/public/transient_window_client.h" |
85 #include "ui/wm/public/window_types.h" | 88 #include "ui/wm/public/window_types.h" |
86 | 89 |
87 #if defined(OS_WIN) | 90 #if defined(OS_WIN) |
88 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 91 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
89 #include "content/browser/accessibility/browser_accessibility_win.h" | 92 #include "content/browser/accessibility/browser_accessibility_win.h" |
90 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" | 93 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
435 last_swapped_software_frame_scale_factor_(1.f), | 438 last_swapped_software_frame_scale_factor_(1.f), |
436 paint_canvas_(NULL), | 439 paint_canvas_(NULL), |
437 synthetic_move_sent_(false), | 440 synthetic_move_sent_(false), |
438 cursor_visibility_state_in_renderer_(UNKNOWN), | 441 cursor_visibility_state_in_renderer_(UNKNOWN), |
439 #if defined(OS_WIN) | 442 #if defined(OS_WIN) |
440 legacy_render_widget_host_HWND_(NULL), | 443 legacy_render_widget_host_HWND_(NULL), |
441 legacy_window_destroyed_(false), | 444 legacy_window_destroyed_(false), |
442 showing_context_menu_(false), | 445 showing_context_menu_(false), |
443 #endif | 446 #endif |
444 has_snapped_to_boundary_(false), | 447 has_snapped_to_boundary_(false), |
445 touch_editing_client_(NULL), | |
446 is_guest_view_hack_(is_guest_view_hack), | 448 is_guest_view_hack_(is_guest_view_hack), |
447 weak_ptr_factory_(this) { | 449 weak_ptr_factory_(this) { |
448 if (!is_guest_view_hack_) | 450 if (!is_guest_view_hack_) |
449 host_->SetView(this); | 451 host_->SetView(this); |
450 | 452 |
451 window_observer_.reset(new WindowObserver(this)); | 453 window_observer_.reset(new WindowObserver(this)); |
452 | 454 |
453 aura::client::SetTooltipText(window_, &tooltip_); | 455 aura::client::SetTooltipText(window_, &tooltip_); |
454 aura::client::SetActivationDelegate(window_, this); | 456 aura::client::SetActivationDelegate(window_, this); |
455 aura::client::SetFocusChangeObserver(window_, this); | 457 aura::client::SetFocusChangeObserver(window_, this); |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
861 // Make sure we have a FocusClient before attempting to Focus(). In some | 863 // Make sure we have a FocusClient before attempting to Focus(). In some |
862 // situations we may not yet be in a valid Window hierarchy (such as reloading | 864 // situations we may not yet be in a valid Window hierarchy (such as reloading |
863 // after out of memory discarded the tab). | 865 // after out of memory discarded the tab). |
864 aura::client::FocusClient* client = aura::client::GetFocusClient(window_); | 866 aura::client::FocusClient* client = aura::client::GetFocusClient(window_); |
865 if (client) | 867 if (client) |
866 window_->Focus(); | 868 window_->Focus(); |
867 } | 869 } |
868 | 870 |
869 void RenderWidgetHostViewAura::Blur() { | 871 void RenderWidgetHostViewAura::Blur() { |
870 window_->Blur(); | 872 window_->Blur(); |
873 if (selection_controller_) | |
874 selection_controller_->HideAndDisallowShowingAutomatically(); | |
sadrul
2015/04/29 19:55:03
Why is this needed? Should |selection_controller_|
mohsen
2015/04/30 18:29:34
My understanding was that this is called on some s
| |
871 } | 875 } |
872 | 876 |
873 bool RenderWidgetHostViewAura::HasFocus() const { | 877 bool RenderWidgetHostViewAura::HasFocus() const { |
874 return window_->HasFocus(); | 878 return window_->HasFocus(); |
875 } | 879 } |
876 | 880 |
877 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { | 881 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { |
878 return delegated_frame_host_->CanCopyToBitmap(); | 882 return delegated_frame_host_->CanCopyToBitmap(); |
879 } | 883 } |
880 | 884 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
928 if (text_input_type_ != type || | 932 if (text_input_type_ != type || |
929 text_input_mode_ != input_mode || | 933 text_input_mode_ != input_mode || |
930 can_compose_inline_ != can_compose_inline || | 934 can_compose_inline_ != can_compose_inline || |
931 text_input_flags_ != flags) { | 935 text_input_flags_ != flags) { |
932 text_input_type_ = type; | 936 text_input_type_ = type; |
933 text_input_mode_ = input_mode; | 937 text_input_mode_ = input_mode; |
934 can_compose_inline_ = can_compose_inline; | 938 can_compose_inline_ = can_compose_inline; |
935 text_input_flags_ = flags; | 939 text_input_flags_ = flags; |
936 if (GetInputMethod()) | 940 if (GetInputMethod()) |
937 GetInputMethod()->OnTextInputTypeChanged(this); | 941 GetInputMethod()->OnTextInputTypeChanged(this); |
938 if (touch_editing_client_) | |
939 touch_editing_client_->OnTextInputTypeChanged(text_input_type_); | |
940 } | 942 } |
941 } | 943 } |
942 | 944 |
943 void RenderWidgetHostViewAura::OnTextInputStateChanged( | 945 void RenderWidgetHostViewAura::OnTextInputStateChanged( |
944 const ViewHostMsg_TextInputState_Params& params) { | 946 const ViewHostMsg_TextInputState_Params& params) { |
945 text_input_flags_ = params.flags; | 947 text_input_flags_ = params.flags; |
946 if (params.show_ime_if_needed && params.type != ui::TEXT_INPUT_TYPE_NONE) { | 948 if (params.show_ime_if_needed && params.type != ui::TEXT_INPUT_TYPE_NONE) { |
947 if (GetInputMethod()) | 949 if (GetInputMethod()) |
948 GetInputMethod()->ShowImeIfNeeded(); | 950 GetInputMethod()->ShowImeIfNeeded(); |
949 } | 951 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1010 clipboard_writer.WriteText(text.substr(pos, n)); | 1012 clipboard_writer.WriteText(text.substr(pos, n)); |
1011 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 1013 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
1012 } | 1014 } |
1013 | 1015 |
1014 gfx::Size RenderWidgetHostViewAura::GetRequestedRendererSize() const { | 1016 gfx::Size RenderWidgetHostViewAura::GetRequestedRendererSize() const { |
1015 return delegated_frame_host_->GetRequestedRendererSize(); | 1017 return delegated_frame_host_->GetRequestedRendererSize(); |
1016 } | 1018 } |
1017 | 1019 |
1018 void RenderWidgetHostViewAura::SelectionBoundsChanged( | 1020 void RenderWidgetHostViewAura::SelectionBoundsChanged( |
1019 const ViewHostMsg_SelectionBounds_Params& params) { | 1021 const ViewHostMsg_SelectionBounds_Params& params) { |
1020 ui::SelectionBound anchor_bound, focus_bound; | 1022 NOTREACHED() << "Selection bounds should be routed through the compositor."; |
sadrul
2015/04/29 19:55:03
As discussed offline, it would be a good idea to k
mohsen
2015/04/30 18:29:34
Sure.
| |
1021 anchor_bound.SetEdge(params.anchor_rect.origin(), | |
1022 params.anchor_rect.bottom_left()); | |
1023 focus_bound.SetEdge(params.focus_rect.origin(), | |
1024 params.focus_rect.bottom_left()); | |
1025 | |
1026 if (params.anchor_rect == params.focus_rect) { | |
1027 anchor_bound.set_type(ui::SelectionBound::CENTER); | |
1028 focus_bound.set_type(ui::SelectionBound::CENTER); | |
1029 } else { | |
1030 // Whether text is LTR at the anchor handle. | |
1031 bool anchor_LTR = params.anchor_dir == blink::WebTextDirectionLeftToRight; | |
1032 // Whether text is LTR at the focus handle. | |
1033 bool focus_LTR = params.focus_dir == blink::WebTextDirectionLeftToRight; | |
1034 | |
1035 if ((params.is_anchor_first && anchor_LTR) || | |
1036 (!params.is_anchor_first && !anchor_LTR)) { | |
1037 anchor_bound.set_type(ui::SelectionBound::LEFT); | |
1038 } else { | |
1039 anchor_bound.set_type(ui::SelectionBound::RIGHT); | |
1040 } | |
1041 if ((params.is_anchor_first && focus_LTR) || | |
1042 (!params.is_anchor_first && !focus_LTR)) { | |
1043 focus_bound.set_type(ui::SelectionBound::RIGHT); | |
1044 } else { | |
1045 focus_bound.set_type(ui::SelectionBound::LEFT); | |
1046 } | |
1047 } | |
1048 | |
1049 if (anchor_bound == selection_anchor_ && focus_bound == selection_focus_) | |
1050 return; | |
1051 | |
1052 selection_anchor_ = anchor_bound; | |
1053 selection_focus_ = focus_bound; | |
1054 if (GetInputMethod()) | |
1055 GetInputMethod()->OnCaretBoundsChanged(this); | |
1056 | |
1057 if (touch_editing_client_) { | |
1058 touch_editing_client_->OnSelectionOrCursorChanged( | |
1059 anchor_bound, focus_bound); | |
1060 } | |
1061 } | 1023 } |
1062 | 1024 |
1063 void RenderWidgetHostViewAura::CopyFromCompositingSurface( | 1025 void RenderWidgetHostViewAura::CopyFromCompositingSurface( |
1064 const gfx::Rect& src_subrect, | 1026 const gfx::Rect& src_subrect, |
1065 const gfx::Size& dst_size, | 1027 const gfx::Size& dst_size, |
1066 ReadbackRequestCallback& callback, | 1028 ReadbackRequestCallback& callback, |
1067 const SkColorType color_type) { | 1029 const SkColorType color_type) { |
1068 delegated_frame_host_->CopyFromCompositingSurface( | 1030 delegated_frame_host_->CopyFromCompositingSurface( |
1069 src_subrect, dst_size, callback, color_type); | 1031 src_subrect, dst_size, callback, color_type); |
1070 } | 1032 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1140 scoped_ptr<cc::CompositorFrame> frame) { | 1102 scoped_ptr<cc::CompositorFrame> frame) { |
1141 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); | 1103 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); |
1142 | 1104 |
1143 last_scroll_offset_ = frame->metadata.root_scroll_offset; | 1105 last_scroll_offset_ = frame->metadata.root_scroll_offset; |
1144 if (frame->delegated_frame_data) { | 1106 if (frame->delegated_frame_data) { |
1145 delegated_frame_host_->SwapDelegatedFrame( | 1107 delegated_frame_host_->SwapDelegatedFrame( |
1146 output_surface_id, | 1108 output_surface_id, |
1147 frame->delegated_frame_data.Pass(), | 1109 frame->delegated_frame_data.Pass(), |
1148 frame->metadata.device_scale_factor, | 1110 frame->metadata.device_scale_factor, |
1149 frame->metadata.latency_info); | 1111 frame->metadata.latency_info); |
1112 SelectionUpdated(frame->metadata.selection.is_editable, | |
1113 frame->metadata.selection.is_empty_text_form_control, | |
1114 ConvertSelectionBound(frame->metadata.selection.start), | |
1115 ConvertSelectionBound(frame->metadata.selection.end)); | |
1150 return; | 1116 return; |
1151 } | 1117 } |
1152 | 1118 |
1153 if (frame->software_frame_data) { | 1119 if (frame->software_frame_data) { |
1154 DLOG(ERROR) << "Unable to use software frame in aura"; | 1120 DLOG(ERROR) << "Unable to use software frame in aura"; |
1155 bad_message::ReceivedBadMessage(host_->GetProcess(), | 1121 bad_message::ReceivedBadMessage(host_->GetProcess(), |
1156 bad_message::RWHVA_SHARED_MEMORY); | 1122 bad_message::RWHVA_SHARED_MEMORY); |
1157 return; | 1123 return; |
1158 } | 1124 } |
1159 } | 1125 } |
1160 | 1126 |
1161 void RenderWidgetHostViewAura::DidStopFlinging() { | 1127 void RenderWidgetHostViewAura::DidStopFlinging() { |
1162 if (touch_editing_client_) | 1128 if (selection_controller_client_) |
1163 touch_editing_client_->DidStopFlinging(); | 1129 selection_controller_client_->OnScrollCompleted(); |
1164 } | 1130 } |
1165 | 1131 |
1166 #if defined(OS_WIN) | 1132 #if defined(OS_WIN) |
1167 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( | 1133 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( |
1168 gfx::NativeViewAccessible accessible_parent) { | 1134 gfx::NativeViewAccessible accessible_parent) { |
1169 } | 1135 } |
1170 | 1136 |
1171 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() | 1137 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() |
1172 const { | 1138 const { |
1173 if (legacy_render_widget_host_HWND_) { | 1139 if (legacy_render_widget_host_HWND_) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1233 InputEventAckState ack_result) { | 1199 InputEventAckState ack_result) { |
1234 if (overscroll_controller_) { | 1200 if (overscroll_controller_) { |
1235 overscroll_controller_->ReceivedEventACK( | 1201 overscroll_controller_->ReceivedEventACK( |
1236 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); | 1202 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); |
1237 } | 1203 } |
1238 } | 1204 } |
1239 | 1205 |
1240 void RenderWidgetHostViewAura::GestureEventAck( | 1206 void RenderWidgetHostViewAura::GestureEventAck( |
1241 const blink::WebGestureEvent& event, | 1207 const blink::WebGestureEvent& event, |
1242 InputEventAckState ack_result) { | 1208 InputEventAckState ack_result) { |
1243 if (touch_editing_client_) | |
1244 touch_editing_client_->GestureEventAck(event.type); | |
1245 | |
1246 if (overscroll_controller_) { | 1209 if (overscroll_controller_) { |
1247 overscroll_controller_->ReceivedEventACK( | 1210 overscroll_controller_->ReceivedEventACK( |
1248 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); | 1211 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); |
1249 } | 1212 } |
1250 } | 1213 } |
1251 | 1214 |
1252 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( | 1215 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( |
1253 const TouchEventWithLatencyInfo& touch, | 1216 const TouchEventWithLatencyInfo& touch, |
1254 InputEventAckState ack_result) { | 1217 InputEventAckState ack_result) { |
1255 ScopedVector<ui::TouchEvent> events; | 1218 ScopedVector<ui::TouchEvent> events; |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1626 return gfx::Rect(origin.x(), | 1589 return gfx::Rect(origin.x(), |
1627 origin.y(), | 1590 origin.y(), |
1628 end.x() - origin.x(), | 1591 end.x() - origin.x(), |
1629 end.y() - origin.y()); | 1592 end.y() - origin.y()); |
1630 } | 1593 } |
1631 | 1594 |
1632 return rect; | 1595 return rect; |
1633 } | 1596 } |
1634 | 1597 |
1635 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const { | 1598 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const { |
1636 gfx::Rect rect = | 1599 return ConvertRectToScreen(ui::RectBetweenSelectionBounds(selection_start_, |
1637 ui::RectBetweenSelectionBounds(selection_anchor_, selection_focus_); | 1600 selection_end_)); |
1638 return ConvertRectToScreen(rect); | |
1639 } | 1601 } |
1640 | 1602 |
1641 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds( | 1603 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds( |
1642 uint32 index, | 1604 uint32 index, |
1643 gfx::Rect* rect) const { | 1605 gfx::Rect* rect) const { |
1644 DCHECK(rect); | 1606 DCHECK(rect); |
1645 if (index >= composition_character_bounds_.size()) | 1607 if (index >= composition_character_bounds_.size()) |
1646 return false; | 1608 return false; |
1647 *rect = ConvertRectToScreen(composition_character_bounds_[index]); | 1609 *rect = ConvertRectToScreen(composition_character_bounds_[index]); |
1648 return true; | 1610 return true; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1831 const gfx::Point& location) { | 1793 const gfx::Point& location) { |
1832 return true; | 1794 return true; |
1833 } | 1795 } |
1834 | 1796 |
1835 bool RenderWidgetHostViewAura::CanFocus() { | 1797 bool RenderWidgetHostViewAura::CanFocus() { |
1836 return popup_type_ == blink::WebPopupTypeNone; | 1798 return popup_type_ == blink::WebPopupTypeNone; |
1837 } | 1799 } |
1838 | 1800 |
1839 void RenderWidgetHostViewAura::OnCaptureLost() { | 1801 void RenderWidgetHostViewAura::OnCaptureLost() { |
1840 host_->LostCapture(); | 1802 host_->LostCapture(); |
1841 if (touch_editing_client_) | |
1842 touch_editing_client_->EndTouchEditing(false); | |
1843 } | 1803 } |
1844 | 1804 |
1845 void RenderWidgetHostViewAura::OnPaint(const ui::PaintContext& context) { | 1805 void RenderWidgetHostViewAura::OnPaint(const ui::PaintContext& context) { |
1846 NOTREACHED(); | 1806 NOTREACHED(); |
1847 } | 1807 } |
1848 | 1808 |
1849 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( | 1809 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( |
1850 float device_scale_factor) { | 1810 float device_scale_factor) { |
1851 if (!host_ || !window_->GetRootWindow()) | 1811 if (!host_ || !window_->GetRootWindow()) |
1852 return; | 1812 return; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1915 } | 1875 } |
1916 | 1876 |
1917 void RenderWidgetHostViewAura::GetHitTestMask(gfx::Path* mask) const { | 1877 void RenderWidgetHostViewAura::GetHitTestMask(gfx::Path* mask) const { |
1918 } | 1878 } |
1919 | 1879 |
1920 //////////////////////////////////////////////////////////////////////////////// | 1880 //////////////////////////////////////////////////////////////////////////////// |
1921 // RenderWidgetHostViewAura, ui::EventHandler implementation: | 1881 // RenderWidgetHostViewAura, ui::EventHandler implementation: |
1922 | 1882 |
1923 void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { | 1883 void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { |
1924 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnKeyEvent"); | 1884 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnKeyEvent"); |
1925 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
1926 return; | |
1927 | 1885 |
1928 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { | 1886 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { |
1929 popup_child_host_view_->OnKeyEvent(event); | 1887 popup_child_host_view_->OnKeyEvent(event); |
1930 if (event->handled()) | 1888 if (event->handled()) |
1931 return; | 1889 return; |
1932 } | 1890 } |
1933 | 1891 |
1934 // We need to handle the Escape key for Pepper Flash. | 1892 // We need to handle the Escape key for Pepper Flash. |
1935 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { | 1893 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { |
1936 // Focus the window we were created from. | 1894 // Focus the window we were created from. |
(...skipping 26 matching lines...) Expand all Loading... | |
1963 // We don't have to communicate with an input method here. | 1921 // We don't have to communicate with an input method here. |
1964 NativeWebKeyboardEvent webkit_event(*event); | 1922 NativeWebKeyboardEvent webkit_event(*event); |
1965 ForwardKeyboardEvent(webkit_event); | 1923 ForwardKeyboardEvent(webkit_event); |
1966 } | 1924 } |
1967 event->SetHandled(); | 1925 event->SetHandled(); |
1968 } | 1926 } |
1969 | 1927 |
1970 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { | 1928 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { |
1971 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnMouseEvent"); | 1929 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnMouseEvent"); |
1972 | 1930 |
1973 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
1974 return; | |
1975 | |
1976 if (mouse_locked_) { | 1931 if (mouse_locked_) { |
1977 aura::client::CursorClient* cursor_client = | 1932 aura::client::CursorClient* cursor_client = |
1978 aura::client::GetCursorClient(window_->GetRootWindow()); | 1933 aura::client::GetCursorClient(window_->GetRootWindow()); |
1979 DCHECK(!cursor_client || !cursor_client->IsCursorVisible()); | 1934 DCHECK(!cursor_client || !cursor_client->IsCursorVisible()); |
1980 | 1935 |
1981 if (event->type() == ui::ET_MOUSEWHEEL) { | 1936 if (event->type() == ui::ET_MOUSEWHEEL) { |
1982 blink::WebMouseWheelEvent mouse_wheel_event = | 1937 blink::WebMouseWheelEvent mouse_wheel_event = |
1983 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); | 1938 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); |
1984 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) | 1939 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) |
1985 host_->ForwardWheelEvent(mouse_wheel_event); | 1940 host_->ForwardWheelEvent(mouse_wheel_event); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2129 event->ConvertLocationToTarget(window_, window_->parent()); | 2084 event->ConvertLocationToTarget(window_, window_->parent()); |
2130 window_->parent()->delegate()->OnMouseEvent(event); | 2085 window_->parent()->delegate()->OnMouseEvent(event); |
2131 } | 2086 } |
2132 | 2087 |
2133 if (!IsXButtonUpEvent(event)) | 2088 if (!IsXButtonUpEvent(event)) |
2134 event->SetHandled(); | 2089 event->SetHandled(); |
2135 } | 2090 } |
2136 | 2091 |
2137 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { | 2092 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { |
2138 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); | 2093 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); |
2139 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
2140 return; | |
2141 | 2094 |
2142 if (event->type() == ui::ET_SCROLL) { | 2095 if (event->type() == ui::ET_SCROLL) { |
2143 #if !defined(OS_WIN) | 2096 #if !defined(OS_WIN) |
2144 // TODO(ananta) | 2097 // TODO(ananta) |
2145 // Investigate if this is true for Windows 8 Metro ASH as well. | 2098 // Investigate if this is true for Windows 8 Metro ASH as well. |
2146 if (event->finger_count() != 2) | 2099 if (event->finger_count() != 2) |
2147 return; | 2100 return; |
2148 #endif | 2101 #endif |
2149 blink::WebGestureEvent gesture_event = | 2102 blink::WebGestureEvent gesture_event = |
2150 MakeWebGestureEventFlingCancel(); | 2103 MakeWebGestureEventFlingCancel(); |
2151 host_->ForwardGestureEvent(gesture_event); | 2104 host_->ForwardGestureEvent(gesture_event); |
2152 blink::WebMouseWheelEvent mouse_wheel_event = | 2105 blink::WebMouseWheelEvent mouse_wheel_event = |
2153 MakeWebMouseWheelEvent(*event); | 2106 MakeWebMouseWheelEvent(*event); |
2154 host_->ForwardWheelEvent(mouse_wheel_event); | 2107 host_->ForwardWheelEvent(mouse_wheel_event); |
2155 RecordAction(base::UserMetricsAction("TrackpadScroll")); | 2108 RecordAction(base::UserMetricsAction("TrackpadScroll")); |
2156 } else if (event->type() == ui::ET_SCROLL_FLING_START || | 2109 } else if (event->type() == ui::ET_SCROLL_FLING_START || |
2157 event->type() == ui::ET_SCROLL_FLING_CANCEL) { | 2110 event->type() == ui::ET_SCROLL_FLING_CANCEL) { |
2158 blink::WebGestureEvent gesture_event = MakeWebGestureEvent(*event); | 2111 blink::WebGestureEvent gesture_event = MakeWebGestureEvent(*event); |
2159 host_->ForwardGestureEvent(gesture_event); | 2112 host_->ForwardGestureEvent(gesture_event); |
2160 if (event->type() == ui::ET_SCROLL_FLING_START) | 2113 if (event->type() == ui::ET_SCROLL_FLING_START) |
2161 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); | 2114 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); |
2162 } | 2115 } |
2163 | 2116 |
2164 event->SetHandled(); | 2117 event->SetHandled(); |
2165 } | 2118 } |
2166 | 2119 |
2167 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { | 2120 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { |
2168 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent"); | 2121 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent"); |
2169 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
2170 return; | |
2171 | 2122 |
2172 // Update the touch event first. | 2123 // Update the touch event first. |
2173 if (!pointer_state_.OnTouch(*event)) { | 2124 if (!pointer_state_.OnTouch(*event)) { |
2174 event->StopPropagation(); | 2125 event->StopPropagation(); |
2175 return; | 2126 return; |
2176 } | 2127 } |
2177 | 2128 |
2129 if (selection_controller_ && | |
2130 selection_controller_->WillHandleTouchEvent(pointer_state_)) { | |
2131 event->SetHandled(); | |
2132 pointer_state_.CleanupRemovedTouchPoints(*event); | |
sadrul
2015/04/29 19:55:03
Should there be some Scoped thingy to make sure th
mohsen
2015/04/30 18:29:34
I thought of a similar thing, but thought it would
| |
2133 return; | |
2134 } | |
2135 | |
2178 blink::WebTouchEvent touch_event = ui::CreateWebTouchEventFromMotionEvent( | 2136 blink::WebTouchEvent touch_event = ui::CreateWebTouchEventFromMotionEvent( |
2179 pointer_state_, event->may_cause_scrolling()); | 2137 pointer_state_, event->may_cause_scrolling()); |
2180 pointer_state_.CleanupRemovedTouchPoints(*event); | 2138 pointer_state_.CleanupRemovedTouchPoints(*event); |
2181 | 2139 |
2182 // It is important to always mark events as being handled asynchronously when | 2140 // It is important to always mark events as being handled asynchronously when |
2183 // they are forwarded. This ensures that the current event does not get | 2141 // they are forwarded. This ensures that the current event does not get |
2184 // processed by the gesture recognizer before events currently awaiting | 2142 // processed by the gesture recognizer before events currently awaiting |
2185 // dispatch in the touch queue. | 2143 // dispatch in the touch queue. |
2186 event->DisableSynchronousHandling(); | 2144 event->DisableSynchronousHandling(); |
2187 host_->ForwardTouchEventWithLatencyInfo(touch_event, *event->latency()); | 2145 host_->ForwardTouchEventWithLatencyInfo(touch_event, *event->latency()); |
2188 } | 2146 } |
2189 | 2147 |
2148 void RenderWidgetHostViewAura::HandleGestureForTouchSelection( | |
2149 ui::GestureEvent* event) { | |
2150 if (!selection_controller_) | |
2151 return; | |
2152 | |
2153 switch (event->type()) { | |
2154 case ui::ET_GESTURE_LONG_PRESS: | |
2155 selection_controller_->OnLongPressEvent(); | |
2156 break; | |
2157 case ui::ET_GESTURE_TAP: | |
2158 if (RectBetweenSelectionBounds(selection_controller_->start(), | |
2159 selection_controller_->end()) | |
2160 .Contains(event->location())) { | |
2161 if (!selection_controller_->is_insertion_active() && | |
2162 !selection_controller_->is_selection_active()) { | |
2163 selection_controller_->AllowShowingFromCurrentSelection(); | |
2164 event->SetHandled(); | |
2165 } else if (text_input_type_ == ui::TEXT_INPUT_TYPE_NONE) { | |
2166 event->SetHandled(); | |
2167 } | |
2168 } | |
2169 if (!event->handled()) | |
2170 selection_controller_->OnTapEvent(); | |
2171 break; | |
2172 case ui::ET_GESTURE_SCROLL_BEGIN: | |
2173 selection_controller_client_->OnScrollStarted(); | |
2174 break; | |
2175 case ui::ET_GESTURE_SCROLL_END: | |
2176 selection_controller_client_->OnScrollCompleted(); | |
2177 break; | |
2178 default: | |
2179 break; | |
2180 } | |
2181 } | |
2182 | |
2190 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { | 2183 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { |
2191 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); | 2184 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); |
2185 | |
2192 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || | 2186 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || |
2193 event->type() == ui::ET_GESTURE_PINCH_UPDATE || | 2187 event->type() == ui::ET_GESTURE_PINCH_UPDATE || |
2194 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { | 2188 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { |
2195 event->SetHandled(); | 2189 event->SetHandled(); |
2196 return; | 2190 return; |
2197 } | 2191 } |
2198 | 2192 |
2199 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | 2193 HandleGestureForTouchSelection(event); |
2194 if (event->handled()) | |
2200 return; | 2195 return; |
2201 | 2196 |
2202 // Confirm existing composition text on TAP gesture, to make sure the input | 2197 // Confirm existing composition text on TAP gesture, to make sure the input |
2203 // caret won't be moved with an ongoing composition text. | 2198 // caret won't be moved with an ongoing composition text. |
2204 if (event->type() == ui::ET_GESTURE_TAP) | 2199 if (event->type() == ui::ET_GESTURE_TAP) |
2205 FinishImeCompositionSession(); | 2200 FinishImeCompositionSession(); |
2206 | 2201 |
2207 blink::WebGestureEvent gesture = MakeWebGestureEvent(*event); | 2202 blink::WebGestureEvent gesture = MakeWebGestureEvent(*event); |
2208 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { | 2203 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { |
2209 // Webkit does not stop a fling-scroll on tap-down. So explicitly send an | 2204 // Webkit does not stop a fling-scroll on tap-down. So explicitly send an |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2286 host_->GetRootBrowserAccessibilityManager(); | 2281 host_->GetRootBrowserAccessibilityManager(); |
2287 if (manager) | 2282 if (manager) |
2288 manager->OnWindowFocused(); | 2283 manager->OnWindowFocused(); |
2289 } else if (window_ == lost_focus) { | 2284 } else if (window_ == lost_focus) { |
2290 host_->SetActive(false); | 2285 host_->SetActive(false); |
2291 host_->Blur(); | 2286 host_->Blur(); |
2292 | 2287 |
2293 DetachFromInputMethod(); | 2288 DetachFromInputMethod(); |
2294 host_->SetInputMethodActive(false); | 2289 host_->SetInputMethodActive(false); |
2295 | 2290 |
2296 if (touch_editing_client_) | 2291 if (selection_controller_) |
2297 touch_editing_client_->EndTouchEditing(false); | 2292 selection_controller_->HideAndDisallowShowingAutomatically(); |
2298 | 2293 |
2299 if (overscroll_controller_) | 2294 if (overscroll_controller_) |
2300 overscroll_controller_->Cancel(); | 2295 overscroll_controller_->Cancel(); |
2301 | 2296 |
2302 BrowserAccessibilityManager* manager = | 2297 BrowserAccessibilityManager* manager = |
2303 host_->GetRootBrowserAccessibilityManager(); | 2298 host_->GetRootBrowserAccessibilityManager(); |
2304 if (manager) | 2299 if (manager) |
2305 manager->OnWindowBlurred(); | 2300 manager->OnWindowBlurred(); |
2306 | 2301 |
2307 // If we lose the focus while fullscreen, close the window; Pepper Flash | 2302 // If we lose the focus while fullscreen, close the window; Pepper Flash |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2344 TRACE_EVENT1("ui", "RenderWidgetHostViewAura::OnHostMoved", | 2339 TRACE_EVENT1("ui", "RenderWidgetHostViewAura::OnHostMoved", |
2345 "new_origin", new_origin.ToString()); | 2340 "new_origin", new_origin.ToString()); |
2346 | 2341 |
2347 UpdateScreenInfo(window_); | 2342 UpdateScreenInfo(window_); |
2348 } | 2343 } |
2349 | 2344 |
2350 //////////////////////////////////////////////////////////////////////////////// | 2345 //////////////////////////////////////////////////////////////////////////////// |
2351 // RenderWidgetHostViewAura, private: | 2346 // RenderWidgetHostViewAura, private: |
2352 | 2347 |
2353 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { | 2348 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { |
2354 if (touch_editing_client_) | 2349 selection_controller_.reset(); |
2355 touch_editing_client_->OnViewDestroyed(); | 2350 selection_controller_client_.reset(); |
2356 | |
2357 delegated_frame_host_.reset(); | 2351 delegated_frame_host_.reset(); |
2358 window_observer_.reset(); | 2352 window_observer_.reset(); |
2359 if (window_->GetHost()) | 2353 if (window_->GetHost()) |
2360 window_->GetHost()->RemoveObserver(this); | 2354 window_->GetHost()->RemoveObserver(this); |
2361 UnlockMouse(); | 2355 UnlockMouse(); |
2362 if (popup_parent_host_view_) { | 2356 if (popup_parent_host_view_) { |
2363 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || | 2357 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || |
2364 popup_parent_host_view_->popup_child_host_view_ == this); | 2358 popup_parent_host_view_->popup_child_host_view_ == this); |
2365 popup_parent_host_view_->popup_child_host_view_ = NULL; | 2359 popup_parent_host_view_->popup_child_host_view_ = NULL; |
2366 } | 2360 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2497 host_->SendCursorVisibilityState(is_visible); | 2491 host_->SendCursorVisibilityState(is_visible); |
2498 } | 2492 } |
2499 | 2493 |
2500 void RenderWidgetHostViewAura::SetOverscrollControllerEnabled(bool enabled) { | 2494 void RenderWidgetHostViewAura::SetOverscrollControllerEnabled(bool enabled) { |
2501 if (!enabled) | 2495 if (!enabled) |
2502 overscroll_controller_.reset(); | 2496 overscroll_controller_.reset(); |
2503 else if (!overscroll_controller_) | 2497 else if (!overscroll_controller_) |
2504 overscroll_controller_.reset(new OverscrollController()); | 2498 overscroll_controller_.reset(new OverscrollController()); |
2505 } | 2499 } |
2506 | 2500 |
2501 void RenderWidgetHostViewAura::InitSelectionController( | |
2502 scoped_ptr<ui::TouchSelectionControllerClient> | |
2503 selection_controller_client) { | |
2504 DCHECK(!selection_controller_client_); | |
2505 selection_controller_client_ = selection_controller_client.Pass(); | |
2506 const int tap_timeout_ms = | |
2507 ui::GestureConfiguration::GetInstance()->show_press_delay_in_ms(); | |
2508 const int touch_slop = ui::GestureConfiguration::GetInstance() | |
2509 ->max_touch_move_in_pixels_for_click(); | |
2510 const bool show_on_tap_for_empty_editable = true; | |
2511 selection_controller_.reset(new ui::TouchSelectionController( | |
2512 selection_controller_client_.get(), | |
2513 base::TimeDelta::FromMilliseconds(tap_timeout_ms), | |
2514 touch_slop, | |
2515 show_on_tap_for_empty_editable)); | |
2516 } | |
2517 | |
2507 void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() { | 2518 void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() { |
2508 // The top left corner of our view in window coordinates might not land on a | 2519 // The top left corner of our view in window coordinates might not land on a |
2509 // device pixel boundary if we have a non-integer device scale. In that case, | 2520 // device pixel boundary if we have a non-integer device scale. In that case, |
2510 // to avoid the web contents area looking blurry we translate the web contents | 2521 // to avoid the web contents area looking blurry we translate the web contents |
2511 // in the +x, +y direction to land on the nearest pixel boundary. This may | 2522 // in the +x, +y direction to land on the nearest pixel boundary. This may |
2512 // cause the bottom and right edges to be clipped slightly, but that's ok. | 2523 // cause the bottom and right edges to be clipped slightly, but that's ok. |
2513 aura::Window* snapped = NULL; | 2524 aura::Window* snapped = NULL; |
2514 // On desktop, use the root window. On alternative environment (ash), | 2525 // On desktop, use the root window. On alternative environment (ash), |
2515 // use the toplevel window which must be already snapped. | 2526 // use the toplevel window which must be already snapped. |
2516 if (gfx::Screen::GetScreenFor(window_) != | 2527 if (gfx::Screen::GetScreenFor(window_) != |
(...skipping 18 matching lines...) Expand all Loading... | |
2535 if (HasDisplayPropertyChanged(window_)) | 2546 if (HasDisplayPropertyChanged(window_)) |
2536 host_->InvalidateScreenInfo(); | 2547 host_->InvalidateScreenInfo(); |
2537 | 2548 |
2538 SnapToPhysicalPixelBoundary(); | 2549 SnapToPhysicalPixelBoundary(); |
2539 // Don't recursively call SetBounds if this bounds update is the result of | 2550 // Don't recursively call SetBounds if this bounds update is the result of |
2540 // a Window::SetBoundsInternal call. | 2551 // a Window::SetBoundsInternal call. |
2541 if (!in_bounds_changed_) | 2552 if (!in_bounds_changed_) |
2542 window_->SetBounds(rect); | 2553 window_->SetBounds(rect); |
2543 host_->WasResized(); | 2554 host_->WasResized(); |
2544 delegated_frame_host_->WasResized(); | 2555 delegated_frame_host_->WasResized(); |
2545 if (touch_editing_client_) { | |
2546 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_, | |
2547 selection_focus_); | |
2548 } | |
2549 #if defined(OS_WIN) | 2556 #if defined(OS_WIN) |
2550 // Create the legacy dummy window which corresponds to the bounds of the | 2557 // Create the legacy dummy window which corresponds to the bounds of the |
2551 // webcontents. This will be passed as the container window for windowless | 2558 // webcontents. This will be passed as the container window for windowless |
2552 // plugins. | 2559 // plugins. |
2553 // Plugins like Flash assume the container window which is returned via the | 2560 // Plugins like Flash assume the container window which is returned via the |
2554 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. | 2561 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. |
2555 // This is not true in Aura where we have only HWND which is the main Aura | 2562 // This is not true in Aura where we have only HWND which is the main Aura |
2556 // window. If we return this window to plugins like Flash then it causes the | 2563 // window. If we return this window to plugins like Flash then it causes the |
2557 // coordinate translations done by these plugins to break. | 2564 // coordinate translations done by these plugins to break. |
2558 // Additonally the legacy dummy window is needed for accessibility and for | 2565 // Additonally the legacy dummy window is needed for accessibility and for |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2682 } | 2689 } |
2683 #endif | 2690 #endif |
2684 | 2691 |
2685 host_->ForwardKeyboardEvent(event); | 2692 host_->ForwardKeyboardEvent(event); |
2686 } | 2693 } |
2687 | 2694 |
2688 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { | 2695 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { |
2689 return kN32_SkColorType; | 2696 return kN32_SkColorType; |
2690 } | 2697 } |
2691 | 2698 |
2699 void RenderWidgetHostViewAura::SelectionUpdated(bool is_editable, | |
2700 bool is_empty_text_form_control, | |
2701 const ui::SelectionBound& start, | |
2702 const ui::SelectionBound& end) { | |
2703 if (selection_start_ != start || selection_end_ != end) { | |
2704 selection_start_ = start; | |
2705 selection_end_ = end; | |
2706 if (GetInputMethod()) | |
2707 GetInputMethod()->OnCaretBoundsChanged(this); | |
2708 } | |
2709 | |
2710 if (selection_controller_) { | |
2711 selection_controller_->OnSelectionEditable(is_editable); | |
2712 selection_controller_->OnSelectionEmpty(is_empty_text_form_control); | |
2713 selection_controller_->OnSelectionBoundsUpdated(start, end); | |
2714 } | |
2715 } | |
2716 | |
2692 //////////////////////////////////////////////////////////////////////////////// | 2717 //////////////////////////////////////////////////////////////////////////////// |
2693 // DelegatedFrameHost, public: | 2718 // DelegatedFrameHost, public: |
2694 | 2719 |
2695 ui::Layer* RenderWidgetHostViewAura::DelegatedFrameHostGetLayer() const { | 2720 ui::Layer* RenderWidgetHostViewAura::DelegatedFrameHostGetLayer() const { |
2696 return window_->layer(); | 2721 return window_->layer(); |
2697 } | 2722 } |
2698 | 2723 |
2699 bool RenderWidgetHostViewAura::DelegatedFrameHostIsVisible() const { | 2724 bool RenderWidgetHostViewAura::DelegatedFrameHostIsVisible() const { |
2700 return !host_->is_hidden(); | 2725 return !host_->is_hidden(); |
2701 } | 2726 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2764 | 2789 |
2765 //////////////////////////////////////////////////////////////////////////////// | 2790 //////////////////////////////////////////////////////////////////////////////// |
2766 // RenderWidgetHostViewBase, public: | 2791 // RenderWidgetHostViewBase, public: |
2767 | 2792 |
2768 // static | 2793 // static |
2769 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2794 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2770 GetScreenInfoForWindow(results, NULL); | 2795 GetScreenInfoForWindow(results, NULL); |
2771 } | 2796 } |
2772 | 2797 |
2773 } // namespace content | 2798 } // namespace content |
OLD | NEW |