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/overscroll_controller.h" | 30 #include "content/browser/renderer_host/overscroll_controller.h" |
31 #include "content/browser/renderer_host/render_view_host_delegate.h" | 31 #include "content/browser/renderer_host/render_view_host_delegate.h" |
32 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 32 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
33 #include "content/browser/renderer_host/render_view_host_impl.h" | 33 #include "content/browser/renderer_host/render_view_host_impl.h" |
34 #include "content/browser/renderer_host/render_widget_host_impl.h" | 34 #include "content/browser/renderer_host/render_widget_host_impl.h" |
35 #include "content/browser/renderer_host/ui_events_helper.h" | 35 #include "content/browser/renderer_host/ui_events_helper.h" |
36 #include "content/browser/renderer_host/web_input_event_aura.h" | 36 #include "content/browser/renderer_host/web_input_event_aura.h" |
37 #include "content/browser/web_contents/web_contents_impl.h" | |
37 #include "content/common/gpu/client/gl_helper.h" | 38 #include "content/common/gpu/client/gl_helper.h" |
38 #include "content/common/gpu/gpu_messages.h" | 39 #include "content/common/gpu/gpu_messages.h" |
39 #include "content/common/view_messages.h" | 40 #include "content/common/view_messages.h" |
40 #include "content/public/browser/content_browser_client.h" | 41 #include "content/public/browser/content_browser_client.h" |
41 #include "content/public/browser/overscroll_configuration.h" | 42 #include "content/public/browser/overscroll_configuration.h" |
42 #include "content/public/browser/render_view_host.h" | 43 #include "content/public/browser/render_view_host.h" |
43 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 44 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
44 #include "content/public/browser/user_metrics.h" | 45 #include "content/public/browser/user_metrics.h" |
46 #include "content/public/browser/web_contents.h" | |
45 #include "content/public/common/content_switches.h" | 47 #include "content/public/common/content_switches.h" |
46 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | 48 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
47 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 49 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
48 #include "third_party/WebKit/public/web/WebInputEvent.h" | 50 #include "third_party/WebKit/public/web/WebInputEvent.h" |
49 #include "ui/aura/client/aura_constants.h" | 51 #include "ui/aura/client/aura_constants.h" |
50 #include "ui/aura/client/cursor_client.h" | 52 #include "ui/aura/client/cursor_client.h" |
51 #include "ui/aura/client/cursor_client_observer.h" | 53 #include "ui/aura/client/cursor_client_observer.h" |
52 #include "ui/aura/client/focus_client.h" | 54 #include "ui/aura/client/focus_client.h" |
53 #include "ui/aura/client/screen_position_client.h" | 55 #include "ui/aura/client/screen_position_client.h" |
54 #include "ui/aura/client/window_tree_client.h" | 56 #include "ui/aura/client/window_tree_client.h" |
(...skipping 11 matching lines...) Expand all Loading... | |
66 #include "ui/compositor/dip_util.h" | 68 #include "ui/compositor/dip_util.h" |
67 #include "ui/events/event.h" | 69 #include "ui/events/event.h" |
68 #include "ui/events/event_utils.h" | 70 #include "ui/events/event_utils.h" |
69 #include "ui/events/gestures/gesture_recognizer.h" | 71 #include "ui/events/gestures/gesture_recognizer.h" |
70 #include "ui/gfx/canvas.h" | 72 #include "ui/gfx/canvas.h" |
71 #include "ui/gfx/display.h" | 73 #include "ui/gfx/display.h" |
72 #include "ui/gfx/rect_conversions.h" | 74 #include "ui/gfx/rect_conversions.h" |
73 #include "ui/gfx/screen.h" | 75 #include "ui/gfx/screen.h" |
74 #include "ui/gfx/size_conversions.h" | 76 #include "ui/gfx/size_conversions.h" |
75 #include "ui/gfx/skia_util.h" | 77 #include "ui/gfx/skia_util.h" |
78 #include "ui/strings/grit/ui_strings.h" | |
76 #include "ui/wm/public/activation_client.h" | 79 #include "ui/wm/public/activation_client.h" |
77 #include "ui/wm/public/scoped_tooltip_disabler.h" | 80 #include "ui/wm/public/scoped_tooltip_disabler.h" |
78 #include "ui/wm/public/tooltip_client.h" | 81 #include "ui/wm/public/tooltip_client.h" |
79 #include "ui/wm/public/transient_window_client.h" | 82 #include "ui/wm/public/transient_window_client.h" |
80 #include "ui/wm/public/window_types.h" | 83 #include "ui/wm/public/window_types.h" |
81 | 84 |
82 #if defined(OS_WIN) | 85 #if defined(OS_WIN) |
83 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 86 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
84 #include "content/browser/accessibility/browser_accessibility_win.h" | 87 #include "content/browser/accessibility/browser_accessibility_win.h" |
85 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" | 88 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
443 has_composition_text_(false), | 446 has_composition_text_(false), |
444 accept_return_character_(false), | 447 accept_return_character_(false), |
445 last_swapped_software_frame_scale_factor_(1.f), | 448 last_swapped_software_frame_scale_factor_(1.f), |
446 paint_canvas_(NULL), | 449 paint_canvas_(NULL), |
447 synthetic_move_sent_(false), | 450 synthetic_move_sent_(false), |
448 cursor_visibility_state_in_renderer_(UNKNOWN), | 451 cursor_visibility_state_in_renderer_(UNKNOWN), |
449 #if defined(OS_WIN) | 452 #if defined(OS_WIN) |
450 legacy_render_widget_host_HWND_(NULL), | 453 legacy_render_widget_host_HWND_(NULL), |
451 #endif | 454 #endif |
452 has_snapped_to_boundary_(false), | 455 has_snapped_to_boundary_(false), |
453 touch_editing_client_(NULL), | 456 selection_controller_(new TouchSelectionControllerAura(this)), |
454 is_guest_view_hack_(is_guest_view_hack), | 457 is_guest_view_hack_(is_guest_view_hack), |
455 weak_ptr_factory_(this) { | 458 weak_ptr_factory_(this) { |
456 if (!is_guest_view_hack_) | 459 if (!is_guest_view_hack_) |
457 host_->SetView(this); | 460 host_->SetView(this); |
458 | 461 |
459 window_observer_.reset(new WindowObserver(this)); | 462 window_observer_.reset(new WindowObserver(this)); |
460 aura::client::SetTooltipText(window_, &tooltip_); | 463 aura::client::SetTooltipText(window_, &tooltip_); |
461 aura::client::SetActivationDelegate(window_, this); | 464 aura::client::SetActivationDelegate(window_, this); |
462 aura::client::SetActivationChangeObserver(window_, this); | 465 aura::client::SetActivationChangeObserver(window_, this); |
463 aura::client::SetFocusChangeObserver(window_, this); | 466 aura::client::SetFocusChangeObserver(window_, this); |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
763 // Make sure we have a FocusClient before attempting to Focus(). In some | 766 // Make sure we have a FocusClient before attempting to Focus(). In some |
764 // situations we may not yet be in a valid Window hierarchy (such as reloading | 767 // situations we may not yet be in a valid Window hierarchy (such as reloading |
765 // after out of memory discarded the tab). | 768 // after out of memory discarded the tab). |
766 aura::client::FocusClient* client = aura::client::GetFocusClient(window_); | 769 aura::client::FocusClient* client = aura::client::GetFocusClient(window_); |
767 if (client) | 770 if (client) |
768 window_->Focus(); | 771 window_->Focus(); |
769 } | 772 } |
770 | 773 |
771 void RenderWidgetHostViewAura::Blur() { | 774 void RenderWidgetHostViewAura::Blur() { |
772 window_->Blur(); | 775 window_->Blur(); |
776 selection_controller_->HideAndDisallowShowingAutomatically(); | |
773 } | 777 } |
774 | 778 |
775 bool RenderWidgetHostViewAura::HasFocus() const { | 779 bool RenderWidgetHostViewAura::HasFocus() const { |
776 return window_->HasFocus(); | 780 return window_->HasFocus(); |
777 } | 781 } |
778 | 782 |
779 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { | 783 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { |
780 return delegated_frame_host_->CanCopyToBitmap(); | 784 return delegated_frame_host_->CanCopyToBitmap(); |
781 } | 785 } |
782 | 786 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
840 if (text_input_type_ != type || | 844 if (text_input_type_ != type || |
841 text_input_mode_ != input_mode || | 845 text_input_mode_ != input_mode || |
842 can_compose_inline_ != can_compose_inline || | 846 can_compose_inline_ != can_compose_inline || |
843 text_input_flags_ != flags) { | 847 text_input_flags_ != flags) { |
844 text_input_type_ = type; | 848 text_input_type_ = type; |
845 text_input_mode_ = input_mode; | 849 text_input_mode_ = input_mode; |
846 can_compose_inline_ = can_compose_inline; | 850 can_compose_inline_ = can_compose_inline; |
847 text_input_flags_ = flags; | 851 text_input_flags_ = flags; |
848 if (GetInputMethod()) | 852 if (GetInputMethod()) |
849 GetInputMethod()->OnTextInputTypeChanged(this); | 853 GetInputMethod()->OnTextInputTypeChanged(this); |
850 if (touch_editing_client_) | 854 const bool is_editable_node = type != ui::TEXT_INPUT_TYPE_NONE; |
851 touch_editing_client_->OnTextInputTypeChanged(text_input_type_); | 855 selection_controller_->OnSelectionEditable(is_editable_node); |
852 } | 856 } |
853 } | 857 } |
854 | 858 |
855 void RenderWidgetHostViewAura::OnTextInputStateChanged( | 859 void RenderWidgetHostViewAura::OnTextInputStateChanged( |
856 const ViewHostMsg_TextInputState_Params& params) { | 860 const ViewHostMsg_TextInputState_Params& params) { |
857 text_input_flags_ = params.flags; | 861 text_input_flags_ = params.flags; |
858 if (params.show_ime_if_needed && params.type != ui::TEXT_INPUT_TYPE_NONE) { | 862 if (params.show_ime_if_needed && params.type != ui::TEXT_INPUT_TYPE_NONE) { |
859 if (GetInputMethod()) | 863 if (GetInputMethod()) |
860 GetInputMethod()->ShowImeIfNeeded(); | 864 GetInputMethod()->ShowImeIfNeeded(); |
861 } | 865 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
898 // Content tooltips should be visible indefinitely. | 902 // Content tooltips should be visible indefinitely. |
899 tooltip_client->SetTooltipShownTimeout(window_, 0); | 903 tooltip_client->SetTooltipShownTimeout(window_, 0); |
900 } | 904 } |
901 } | 905 } |
902 | 906 |
903 void RenderWidgetHostViewAura::SelectionChanged(const base::string16& text, | 907 void RenderWidgetHostViewAura::SelectionChanged(const base::string16& text, |
904 size_t offset, | 908 size_t offset, |
905 const gfx::Range& range) { | 909 const gfx::Range& range) { |
906 RenderWidgetHostViewBase::SelectionChanged(text, offset, range); | 910 RenderWidgetHostViewBase::SelectionChanged(text, offset, range); |
907 | 911 |
912 selection_controller_->OnSelectionEmpty(text.empty()); | |
913 | |
908 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 914 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
909 if (text.empty() || range.is_empty()) | 915 if (text.empty() || range.is_empty()) |
910 return; | 916 return; |
911 size_t pos = range.GetMin() - offset; | 917 size_t pos = range.GetMin() - offset; |
912 size_t n = range.length(); | 918 size_t n = range.length(); |
913 | 919 |
914 DCHECK(pos + n <= text.length()) << "The text can not fully cover range."; | 920 DCHECK(pos + n <= text.length()) << "The text can not fully cover range."; |
915 if (pos >= text.length()) { | 921 if (pos >= text.length()) { |
916 NOTREACHED() << "The text can not cover range."; | 922 NOTREACHED() << "The text can not cover range."; |
917 return; | 923 return; |
918 } | 924 } |
919 | 925 |
920 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 926 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
921 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); | 927 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
922 clipboard_writer.WriteText(text.substr(pos, n)); | 928 clipboard_writer.WriteText(text.substr(pos, n)); |
923 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 929 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
924 } | 930 } |
925 | 931 |
926 gfx::Size RenderWidgetHostViewAura::GetRequestedRendererSize() const { | 932 gfx::Size RenderWidgetHostViewAura::GetRequestedRendererSize() const { |
927 return delegated_frame_host_->GetRequestedRendererSize(); | 933 return delegated_frame_host_->GetRequestedRendererSize(); |
928 } | 934 } |
929 | 935 |
930 void RenderWidgetHostViewAura::SelectionBoundsChanged( | 936 void RenderWidgetHostViewAura::SelectionBoundsChanged( |
931 const ViewHostMsg_SelectionBounds_Params& params) { | 937 const ViewHostMsg_SelectionBounds_Params& params) { |
932 if (selection_anchor_rect_ == params.anchor_rect && | 938 NOTREACHED() << "Selection bounds should be routed through the compositor."; |
jdduke (slow)
2014/11/06 16:17:45
Yay! I'm still curious how the frame metadata will
| |
933 selection_focus_rect_ == params.focus_rect) | |
934 return; | |
935 | |
936 selection_anchor_rect_ = params.anchor_rect; | |
937 selection_focus_rect_ = params.focus_rect; | |
938 | |
939 if (GetInputMethod()) | |
940 GetInputMethod()->OnCaretBoundsChanged(this); | |
941 | |
942 if (touch_editing_client_) { | |
943 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, | |
944 selection_focus_rect_); | |
945 } | |
946 } | 939 } |
947 | 940 |
948 void RenderWidgetHostViewAura::CopyFromCompositingSurface( | 941 void RenderWidgetHostViewAura::CopyFromCompositingSurface( |
949 const gfx::Rect& src_subrect, | 942 const gfx::Rect& src_subrect, |
950 const gfx::Size& dst_size, | 943 const gfx::Size& dst_size, |
951 CopyFromCompositingSurfaceCallback& callback, | 944 CopyFromCompositingSurfaceCallback& callback, |
952 const SkColorType color_type) { | 945 const SkColorType color_type) { |
953 delegated_frame_host_->CopyFromCompositingSurface( | 946 delegated_frame_host_->CopyFromCompositingSurface( |
954 src_subrect, dst_size, callback, color_type); | 947 src_subrect, dst_size, callback, color_type); |
955 } | 948 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1019 scoped_ptr<cc::CompositorFrame> frame) { | 1012 scoped_ptr<cc::CompositorFrame> frame) { |
1020 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); | 1013 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); |
1021 | 1014 |
1022 last_scroll_offset_ = frame->metadata.root_scroll_offset; | 1015 last_scroll_offset_ = frame->metadata.root_scroll_offset; |
1023 if (frame->delegated_frame_data) { | 1016 if (frame->delegated_frame_data) { |
1024 delegated_frame_host_->SwapDelegatedFrame( | 1017 delegated_frame_host_->SwapDelegatedFrame( |
1025 output_surface_id, | 1018 output_surface_id, |
1026 frame->delegated_frame_data.Pass(), | 1019 frame->delegated_frame_data.Pass(), |
1027 frame->metadata.device_scale_factor, | 1020 frame->metadata.device_scale_factor, |
1028 frame->metadata.latency_info); | 1021 frame->metadata.latency_info); |
1022 SelectionBoundsUpdated(frame->metadata.selection_start, | |
1023 frame->metadata.selection_end); | |
1029 return; | 1024 return; |
1030 } | 1025 } |
1031 | 1026 |
1032 if (frame->software_frame_data) { | 1027 if (frame->software_frame_data) { |
1033 DLOG(ERROR) << "Unable to use software frame in aura"; | 1028 DLOG(ERROR) << "Unable to use software frame in aura"; |
1034 RecordAction( | 1029 RecordAction( |
1035 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura")); | 1030 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura")); |
1036 host_->GetProcess()->ReceivedBadMessage(); | 1031 host_->GetProcess()->ReceivedBadMessage(); |
1037 return; | 1032 return; |
1038 } | 1033 } |
1039 } | 1034 } |
1040 | 1035 |
1041 void RenderWidgetHostViewAura::DidStopFlinging() { | 1036 void RenderWidgetHostViewAura::DidStopFlinging() { |
1042 if (touch_editing_client_) | 1037 selection_controller_->OnFlingCompleted(); |
1043 touch_editing_client_->DidStopFlinging(); | |
1044 } | 1038 } |
1045 | 1039 |
1046 #if defined(OS_WIN) | 1040 #if defined(OS_WIN) |
1047 void RenderWidgetHostViewAura::SetLegacyRenderWidgetHostHWND( | 1041 void RenderWidgetHostViewAura::SetLegacyRenderWidgetHostHWND( |
1048 LegacyRenderWidgetHostHWND* legacy_hwnd) { | 1042 LegacyRenderWidgetHostHWND* legacy_hwnd) { |
1049 legacy_render_widget_host_HWND_ = legacy_hwnd; | 1043 legacy_render_widget_host_HWND_ = legacy_hwnd; |
1050 } | 1044 } |
1051 | 1045 |
1052 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( | 1046 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( |
1053 gfx::NativeViewAccessible accessible_parent) { | 1047 gfx::NativeViewAccessible accessible_parent) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1119 InputEventAckState ack_result) { | 1113 InputEventAckState ack_result) { |
1120 if (overscroll_controller_) { | 1114 if (overscroll_controller_) { |
1121 overscroll_controller_->ReceivedEventACK( | 1115 overscroll_controller_->ReceivedEventACK( |
1122 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); | 1116 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); |
1123 } | 1117 } |
1124 } | 1118 } |
1125 | 1119 |
1126 void RenderWidgetHostViewAura::GestureEventAck( | 1120 void RenderWidgetHostViewAura::GestureEventAck( |
1127 const blink::WebGestureEvent& event, | 1121 const blink::WebGestureEvent& event, |
1128 InputEventAckState ack_result) { | 1122 InputEventAckState ack_result) { |
1129 if (touch_editing_client_) | |
1130 touch_editing_client_->GestureEventAck(event.type); | |
1131 | |
1132 if (overscroll_controller_) { | 1123 if (overscroll_controller_) { |
1133 overscroll_controller_->ReceivedEventACK( | 1124 overscroll_controller_->ReceivedEventACK( |
1134 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); | 1125 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); |
1135 } | 1126 } |
1136 } | 1127 } |
1137 | 1128 |
1138 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( | 1129 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( |
1139 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { | 1130 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { |
1140 ScopedVector<ui::TouchEvent> events; | 1131 ScopedVector<ui::TouchEvent> events; |
1141 if (!MakeUITouchEventsFromWebTouchEvents(touch, &events, | 1132 if (!MakeUITouchEventsFromWebTouchEvents(touch, &events, |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1486 return gfx::Rect(origin.x(), | 1477 return gfx::Rect(origin.x(), |
1487 origin.y(), | 1478 origin.y(), |
1488 end.x() - origin.x(), | 1479 end.x() - origin.x(), |
1489 end.y() - origin.y()); | 1480 end.y() - origin.y()); |
1490 } | 1481 } |
1491 | 1482 |
1492 return rect; | 1483 return rect; |
1493 } | 1484 } |
1494 | 1485 |
1495 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const { | 1486 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const { |
1496 const gfx::Rect rect = | 1487 return ConvertRectToScreen(selection_controller_->GetCaretBounds()); |
1497 gfx::UnionRects(selection_anchor_rect_, selection_focus_rect_); | |
1498 return ConvertRectToScreen(rect); | |
1499 } | 1488 } |
1500 | 1489 |
1501 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds( | 1490 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds( |
1502 uint32 index, | 1491 uint32 index, |
1503 gfx::Rect* rect) const { | 1492 gfx::Rect* rect) const { |
1504 DCHECK(rect); | 1493 DCHECK(rect); |
1505 if (index >= composition_character_bounds_.size()) | 1494 if (index >= composition_character_bounds_.size()) |
1506 return false; | 1495 return false; |
1507 *rect = ConvertRectToScreen(composition_character_bounds_[index]); | 1496 *rect = ConvertRectToScreen(composition_character_bounds_[index]); |
1508 return true; | 1497 return true; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1687 const gfx::Point& location) { | 1676 const gfx::Point& location) { |
1688 return true; | 1677 return true; |
1689 } | 1678 } |
1690 | 1679 |
1691 bool RenderWidgetHostViewAura::CanFocus() { | 1680 bool RenderWidgetHostViewAura::CanFocus() { |
1692 return popup_type_ == blink::WebPopupTypeNone; | 1681 return popup_type_ == blink::WebPopupTypeNone; |
1693 } | 1682 } |
1694 | 1683 |
1695 void RenderWidgetHostViewAura::OnCaptureLost() { | 1684 void RenderWidgetHostViewAura::OnCaptureLost() { |
1696 host_->LostCapture(); | 1685 host_->LostCapture(); |
1697 if (touch_editing_client_) | 1686 selection_controller_->HideAndDisallowShowingAutomatically(); |
1698 touch_editing_client_->EndTouchEditing(false); | |
1699 } | 1687 } |
1700 | 1688 |
1701 void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { | 1689 void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { |
1702 NOTREACHED(); | 1690 NOTREACHED(); |
1703 } | 1691 } |
1704 | 1692 |
1705 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( | 1693 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( |
1706 float device_scale_factor) { | 1694 float device_scale_factor) { |
1707 if (!host_ || !window_->GetRootWindow()) | 1695 if (!host_ || !window_->GetRootWindow()) |
1708 return; | 1696 return; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1758 } | 1746 } |
1759 | 1747 |
1760 void RenderWidgetHostViewAura::GetHitTestMask(gfx::Path* mask) const { | 1748 void RenderWidgetHostViewAura::GetHitTestMask(gfx::Path* mask) const { |
1761 } | 1749 } |
1762 | 1750 |
1763 //////////////////////////////////////////////////////////////////////////////// | 1751 //////////////////////////////////////////////////////////////////////////////// |
1764 // RenderWidgetHostViewAura, ui::EventHandler implementation: | 1752 // RenderWidgetHostViewAura, ui::EventHandler implementation: |
1765 | 1753 |
1766 void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { | 1754 void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { |
1767 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnKeyEvent"); | 1755 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnKeyEvent"); |
1768 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
1769 return; | |
1770 | 1756 |
1771 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { | 1757 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { |
1772 popup_child_host_view_->OnKeyEvent(event); | 1758 popup_child_host_view_->OnKeyEvent(event); |
1773 if (event->handled()) | 1759 if (event->handled()) |
1774 return; | 1760 return; |
1775 } | 1761 } |
1776 | 1762 |
1777 // We need to handle the Escape key for Pepper Flash. | 1763 // We need to handle the Escape key for Pepper Flash. |
1778 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { | 1764 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { |
1779 // Focus the window we were created from. | 1765 // Focus the window we were created from. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1816 NativeWebKeyboardEvent webkit_event(event); | 1802 NativeWebKeyboardEvent webkit_event(event); |
1817 ForwardKeyboardEvent(webkit_event); | 1803 ForwardKeyboardEvent(webkit_event); |
1818 } | 1804 } |
1819 } | 1805 } |
1820 event->SetHandled(); | 1806 event->SetHandled(); |
1821 } | 1807 } |
1822 | 1808 |
1823 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { | 1809 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { |
1824 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnMouseEvent"); | 1810 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnMouseEvent"); |
1825 | 1811 |
1826 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
1827 return; | |
1828 | |
1829 if (mouse_locked_) { | 1812 if (mouse_locked_) { |
1830 aura::client::CursorClient* cursor_client = | 1813 aura::client::CursorClient* cursor_client = |
1831 aura::client::GetCursorClient(window_->GetRootWindow()); | 1814 aura::client::GetCursorClient(window_->GetRootWindow()); |
1832 DCHECK(!cursor_client || !cursor_client->IsCursorVisible()); | 1815 DCHECK(!cursor_client || !cursor_client->IsCursorVisible()); |
1833 | 1816 |
1834 if (event->type() == ui::ET_MOUSEWHEEL) { | 1817 if (event->type() == ui::ET_MOUSEWHEEL) { |
1835 blink::WebMouseWheelEvent mouse_wheel_event = | 1818 blink::WebMouseWheelEvent mouse_wheel_event = |
1836 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent*>(event)); | 1819 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent*>(event)); |
1837 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) | 1820 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) |
1838 host_->ForwardWheelEvent(mouse_wheel_event); | 1821 host_->ForwardWheelEvent(mouse_wheel_event); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1957 event->ConvertLocationToTarget(window_, window_->parent()); | 1940 event->ConvertLocationToTarget(window_, window_->parent()); |
1958 window_->parent()->delegate()->OnMouseEvent(event); | 1941 window_->parent()->delegate()->OnMouseEvent(event); |
1959 } | 1942 } |
1960 | 1943 |
1961 if (!IsXButtonUpEvent(event)) | 1944 if (!IsXButtonUpEvent(event)) |
1962 event->SetHandled(); | 1945 event->SetHandled(); |
1963 } | 1946 } |
1964 | 1947 |
1965 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { | 1948 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { |
1966 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); | 1949 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); |
1967 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
1968 return; | |
1969 | 1950 |
1970 if (event->type() == ui::ET_SCROLL) { | 1951 if (event->type() == ui::ET_SCROLL) { |
1971 #if !defined(OS_WIN) | 1952 #if !defined(OS_WIN) |
1972 // TODO(ananta) | 1953 // TODO(ananta) |
1973 // Investigate if this is true for Windows 8 Metro ASH as well. | 1954 // Investigate if this is true for Windows 8 Metro ASH as well. |
1974 if (event->finger_count() != 2) | 1955 if (event->finger_count() != 2) |
1975 return; | 1956 return; |
1976 #endif | 1957 #endif |
1977 blink::WebGestureEvent gesture_event = | 1958 blink::WebGestureEvent gesture_event = |
1978 MakeWebGestureEventFlingCancel(); | 1959 MakeWebGestureEventFlingCancel(); |
1979 host_->ForwardGestureEvent(gesture_event); | 1960 host_->ForwardGestureEvent(gesture_event); |
1980 blink::WebMouseWheelEvent mouse_wheel_event = | 1961 blink::WebMouseWheelEvent mouse_wheel_event = |
1981 MakeWebMouseWheelEvent(event); | 1962 MakeWebMouseWheelEvent(event); |
1982 host_->ForwardWheelEvent(mouse_wheel_event); | 1963 host_->ForwardWheelEvent(mouse_wheel_event); |
1983 RecordAction(base::UserMetricsAction("TrackpadScroll")); | 1964 RecordAction(base::UserMetricsAction("TrackpadScroll")); |
1984 } else if (event->type() == ui::ET_SCROLL_FLING_START || | 1965 } else if (event->type() == ui::ET_SCROLL_FLING_START || |
1985 event->type() == ui::ET_SCROLL_FLING_CANCEL) { | 1966 event->type() == ui::ET_SCROLL_FLING_CANCEL) { |
1986 blink::WebGestureEvent gesture_event = | 1967 blink::WebGestureEvent gesture_event = |
1987 MakeWebGestureEvent(event); | 1968 MakeWebGestureEvent(event); |
1988 host_->ForwardGestureEvent(gesture_event); | 1969 host_->ForwardGestureEvent(gesture_event); |
1989 if (event->type() == ui::ET_SCROLL_FLING_START) | 1970 if (event->type() == ui::ET_SCROLL_FLING_START) |
1990 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); | 1971 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); |
1991 } | 1972 } |
1992 | 1973 |
1993 event->SetHandled(); | 1974 event->SetHandled(); |
1994 } | 1975 } |
1995 | 1976 |
1996 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { | 1977 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { |
1997 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent"); | 1978 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent"); |
1998 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | 1979 |
1980 selection_controller_->HandleTouchEvent(event); | |
1981 if (event->handled()) | |
1999 return; | 1982 return; |
2000 | 1983 |
2001 // Update the touch event first. | 1984 // Update the touch event first. |
2002 blink::WebTouchPoint* point = UpdateWebTouchEventFromUIEvent(*event, | 1985 blink::WebTouchPoint* point = UpdateWebTouchEventFromUIEvent(*event, |
2003 &touch_event_); | 1986 &touch_event_); |
2004 | 1987 |
2005 // Forward the touch event only if a touch point was updated, and there's a | 1988 // Forward the touch event only if a touch point was updated, and there's a |
2006 // touch-event handler in the page, and no other touch-event is in the queue. | 1989 // touch-event handler in the page, and no other touch-event is in the queue. |
2007 // It is important to always consume the event if there is a touch-event | 1990 // It is important to always consume the event if there is a touch-event |
2008 // handler in the page, or some touch-event is already in the queue, even if | 1991 // handler in the page, or some touch-event is already in the queue, even if |
2009 // no point has been updated, to make sure that this event does not get | 1992 // no point has been updated, to make sure that this event does not get |
2010 // processed by the gesture recognizer before the events in the queue. | 1993 // processed by the gesture recognizer before the events in the queue. |
2011 if (host_->ShouldForwardTouchEvent()) | 1994 if (host_->ShouldForwardTouchEvent()) |
2012 event->StopPropagation(); | 1995 event->StopPropagation(); |
2013 | 1996 |
2014 if (point) { | 1997 if (point) { |
2015 if (host_->ShouldForwardTouchEvent()) | 1998 if (host_->ShouldForwardTouchEvent()) |
2016 host_->ForwardTouchEventWithLatencyInfo(touch_event_, *event->latency()); | 1999 host_->ForwardTouchEventWithLatencyInfo(touch_event_, *event->latency()); |
2017 UpdateWebTouchEventAfterDispatch(&touch_event_, point); | 2000 UpdateWebTouchEventAfterDispatch(&touch_event_, point); |
2018 } | 2001 } |
2019 } | 2002 } |
2020 | 2003 |
2021 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { | 2004 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { |
2022 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); | 2005 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); |
2006 | |
2007 selection_controller_->HandleGestureEvent(event); | |
2008 if (event->handled()) | |
2009 return; | |
2010 | |
2023 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || | 2011 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || |
2024 event->type() == ui::ET_GESTURE_PINCH_UPDATE || | 2012 event->type() == ui::ET_GESTURE_PINCH_UPDATE || |
2025 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { | 2013 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { |
2026 event->SetHandled(); | 2014 event->SetHandled(); |
2027 return; | 2015 return; |
2028 } | 2016 } |
2029 | 2017 |
2030 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
2031 return; | |
2032 | |
2033 // Confirm existing composition text on TAP gesture, to make sure the input | 2018 // Confirm existing composition text on TAP gesture, to make sure the input |
2034 // caret won't be moved with an ongoing composition text. | 2019 // caret won't be moved with an ongoing composition text. |
2035 if (event->type() == ui::ET_GESTURE_TAP) | 2020 if (event->type() == ui::ET_GESTURE_TAP) |
2036 FinishImeCompositionSession(); | 2021 FinishImeCompositionSession(); |
2037 | 2022 |
2038 RenderViewHostDelegate* delegate = NULL; | 2023 RenderViewHostDelegate* delegate = NULL; |
2039 if (host_->IsRenderView()) | 2024 if (host_->IsRenderView()) |
2040 delegate = RenderViewHost::From(host_)->GetDelegate(); | 2025 delegate = RenderViewHost::From(host_)->GetDelegate(); |
2041 | 2026 |
2042 if (delegate && event->type() == ui::ET_GESTURE_BEGIN && | 2027 if (delegate && event->type() == ui::ET_GESTURE_BEGIN && |
(...skipping 27 matching lines...) Expand all Loading... | |
2070 event->details().touch_points() == 1) { | 2055 event->details().touch_points() == 1) { |
2071 delegate->HandleGestureEnd(); | 2056 delegate->HandleGestureEnd(); |
2072 } | 2057 } |
2073 | 2058 |
2074 // If a gesture is not processed by the webpage, then WebKit processes it | 2059 // If a gesture is not processed by the webpage, then WebKit processes it |
2075 // (e.g. generates synthetic mouse events). | 2060 // (e.g. generates synthetic mouse events). |
2076 event->SetHandled(); | 2061 event->SetHandled(); |
2077 } | 2062 } |
2078 | 2063 |
2079 //////////////////////////////////////////////////////////////////////////////// | 2064 //////////////////////////////////////////////////////////////////////////////// |
2065 // RenderWidgetHostViewAura, TouchSelectionControllerClientAura implementation: | |
2066 | |
2067 float RenderWidgetHostViewAura::GetDeviceScaleFactor() { | |
2068 return current_device_scale_factor_; | |
2069 } | |
2070 | |
2071 void RenderWidgetHostViewAura::MoveCaret(const gfx::PointF& position) { | |
2072 RenderWidgetHostImpl* host = | |
2073 RenderWidgetHostImpl::From(GetRenderWidgetHost()); | |
2074 host->MoveCaret(gfx::Point(position.x(), position.y())); | |
2075 } | |
2076 | |
2077 void RenderWidgetHostViewAura::SelectBetweenCoordinates( | |
2078 const gfx::PointF& start, | |
2079 const gfx::PointF& end) { | |
2080 RenderWidgetHost* host = GetRenderWidgetHost(); | |
2081 RenderViewHost* rvh = RenderViewHost::From(host); | |
2082 WebContentsImpl* wc = | |
2083 static_cast<WebContentsImpl*>(WebContents::FromRenderViewHost(rvh)); | |
2084 gfx::Point start_point(start.x(), start.y()); | |
2085 gfx::Point end_point(end.x(), end.y()); | |
2086 wc->SelectRange(start_point, end_point); | |
2087 } | |
2088 | |
2089 aura::Window* RenderWidgetHostViewAura::GetParentWindow() { | |
2090 return window_; | |
2091 } | |
2092 | |
2093 bool RenderWidgetHostViewAura::IsCommandIdEnabled(int command_id) { | |
2094 bool editable = GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; | |
2095 bool readable = GetTextInputType() != ui::TEXT_INPUT_TYPE_PASSWORD; | |
2096 gfx::Range selection_range; | |
2097 GetSelectionRange(&selection_range); | |
2098 bool has_selection = !selection_range.is_empty(); | |
2099 switch (command_id) { | |
2100 case IDS_APP_CUT: | |
2101 return editable && readable && has_selection; | |
2102 case IDS_APP_COPY: | |
2103 return readable && has_selection; | |
2104 case IDS_APP_PASTE: { | |
2105 base::string16 result; | |
2106 ui::Clipboard::GetForCurrentThread()->ReadText( | |
2107 ui::CLIPBOARD_TYPE_COPY_PASTE, &result); | |
2108 return editable && !result.empty(); | |
2109 } | |
2110 case IDS_APP_DELETE: | |
2111 return editable && has_selection; | |
2112 case IDS_APP_SELECT_ALL: | |
2113 return true; | |
2114 default: | |
2115 return false; | |
2116 } | |
2117 } | |
2118 | |
2119 void RenderWidgetHostViewAura::ExecuteCommand(int command_id, int event_flags) { | |
2120 RenderWidgetHost* host = GetRenderWidgetHost(); | |
2121 RenderViewHost* rvh = RenderViewHost::From(host); | |
2122 WebContents* wc = WebContents::FromRenderViewHost(rvh); | |
2123 | |
2124 switch (command_id) { | |
2125 case IDS_APP_CUT: | |
2126 wc->Cut(); | |
2127 break; | |
2128 case IDS_APP_COPY: | |
2129 wc->Copy(); | |
2130 break; | |
2131 case IDS_APP_PASTE: | |
2132 wc->Paste(); | |
2133 break; | |
2134 case IDS_APP_DELETE: | |
2135 wc->Delete(); | |
2136 break; | |
2137 case IDS_APP_SELECT_ALL: | |
2138 wc->SelectAll(); | |
2139 break; | |
2140 default: | |
2141 NOTREACHED(); | |
2142 break; | |
2143 } | |
2144 } | |
2145 | |
2146 void RenderWidgetHostViewAura::OpenContextMenu(const gfx::PointF& point) { | |
2147 RenderWidgetHost* host = GetRenderWidgetHost(); | |
2148 host->Send(new ViewMsg_ShowContextMenu(host->GetRoutingID(), | |
2149 ui::MENU_SOURCE_TOUCH_EDIT_MENU, | |
2150 gfx::Point(point.x(), point.y()))); | |
2151 } | |
2152 | |
2153 gfx::Rect RenderWidgetHostViewAura::ConvertRectToScreen( | |
2154 const gfx::RectF& rect) const { | |
2155 gfx::Rect r(rect.x(), rect.y(), rect.width(), rect.height()); | |
2156 return ConvertRectToScreen(r); | |
2157 } | |
2158 | |
2159 //////////////////////////////////////////////////////////////////////////////// | |
2080 // RenderWidgetHostViewAura, aura::client::ActivationDelegate implementation: | 2160 // RenderWidgetHostViewAura, aura::client::ActivationDelegate implementation: |
2081 | 2161 |
2082 bool RenderWidgetHostViewAura::ShouldActivate() const { | 2162 bool RenderWidgetHostViewAura::ShouldActivate() const { |
2083 aura::WindowTreeHost* host = window_->GetHost(); | 2163 aura::WindowTreeHost* host = window_->GetHost(); |
2084 if (!host) | 2164 if (!host) |
2085 return true; | 2165 return true; |
2086 const ui::Event* event = host->dispatcher()->current_event(); | 2166 const ui::Event* event = host->dispatcher()->current_event(); |
2087 if (!event) | 2167 if (!event) |
2088 return true; | 2168 return true; |
2089 return is_fullscreen_; | 2169 return is_fullscreen_; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2145 host_->GetRootBrowserAccessibilityManager(); | 2225 host_->GetRootBrowserAccessibilityManager(); |
2146 if (manager) | 2226 if (manager) |
2147 manager->OnWindowFocused(); | 2227 manager->OnWindowFocused(); |
2148 } else if (window_ == lost_focus) { | 2228 } else if (window_ == lost_focus) { |
2149 host_->SetActive(false); | 2229 host_->SetActive(false); |
2150 host_->Blur(); | 2230 host_->Blur(); |
2151 | 2231 |
2152 DetachFromInputMethod(); | 2232 DetachFromInputMethod(); |
2153 host_->SetInputMethodActive(false); | 2233 host_->SetInputMethodActive(false); |
2154 | 2234 |
2155 if (touch_editing_client_) | 2235 selection_controller_->HideAndDisallowShowingAutomatically(); |
2156 touch_editing_client_->EndTouchEditing(false); | |
2157 | 2236 |
2158 if (overscroll_controller_) | 2237 if (overscroll_controller_) |
2159 overscroll_controller_->Cancel(); | 2238 overscroll_controller_->Cancel(); |
2160 | 2239 |
2161 BrowserAccessibilityManager* manager = | 2240 BrowserAccessibilityManager* manager = |
2162 host_->GetRootBrowserAccessibilityManager(); | 2241 host_->GetRootBrowserAccessibilityManager(); |
2163 if (manager) | 2242 if (manager) |
2164 manager->OnWindowBlurred(); | 2243 manager->OnWindowBlurred(); |
2165 | 2244 |
2166 // If we lose the focus while fullscreen, close the window; Pepper Flash | 2245 // 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... | |
2203 TRACE_EVENT1("ui", "RenderWidgetHostViewAura::OnHostMoved", | 2282 TRACE_EVENT1("ui", "RenderWidgetHostViewAura::OnHostMoved", |
2204 "new_origin", new_origin.ToString()); | 2283 "new_origin", new_origin.ToString()); |
2205 | 2284 |
2206 UpdateScreenInfo(window_); | 2285 UpdateScreenInfo(window_); |
2207 } | 2286 } |
2208 | 2287 |
2209 //////////////////////////////////////////////////////////////////////////////// | 2288 //////////////////////////////////////////////////////////////////////////////// |
2210 // RenderWidgetHostViewAura, private: | 2289 // RenderWidgetHostViewAura, private: |
2211 | 2290 |
2212 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { | 2291 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { |
2213 if (touch_editing_client_) | |
2214 touch_editing_client_->OnViewDestroyed(); | |
2215 | |
2216 delegated_frame_host_.reset(); | 2292 delegated_frame_host_.reset(); |
2217 window_observer_.reset(); | 2293 window_observer_.reset(); |
2218 if (window_->GetHost()) | 2294 if (window_->GetHost()) |
2219 window_->GetHost()->RemoveObserver(this); | 2295 window_->GetHost()->RemoveObserver(this); |
2220 UnlockMouse(); | 2296 UnlockMouse(); |
2221 if (popup_parent_host_view_) { | 2297 if (popup_parent_host_view_) { |
2222 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || | 2298 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || |
2223 popup_parent_host_view_->popup_child_host_view_ == this); | 2299 popup_parent_host_view_->popup_child_host_view_ == this); |
2224 popup_parent_host_view_->popup_child_host_view_ = NULL; | 2300 popup_parent_host_view_->popup_child_host_view_ = NULL; |
2225 } | 2301 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2380 if (HasDisplayPropertyChanged(window_)) | 2456 if (HasDisplayPropertyChanged(window_)) |
2381 host_->InvalidateScreenInfo(); | 2457 host_->InvalidateScreenInfo(); |
2382 | 2458 |
2383 SnapToPhysicalPixelBoundary(); | 2459 SnapToPhysicalPixelBoundary(); |
2384 // Don't recursively call SetBounds if this bounds update is the result of | 2460 // Don't recursively call SetBounds if this bounds update is the result of |
2385 // a Window::SetBoundsInternal call. | 2461 // a Window::SetBoundsInternal call. |
2386 if (!in_bounds_changed_) | 2462 if (!in_bounds_changed_) |
2387 window_->SetBounds(rect); | 2463 window_->SetBounds(rect); |
2388 host_->WasResized(); | 2464 host_->WasResized(); |
2389 delegated_frame_host_->WasResized(); | 2465 delegated_frame_host_->WasResized(); |
2390 if (touch_editing_client_) { | |
2391 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, | |
2392 selection_focus_rect_); | |
2393 } | |
2394 #if defined(OS_WIN) | 2466 #if defined(OS_WIN) |
2395 if (mouse_locked_) | 2467 if (mouse_locked_) |
2396 UpdateMouseLockRegion(); | 2468 UpdateMouseLockRegion(); |
2397 #endif | 2469 #endif |
2398 } | 2470 } |
2399 | 2471 |
2400 void RenderWidgetHostViewAura::SchedulePaintIfNotInClip( | 2472 void RenderWidgetHostViewAura::SchedulePaintIfNotInClip( |
2401 const gfx::Rect& rect, | 2473 const gfx::Rect& rect, |
2402 const gfx::Rect& clip) { | 2474 const gfx::Rect& clip) { |
2403 if (!clip.IsEmpty()) { | 2475 if (!clip.IsEmpty()) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2484 } | 2556 } |
2485 #endif | 2557 #endif |
2486 | 2558 |
2487 host_->ForwardKeyboardEvent(event); | 2559 host_->ForwardKeyboardEvent(event); |
2488 } | 2560 } |
2489 | 2561 |
2490 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { | 2562 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { |
2491 return kN32_SkColorType; | 2563 return kN32_SkColorType; |
2492 } | 2564 } |
2493 | 2565 |
2566 void RenderWidgetHostViewAura::SelectionBoundsUpdated( | |
2567 const cc::ViewportSelectionBound& start, | |
2568 const cc::ViewportSelectionBound& end) { | |
2569 selection_controller_->OnSelectionBoundsChanged(start, end); | |
2570 if (GetInputMethod()) | |
2571 GetInputMethod()->OnCaretBoundsChanged(this); | |
2572 } | |
2573 | |
2494 //////////////////////////////////////////////////////////////////////////////// | 2574 //////////////////////////////////////////////////////////////////////////////// |
2495 // DelegatedFrameHost, public: | 2575 // DelegatedFrameHost, public: |
2496 | 2576 |
2497 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { | 2577 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { |
2498 aura::WindowTreeHost* host = window_->GetHost(); | 2578 aura::WindowTreeHost* host = window_->GetHost(); |
2499 return host ? host->compositor() : NULL; | 2579 return host ? host->compositor() : NULL; |
2500 } | 2580 } |
2501 | 2581 |
2502 ui::Layer* RenderWidgetHostViewAura::GetLayer() { | 2582 ui::Layer* RenderWidgetHostViewAura::GetLayer() { |
2503 return window_->layer(); | 2583 return window_->layer(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2540 | 2620 |
2541 //////////////////////////////////////////////////////////////////////////////// | 2621 //////////////////////////////////////////////////////////////////////////////// |
2542 // RenderWidgetHostViewBase, public: | 2622 // RenderWidgetHostViewBase, public: |
2543 | 2623 |
2544 // static | 2624 // static |
2545 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2625 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2546 GetScreenInfoForWindow(results, NULL); | 2626 GetScreenInfoForWindow(results, NULL); |
2547 } | 2627 } |
2548 | 2628 |
2549 } // namespace content | 2629 } // namespace content |
OLD | NEW |