| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 #include "ui/compositor/dip_util.h" | 67 #include "ui/compositor/dip_util.h" |
| 68 #include "ui/events/event.h" | 68 #include "ui/events/event.h" |
| 69 #include "ui/events/event_utils.h" | 69 #include "ui/events/event_utils.h" |
| 70 #include "ui/events/gestures/gesture_recognizer.h" | 70 #include "ui/events/gestures/gesture_recognizer.h" |
| 71 #include "ui/gfx/canvas.h" | 71 #include "ui/gfx/canvas.h" |
| 72 #include "ui/gfx/display.h" | 72 #include "ui/gfx/display.h" |
| 73 #include "ui/gfx/geometry/rect_conversions.h" | 73 #include "ui/gfx/geometry/rect_conversions.h" |
| 74 #include "ui/gfx/geometry/size_conversions.h" | 74 #include "ui/gfx/geometry/size_conversions.h" |
| 75 #include "ui/gfx/screen.h" | 75 #include "ui/gfx/screen.h" |
| 76 #include "ui/gfx/skia_util.h" | 76 #include "ui/gfx/skia_util.h" |
| 77 #include "ui/touch_selection/touch_selection_controller_aura.h" |
| 77 #include "ui/wm/public/activation_client.h" | 78 #include "ui/wm/public/activation_client.h" |
| 78 #include "ui/wm/public/scoped_tooltip_disabler.h" | 79 #include "ui/wm/public/scoped_tooltip_disabler.h" |
| 79 #include "ui/wm/public/tooltip_client.h" | 80 #include "ui/wm/public/tooltip_client.h" |
| 80 #include "ui/wm/public/transient_window_client.h" | 81 #include "ui/wm/public/transient_window_client.h" |
| 81 #include "ui/wm/public/window_types.h" | 82 #include "ui/wm/public/window_types.h" |
| 82 | 83 |
| 83 #if defined(OS_WIN) | 84 #if defined(OS_WIN) |
| 84 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 85 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
| 85 #include "content/browser/accessibility/browser_accessibility_win.h" | 86 #include "content/browser/accessibility/browser_accessibility_win.h" |
| 86 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" | 87 #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), | 430 accept_return_character_(false), |
| 430 last_swapped_software_frame_scale_factor_(1.f), | 431 last_swapped_software_frame_scale_factor_(1.f), |
| 431 paint_canvas_(NULL), | 432 paint_canvas_(NULL), |
| 432 synthetic_move_sent_(false), | 433 synthetic_move_sent_(false), |
| 433 cursor_visibility_state_in_renderer_(UNKNOWN), | 434 cursor_visibility_state_in_renderer_(UNKNOWN), |
| 434 #if defined(OS_WIN) | 435 #if defined(OS_WIN) |
| 435 legacy_render_widget_host_HWND_(NULL), | 436 legacy_render_widget_host_HWND_(NULL), |
| 436 legacy_window_destroyed_(false), | 437 legacy_window_destroyed_(false), |
| 437 #endif | 438 #endif |
| 438 has_snapped_to_boundary_(false), | 439 has_snapped_to_boundary_(false), |
| 439 touch_editing_client_(NULL), | |
| 440 is_guest_view_hack_(is_guest_view_hack), | 440 is_guest_view_hack_(is_guest_view_hack), |
| 441 weak_ptr_factory_(this) { | 441 weak_ptr_factory_(this) { |
| 442 if (!is_guest_view_hack_) | 442 if (!is_guest_view_hack_) |
| 443 host_->SetView(this); | 443 host_->SetView(this); |
| 444 | 444 |
| 445 window_observer_.reset(new WindowObserver(this)); | 445 window_observer_.reset(new WindowObserver(this)); |
| 446 aura::client::SetTooltipText(window_, &tooltip_); | 446 aura::client::SetTooltipText(window_, &tooltip_); |
| 447 aura::client::SetActivationDelegate(window_, this); | 447 aura::client::SetActivationDelegate(window_, this); |
| 448 aura::client::SetActivationChangeObserver(window_, this); | 448 aura::client::SetActivationChangeObserver(window_, this); |
| 449 aura::client::SetFocusChangeObserver(window_, this); | 449 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 | 774 // 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 | 775 // situations we may not yet be in a valid Window hierarchy (such as reloading |
| 776 // after out of memory discarded the tab). | 776 // after out of memory discarded the tab). |
| 777 aura::client::FocusClient* client = aura::client::GetFocusClient(window_); | 777 aura::client::FocusClient* client = aura::client::GetFocusClient(window_); |
| 778 if (client) | 778 if (client) |
| 779 window_->Focus(); | 779 window_->Focus(); |
| 780 } | 780 } |
| 781 | 781 |
| 782 void RenderWidgetHostViewAura::Blur() { | 782 void RenderWidgetHostViewAura::Blur() { |
| 783 window_->Blur(); | 783 window_->Blur(); |
| 784 if (selection_controller_) |
| 785 selection_controller_->HideAndDisallowShowingAutomatically(); |
| 784 } | 786 } |
| 785 | 787 |
| 786 bool RenderWidgetHostViewAura::HasFocus() const { | 788 bool RenderWidgetHostViewAura::HasFocus() const { |
| 787 return window_->HasFocus(); | 789 return window_->HasFocus(); |
| 788 } | 790 } |
| 789 | 791 |
| 790 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { | 792 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { |
| 791 return delegated_frame_host_->CanCopyToBitmap(); | 793 return delegated_frame_host_->CanCopyToBitmap(); |
| 792 } | 794 } |
| 793 | 795 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 if (text_input_type_ != type || | 843 if (text_input_type_ != type || |
| 842 text_input_mode_ != input_mode || | 844 text_input_mode_ != input_mode || |
| 843 can_compose_inline_ != can_compose_inline || | 845 can_compose_inline_ != can_compose_inline || |
| 844 text_input_flags_ != flags) { | 846 text_input_flags_ != flags) { |
| 845 text_input_type_ = type; | 847 text_input_type_ = type; |
| 846 text_input_mode_ = input_mode; | 848 text_input_mode_ = input_mode; |
| 847 can_compose_inline_ = can_compose_inline; | 849 can_compose_inline_ = can_compose_inline; |
| 848 text_input_flags_ = flags; | 850 text_input_flags_ = flags; |
| 849 if (GetInputMethod()) | 851 if (GetInputMethod()) |
| 850 GetInputMethod()->OnTextInputTypeChanged(this); | 852 GetInputMethod()->OnTextInputTypeChanged(this); |
| 851 if (touch_editing_client_) | 853 const bool is_editable_node = type != ui::TEXT_INPUT_TYPE_NONE; |
| 852 touch_editing_client_->OnTextInputTypeChanged(text_input_type_); | 854 if (selection_controller_) |
| 855 selection_controller_->OnSelectionEditable(is_editable_node); |
| 853 } | 856 } |
| 854 } | 857 } |
| 855 | 858 |
| 856 void RenderWidgetHostViewAura::OnTextInputStateChanged( | 859 void RenderWidgetHostViewAura::OnTextInputStateChanged( |
| 857 const ViewHostMsg_TextInputState_Params& params) { | 860 const ViewHostMsg_TextInputState_Params& params) { |
| 858 text_input_flags_ = params.flags; | 861 text_input_flags_ = params.flags; |
| 859 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) { |
| 860 if (GetInputMethod()) | 863 if (GetInputMethod()) |
| 861 GetInputMethod()->ShowImeIfNeeded(); | 864 GetInputMethod()->ShowImeIfNeeded(); |
| 862 } | 865 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 // Content tooltips should be visible indefinitely. | 902 // Content tooltips should be visible indefinitely. |
| 900 tooltip_client->SetTooltipShownTimeout(window_, 0); | 903 tooltip_client->SetTooltipShownTimeout(window_, 0); |
| 901 } | 904 } |
| 902 } | 905 } |
| 903 | 906 |
| 904 void RenderWidgetHostViewAura::SelectionChanged(const base::string16& text, | 907 void RenderWidgetHostViewAura::SelectionChanged(const base::string16& text, |
| 905 size_t offset, | 908 size_t offset, |
| 906 const gfx::Range& range) { | 909 const gfx::Range& range) { |
| 907 RenderWidgetHostViewBase::SelectionChanged(text, offset, range); | 910 RenderWidgetHostViewBase::SelectionChanged(text, offset, range); |
| 908 | 911 |
| 912 if (selection_controller_) |
| 913 selection_controller_->OnSelectionEmpty(text.empty()); |
| 914 |
| 909 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 915 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
| 910 if (text.empty() || range.is_empty()) | 916 if (text.empty() || range.is_empty()) |
| 911 return; | 917 return; |
| 912 size_t pos = range.GetMin() - offset; | 918 size_t pos = range.GetMin() - offset; |
| 913 size_t n = range.length(); | 919 size_t n = range.length(); |
| 914 | 920 |
| 915 DCHECK(pos + n <= text.length()) << "The text can not fully cover range."; | 921 DCHECK(pos + n <= text.length()) << "The text can not fully cover range."; |
| 916 if (pos >= text.length()) { | 922 if (pos >= text.length()) { |
| 917 NOTREACHED() << "The text can not cover range."; | 923 NOTREACHED() << "The text can not cover range."; |
| 918 return; | 924 return; |
| 919 } | 925 } |
| 920 | 926 |
| 921 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 927 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
| 922 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); | 928 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
| 923 clipboard_writer.WriteText(text.substr(pos, n)); | 929 clipboard_writer.WriteText(text.substr(pos, n)); |
| 924 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 930 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
| 925 } | 931 } |
| 926 | 932 |
| 927 gfx::Size RenderWidgetHostViewAura::GetRequestedRendererSize() const { | 933 gfx::Size RenderWidgetHostViewAura::GetRequestedRendererSize() const { |
| 928 return delegated_frame_host_->GetRequestedRendererSize(); | 934 return delegated_frame_host_->GetRequestedRendererSize(); |
| 929 } | 935 } |
| 930 | 936 |
| 931 void RenderWidgetHostViewAura::SelectionBoundsChanged( | 937 void RenderWidgetHostViewAura::SelectionBoundsChanged( |
| 932 const ViewHostMsg_SelectionBounds_Params& params) { | 938 const ViewHostMsg_SelectionBounds_Params& params) { |
| 933 ui::SelectionBound anchor_bound, focus_bound; | 939 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 } | 940 } |
| 975 | 941 |
| 976 void RenderWidgetHostViewAura::CopyFromCompositingSurface( | 942 void RenderWidgetHostViewAura::CopyFromCompositingSurface( |
| 977 const gfx::Rect& src_subrect, | 943 const gfx::Rect& src_subrect, |
| 978 const gfx::Size& dst_size, | 944 const gfx::Size& dst_size, |
| 979 ReadbackRequestCallback& callback, | 945 ReadbackRequestCallback& callback, |
| 980 const SkColorType color_type) { | 946 const SkColorType color_type) { |
| 981 delegated_frame_host_->CopyFromCompositingSurface( | 947 delegated_frame_host_->CopyFromCompositingSurface( |
| 982 src_subrect, dst_size, callback, color_type); | 948 src_subrect, dst_size, callback, color_type); |
| 983 } | 949 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 scoped_ptr<cc::CompositorFrame> frame) { | 1018 scoped_ptr<cc::CompositorFrame> frame) { |
| 1053 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); | 1019 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); |
| 1054 | 1020 |
| 1055 last_scroll_offset_ = frame->metadata.root_scroll_offset; | 1021 last_scroll_offset_ = frame->metadata.root_scroll_offset; |
| 1056 if (frame->delegated_frame_data) { | 1022 if (frame->delegated_frame_data) { |
| 1057 delegated_frame_host_->SwapDelegatedFrame( | 1023 delegated_frame_host_->SwapDelegatedFrame( |
| 1058 output_surface_id, | 1024 output_surface_id, |
| 1059 frame->delegated_frame_data.Pass(), | 1025 frame->delegated_frame_data.Pass(), |
| 1060 frame->metadata.device_scale_factor, | 1026 frame->metadata.device_scale_factor, |
| 1061 frame->metadata.latency_info); | 1027 frame->metadata.latency_info); |
| 1028 SelectionBoundsUpdated(ui::SelectionBound(frame->metadata.selection_start), |
| 1029 ui::SelectionBound(frame->metadata.selection_end)); |
| 1062 return; | 1030 return; |
| 1063 } | 1031 } |
| 1064 | 1032 |
| 1065 if (frame->software_frame_data) { | 1033 if (frame->software_frame_data) { |
| 1066 DLOG(ERROR) << "Unable to use software frame in aura"; | 1034 DLOG(ERROR) << "Unable to use software frame in aura"; |
| 1067 RecordAction( | 1035 RecordAction( |
| 1068 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura")); | 1036 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura")); |
| 1069 host_->GetProcess()->ReceivedBadMessage(); | 1037 host_->GetProcess()->ReceivedBadMessage(); |
| 1070 return; | 1038 return; |
| 1071 } | 1039 } |
| 1072 } | 1040 } |
| 1073 | 1041 |
| 1074 void RenderWidgetHostViewAura::DidStopFlinging() { | 1042 void RenderWidgetHostViewAura::DidStopFlinging() { |
| 1075 if (touch_editing_client_) | 1043 if (selection_controller_) |
| 1076 touch_editing_client_->DidStopFlinging(); | 1044 selection_controller_->OnFlingCompleted(); |
| 1077 } | 1045 } |
| 1078 | 1046 |
| 1079 #if defined(OS_WIN) | 1047 #if defined(OS_WIN) |
| 1080 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( | 1048 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( |
| 1081 gfx::NativeViewAccessible accessible_parent) { | 1049 gfx::NativeViewAccessible accessible_parent) { |
| 1082 } | 1050 } |
| 1083 | 1051 |
| 1084 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() | 1052 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() |
| 1085 const { | 1053 const { |
| 1086 if (legacy_render_widget_host_HWND_) { | 1054 if (legacy_render_widget_host_HWND_) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 InputEventAckState ack_result) { | 1114 InputEventAckState ack_result) { |
| 1147 if (overscroll_controller_) { | 1115 if (overscroll_controller_) { |
| 1148 overscroll_controller_->ReceivedEventACK( | 1116 overscroll_controller_->ReceivedEventACK( |
| 1149 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); | 1117 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); |
| 1150 } | 1118 } |
| 1151 } | 1119 } |
| 1152 | 1120 |
| 1153 void RenderWidgetHostViewAura::GestureEventAck( | 1121 void RenderWidgetHostViewAura::GestureEventAck( |
| 1154 const blink::WebGestureEvent& event, | 1122 const blink::WebGestureEvent& event, |
| 1155 InputEventAckState ack_result) { | 1123 InputEventAckState ack_result) { |
| 1156 if (touch_editing_client_) | |
| 1157 touch_editing_client_->GestureEventAck(event.type); | |
| 1158 | |
| 1159 if (overscroll_controller_) { | 1124 if (overscroll_controller_) { |
| 1160 overscroll_controller_->ReceivedEventACK( | 1125 overscroll_controller_->ReceivedEventACK( |
| 1161 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); | 1126 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); |
| 1162 } | 1127 } |
| 1163 } | 1128 } |
| 1164 | 1129 |
| 1165 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( | 1130 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( |
| 1166 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { | 1131 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { |
| 1167 ScopedVector<ui::TouchEvent> events; | 1132 ScopedVector<ui::TouchEvent> events; |
| 1168 if (!MakeUITouchEventsFromWebTouchEvents(touch, &events, | 1133 if (!MakeUITouchEventsFromWebTouchEvents(touch, &events, |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1519 return gfx::Rect(origin.x(), | 1484 return gfx::Rect(origin.x(), |
| 1520 origin.y(), | 1485 origin.y(), |
| 1521 end.x() - origin.x(), | 1486 end.x() - origin.x(), |
| 1522 end.y() - origin.y()); | 1487 end.y() - origin.y()); |
| 1523 } | 1488 } |
| 1524 | 1489 |
| 1525 return rect; | 1490 return rect; |
| 1526 } | 1491 } |
| 1527 | 1492 |
| 1528 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const { | 1493 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const { |
| 1529 gfx::Rect rect = | 1494 if (selection_controller_) { |
| 1530 ui::RectBetweenSelectionBounds(selection_anchor_, selection_focus_); | 1495 const ui::SelectionBound& start = selection_controller_->start(); |
| 1531 return ConvertRectToScreen(rect); | 1496 const ui::SelectionBound& end = selection_controller_->end(); |
| 1497 return ConvertRectToScreen(ui::RectBetweenSelectionBounds(start, end)); |
| 1498 } |
| 1499 return gfx::Rect(); |
| 1532 } | 1500 } |
| 1533 | 1501 |
| 1534 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds( | 1502 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds( |
| 1535 uint32 index, | 1503 uint32 index, |
| 1536 gfx::Rect* rect) const { | 1504 gfx::Rect* rect) const { |
| 1537 DCHECK(rect); | 1505 DCHECK(rect); |
| 1538 if (index >= composition_character_bounds_.size()) | 1506 if (index >= composition_character_bounds_.size()) |
| 1539 return false; | 1507 return false; |
| 1540 *rect = ConvertRectToScreen(composition_character_bounds_[index]); | 1508 *rect = ConvertRectToScreen(composition_character_bounds_[index]); |
| 1541 return true; | 1509 return true; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1720 const gfx::Point& location) { | 1688 const gfx::Point& location) { |
| 1721 return true; | 1689 return true; |
| 1722 } | 1690 } |
| 1723 | 1691 |
| 1724 bool RenderWidgetHostViewAura::CanFocus() { | 1692 bool RenderWidgetHostViewAura::CanFocus() { |
| 1725 return popup_type_ == blink::WebPopupTypeNone; | 1693 return popup_type_ == blink::WebPopupTypeNone; |
| 1726 } | 1694 } |
| 1727 | 1695 |
| 1728 void RenderWidgetHostViewAura::OnCaptureLost() { | 1696 void RenderWidgetHostViewAura::OnCaptureLost() { |
| 1729 host_->LostCapture(); | 1697 host_->LostCapture(); |
| 1730 if (touch_editing_client_) | 1698 if (selection_controller_) |
| 1731 touch_editing_client_->EndTouchEditing(false); | 1699 selection_controller_->HideAndDisallowShowingAutomatically(); |
| 1732 } | 1700 } |
| 1733 | 1701 |
| 1734 void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { | 1702 void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { |
| 1735 NOTREACHED(); | 1703 NOTREACHED(); |
| 1736 } | 1704 } |
| 1737 | 1705 |
| 1738 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( | 1706 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( |
| 1739 float device_scale_factor) { | 1707 float device_scale_factor) { |
| 1740 if (!host_ || !window_->GetRootWindow()) | 1708 if (!host_ || !window_->GetRootWindow()) |
| 1741 return; | 1709 return; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1804 } | 1772 } |
| 1805 | 1773 |
| 1806 void RenderWidgetHostViewAura::GetHitTestMask(gfx::Path* mask) const { | 1774 void RenderWidgetHostViewAura::GetHitTestMask(gfx::Path* mask) const { |
| 1807 } | 1775 } |
| 1808 | 1776 |
| 1809 //////////////////////////////////////////////////////////////////////////////// | 1777 //////////////////////////////////////////////////////////////////////////////// |
| 1810 // RenderWidgetHostViewAura, ui::EventHandler implementation: | 1778 // RenderWidgetHostViewAura, ui::EventHandler implementation: |
| 1811 | 1779 |
| 1812 void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { | 1780 void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { |
| 1813 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnKeyEvent"); | 1781 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnKeyEvent"); |
| 1814 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
| 1815 return; | |
| 1816 | 1782 |
| 1817 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { | 1783 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { |
| 1818 popup_child_host_view_->OnKeyEvent(event); | 1784 popup_child_host_view_->OnKeyEvent(event); |
| 1819 if (event->handled()) | 1785 if (event->handled()) |
| 1820 return; | 1786 return; |
| 1821 } | 1787 } |
| 1822 | 1788 |
| 1823 // We need to handle the Escape key for Pepper Flash. | 1789 // We need to handle the Escape key for Pepper Flash. |
| 1824 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { | 1790 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { |
| 1825 // Focus the window we were created from. | 1791 // Focus the window we were created from. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1852 // We don't have to communicate with an input method here. | 1818 // We don't have to communicate with an input method here. |
| 1853 NativeWebKeyboardEvent webkit_event(*event); | 1819 NativeWebKeyboardEvent webkit_event(*event); |
| 1854 ForwardKeyboardEvent(webkit_event); | 1820 ForwardKeyboardEvent(webkit_event); |
| 1855 } | 1821 } |
| 1856 event->SetHandled(); | 1822 event->SetHandled(); |
| 1857 } | 1823 } |
| 1858 | 1824 |
| 1859 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { | 1825 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { |
| 1860 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnMouseEvent"); | 1826 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnMouseEvent"); |
| 1861 | 1827 |
| 1862 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
| 1863 return; | |
| 1864 | |
| 1865 if (mouse_locked_) { | 1828 if (mouse_locked_) { |
| 1866 aura::client::CursorClient* cursor_client = | 1829 aura::client::CursorClient* cursor_client = |
| 1867 aura::client::GetCursorClient(window_->GetRootWindow()); | 1830 aura::client::GetCursorClient(window_->GetRootWindow()); |
| 1868 DCHECK(!cursor_client || !cursor_client->IsCursorVisible()); | 1831 DCHECK(!cursor_client || !cursor_client->IsCursorVisible()); |
| 1869 | 1832 |
| 1870 if (event->type() == ui::ET_MOUSEWHEEL) { | 1833 if (event->type() == ui::ET_MOUSEWHEEL) { |
| 1871 blink::WebMouseWheelEvent mouse_wheel_event = | 1834 blink::WebMouseWheelEvent mouse_wheel_event = |
| 1872 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); | 1835 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); |
| 1873 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) | 1836 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) |
| 1874 host_->ForwardWheelEvent(mouse_wheel_event); | 1837 host_->ForwardWheelEvent(mouse_wheel_event); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1993 event->ConvertLocationToTarget(window_, window_->parent()); | 1956 event->ConvertLocationToTarget(window_, window_->parent()); |
| 1994 window_->parent()->delegate()->OnMouseEvent(event); | 1957 window_->parent()->delegate()->OnMouseEvent(event); |
| 1995 } | 1958 } |
| 1996 | 1959 |
| 1997 if (!IsXButtonUpEvent(event)) | 1960 if (!IsXButtonUpEvent(event)) |
| 1998 event->SetHandled(); | 1961 event->SetHandled(); |
| 1999 } | 1962 } |
| 2000 | 1963 |
| 2001 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { | 1964 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { |
| 2002 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); | 1965 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); |
| 2003 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
| 2004 return; | |
| 2005 | 1966 |
| 2006 if (event->type() == ui::ET_SCROLL) { | 1967 if (event->type() == ui::ET_SCROLL) { |
| 2007 #if !defined(OS_WIN) | 1968 #if !defined(OS_WIN) |
| 2008 // TODO(ananta) | 1969 // TODO(ananta) |
| 2009 // Investigate if this is true for Windows 8 Metro ASH as well. | 1970 // Investigate if this is true for Windows 8 Metro ASH as well. |
| 2010 if (event->finger_count() != 2) | 1971 if (event->finger_count() != 2) |
| 2011 return; | 1972 return; |
| 2012 #endif | 1973 #endif |
| 2013 blink::WebGestureEvent gesture_event = | 1974 blink::WebGestureEvent gesture_event = |
| 2014 MakeWebGestureEventFlingCancel(); | 1975 MakeWebGestureEventFlingCancel(); |
| 2015 host_->ForwardGestureEvent(gesture_event); | 1976 host_->ForwardGestureEvent(gesture_event); |
| 2016 blink::WebMouseWheelEvent mouse_wheel_event = | 1977 blink::WebMouseWheelEvent mouse_wheel_event = |
| 2017 MakeWebMouseWheelEvent(*event); | 1978 MakeWebMouseWheelEvent(*event); |
| 2018 host_->ForwardWheelEvent(mouse_wheel_event); | 1979 host_->ForwardWheelEvent(mouse_wheel_event); |
| 2019 RecordAction(base::UserMetricsAction("TrackpadScroll")); | 1980 RecordAction(base::UserMetricsAction("TrackpadScroll")); |
| 2020 } else if (event->type() == ui::ET_SCROLL_FLING_START || | 1981 } else if (event->type() == ui::ET_SCROLL_FLING_START || |
| 2021 event->type() == ui::ET_SCROLL_FLING_CANCEL) { | 1982 event->type() == ui::ET_SCROLL_FLING_CANCEL) { |
| 2022 blink::WebGestureEvent gesture_event = MakeWebGestureEvent(*event); | 1983 blink::WebGestureEvent gesture_event = MakeWebGestureEvent(*event); |
| 2023 host_->ForwardGestureEvent(gesture_event); | 1984 host_->ForwardGestureEvent(gesture_event); |
| 2024 if (event->type() == ui::ET_SCROLL_FLING_START) | 1985 if (event->type() == ui::ET_SCROLL_FLING_START) |
| 2025 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); | 1986 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); |
| 2026 } | 1987 } |
| 2027 | 1988 |
| 2028 event->SetHandled(); | 1989 event->SetHandled(); |
| 2029 } | 1990 } |
| 2030 | 1991 |
| 2031 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { | 1992 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { |
| 2032 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent"); | 1993 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent"); |
| 2033 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | 1994 |
| 2034 return; | 1995 if (selection_controller_) { |
| 1996 selection_controller_->HandleTouchEvent(event); |
| 1997 if (event->handled()) |
| 1998 return; |
| 1999 } |
| 2035 | 2000 |
| 2036 // Update the touch event first. | 2001 // Update the touch event first. |
| 2037 if (!pointer_state_.OnTouch(*event)) { | 2002 if (!pointer_state_.OnTouch(*event)) { |
| 2038 event->StopPropagation(); | 2003 event->StopPropagation(); |
| 2039 return; | 2004 return; |
| 2040 } | 2005 } |
| 2041 | 2006 |
| 2042 blink::WebTouchEvent touch_event = CreateWebTouchEventFromMotionEvent( | 2007 blink::WebTouchEvent touch_event = CreateWebTouchEventFromMotionEvent( |
| 2043 pointer_state_, event->may_cause_scrolling()); | 2008 pointer_state_, event->may_cause_scrolling()); |
| 2044 pointer_state_.CleanupRemovedTouchPoints(*event); | 2009 pointer_state_.CleanupRemovedTouchPoints(*event); |
| 2045 | 2010 |
| 2046 // Forward the touch event only if a touch point was updated, and | 2011 // Forward the touch event only if a touch point was updated, and |
| 2047 // there's a touch-event handler in the page, and no other | 2012 // there's a touch-event handler in the page, and no other |
| 2048 // touch-event is in the queue. It is important to always mark | 2013 // touch-event is in the queue. It is important to always mark |
| 2049 // events as being handled asynchronously if there is a touch-event | 2014 // events as being handled asynchronously if there is a touch-event |
| 2050 // handler in the page, or some touch-event is already in the queue, | 2015 // handler in the page, or some touch-event is already in the queue, |
| 2051 // even if no point has been updated. This ensures that this event | 2016 // even if no point has been updated. This ensures that this event |
| 2052 // does not get processed by the gesture recognizer before events | 2017 // does not get processed by the gesture recognizer before events |
| 2053 // currently awaiting dispatch in the touch queue. | 2018 // currently awaiting dispatch in the touch queue. |
| 2054 if (host_->ShouldForwardTouchEvent()) { | 2019 if (host_->ShouldForwardTouchEvent()) { |
| 2055 event->DisableSynchronousHandling(); | 2020 event->DisableSynchronousHandling(); |
| 2056 host_->ForwardTouchEventWithLatencyInfo(touch_event, *event->latency()); | 2021 host_->ForwardTouchEventWithLatencyInfo(touch_event, *event->latency()); |
| 2057 } | 2022 } |
| 2058 } | 2023 } |
| 2059 | 2024 |
| 2060 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { | 2025 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { |
| 2061 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); | 2026 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); |
| 2027 |
| 2028 if (selection_controller_) { |
| 2029 selection_controller_->HandleGestureEvent(event); |
| 2030 if (event->handled()) |
| 2031 return; |
| 2032 } |
| 2033 |
| 2062 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || | 2034 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || |
| 2063 event->type() == ui::ET_GESTURE_PINCH_UPDATE || | 2035 event->type() == ui::ET_GESTURE_PINCH_UPDATE || |
| 2064 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { | 2036 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { |
| 2065 event->SetHandled(); | 2037 event->SetHandled(); |
| 2066 return; | 2038 return; |
| 2067 } | 2039 } |
| 2068 | 2040 |
| 2069 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
| 2070 return; | |
| 2071 | |
| 2072 // Confirm existing composition text on TAP gesture, to make sure the input | 2041 // Confirm existing composition text on TAP gesture, to make sure the input |
| 2073 // caret won't be moved with an ongoing composition text. | 2042 // caret won't be moved with an ongoing composition text. |
| 2074 if (event->type() == ui::ET_GESTURE_TAP) | 2043 if (event->type() == ui::ET_GESTURE_TAP) |
| 2075 FinishImeCompositionSession(); | 2044 FinishImeCompositionSession(); |
| 2076 | 2045 |
| 2077 RenderViewHostDelegate* delegate = NULL; | 2046 RenderViewHostDelegate* delegate = NULL; |
| 2078 if (host_->IsRenderView()) | 2047 if (host_->IsRenderView()) |
| 2079 delegate = RenderViewHost::From(host_)->GetDelegate(); | 2048 delegate = RenderViewHost::From(host_)->GetDelegate(); |
| 2080 | 2049 |
| 2081 if (delegate && event->type() == ui::ET_GESTURE_BEGIN && | 2050 if (delegate && event->type() == ui::ET_GESTURE_BEGIN && |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2184 host_->GetRootBrowserAccessibilityManager(); | 2153 host_->GetRootBrowserAccessibilityManager(); |
| 2185 if (manager) | 2154 if (manager) |
| 2186 manager->OnWindowFocused(); | 2155 manager->OnWindowFocused(); |
| 2187 } else if (window_ == lost_focus) { | 2156 } else if (window_ == lost_focus) { |
| 2188 host_->SetActive(false); | 2157 host_->SetActive(false); |
| 2189 host_->Blur(); | 2158 host_->Blur(); |
| 2190 | 2159 |
| 2191 DetachFromInputMethod(); | 2160 DetachFromInputMethod(); |
| 2192 host_->SetInputMethodActive(false); | 2161 host_->SetInputMethodActive(false); |
| 2193 | 2162 |
| 2194 if (touch_editing_client_) | 2163 if (selection_controller_) |
| 2195 touch_editing_client_->EndTouchEditing(false); | 2164 selection_controller_->HideAndDisallowShowingAutomatically(); |
| 2196 | 2165 |
| 2197 if (overscroll_controller_) | 2166 if (overscroll_controller_) |
| 2198 overscroll_controller_->Cancel(); | 2167 overscroll_controller_->Cancel(); |
| 2199 | 2168 |
| 2200 BrowserAccessibilityManager* manager = | 2169 BrowserAccessibilityManager* manager = |
| 2201 host_->GetRootBrowserAccessibilityManager(); | 2170 host_->GetRootBrowserAccessibilityManager(); |
| 2202 if (manager) | 2171 if (manager) |
| 2203 manager->OnWindowBlurred(); | 2172 manager->OnWindowBlurred(); |
| 2204 | 2173 |
| 2205 // If we lose the focus while fullscreen, close the window; Pepper Flash | 2174 // 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... |
| 2242 TRACE_EVENT1("ui", "RenderWidgetHostViewAura::OnHostMoved", | 2211 TRACE_EVENT1("ui", "RenderWidgetHostViewAura::OnHostMoved", |
| 2243 "new_origin", new_origin.ToString()); | 2212 "new_origin", new_origin.ToString()); |
| 2244 | 2213 |
| 2245 UpdateScreenInfo(window_); | 2214 UpdateScreenInfo(window_); |
| 2246 } | 2215 } |
| 2247 | 2216 |
| 2248 //////////////////////////////////////////////////////////////////////////////// | 2217 //////////////////////////////////////////////////////////////////////////////// |
| 2249 // RenderWidgetHostViewAura, private: | 2218 // RenderWidgetHostViewAura, private: |
| 2250 | 2219 |
| 2251 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { | 2220 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { |
| 2252 if (touch_editing_client_) | 2221 selection_controller_.reset(); |
| 2253 touch_editing_client_->OnViewDestroyed(); | 2222 selection_controller_client_.reset(); |
| 2254 | |
| 2255 delegated_frame_host_.reset(); | 2223 delegated_frame_host_.reset(); |
| 2256 window_observer_.reset(); | 2224 window_observer_.reset(); |
| 2257 if (window_->GetHost()) | 2225 if (window_->GetHost()) |
| 2258 window_->GetHost()->RemoveObserver(this); | 2226 window_->GetHost()->RemoveObserver(this); |
| 2259 UnlockMouse(); | 2227 UnlockMouse(); |
| 2260 if (popup_parent_host_view_) { | 2228 if (popup_parent_host_view_) { |
| 2261 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || | 2229 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || |
| 2262 popup_parent_host_view_->popup_child_host_view_ == this); | 2230 popup_parent_host_view_->popup_child_host_view_ == this); |
| 2263 popup_parent_host_view_->popup_child_host_view_ = NULL; | 2231 popup_parent_host_view_->popup_child_host_view_ = NULL; |
| 2264 } | 2232 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2394 host_->SendCursorVisibilityState(is_visible); | 2362 host_->SendCursorVisibilityState(is_visible); |
| 2395 } | 2363 } |
| 2396 | 2364 |
| 2397 void RenderWidgetHostViewAura::SetOverscrollControllerEnabled(bool enabled) { | 2365 void RenderWidgetHostViewAura::SetOverscrollControllerEnabled(bool enabled) { |
| 2398 if (!enabled) | 2366 if (!enabled) |
| 2399 overscroll_controller_.reset(); | 2367 overscroll_controller_.reset(); |
| 2400 else if (!overscroll_controller_) | 2368 else if (!overscroll_controller_) |
| 2401 overscroll_controller_.reset(new OverscrollController()); | 2369 overscroll_controller_.reset(new OverscrollController()); |
| 2402 } | 2370 } |
| 2403 | 2371 |
| 2372 void RenderWidgetHostViewAura::InitSelectionController( |
| 2373 ui::TouchSelectionControllerAuraClient* selection_controller_client) { |
| 2374 DCHECK(!selection_controller_client_); |
| 2375 selection_controller_client_.reset(selection_controller_client); |
| 2376 selection_controller_.reset( |
| 2377 new ui::TouchSelectionControllerAura(selection_controller_client)); |
| 2378 } |
| 2379 |
| 2404 void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() { | 2380 void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() { |
| 2405 // The top left corner of our view in window coordinates might not land on a | 2381 // The top left corner of our view in window coordinates might not land on a |
| 2406 // device pixel boundary if we have a non-integer device scale. In that case, | 2382 // device pixel boundary if we have a non-integer device scale. In that case, |
| 2407 // to avoid the web contents area looking blurry we translate the web contents | 2383 // to avoid the web contents area looking blurry we translate the web contents |
| 2408 // in the +x, +y direction to land on the nearest pixel boundary. This may | 2384 // in the +x, +y direction to land on the nearest pixel boundary. This may |
| 2409 // cause the bottom and right edges to be clipped slightly, but that's ok. | 2385 // cause the bottom and right edges to be clipped slightly, but that's ok. |
| 2410 aura::Window* snapped = NULL; | 2386 aura::Window* snapped = NULL; |
| 2411 // On desktop, use the root window. On alternative environment (ash), | 2387 // On desktop, use the root window. On alternative environment (ash), |
| 2412 // use the toplevel window which must be already snapped. | 2388 // use the toplevel window which must be already snapped. |
| 2413 if (gfx::Screen::GetScreenFor(window_) != | 2389 if (gfx::Screen::GetScreenFor(window_) != |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2426 if (HasDisplayPropertyChanged(window_)) | 2402 if (HasDisplayPropertyChanged(window_)) |
| 2427 host_->InvalidateScreenInfo(); | 2403 host_->InvalidateScreenInfo(); |
| 2428 | 2404 |
| 2429 SnapToPhysicalPixelBoundary(); | 2405 SnapToPhysicalPixelBoundary(); |
| 2430 // Don't recursively call SetBounds if this bounds update is the result of | 2406 // Don't recursively call SetBounds if this bounds update is the result of |
| 2431 // a Window::SetBoundsInternal call. | 2407 // a Window::SetBoundsInternal call. |
| 2432 if (!in_bounds_changed_) | 2408 if (!in_bounds_changed_) |
| 2433 window_->SetBounds(rect); | 2409 window_->SetBounds(rect); |
| 2434 host_->WasResized(); | 2410 host_->WasResized(); |
| 2435 delegated_frame_host_->WasResized(); | 2411 delegated_frame_host_->WasResized(); |
| 2436 if (touch_editing_client_) { | |
| 2437 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_, | |
| 2438 selection_focus_); | |
| 2439 } | |
| 2440 #if defined(OS_WIN) | 2412 #if defined(OS_WIN) |
| 2441 // Create the legacy dummy window which corresponds to the bounds of the | 2413 // Create the legacy dummy window which corresponds to the bounds of the |
| 2442 // webcontents. This will be passed as the container window for windowless | 2414 // webcontents. This will be passed as the container window for windowless |
| 2443 // plugins. | 2415 // plugins. |
| 2444 // Plugins like Flash assume the container window which is returned via the | 2416 // Plugins like Flash assume the container window which is returned via the |
| 2445 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. | 2417 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. |
| 2446 // This is not true in Aura where we have only HWND which is the main Aura | 2418 // This is not true in Aura where we have only HWND which is the main Aura |
| 2447 // window. If we return this window to plugins like Flash then it causes the | 2419 // window. If we return this window to plugins like Flash then it causes the |
| 2448 // coordinate translations done by these plugins to break. | 2420 // coordinate translations done by these plugins to break. |
| 2449 // Additonally the legacy dummy window is needed for accessibility and for | 2421 // Additonally the legacy dummy window is needed for accessibility and for |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2573 } | 2545 } |
| 2574 #endif | 2546 #endif |
| 2575 | 2547 |
| 2576 host_->ForwardKeyboardEvent(event); | 2548 host_->ForwardKeyboardEvent(event); |
| 2577 } | 2549 } |
| 2578 | 2550 |
| 2579 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { | 2551 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { |
| 2580 return kN32_SkColorType; | 2552 return kN32_SkColorType; |
| 2581 } | 2553 } |
| 2582 | 2554 |
| 2555 void RenderWidgetHostViewAura::SelectionBoundsUpdated( |
| 2556 const ui::SelectionBound& start, |
| 2557 const ui::SelectionBound& end) { |
| 2558 if (selection_controller_) |
| 2559 selection_controller_->OnSelectionBoundsUpdated(start, end); |
| 2560 if (GetInputMethod()) |
| 2561 GetInputMethod()->OnCaretBoundsChanged(this); |
| 2562 } |
| 2563 |
| 2583 //////////////////////////////////////////////////////////////////////////////// | 2564 //////////////////////////////////////////////////////////////////////////////// |
| 2584 // DelegatedFrameHost, public: | 2565 // DelegatedFrameHost, public: |
| 2585 | 2566 |
| 2586 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { | 2567 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { |
| 2587 aura::WindowTreeHost* host = window_->GetHost(); | 2568 aura::WindowTreeHost* host = window_->GetHost(); |
| 2588 return host ? host->compositor() : NULL; | 2569 return host ? host->compositor() : NULL; |
| 2589 } | 2570 } |
| 2590 | 2571 |
| 2591 ui::Layer* RenderWidgetHostViewAura::GetLayer() { | 2572 ui::Layer* RenderWidgetHostViewAura::GetLayer() { |
| 2592 return window_->layer(); | 2573 return window_->layer(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2629 | 2610 |
| 2630 //////////////////////////////////////////////////////////////////////////////// | 2611 //////////////////////////////////////////////////////////////////////////////// |
| 2631 // RenderWidgetHostViewBase, public: | 2612 // RenderWidgetHostViewBase, public: |
| 2632 | 2613 |
| 2633 // static | 2614 // static |
| 2634 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2615 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2635 GetScreenInfoForWindow(results, NULL); | 2616 GetScreenInfoForWindow(results, NULL); |
| 2636 } | 2617 } |
| 2637 | 2618 |
| 2638 } // namespace content | 2619 } // namespace content |
| OLD | NEW |