| 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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 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/web_input_event_util.h" | 30 #include "content/browser/renderer_host/input/web_input_event_util.h" |
| 31 #include "content/browser/renderer_host/overscroll_controller.h" | 31 #include "content/browser/renderer_host/overscroll_controller.h" |
| 32 #include "content/browser/renderer_host/render_view_host_delegate.h" | 32 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 33 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 33 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
| 34 #include "content/browser/renderer_host/render_view_host_impl.h" | 34 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 35 #include "content/browser/renderer_host/render_widget_host_impl.h" | 35 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 36 #include "content/browser/renderer_host/ui_events_helper.h" | 36 #include "content/browser/renderer_host/ui_events_helper.h" |
| 37 #include "content/browser/renderer_host/ui_touch_selection_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" |
| 40 #include "content/common/view_messages.h" | 41 #include "content/common/view_messages.h" |
| 41 #include "content/public/browser/content_browser_client.h" | 42 #include "content/public/browser/content_browser_client.h" |
| 42 #include "content/public/browser/overscroll_configuration.h" | 43 #include "content/public/browser/overscroll_configuration.h" |
| 43 #include "content/public/browser/render_view_host.h" | 44 #include "content/public/browser/render_view_host.h" |
| 44 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 45 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
| 45 #include "content/public/browser/user_metrics.h" | 46 #include "content/public/browser/user_metrics.h" |
| 46 #include "content/public/common/content_switches.h" | 47 #include "content/public/common/content_switches.h" |
| (...skipping 20 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, InputEventAckState ack_result) { | 1134 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { |
| 1167 ScopedVector<ui::TouchEvent> events; | 1135 ScopedVector<ui::TouchEvent> events; |
| 1168 if (!MakeUITouchEventsFromWebTouchEvents(touch, &events, | 1136 if (!MakeUITouchEventsFromWebTouchEvents(touch, &events, |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1519 return gfx::Rect(origin.x(), | 1487 return gfx::Rect(origin.x(), |
| 1520 origin.y(), | 1488 origin.y(), |
| 1521 end.x() - origin.x(), | 1489 end.x() - origin.x(), |
| 1522 end.y() - origin.y()); | 1490 end.y() - origin.y()); |
| 1523 } | 1491 } |
| 1524 | 1492 |
| 1525 return rect; | 1493 return rect; |
| 1526 } | 1494 } |
| 1527 | 1495 |
| 1528 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const { | 1496 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const { |
| 1529 gfx::Rect rect = | 1497 return ConvertRectToScreen(ui::RectBetweenSelectionBounds(selection_start_, |
| 1530 ui::RectBetweenSelectionBounds(selection_anchor_, selection_focus_); | 1498 selection_end_)); |
| 1531 return ConvertRectToScreen(rect); | |
| 1532 } | 1499 } |
| 1533 | 1500 |
| 1534 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds( | 1501 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds( |
| 1535 uint32 index, | 1502 uint32 index, |
| 1536 gfx::Rect* rect) const { | 1503 gfx::Rect* rect) const { |
| 1537 DCHECK(rect); | 1504 DCHECK(rect); |
| 1538 if (index >= composition_character_bounds_.size()) | 1505 if (index >= composition_character_bounds_.size()) |
| 1539 return false; | 1506 return false; |
| 1540 *rect = ConvertRectToScreen(composition_character_bounds_[index]); | 1507 *rect = ConvertRectToScreen(composition_character_bounds_[index]); |
| 1541 return true; | 1508 return true; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1724 const gfx::Point& location) { | 1691 const gfx::Point& location) { |
| 1725 return true; | 1692 return true; |
| 1726 } | 1693 } |
| 1727 | 1694 |
| 1728 bool RenderWidgetHostViewAura::CanFocus() { | 1695 bool RenderWidgetHostViewAura::CanFocus() { |
| 1729 return popup_type_ == blink::WebPopupTypeNone; | 1696 return popup_type_ == blink::WebPopupTypeNone; |
| 1730 } | 1697 } |
| 1731 | 1698 |
| 1732 void RenderWidgetHostViewAura::OnCaptureLost() { | 1699 void RenderWidgetHostViewAura::OnCaptureLost() { |
| 1733 host_->LostCapture(); | 1700 host_->LostCapture(); |
| 1734 if (touch_editing_client_) | 1701 if (selection_controller_) |
| 1735 touch_editing_client_->EndTouchEditing(false); | 1702 selection_controller_->HideAndDisallowShowingAutomatically(); |
| 1736 } | 1703 } |
| 1737 | 1704 |
| 1738 void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { | 1705 void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { |
| 1739 NOTREACHED(); | 1706 NOTREACHED(); |
| 1740 } | 1707 } |
| 1741 | 1708 |
| 1742 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( | 1709 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( |
| 1743 float device_scale_factor) { | 1710 float device_scale_factor) { |
| 1744 if (!host_ || !window_->GetRootWindow()) | 1711 if (!host_ || !window_->GetRootWindow()) |
| 1745 return; | 1712 return; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1808 } | 1775 } |
| 1809 | 1776 |
| 1810 void RenderWidgetHostViewAura::GetHitTestMask(gfx::Path* mask) const { | 1777 void RenderWidgetHostViewAura::GetHitTestMask(gfx::Path* mask) const { |
| 1811 } | 1778 } |
| 1812 | 1779 |
| 1813 //////////////////////////////////////////////////////////////////////////////// | 1780 //////////////////////////////////////////////////////////////////////////////// |
| 1814 // RenderWidgetHostViewAura, ui::EventHandler implementation: | 1781 // RenderWidgetHostViewAura, ui::EventHandler implementation: |
| 1815 | 1782 |
| 1816 void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { | 1783 void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { |
| 1817 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnKeyEvent"); | 1784 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnKeyEvent"); |
| 1818 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
| 1819 return; | |
| 1820 | 1785 |
| 1821 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { | 1786 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { |
| 1822 popup_child_host_view_->OnKeyEvent(event); | 1787 popup_child_host_view_->OnKeyEvent(event); |
| 1823 if (event->handled()) | 1788 if (event->handled()) |
| 1824 return; | 1789 return; |
| 1825 } | 1790 } |
| 1826 | 1791 |
| 1827 // We need to handle the Escape key for Pepper Flash. | 1792 // We need to handle the Escape key for Pepper Flash. |
| 1828 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { | 1793 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { |
| 1829 // Focus the window we were created from. | 1794 // Focus the window we were created from. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1856 // We don't have to communicate with an input method here. | 1821 // We don't have to communicate with an input method here. |
| 1857 NativeWebKeyboardEvent webkit_event(*event); | 1822 NativeWebKeyboardEvent webkit_event(*event); |
| 1858 ForwardKeyboardEvent(webkit_event); | 1823 ForwardKeyboardEvent(webkit_event); |
| 1859 } | 1824 } |
| 1860 event->SetHandled(); | 1825 event->SetHandled(); |
| 1861 } | 1826 } |
| 1862 | 1827 |
| 1863 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { | 1828 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { |
| 1864 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnMouseEvent"); | 1829 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnMouseEvent"); |
| 1865 | 1830 |
| 1866 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
| 1867 return; | |
| 1868 | |
| 1869 if (mouse_locked_) { | 1831 if (mouse_locked_) { |
| 1870 aura::client::CursorClient* cursor_client = | 1832 aura::client::CursorClient* cursor_client = |
| 1871 aura::client::GetCursorClient(window_->GetRootWindow()); | 1833 aura::client::GetCursorClient(window_->GetRootWindow()); |
| 1872 DCHECK(!cursor_client || !cursor_client->IsCursorVisible()); | 1834 DCHECK(!cursor_client || !cursor_client->IsCursorVisible()); |
| 1873 | 1835 |
| 1874 if (event->type() == ui::ET_MOUSEWHEEL) { | 1836 if (event->type() == ui::ET_MOUSEWHEEL) { |
| 1875 blink::WebMouseWheelEvent mouse_wheel_event = | 1837 blink::WebMouseWheelEvent mouse_wheel_event = |
| 1876 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); | 1838 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); |
| 1877 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) | 1839 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) |
| 1878 host_->ForwardWheelEvent(mouse_wheel_event); | 1840 host_->ForwardWheelEvent(mouse_wheel_event); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1997 event->ConvertLocationToTarget(window_, window_->parent()); | 1959 event->ConvertLocationToTarget(window_, window_->parent()); |
| 1998 window_->parent()->delegate()->OnMouseEvent(event); | 1960 window_->parent()->delegate()->OnMouseEvent(event); |
| 1999 } | 1961 } |
| 2000 | 1962 |
| 2001 if (!IsXButtonUpEvent(event)) | 1963 if (!IsXButtonUpEvent(event)) |
| 2002 event->SetHandled(); | 1964 event->SetHandled(); |
| 2003 } | 1965 } |
| 2004 | 1966 |
| 2005 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { | 1967 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { |
| 2006 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); | 1968 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); |
| 2007 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
| 2008 return; | |
| 2009 | 1969 |
| 2010 if (event->type() == ui::ET_SCROLL) { | 1970 if (event->type() == ui::ET_SCROLL) { |
| 2011 #if !defined(OS_WIN) | 1971 #if !defined(OS_WIN) |
| 2012 // TODO(ananta) | 1972 // TODO(ananta) |
| 2013 // Investigate if this is true for Windows 8 Metro ASH as well. | 1973 // Investigate if this is true for Windows 8 Metro ASH as well. |
| 2014 if (event->finger_count() != 2) | 1974 if (event->finger_count() != 2) |
| 2015 return; | 1975 return; |
| 2016 #endif | 1976 #endif |
| 2017 blink::WebGestureEvent gesture_event = | 1977 blink::WebGestureEvent gesture_event = |
| 2018 MakeWebGestureEventFlingCancel(); | 1978 MakeWebGestureEventFlingCancel(); |
| 2019 host_->ForwardGestureEvent(gesture_event); | 1979 host_->ForwardGestureEvent(gesture_event); |
| 2020 blink::WebMouseWheelEvent mouse_wheel_event = | 1980 blink::WebMouseWheelEvent mouse_wheel_event = |
| 2021 MakeWebMouseWheelEvent(*event); | 1981 MakeWebMouseWheelEvent(*event); |
| 2022 host_->ForwardWheelEvent(mouse_wheel_event); | 1982 host_->ForwardWheelEvent(mouse_wheel_event); |
| 2023 RecordAction(base::UserMetricsAction("TrackpadScroll")); | 1983 RecordAction(base::UserMetricsAction("TrackpadScroll")); |
| 2024 } else if (event->type() == ui::ET_SCROLL_FLING_START || | 1984 } else if (event->type() == ui::ET_SCROLL_FLING_START || |
| 2025 event->type() == ui::ET_SCROLL_FLING_CANCEL) { | 1985 event->type() == ui::ET_SCROLL_FLING_CANCEL) { |
| 2026 blink::WebGestureEvent gesture_event = MakeWebGestureEvent(*event); | 1986 blink::WebGestureEvent gesture_event = MakeWebGestureEvent(*event); |
| 2027 host_->ForwardGestureEvent(gesture_event); | 1987 host_->ForwardGestureEvent(gesture_event); |
| 2028 if (event->type() == ui::ET_SCROLL_FLING_START) | 1988 if (event->type() == ui::ET_SCROLL_FLING_START) |
| 2029 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); | 1989 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); |
| 2030 } | 1990 } |
| 2031 | 1991 |
| 2032 event->SetHandled(); | 1992 event->SetHandled(); |
| 2033 } | 1993 } |
| 2034 | 1994 |
| 2035 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { | 1995 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { |
| 2036 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent"); | 1996 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent"); |
| 2037 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | 1997 |
| 2038 return; | 1998 if (selection_controller_) { |
| 1999 selection_controller_->HandleTouchEvent(event); |
| 2000 if (event->handled()) |
| 2001 return; |
| 2002 } |
| 2039 | 2003 |
| 2040 // Update the touch event first. | 2004 // Update the touch event first. |
| 2041 if (!pointer_state_.OnTouch(*event)) { | 2005 if (!pointer_state_.OnTouch(*event)) { |
| 2042 event->StopPropagation(); | 2006 event->StopPropagation(); |
| 2043 return; | 2007 return; |
| 2044 } | 2008 } |
| 2045 | 2009 |
| 2046 blink::WebTouchEvent touch_event = CreateWebTouchEventFromMotionEvent( | 2010 blink::WebTouchEvent touch_event = CreateWebTouchEventFromMotionEvent( |
| 2047 pointer_state_, event->may_cause_scrolling()); | 2011 pointer_state_, event->may_cause_scrolling()); |
| 2048 pointer_state_.CleanupRemovedTouchPoints(*event); | 2012 pointer_state_.CleanupRemovedTouchPoints(*event); |
| 2049 | 2013 |
| 2050 // Forward the touch event only if a touch point was updated, and | 2014 // Forward the touch event only if a touch point was updated, and |
| 2051 // there's a touch-event handler in the page, and no other | 2015 // there's a touch-event handler in the page, and no other |
| 2052 // touch-event is in the queue. It is important to always mark | 2016 // touch-event is in the queue. It is important to always mark |
| 2053 // events as being handled asynchronously if there is a touch-event | 2017 // events as being handled asynchronously if there is a touch-event |
| 2054 // handler in the page, or some touch-event is already in the queue, | 2018 // handler in the page, or some touch-event is already in the queue, |
| 2055 // even if no point has been updated. This ensures that this event | 2019 // even if no point has been updated. This ensures that this event |
| 2056 // does not get processed by the gesture recognizer before events | 2020 // does not get processed by the gesture recognizer before events |
| 2057 // currently awaiting dispatch in the touch queue. | 2021 // currently awaiting dispatch in the touch queue. |
| 2058 if (host_->ShouldForwardTouchEvent()) { | 2022 if (host_->ShouldForwardTouchEvent()) { |
| 2059 event->DisableSynchronousHandling(); | 2023 event->DisableSynchronousHandling(); |
| 2060 host_->ForwardTouchEventWithLatencyInfo(touch_event, *event->latency()); | 2024 host_->ForwardTouchEventWithLatencyInfo(touch_event, *event->latency()); |
| 2061 } | 2025 } |
| 2062 } | 2026 } |
| 2063 | 2027 |
| 2064 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { | 2028 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { |
| 2065 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); | 2029 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); |
| 2030 |
| 2031 if (selection_controller_) { |
| 2032 selection_controller_->HandleGestureEvent(event); |
| 2033 if (event->handled()) |
| 2034 return; |
| 2035 } |
| 2036 |
| 2066 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || | 2037 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || |
| 2067 event->type() == ui::ET_GESTURE_PINCH_UPDATE || | 2038 event->type() == ui::ET_GESTURE_PINCH_UPDATE || |
| 2068 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { | 2039 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { |
| 2069 event->SetHandled(); | 2040 event->SetHandled(); |
| 2070 return; | 2041 return; |
| 2071 } | 2042 } |
| 2072 | 2043 |
| 2073 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
| 2074 return; | |
| 2075 | |
| 2076 // Confirm existing composition text on TAP gesture, to make sure the input | 2044 // Confirm existing composition text on TAP gesture, to make sure the input |
| 2077 // caret won't be moved with an ongoing composition text. | 2045 // caret won't be moved with an ongoing composition text. |
| 2078 if (event->type() == ui::ET_GESTURE_TAP) | 2046 if (event->type() == ui::ET_GESTURE_TAP) |
| 2079 FinishImeCompositionSession(); | 2047 FinishImeCompositionSession(); |
| 2080 | 2048 |
| 2081 RenderViewHostDelegate* delegate = NULL; | 2049 RenderViewHostDelegate* delegate = NULL; |
| 2082 if (host_->IsRenderView()) | 2050 if (host_->IsRenderView()) |
| 2083 delegate = RenderViewHost::From(host_)->GetDelegate(); | 2051 delegate = RenderViewHost::From(host_)->GetDelegate(); |
| 2084 | 2052 |
| 2085 if (delegate && event->type() == ui::ET_GESTURE_BEGIN && | 2053 if (delegate && event->type() == ui::ET_GESTURE_BEGIN && |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2188 host_->GetRootBrowserAccessibilityManager(); | 2156 host_->GetRootBrowserAccessibilityManager(); |
| 2189 if (manager) | 2157 if (manager) |
| 2190 manager->OnWindowFocused(); | 2158 manager->OnWindowFocused(); |
| 2191 } else if (window_ == lost_focus) { | 2159 } else if (window_ == lost_focus) { |
| 2192 host_->SetActive(false); | 2160 host_->SetActive(false); |
| 2193 host_->Blur(); | 2161 host_->Blur(); |
| 2194 | 2162 |
| 2195 DetachFromInputMethod(); | 2163 DetachFromInputMethod(); |
| 2196 host_->SetInputMethodActive(false); | 2164 host_->SetInputMethodActive(false); |
| 2197 | 2165 |
| 2198 if (touch_editing_client_) | 2166 if (selection_controller_) |
| 2199 touch_editing_client_->EndTouchEditing(false); | 2167 selection_controller_->HideAndDisallowShowingAutomatically(); |
| 2200 | 2168 |
| 2201 if (overscroll_controller_) | 2169 if (overscroll_controller_) |
| 2202 overscroll_controller_->Cancel(); | 2170 overscroll_controller_->Cancel(); |
| 2203 | 2171 |
| 2204 BrowserAccessibilityManager* manager = | 2172 BrowserAccessibilityManager* manager = |
| 2205 host_->GetRootBrowserAccessibilityManager(); | 2173 host_->GetRootBrowserAccessibilityManager(); |
| 2206 if (manager) | 2174 if (manager) |
| 2207 manager->OnWindowBlurred(); | 2175 manager->OnWindowBlurred(); |
| 2208 | 2176 |
| 2209 // If we lose the focus while fullscreen, close the window; Pepper Flash | 2177 // 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... |
| 2246 TRACE_EVENT1("ui", "RenderWidgetHostViewAura::OnHostMoved", | 2214 TRACE_EVENT1("ui", "RenderWidgetHostViewAura::OnHostMoved", |
| 2247 "new_origin", new_origin.ToString()); | 2215 "new_origin", new_origin.ToString()); |
| 2248 | 2216 |
| 2249 UpdateScreenInfo(window_); | 2217 UpdateScreenInfo(window_); |
| 2250 } | 2218 } |
| 2251 | 2219 |
| 2252 //////////////////////////////////////////////////////////////////////////////// | 2220 //////////////////////////////////////////////////////////////////////////////// |
| 2253 // RenderWidgetHostViewAura, private: | 2221 // RenderWidgetHostViewAura, private: |
| 2254 | 2222 |
| 2255 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { | 2223 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { |
| 2256 if (touch_editing_client_) | 2224 selection_controller_.reset(); |
| 2257 touch_editing_client_->OnViewDestroyed(); | 2225 selection_controller_client_.reset(); |
| 2258 | |
| 2259 delegated_frame_host_.reset(); | 2226 delegated_frame_host_.reset(); |
| 2260 window_observer_.reset(); | 2227 window_observer_.reset(); |
| 2261 if (window_->GetHost()) | 2228 if (window_->GetHost()) |
| 2262 window_->GetHost()->RemoveObserver(this); | 2229 window_->GetHost()->RemoveObserver(this); |
| 2263 UnlockMouse(); | 2230 UnlockMouse(); |
| 2264 if (popup_parent_host_view_) { | 2231 if (popup_parent_host_view_) { |
| 2265 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || | 2232 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || |
| 2266 popup_parent_host_view_->popup_child_host_view_ == this); | 2233 popup_parent_host_view_->popup_child_host_view_ == this); |
| 2267 popup_parent_host_view_->popup_child_host_view_ = NULL; | 2234 popup_parent_host_view_->popup_child_host_view_ = NULL; |
| 2268 } | 2235 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2398 host_->SendCursorVisibilityState(is_visible); | 2365 host_->SendCursorVisibilityState(is_visible); |
| 2399 } | 2366 } |
| 2400 | 2367 |
| 2401 void RenderWidgetHostViewAura::SetOverscrollControllerEnabled(bool enabled) { | 2368 void RenderWidgetHostViewAura::SetOverscrollControllerEnabled(bool enabled) { |
| 2402 if (!enabled) | 2369 if (!enabled) |
| 2403 overscroll_controller_.reset(); | 2370 overscroll_controller_.reset(); |
| 2404 else if (!overscroll_controller_) | 2371 else if (!overscroll_controller_) |
| 2405 overscroll_controller_.reset(new OverscrollController()); | 2372 overscroll_controller_.reset(new OverscrollController()); |
| 2406 } | 2373 } |
| 2407 | 2374 |
| 2375 void RenderWidgetHostViewAura::InitSelectionController( |
| 2376 ui::TouchSelectionControllerAuraClient* selection_controller_client) { |
| 2377 DCHECK(!selection_controller_client_); |
| 2378 selection_controller_client_.reset(selection_controller_client); |
| 2379 selection_controller_.reset( |
| 2380 new ui::TouchSelectionControllerAura(selection_controller_client)); |
| 2381 } |
| 2382 |
| 2408 void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() { | 2383 void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() { |
| 2409 // The top left corner of our view in window coordinates might not land on a | 2384 // The top left corner of our view in window coordinates might not land on a |
| 2410 // device pixel boundary if we have a non-integer device scale. In that case, | 2385 // device pixel boundary if we have a non-integer device scale. In that case, |
| 2411 // to avoid the web contents area looking blurry we translate the web contents | 2386 // to avoid the web contents area looking blurry we translate the web contents |
| 2412 // in the +x, +y direction to land on the nearest pixel boundary. This may | 2387 // in the +x, +y direction to land on the nearest pixel boundary. This may |
| 2413 // cause the bottom and right edges to be clipped slightly, but that's ok. | 2388 // cause the bottom and right edges to be clipped slightly, but that's ok. |
| 2414 aura::Window* snapped = NULL; | 2389 aura::Window* snapped = NULL; |
| 2415 // On desktop, use the root window. On alternative environment (ash), | 2390 // On desktop, use the root window. On alternative environment (ash), |
| 2416 // use the toplevel window which must be already snapped. | 2391 // use the toplevel window which must be already snapped. |
| 2417 if (gfx::Screen::GetScreenFor(window_) != | 2392 if (gfx::Screen::GetScreenFor(window_) != |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2430 if (HasDisplayPropertyChanged(window_)) | 2405 if (HasDisplayPropertyChanged(window_)) |
| 2431 host_->InvalidateScreenInfo(); | 2406 host_->InvalidateScreenInfo(); |
| 2432 | 2407 |
| 2433 SnapToPhysicalPixelBoundary(); | 2408 SnapToPhysicalPixelBoundary(); |
| 2434 // Don't recursively call SetBounds if this bounds update is the result of | 2409 // Don't recursively call SetBounds if this bounds update is the result of |
| 2435 // a Window::SetBoundsInternal call. | 2410 // a Window::SetBoundsInternal call. |
| 2436 if (!in_bounds_changed_) | 2411 if (!in_bounds_changed_) |
| 2437 window_->SetBounds(rect); | 2412 window_->SetBounds(rect); |
| 2438 host_->WasResized(); | 2413 host_->WasResized(); |
| 2439 delegated_frame_host_->WasResized(); | 2414 delegated_frame_host_->WasResized(); |
| 2440 if (touch_editing_client_) { | |
| 2441 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_, | |
| 2442 selection_focus_); | |
| 2443 } | |
| 2444 #if defined(OS_WIN) | 2415 #if defined(OS_WIN) |
| 2445 // Create the legacy dummy window which corresponds to the bounds of the | 2416 // Create the legacy dummy window which corresponds to the bounds of the |
| 2446 // webcontents. This will be passed as the container window for windowless | 2417 // webcontents. This will be passed as the container window for windowless |
| 2447 // plugins. | 2418 // plugins. |
| 2448 // Plugins like Flash assume the container window which is returned via the | 2419 // Plugins like Flash assume the container window which is returned via the |
| 2449 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. | 2420 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. |
| 2450 // This is not true in Aura where we have only HWND which is the main Aura | 2421 // This is not true in Aura where we have only HWND which is the main Aura |
| 2451 // window. If we return this window to plugins like Flash then it causes the | 2422 // window. If we return this window to plugins like Flash then it causes the |
| 2452 // coordinate translations done by these plugins to break. | 2423 // coordinate translations done by these plugins to break. |
| 2453 // Additonally the legacy dummy window is needed for accessibility and for | 2424 // Additonally the legacy dummy window is needed for accessibility and for |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2577 } | 2548 } |
| 2578 #endif | 2549 #endif |
| 2579 | 2550 |
| 2580 host_->ForwardKeyboardEvent(event); | 2551 host_->ForwardKeyboardEvent(event); |
| 2581 } | 2552 } |
| 2582 | 2553 |
| 2583 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { | 2554 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { |
| 2584 return kN32_SkColorType; | 2555 return kN32_SkColorType; |
| 2585 } | 2556 } |
| 2586 | 2557 |
| 2558 void RenderWidgetHostViewAura::SelectionBoundsUpdated( |
| 2559 const ui::SelectionBound& start, |
| 2560 const ui::SelectionBound& end) { |
| 2561 if (selection_start_ == start && selection_end_ == end) |
| 2562 return; |
| 2563 |
| 2564 selection_start_ = start; |
| 2565 selection_end_ = end; |
| 2566 |
| 2567 if (GetInputMethod()) |
| 2568 GetInputMethod()->OnCaretBoundsChanged(this); |
| 2569 |
| 2570 if (selection_controller_) |
| 2571 selection_controller_->OnSelectionBoundsUpdated(start, end); |
| 2572 } |
| 2573 |
| 2587 //////////////////////////////////////////////////////////////////////////////// | 2574 //////////////////////////////////////////////////////////////////////////////// |
| 2588 // DelegatedFrameHost, public: | 2575 // DelegatedFrameHost, public: |
| 2589 | 2576 |
| 2590 ui::Layer* RenderWidgetHostViewAura::DelegatedFrameHostGetLayer() const { | 2577 ui::Layer* RenderWidgetHostViewAura::DelegatedFrameHostGetLayer() const { |
| 2591 return window_->layer(); | 2578 return window_->layer(); |
| 2592 } | 2579 } |
| 2593 | 2580 |
| 2594 bool RenderWidgetHostViewAura::DelegatedFrameHostIsVisible() const { | 2581 bool RenderWidgetHostViewAura::DelegatedFrameHostIsVisible() const { |
| 2595 return !host_->is_hidden(); | 2582 return !host_->is_hidden(); |
| 2596 } | 2583 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2659 | 2646 |
| 2660 //////////////////////////////////////////////////////////////////////////////// | 2647 //////////////////////////////////////////////////////////////////////////////// |
| 2661 // RenderWidgetHostViewBase, public: | 2648 // RenderWidgetHostViewBase, public: |
| 2662 | 2649 |
| 2663 // static | 2650 // static |
| 2664 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2651 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2665 GetScreenInfoForWindow(results, NULL); | 2652 GetScreenInfoForWindow(results, NULL); |
| 2666 } | 2653 } |
| 2667 | 2654 |
| 2668 } // namespace content | 2655 } // namespace content |
| OLD | NEW |