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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
16 #include "cc/layers/layer.h" | 16 #include "cc/layers/layer.h" |
17 #include "cc/output/copy_output_request.h" | 17 #include "cc/output/copy_output_request.h" |
18 #include "cc/output/copy_output_result.h" | 18 #include "cc/output/copy_output_result.h" |
19 #include "cc/resources/texture_mailbox.h" | 19 #include "cc/resources/texture_mailbox.h" |
20 #include "cc/trees/layer_tree_settings.h" | 20 #include "cc/trees/layer_tree_settings.h" |
21 #include "content/browser/accessibility/browser_accessibility_manager.h" | 21 #include "content/browser/accessibility/browser_accessibility_manager.h" |
22 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 22 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
23 #include "content/browser/frame_host/frame_tree.h" | 23 #include "content/browser/frame_host/frame_tree.h" |
24 #include "content/browser/frame_host/frame_tree_node.h" | 24 #include "content/browser/frame_host/frame_tree_node.h" |
25 #include "content/browser/frame_host/render_frame_host_impl.h" | 25 #include "content/browser/frame_host/render_frame_host_impl.h" |
26 #include "content/browser/gpu/compositor_util.h" | 26 #include "content/browser/gpu/compositor_util.h" |
27 #include "content/browser/renderer_host/compositor_resize_lock_aura.h" | 27 #include "content/browser/renderer_host/compositor_resize_lock_aura.h" |
28 #include "content/browser/renderer_host/dip_util.h" | 28 #include "content/browser/renderer_host/dip_util.h" |
29 #include "content/browser/renderer_host/input/synthetic_gesture_target_aura.h" | 29 #include "content/browser/renderer_host/input/synthetic_gesture_target_aura.h" |
30 #include "content/browser/renderer_host/input/ui_touch_selection_helper.h" | |
30 #include "content/browser/renderer_host/input/web_input_event_util.h" | 31 #include "content/browser/renderer_host/input/web_input_event_util.h" |
31 #include "content/browser/renderer_host/overscroll_controller.h" | 32 #include "content/browser/renderer_host/overscroll_controller.h" |
32 #include "content/browser/renderer_host/render_view_host_delegate.h" | 33 #include "content/browser/renderer_host/render_view_host_delegate.h" |
33 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 34 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
34 #include "content/browser/renderer_host/render_view_host_impl.h" | 35 #include "content/browser/renderer_host/render_view_host_impl.h" |
35 #include "content/browser/renderer_host/render_widget_host_impl.h" | 36 #include "content/browser/renderer_host/render_widget_host_impl.h" |
36 #include "content/browser/renderer_host/ui_events_helper.h" | 37 #include "content/browser/renderer_host/ui_events_helper.h" |
37 #include "content/browser/renderer_host/web_input_event_aura.h" | 38 #include "content/browser/renderer_host/web_input_event_aura.h" |
38 #include "content/common/gpu/client/gl_helper.h" | 39 #include "content/common/gpu/client/gl_helper.h" |
39 #include "content/common/gpu/gpu_messages.h" | 40 #include "content/common/gpu/gpu_messages.h" |
(...skipping 27 matching lines...) Expand all Loading... | |
67 #include "ui/compositor/dip_util.h" | 68 #include "ui/compositor/dip_util.h" |
68 #include "ui/events/event.h" | 69 #include "ui/events/event.h" |
69 #include "ui/events/event_utils.h" | 70 #include "ui/events/event_utils.h" |
70 #include "ui/events/gestures/gesture_recognizer.h" | 71 #include "ui/events/gestures/gesture_recognizer.h" |
71 #include "ui/gfx/canvas.h" | 72 #include "ui/gfx/canvas.h" |
72 #include "ui/gfx/display.h" | 73 #include "ui/gfx/display.h" |
73 #include "ui/gfx/geometry/rect_conversions.h" | 74 #include "ui/gfx/geometry/rect_conversions.h" |
74 #include "ui/gfx/geometry/size_conversions.h" | 75 #include "ui/gfx/geometry/size_conversions.h" |
75 #include "ui/gfx/screen.h" | 76 #include "ui/gfx/screen.h" |
76 #include "ui/gfx/skia_util.h" | 77 #include "ui/gfx/skia_util.h" |
78 #include "ui/touch_selection/touch_selection_controller_aura.h" | |
77 #include "ui/wm/public/activation_client.h" | 79 #include "ui/wm/public/activation_client.h" |
78 #include "ui/wm/public/scoped_tooltip_disabler.h" | 80 #include "ui/wm/public/scoped_tooltip_disabler.h" |
79 #include "ui/wm/public/tooltip_client.h" | 81 #include "ui/wm/public/tooltip_client.h" |
80 #include "ui/wm/public/transient_window_client.h" | 82 #include "ui/wm/public/transient_window_client.h" |
81 #include "ui/wm/public/window_types.h" | 83 #include "ui/wm/public/window_types.h" |
82 | 84 |
83 #if defined(OS_WIN) | 85 #if defined(OS_WIN) |
84 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 86 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
85 #include "content/browser/accessibility/browser_accessibility_win.h" | 87 #include "content/browser/accessibility/browser_accessibility_win.h" |
86 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" | 88 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
429 accept_return_character_(false), | 431 accept_return_character_(false), |
430 last_swapped_software_frame_scale_factor_(1.f), | 432 last_swapped_software_frame_scale_factor_(1.f), |
431 paint_canvas_(NULL), | 433 paint_canvas_(NULL), |
432 synthetic_move_sent_(false), | 434 synthetic_move_sent_(false), |
433 cursor_visibility_state_in_renderer_(UNKNOWN), | 435 cursor_visibility_state_in_renderer_(UNKNOWN), |
434 #if defined(OS_WIN) | 436 #if defined(OS_WIN) |
435 legacy_render_widget_host_HWND_(NULL), | 437 legacy_render_widget_host_HWND_(NULL), |
436 legacy_window_destroyed_(false), | 438 legacy_window_destroyed_(false), |
437 #endif | 439 #endif |
438 has_snapped_to_boundary_(false), | 440 has_snapped_to_boundary_(false), |
439 touch_editing_client_(NULL), | |
440 is_guest_view_hack_(is_guest_view_hack), | 441 is_guest_view_hack_(is_guest_view_hack), |
441 weak_ptr_factory_(this) { | 442 weak_ptr_factory_(this) { |
442 if (!is_guest_view_hack_) | 443 if (!is_guest_view_hack_) |
443 host_->SetView(this); | 444 host_->SetView(this); |
444 | 445 |
445 window_observer_.reset(new WindowObserver(this)); | 446 window_observer_.reset(new WindowObserver(this)); |
446 aura::client::SetTooltipText(window_, &tooltip_); | 447 aura::client::SetTooltipText(window_, &tooltip_); |
447 aura::client::SetActivationDelegate(window_, this); | 448 aura::client::SetActivationDelegate(window_, this); |
448 aura::client::SetActivationChangeObserver(window_, this); | 449 aura::client::SetActivationChangeObserver(window_, this); |
449 aura::client::SetFocusChangeObserver(window_, this); | 450 aura::client::SetFocusChangeObserver(window_, this); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
774 // Make sure we have a FocusClient before attempting to Focus(). In some | 775 // Make sure we have a FocusClient before attempting to Focus(). In some |
775 // situations we may not yet be in a valid Window hierarchy (such as reloading | 776 // situations we may not yet be in a valid Window hierarchy (such as reloading |
776 // after out of memory discarded the tab). | 777 // after out of memory discarded the tab). |
777 aura::client::FocusClient* client = aura::client::GetFocusClient(window_); | 778 aura::client::FocusClient* client = aura::client::GetFocusClient(window_); |
778 if (client) | 779 if (client) |
779 window_->Focus(); | 780 window_->Focus(); |
780 } | 781 } |
781 | 782 |
782 void RenderWidgetHostViewAura::Blur() { | 783 void RenderWidgetHostViewAura::Blur() { |
783 window_->Blur(); | 784 window_->Blur(); |
785 if (selection_controller_) | |
786 selection_controller_->HideAndDisallowShowingAutomatically(); | |
784 } | 787 } |
785 | 788 |
786 bool RenderWidgetHostViewAura::HasFocus() const { | 789 bool RenderWidgetHostViewAura::HasFocus() const { |
787 return window_->HasFocus(); | 790 return window_->HasFocus(); |
788 } | 791 } |
789 | 792 |
790 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { | 793 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { |
791 return delegated_frame_host_->CanCopyToBitmap(); | 794 return delegated_frame_host_->CanCopyToBitmap(); |
792 } | 795 } |
793 | 796 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
841 if (text_input_type_ != type || | 844 if (text_input_type_ != type || |
842 text_input_mode_ != input_mode || | 845 text_input_mode_ != input_mode || |
843 can_compose_inline_ != can_compose_inline || | 846 can_compose_inline_ != can_compose_inline || |
844 text_input_flags_ != flags) { | 847 text_input_flags_ != flags) { |
845 text_input_type_ = type; | 848 text_input_type_ = type; |
846 text_input_mode_ = input_mode; | 849 text_input_mode_ = input_mode; |
847 can_compose_inline_ = can_compose_inline; | 850 can_compose_inline_ = can_compose_inline; |
848 text_input_flags_ = flags; | 851 text_input_flags_ = flags; |
849 if (GetInputMethod()) | 852 if (GetInputMethod()) |
850 GetInputMethod()->OnTextInputTypeChanged(this); | 853 GetInputMethod()->OnTextInputTypeChanged(this); |
851 if (touch_editing_client_) | 854 if (selection_controller_) { |
852 touch_editing_client_->OnTextInputTypeChanged(text_input_type_); | 855 const bool is_editable_node = type != ui::TEXT_INPUT_TYPE_NONE; |
856 selection_controller_->OnSelectionEditable(is_editable_node); | |
857 } | |
853 } | 858 } |
854 } | 859 } |
855 | 860 |
856 void RenderWidgetHostViewAura::OnTextInputStateChanged( | 861 void RenderWidgetHostViewAura::OnTextInputStateChanged( |
857 const ViewHostMsg_TextInputState_Params& params) { | 862 const ViewHostMsg_TextInputState_Params& params) { |
858 text_input_flags_ = params.flags; | 863 text_input_flags_ = params.flags; |
859 if (params.show_ime_if_needed && params.type != ui::TEXT_INPUT_TYPE_NONE) { | 864 if (params.show_ime_if_needed && params.type != ui::TEXT_INPUT_TYPE_NONE) { |
860 if (GetInputMethod()) | 865 if (GetInputMethod()) |
861 GetInputMethod()->ShowImeIfNeeded(); | 866 GetInputMethod()->ShowImeIfNeeded(); |
862 } | 867 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
899 // Content tooltips should be visible indefinitely. | 904 // Content tooltips should be visible indefinitely. |
900 tooltip_client->SetTooltipShownTimeout(window_, 0); | 905 tooltip_client->SetTooltipShownTimeout(window_, 0); |
901 } | 906 } |
902 } | 907 } |
903 | 908 |
904 void RenderWidgetHostViewAura::SelectionChanged(const base::string16& text, | 909 void RenderWidgetHostViewAura::SelectionChanged(const base::string16& text, |
905 size_t offset, | 910 size_t offset, |
906 const gfx::Range& range) { | 911 const gfx::Range& range) { |
907 RenderWidgetHostViewBase::SelectionChanged(text, offset, range); | 912 RenderWidgetHostViewBase::SelectionChanged(text, offset, range); |
908 | 913 |
914 if (selection_controller_) | |
915 selection_controller_->OnSelectionEmpty(text.empty()); | |
916 | |
909 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 917 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
910 if (text.empty() || range.is_empty()) | 918 if (text.empty() || range.is_empty()) |
911 return; | 919 return; |
912 size_t pos = range.GetMin() - offset; | 920 size_t pos = range.GetMin() - offset; |
913 size_t n = range.length(); | 921 size_t n = range.length(); |
914 | 922 |
915 DCHECK(pos + n <= text.length()) << "The text can not fully cover range."; | 923 DCHECK(pos + n <= text.length()) << "The text can not fully cover range."; |
916 if (pos >= text.length()) { | 924 if (pos >= text.length()) { |
917 NOTREACHED() << "The text can not cover range."; | 925 NOTREACHED() << "The text can not cover range."; |
918 return; | 926 return; |
919 } | 927 } |
920 | 928 |
921 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 929 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
922 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); | 930 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
923 clipboard_writer.WriteText(text.substr(pos, n)); | 931 clipboard_writer.WriteText(text.substr(pos, n)); |
924 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 932 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
925 } | 933 } |
926 | 934 |
927 gfx::Size RenderWidgetHostViewAura::GetRequestedRendererSize() const { | 935 gfx::Size RenderWidgetHostViewAura::GetRequestedRendererSize() const { |
928 return delegated_frame_host_->GetRequestedRendererSize(); | 936 return delegated_frame_host_->GetRequestedRendererSize(); |
929 } | 937 } |
930 | 938 |
931 void RenderWidgetHostViewAura::SelectionBoundsChanged( | 939 void RenderWidgetHostViewAura::SelectionBoundsChanged( |
932 const ViewHostMsg_SelectionBounds_Params& params) { | 940 const ViewHostMsg_SelectionBounds_Params& params) { |
933 ui::SelectionBound anchor_bound, focus_bound; | 941 NOTREACHED() << "Selection bounds should be routed through the compositor."; |
934 anchor_bound.SetEdge(params.anchor_rect.origin(), | |
935 params.anchor_rect.bottom_left()); | |
936 focus_bound.SetEdge(params.focus_rect.origin(), | |
937 params.focus_rect.bottom_left()); | |
938 | |
939 if (params.anchor_rect == params.focus_rect) { | |
940 anchor_bound.set_type(ui::SelectionBound::CENTER); | |
941 focus_bound.set_type(ui::SelectionBound::CENTER); | |
942 } else { | |
943 // Whether text is LTR at the anchor handle. | |
944 bool anchor_LTR = params.anchor_dir == blink::WebTextDirectionLeftToRight; | |
945 // Whether text is LTR at the focus handle. | |
946 bool focus_LTR = params.focus_dir == blink::WebTextDirectionLeftToRight; | |
947 | |
948 if ((params.is_anchor_first && anchor_LTR) || | |
949 (!params.is_anchor_first && !anchor_LTR)) { | |
950 anchor_bound.set_type(ui::SelectionBound::LEFT); | |
951 } else { | |
952 anchor_bound.set_type(ui::SelectionBound::RIGHT); | |
953 } | |
954 if ((params.is_anchor_first && focus_LTR) || | |
955 (!params.is_anchor_first && !focus_LTR)) { | |
956 focus_bound.set_type(ui::SelectionBound::RIGHT); | |
957 } else { | |
958 focus_bound.set_type(ui::SelectionBound::LEFT); | |
959 } | |
960 } | |
961 | |
962 if (anchor_bound == selection_anchor_ && focus_bound == selection_focus_) | |
963 return; | |
964 | |
965 selection_anchor_ = anchor_bound; | |
966 selection_focus_ = focus_bound; | |
967 if (GetInputMethod()) | |
968 GetInputMethod()->OnCaretBoundsChanged(this); | |
969 | |
970 if (touch_editing_client_) { | |
971 touch_editing_client_->OnSelectionOrCursorChanged( | |
972 anchor_bound, focus_bound); | |
973 } | |
974 } | 942 } |
975 | 943 |
976 void RenderWidgetHostViewAura::CopyFromCompositingSurface( | 944 void RenderWidgetHostViewAura::CopyFromCompositingSurface( |
977 const gfx::Rect& src_subrect, | 945 const gfx::Rect& src_subrect, |
978 const gfx::Size& dst_size, | 946 const gfx::Size& dst_size, |
979 ReadbackRequestCallback& callback, | 947 ReadbackRequestCallback& callback, |
980 const SkColorType color_type) { | 948 const SkColorType color_type) { |
981 delegated_frame_host_->CopyFromCompositingSurface( | 949 delegated_frame_host_->CopyFromCompositingSurface( |
982 src_subrect, dst_size, callback, color_type); | 950 src_subrect, dst_size, callback, color_type); |
983 } | 951 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1052 scoped_ptr<cc::CompositorFrame> frame) { | 1020 scoped_ptr<cc::CompositorFrame> frame) { |
1053 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); | 1021 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); |
1054 | 1022 |
1055 last_scroll_offset_ = frame->metadata.root_scroll_offset; | 1023 last_scroll_offset_ = frame->metadata.root_scroll_offset; |
1056 if (frame->delegated_frame_data) { | 1024 if (frame->delegated_frame_data) { |
1057 delegated_frame_host_->SwapDelegatedFrame( | 1025 delegated_frame_host_->SwapDelegatedFrame( |
1058 output_surface_id, | 1026 output_surface_id, |
1059 frame->delegated_frame_data.Pass(), | 1027 frame->delegated_frame_data.Pass(), |
1060 frame->metadata.device_scale_factor, | 1028 frame->metadata.device_scale_factor, |
1061 frame->metadata.latency_info); | 1029 frame->metadata.latency_info); |
1030 SelectionBoundsUpdated( | |
1031 ConvertSelectionBound(frame->metadata.selection_start), | |
1032 ConvertSelectionBound(frame->metadata.selection_end)); | |
1062 return; | 1033 return; |
1063 } | 1034 } |
1064 | 1035 |
1065 if (frame->software_frame_data) { | 1036 if (frame->software_frame_data) { |
1066 DLOG(ERROR) << "Unable to use software frame in aura"; | 1037 DLOG(ERROR) << "Unable to use software frame in aura"; |
1067 RecordAction( | 1038 RecordAction( |
1068 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura")); | 1039 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura")); |
1069 host_->GetProcess()->ReceivedBadMessage(); | 1040 host_->GetProcess()->ReceivedBadMessage(); |
1070 return; | 1041 return; |
1071 } | 1042 } |
1072 } | 1043 } |
1073 | 1044 |
1074 void RenderWidgetHostViewAura::DidStopFlinging() { | 1045 void RenderWidgetHostViewAura::DidStopFlinging() { |
1075 if (touch_editing_client_) | 1046 if (selection_controller_) |
1076 touch_editing_client_->DidStopFlinging(); | 1047 selection_controller_->OnFlingCompleted(); |
1077 } | 1048 } |
1078 | 1049 |
1079 #if defined(OS_WIN) | 1050 #if defined(OS_WIN) |
1080 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( | 1051 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( |
1081 gfx::NativeViewAccessible accessible_parent) { | 1052 gfx::NativeViewAccessible accessible_parent) { |
1082 } | 1053 } |
1083 | 1054 |
1084 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() | 1055 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() |
1085 const { | 1056 const { |
1086 if (legacy_render_widget_host_HWND_) { | 1057 if (legacy_render_widget_host_HWND_) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1146 InputEventAckState ack_result) { | 1117 InputEventAckState ack_result) { |
1147 if (overscroll_controller_) { | 1118 if (overscroll_controller_) { |
1148 overscroll_controller_->ReceivedEventACK( | 1119 overscroll_controller_->ReceivedEventACK( |
1149 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); | 1120 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); |
1150 } | 1121 } |
1151 } | 1122 } |
1152 | 1123 |
1153 void RenderWidgetHostViewAura::GestureEventAck( | 1124 void RenderWidgetHostViewAura::GestureEventAck( |
1154 const blink::WebGestureEvent& event, | 1125 const blink::WebGestureEvent& event, |
1155 InputEventAckState ack_result) { | 1126 InputEventAckState ack_result) { |
1156 if (touch_editing_client_) | |
1157 touch_editing_client_->GestureEventAck(event.type); | |
1158 | |
1159 if (overscroll_controller_) { | 1127 if (overscroll_controller_) { |
1160 overscroll_controller_->ReceivedEventACK( | 1128 overscroll_controller_->ReceivedEventACK( |
1161 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); | 1129 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); |
1162 } | 1130 } |
1163 } | 1131 } |
1164 | 1132 |
1165 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( | 1133 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( |
1166 const TouchEventWithLatencyInfo& touch, | 1134 const TouchEventWithLatencyInfo& touch, |
1167 InputEventAckState ack_result) { | 1135 InputEventAckState ack_result) { |
1168 ScopedVector<ui::TouchEvent> events; | 1136 ScopedVector<ui::TouchEvent> events; |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1539 return gfx::Rect(origin.x(), | 1507 return gfx::Rect(origin.x(), |
1540 origin.y(), | 1508 origin.y(), |
1541 end.x() - origin.x(), | 1509 end.x() - origin.x(), |
1542 end.y() - origin.y()); | 1510 end.y() - origin.y()); |
1543 } | 1511 } |
1544 | 1512 |
1545 return rect; | 1513 return rect; |
1546 } | 1514 } |
1547 | 1515 |
1548 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const { | 1516 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const { |
1549 gfx::Rect rect = | 1517 return ConvertRectToScreen(ui::RectBetweenSelectionBounds(selection_start_, |
1550 ui::RectBetweenSelectionBounds(selection_anchor_, selection_focus_); | 1518 selection_end_)); |
1551 return ConvertRectToScreen(rect); | |
1552 } | 1519 } |
1553 | 1520 |
1554 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds( | 1521 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds( |
1555 uint32 index, | 1522 uint32 index, |
1556 gfx::Rect* rect) const { | 1523 gfx::Rect* rect) const { |
1557 DCHECK(rect); | 1524 DCHECK(rect); |
1558 if (index >= composition_character_bounds_.size()) | 1525 if (index >= composition_character_bounds_.size()) |
1559 return false; | 1526 return false; |
1560 *rect = ConvertRectToScreen(composition_character_bounds_[index]); | 1527 *rect = ConvertRectToScreen(composition_character_bounds_[index]); |
1561 return true; | 1528 return true; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1744 const gfx::Point& location) { | 1711 const gfx::Point& location) { |
1745 return true; | 1712 return true; |
1746 } | 1713 } |
1747 | 1714 |
1748 bool RenderWidgetHostViewAura::CanFocus() { | 1715 bool RenderWidgetHostViewAura::CanFocus() { |
1749 return popup_type_ == blink::WebPopupTypeNone; | 1716 return popup_type_ == blink::WebPopupTypeNone; |
1750 } | 1717 } |
1751 | 1718 |
1752 void RenderWidgetHostViewAura::OnCaptureLost() { | 1719 void RenderWidgetHostViewAura::OnCaptureLost() { |
1753 host_->LostCapture(); | 1720 host_->LostCapture(); |
1754 if (touch_editing_client_) | 1721 if (selection_controller_) |
1755 touch_editing_client_->EndTouchEditing(false); | 1722 selection_controller_->HideAndDisallowShowingAutomatically(); |
1756 } | 1723 } |
1757 | 1724 |
1758 void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { | 1725 void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { |
1759 NOTREACHED(); | 1726 NOTREACHED(); |
1760 } | 1727 } |
1761 | 1728 |
1762 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( | 1729 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( |
1763 float device_scale_factor) { | 1730 float device_scale_factor) { |
1764 if (!host_ || !window_->GetRootWindow()) | 1731 if (!host_ || !window_->GetRootWindow()) |
1765 return; | 1732 return; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1828 } | 1795 } |
1829 | 1796 |
1830 void RenderWidgetHostViewAura::GetHitTestMask(gfx::Path* mask) const { | 1797 void RenderWidgetHostViewAura::GetHitTestMask(gfx::Path* mask) const { |
1831 } | 1798 } |
1832 | 1799 |
1833 //////////////////////////////////////////////////////////////////////////////// | 1800 //////////////////////////////////////////////////////////////////////////////// |
1834 // RenderWidgetHostViewAura, ui::EventHandler implementation: | 1801 // RenderWidgetHostViewAura, ui::EventHandler implementation: |
1835 | 1802 |
1836 void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { | 1803 void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { |
1837 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnKeyEvent"); | 1804 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnKeyEvent"); |
1838 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
1839 return; | |
1840 | 1805 |
1841 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { | 1806 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { |
1842 popup_child_host_view_->OnKeyEvent(event); | 1807 popup_child_host_view_->OnKeyEvent(event); |
1843 if (event->handled()) | 1808 if (event->handled()) |
1844 return; | 1809 return; |
1845 } | 1810 } |
1846 | 1811 |
1847 // We need to handle the Escape key for Pepper Flash. | 1812 // We need to handle the Escape key for Pepper Flash. |
1848 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { | 1813 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { |
1849 // Focus the window we were created from. | 1814 // Focus the window we were created from. |
(...skipping 26 matching lines...) Expand all Loading... | |
1876 // We don't have to communicate with an input method here. | 1841 // We don't have to communicate with an input method here. |
1877 NativeWebKeyboardEvent webkit_event(*event); | 1842 NativeWebKeyboardEvent webkit_event(*event); |
1878 ForwardKeyboardEvent(webkit_event); | 1843 ForwardKeyboardEvent(webkit_event); |
1879 } | 1844 } |
1880 event->SetHandled(); | 1845 event->SetHandled(); |
1881 } | 1846 } |
1882 | 1847 |
1883 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { | 1848 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { |
1884 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnMouseEvent"); | 1849 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnMouseEvent"); |
1885 | 1850 |
1886 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
1887 return; | |
1888 | |
1889 if (mouse_locked_) { | 1851 if (mouse_locked_) { |
1890 aura::client::CursorClient* cursor_client = | 1852 aura::client::CursorClient* cursor_client = |
1891 aura::client::GetCursorClient(window_->GetRootWindow()); | 1853 aura::client::GetCursorClient(window_->GetRootWindow()); |
1892 DCHECK(!cursor_client || !cursor_client->IsCursorVisible()); | 1854 DCHECK(!cursor_client || !cursor_client->IsCursorVisible()); |
1893 | 1855 |
1894 if (event->type() == ui::ET_MOUSEWHEEL) { | 1856 if (event->type() == ui::ET_MOUSEWHEEL) { |
1895 blink::WebMouseWheelEvent mouse_wheel_event = | 1857 blink::WebMouseWheelEvent mouse_wheel_event = |
1896 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); | 1858 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); |
1897 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) | 1859 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) |
1898 host_->ForwardWheelEvent(mouse_wheel_event); | 1860 host_->ForwardWheelEvent(mouse_wheel_event); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2017 event->ConvertLocationToTarget(window_, window_->parent()); | 1979 event->ConvertLocationToTarget(window_, window_->parent()); |
2018 window_->parent()->delegate()->OnMouseEvent(event); | 1980 window_->parent()->delegate()->OnMouseEvent(event); |
2019 } | 1981 } |
2020 | 1982 |
2021 if (!IsXButtonUpEvent(event)) | 1983 if (!IsXButtonUpEvent(event)) |
2022 event->SetHandled(); | 1984 event->SetHandled(); |
2023 } | 1985 } |
2024 | 1986 |
2025 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { | 1987 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { |
2026 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); | 1988 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); |
2027 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
2028 return; | |
2029 | 1989 |
2030 if (event->type() == ui::ET_SCROLL) { | 1990 if (event->type() == ui::ET_SCROLL) { |
2031 #if !defined(OS_WIN) | 1991 #if !defined(OS_WIN) |
2032 // TODO(ananta) | 1992 // TODO(ananta) |
2033 // Investigate if this is true for Windows 8 Metro ASH as well. | 1993 // Investigate if this is true for Windows 8 Metro ASH as well. |
2034 if (event->finger_count() != 2) | 1994 if (event->finger_count() != 2) |
2035 return; | 1995 return; |
2036 #endif | 1996 #endif |
2037 blink::WebGestureEvent gesture_event = | 1997 blink::WebGestureEvent gesture_event = |
2038 MakeWebGestureEventFlingCancel(); | 1998 MakeWebGestureEventFlingCancel(); |
2039 host_->ForwardGestureEvent(gesture_event); | 1999 host_->ForwardGestureEvent(gesture_event); |
2040 blink::WebMouseWheelEvent mouse_wheel_event = | 2000 blink::WebMouseWheelEvent mouse_wheel_event = |
2041 MakeWebMouseWheelEvent(*event); | 2001 MakeWebMouseWheelEvent(*event); |
2042 host_->ForwardWheelEvent(mouse_wheel_event); | 2002 host_->ForwardWheelEvent(mouse_wheel_event); |
2043 RecordAction(base::UserMetricsAction("TrackpadScroll")); | 2003 RecordAction(base::UserMetricsAction("TrackpadScroll")); |
2044 } else if (event->type() == ui::ET_SCROLL_FLING_START || | 2004 } else if (event->type() == ui::ET_SCROLL_FLING_START || |
2045 event->type() == ui::ET_SCROLL_FLING_CANCEL) { | 2005 event->type() == ui::ET_SCROLL_FLING_CANCEL) { |
2046 blink::WebGestureEvent gesture_event = MakeWebGestureEvent(*event); | 2006 blink::WebGestureEvent gesture_event = MakeWebGestureEvent(*event); |
2047 host_->ForwardGestureEvent(gesture_event); | 2007 host_->ForwardGestureEvent(gesture_event); |
2048 if (event->type() == ui::ET_SCROLL_FLING_START) | 2008 if (event->type() == ui::ET_SCROLL_FLING_START) |
2049 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); | 2009 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); |
2050 } | 2010 } |
2051 | 2011 |
2052 event->SetHandled(); | 2012 event->SetHandled(); |
2053 } | 2013 } |
2054 | 2014 |
2055 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { | 2015 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { |
2056 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent"); | 2016 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent"); |
2057 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | 2017 |
2058 return; | 2018 if (selection_controller_) { |
2019 selection_controller_->HandleTouchEvent(event); | |
2020 if (event->handled()) | |
2021 return; | |
sadrul
2015/03/05 12:37:03
Have you considered making the selection controlle
mohsen
2015/03/06 23:10:08
Since selection controller was already a pre-targe
| |
2022 } | |
2059 | 2023 |
2060 // Update the touch event first. | 2024 // Update the touch event first. |
2061 if (!pointer_state_.OnTouch(*event)) { | 2025 if (!pointer_state_.OnTouch(*event)) { |
2062 event->StopPropagation(); | 2026 event->StopPropagation(); |
2063 return; | 2027 return; |
2064 } | 2028 } |
2065 | 2029 |
2066 blink::WebTouchEvent touch_event = CreateWebTouchEventFromMotionEvent( | 2030 blink::WebTouchEvent touch_event = CreateWebTouchEventFromMotionEvent( |
2067 pointer_state_, event->may_cause_scrolling()); | 2031 pointer_state_, event->may_cause_scrolling()); |
2068 pointer_state_.CleanupRemovedTouchPoints(*event); | 2032 pointer_state_.CleanupRemovedTouchPoints(*event); |
2069 | 2033 |
2070 // It is important to always mark events as being handled asynchronously when | 2034 // It is important to always mark events as being handled asynchronously when |
2071 // they are forwarded. This ensures that the current event does not get | 2035 // they are forwarded. This ensures that the current event does not get |
2072 // processed by the gesture recognizer before events currently awaiting | 2036 // processed by the gesture recognizer before events currently awaiting |
2073 // dispatch in the touch queue. | 2037 // dispatch in the touch queue. |
2074 event->DisableSynchronousHandling(); | 2038 event->DisableSynchronousHandling(); |
2075 host_->ForwardTouchEventWithLatencyInfo(touch_event, *event->latency()); | 2039 host_->ForwardTouchEventWithLatencyInfo(touch_event, *event->latency()); |
2076 } | 2040 } |
2077 | 2041 |
2078 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { | 2042 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { |
2079 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); | 2043 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); |
2044 | |
2045 if (selection_controller_) { | |
2046 selection_controller_->HandleGestureEvent(event); | |
2047 if (event->handled()) | |
2048 return; | |
2049 } | |
2050 | |
2080 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || | 2051 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || |
2081 event->type() == ui::ET_GESTURE_PINCH_UPDATE || | 2052 event->type() == ui::ET_GESTURE_PINCH_UPDATE || |
2082 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { | 2053 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { |
2083 event->SetHandled(); | 2054 event->SetHandled(); |
2084 return; | 2055 return; |
2085 } | 2056 } |
2086 | 2057 |
2087 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
2088 return; | |
2089 | |
2090 // Confirm existing composition text on TAP gesture, to make sure the input | 2058 // Confirm existing composition text on TAP gesture, to make sure the input |
2091 // caret won't be moved with an ongoing composition text. | 2059 // caret won't be moved with an ongoing composition text. |
2092 if (event->type() == ui::ET_GESTURE_TAP) | 2060 if (event->type() == ui::ET_GESTURE_TAP) |
2093 FinishImeCompositionSession(); | 2061 FinishImeCompositionSession(); |
2094 | 2062 |
2095 RenderViewHostDelegate* delegate = NULL; | 2063 RenderViewHostDelegate* delegate = NULL; |
2096 if (host_->IsRenderView()) | 2064 if (host_->IsRenderView()) |
2097 delegate = RenderViewHost::From(host_)->GetDelegate(); | 2065 delegate = RenderViewHost::From(host_)->GetDelegate(); |
2098 | 2066 |
2099 if (delegate && event->type() == ui::ET_GESTURE_BEGIN && | 2067 if (delegate && event->type() == ui::ET_GESTURE_BEGIN && |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2202 host_->GetRootBrowserAccessibilityManager(); | 2170 host_->GetRootBrowserAccessibilityManager(); |
2203 if (manager) | 2171 if (manager) |
2204 manager->OnWindowFocused(); | 2172 manager->OnWindowFocused(); |
2205 } else if (window_ == lost_focus) { | 2173 } else if (window_ == lost_focus) { |
2206 host_->SetActive(false); | 2174 host_->SetActive(false); |
2207 host_->Blur(); | 2175 host_->Blur(); |
2208 | 2176 |
2209 DetachFromInputMethod(); | 2177 DetachFromInputMethod(); |
2210 host_->SetInputMethodActive(false); | 2178 host_->SetInputMethodActive(false); |
2211 | 2179 |
2212 if (touch_editing_client_) | 2180 if (selection_controller_) |
2213 touch_editing_client_->EndTouchEditing(false); | 2181 selection_controller_->HideAndDisallowShowingAutomatically(); |
2214 | 2182 |
2215 if (overscroll_controller_) | 2183 if (overscroll_controller_) |
2216 overscroll_controller_->Cancel(); | 2184 overscroll_controller_->Cancel(); |
2217 | 2185 |
2218 BrowserAccessibilityManager* manager = | 2186 BrowserAccessibilityManager* manager = |
2219 host_->GetRootBrowserAccessibilityManager(); | 2187 host_->GetRootBrowserAccessibilityManager(); |
2220 if (manager) | 2188 if (manager) |
2221 manager->OnWindowBlurred(); | 2189 manager->OnWindowBlurred(); |
2222 | 2190 |
2223 // If we lose the focus while fullscreen, close the window; Pepper Flash | 2191 // 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... | |
2260 TRACE_EVENT1("ui", "RenderWidgetHostViewAura::OnHostMoved", | 2228 TRACE_EVENT1("ui", "RenderWidgetHostViewAura::OnHostMoved", |
2261 "new_origin", new_origin.ToString()); | 2229 "new_origin", new_origin.ToString()); |
2262 | 2230 |
2263 UpdateScreenInfo(window_); | 2231 UpdateScreenInfo(window_); |
2264 } | 2232 } |
2265 | 2233 |
2266 //////////////////////////////////////////////////////////////////////////////// | 2234 //////////////////////////////////////////////////////////////////////////////// |
2267 // RenderWidgetHostViewAura, private: | 2235 // RenderWidgetHostViewAura, private: |
2268 | 2236 |
2269 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { | 2237 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { |
2270 if (touch_editing_client_) | 2238 selection_controller_.reset(); |
2271 touch_editing_client_->OnViewDestroyed(); | 2239 selection_controller_client_.reset(); |
2272 | |
2273 delegated_frame_host_.reset(); | 2240 delegated_frame_host_.reset(); |
2274 window_observer_.reset(); | 2241 window_observer_.reset(); |
2275 if (window_->GetHost()) | 2242 if (window_->GetHost()) |
2276 window_->GetHost()->RemoveObserver(this); | 2243 window_->GetHost()->RemoveObserver(this); |
2277 UnlockMouse(); | 2244 UnlockMouse(); |
2278 if (popup_parent_host_view_) { | 2245 if (popup_parent_host_view_) { |
2279 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || | 2246 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || |
2280 popup_parent_host_view_->popup_child_host_view_ == this); | 2247 popup_parent_host_view_->popup_child_host_view_ == this); |
2281 popup_parent_host_view_->popup_child_host_view_ = NULL; | 2248 popup_parent_host_view_->popup_child_host_view_ = NULL; |
2282 } | 2249 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2412 host_->SendCursorVisibilityState(is_visible); | 2379 host_->SendCursorVisibilityState(is_visible); |
2413 } | 2380 } |
2414 | 2381 |
2415 void RenderWidgetHostViewAura::SetOverscrollControllerEnabled(bool enabled) { | 2382 void RenderWidgetHostViewAura::SetOverscrollControllerEnabled(bool enabled) { |
2416 if (!enabled) | 2383 if (!enabled) |
2417 overscroll_controller_.reset(); | 2384 overscroll_controller_.reset(); |
2418 else if (!overscroll_controller_) | 2385 else if (!overscroll_controller_) |
2419 overscroll_controller_.reset(new OverscrollController()); | 2386 overscroll_controller_.reset(new OverscrollController()); |
2420 } | 2387 } |
2421 | 2388 |
2389 void RenderWidgetHostViewAura::InitSelectionController( | |
2390 ui::TouchSelectionControllerAuraClient* selection_controller_client) { | |
2391 DCHECK(!selection_controller_client_); | |
2392 selection_controller_client_.reset(selection_controller_client); | |
2393 selection_controller_.reset( | |
2394 new ui::TouchSelectionControllerAura(selection_controller_client)); | |
2395 } | |
2396 | |
2422 void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() { | 2397 void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() { |
2423 // The top left corner of our view in window coordinates might not land on a | 2398 // The top left corner of our view in window coordinates might not land on a |
2424 // device pixel boundary if we have a non-integer device scale. In that case, | 2399 // device pixel boundary if we have a non-integer device scale. In that case, |
2425 // to avoid the web contents area looking blurry we translate the web contents | 2400 // to avoid the web contents area looking blurry we translate the web contents |
2426 // in the +x, +y direction to land on the nearest pixel boundary. This may | 2401 // in the +x, +y direction to land on the nearest pixel boundary. This may |
2427 // cause the bottom and right edges to be clipped slightly, but that's ok. | 2402 // cause the bottom and right edges to be clipped slightly, but that's ok. |
2428 aura::Window* snapped = NULL; | 2403 aura::Window* snapped = NULL; |
2429 // On desktop, use the root window. On alternative environment (ash), | 2404 // On desktop, use the root window. On alternative environment (ash), |
2430 // use the toplevel window which must be already snapped. | 2405 // use the toplevel window which must be already snapped. |
2431 if (gfx::Screen::GetScreenFor(window_) != | 2406 if (gfx::Screen::GetScreenFor(window_) != |
(...skipping 12 matching lines...) Expand all Loading... | |
2444 if (HasDisplayPropertyChanged(window_)) | 2419 if (HasDisplayPropertyChanged(window_)) |
2445 host_->InvalidateScreenInfo(); | 2420 host_->InvalidateScreenInfo(); |
2446 | 2421 |
2447 SnapToPhysicalPixelBoundary(); | 2422 SnapToPhysicalPixelBoundary(); |
2448 // Don't recursively call SetBounds if this bounds update is the result of | 2423 // Don't recursively call SetBounds if this bounds update is the result of |
2449 // a Window::SetBoundsInternal call. | 2424 // a Window::SetBoundsInternal call. |
2450 if (!in_bounds_changed_) | 2425 if (!in_bounds_changed_) |
2451 window_->SetBounds(rect); | 2426 window_->SetBounds(rect); |
2452 host_->WasResized(); | 2427 host_->WasResized(); |
2453 delegated_frame_host_->WasResized(); | 2428 delegated_frame_host_->WasResized(); |
2454 if (touch_editing_client_) { | |
2455 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_, | |
2456 selection_focus_); | |
2457 } | |
2458 #if defined(OS_WIN) | 2429 #if defined(OS_WIN) |
2459 // Create the legacy dummy window which corresponds to the bounds of the | 2430 // Create the legacy dummy window which corresponds to the bounds of the |
2460 // webcontents. This will be passed as the container window for windowless | 2431 // webcontents. This will be passed as the container window for windowless |
2461 // plugins. | 2432 // plugins. |
2462 // Plugins like Flash assume the container window which is returned via the | 2433 // Plugins like Flash assume the container window which is returned via the |
2463 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. | 2434 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. |
2464 // This is not true in Aura where we have only HWND which is the main Aura | 2435 // This is not true in Aura where we have only HWND which is the main Aura |
2465 // window. If we return this window to plugins like Flash then it causes the | 2436 // window. If we return this window to plugins like Flash then it causes the |
2466 // coordinate translations done by these plugins to break. | 2437 // coordinate translations done by these plugins to break. |
2467 // Additonally the legacy dummy window is needed for accessibility and for | 2438 // Additonally the legacy dummy window is needed for accessibility and for |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2591 } | 2562 } |
2592 #endif | 2563 #endif |
2593 | 2564 |
2594 host_->ForwardKeyboardEvent(event); | 2565 host_->ForwardKeyboardEvent(event); |
2595 } | 2566 } |
2596 | 2567 |
2597 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { | 2568 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { |
2598 return kN32_SkColorType; | 2569 return kN32_SkColorType; |
2599 } | 2570 } |
2600 | 2571 |
2572 void RenderWidgetHostViewAura::SelectionBoundsUpdated( | |
2573 const ui::SelectionBound& start, | |
2574 const ui::SelectionBound& end) { | |
2575 if (selection_start_ == start && selection_end_ == end) | |
2576 return; | |
2577 | |
2578 selection_start_ = start; | |
2579 selection_end_ = end; | |
2580 | |
2581 if (GetInputMethod()) | |
2582 GetInputMethod()->OnCaretBoundsChanged(this); | |
2583 | |
2584 if (selection_controller_) | |
2585 selection_controller_->OnSelectionBoundsUpdated(start, end); | |
2586 } | |
2587 | |
2601 //////////////////////////////////////////////////////////////////////////////// | 2588 //////////////////////////////////////////////////////////////////////////////// |
2602 // DelegatedFrameHost, public: | 2589 // DelegatedFrameHost, public: |
2603 | 2590 |
2604 ui::Layer* RenderWidgetHostViewAura::DelegatedFrameHostGetLayer() const { | 2591 ui::Layer* RenderWidgetHostViewAura::DelegatedFrameHostGetLayer() const { |
2605 return window_->layer(); | 2592 return window_->layer(); |
2606 } | 2593 } |
2607 | 2594 |
2608 bool RenderWidgetHostViewAura::DelegatedFrameHostIsVisible() const { | 2595 bool RenderWidgetHostViewAura::DelegatedFrameHostIsVisible() const { |
2609 return !host_->is_hidden(); | 2596 return !host_->is_hidden(); |
2610 } | 2597 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2673 | 2660 |
2674 //////////////////////////////////////////////////////////////////////////////// | 2661 //////////////////////////////////////////////////////////////////////////////// |
2675 // RenderWidgetHostViewBase, public: | 2662 // RenderWidgetHostViewBase, public: |
2676 | 2663 |
2677 // static | 2664 // static |
2678 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2665 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2679 GetScreenInfoForWindow(results, NULL); | 2666 GetScreenInfoForWindow(results, NULL); |
2680 } | 2667 } |
2681 | 2668 |
2682 } // namespace content | 2669 } // namespace content |
OLD | NEW |