| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 popup_child_host_view_(NULL), | 622 popup_child_host_view_(NULL), |
| 623 is_loading_(false), | 623 is_loading_(false), |
| 624 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 624 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
| 625 can_compose_inline_(true), | 625 can_compose_inline_(true), |
| 626 has_composition_text_(false), | 626 has_composition_text_(false), |
| 627 paint_canvas_(NULL), | 627 paint_canvas_(NULL), |
| 628 synthetic_move_sent_(false), | 628 synthetic_move_sent_(false), |
| 629 accelerated_compositing_state_changed_(false), | 629 accelerated_compositing_state_changed_(false), |
| 630 can_lock_compositor_(YES), | 630 can_lock_compositor_(YES), |
| 631 paint_observer_(NULL), | 631 paint_observer_(NULL), |
| 632 accessible_parent_(NULL) { | 632 accessible_parent_(NULL), |
| 633 touch_editing_client_(NULL) { |
| 633 host_->SetView(this); | 634 host_->SetView(this); |
| 634 window_observer_.reset(new WindowObserver(this)); | 635 window_observer_.reset(new WindowObserver(this)); |
| 635 aura::client::SetTooltipText(window_, &tooltip_); | 636 aura::client::SetTooltipText(window_, &tooltip_); |
| 636 aura::client::SetActivationDelegate(window_, this); | 637 aura::client::SetActivationDelegate(window_, this); |
| 637 aura::client::SetActivationChangeObserver(window_, this); | 638 aura::client::SetActivationChangeObserver(window_, this); |
| 638 aura::client::SetFocusChangeObserver(window_, this); | 639 aura::client::SetFocusChangeObserver(window_, this); |
| 639 gfx::Screen::GetScreenFor(window_)->AddObserver(this); | 640 gfx::Screen::GetScreenFor(window_)->AddObserver(this); |
| 640 #if defined(OS_WIN) | 641 #if defined(OS_WIN) |
| 641 transient_observer_.reset(new TransientWindowObserver(this)); | 642 transient_observer_.reset(new TransientWindowObserver(this)); |
| 642 #endif | 643 #endif |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 if (can_lock_compositor_ == YES) | 785 if (can_lock_compositor_ == YES) |
| 785 can_lock_compositor_ = YES_DID_LOCK; | 786 can_lock_compositor_ = YES_DID_LOCK; |
| 786 | 787 |
| 787 resize_locks_.push_back(make_linked_ptr( | 788 resize_locks_.push_back(make_linked_ptr( |
| 788 new ResizeLock(root_window, rect.size(), defer_compositor_lock))); | 789 new ResizeLock(root_window, rect.size(), defer_compositor_lock))); |
| 789 #endif | 790 #endif |
| 790 } | 791 } |
| 791 } | 792 } |
| 792 window_->SetBounds(rect); | 793 window_->SetBounds(rect); |
| 793 host_->WasResized(); | 794 host_->WasResized(); |
| 795 if (touch_editing_client_) { |
| 796 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, |
| 797 selection_focus_rect_); |
| 798 } |
| 794 } | 799 } |
| 795 | 800 |
| 796 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { | 801 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { |
| 797 return window_; | 802 return window_; |
| 798 } | 803 } |
| 799 | 804 |
| 800 gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const { | 805 gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const { |
| 801 #if defined(OS_WIN) | 806 #if defined(OS_WIN) |
| 802 aura::RootWindow* root_window = window_->GetRootWindow(); | 807 aura::RootWindow* root_window = window_->GetRootWindow(); |
| 803 if (root_window) { | 808 if (root_window) { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 } | 994 } |
| 990 | 995 |
| 991 void RenderWidgetHostViewAura::TextInputStateChanged( | 996 void RenderWidgetHostViewAura::TextInputStateChanged( |
| 992 const ViewHostMsg_TextInputState_Params& params) { | 997 const ViewHostMsg_TextInputState_Params& params) { |
| 993 if (text_input_type_ != params.type || | 998 if (text_input_type_ != params.type || |
| 994 can_compose_inline_ != params.can_compose_inline) { | 999 can_compose_inline_ != params.can_compose_inline) { |
| 995 text_input_type_ = params.type; | 1000 text_input_type_ = params.type; |
| 996 can_compose_inline_ = params.can_compose_inline; | 1001 can_compose_inline_ = params.can_compose_inline; |
| 997 if (GetInputMethod()) | 1002 if (GetInputMethod()) |
| 998 GetInputMethod()->OnTextInputTypeChanged(this); | 1003 GetInputMethod()->OnTextInputTypeChanged(this); |
| 1004 if (touch_editing_client_) |
| 1005 touch_editing_client_->OnTextInputTypeChanged(text_input_type_); |
| 999 } | 1006 } |
| 1000 } | 1007 } |
| 1001 | 1008 |
| 1002 void RenderWidgetHostViewAura::ImeCancelComposition() { | 1009 void RenderWidgetHostViewAura::ImeCancelComposition() { |
| 1003 if (GetInputMethod()) | 1010 if (GetInputMethod()) |
| 1004 GetInputMethod()->CancelComposition(this); | 1011 GetInputMethod()->CancelComposition(this); |
| 1005 has_composition_text_ = false; | 1012 has_composition_text_ = false; |
| 1006 } | 1013 } |
| 1007 | 1014 |
| 1008 void RenderWidgetHostViewAura::ImeCompositionRangeChanged( | 1015 void RenderWidgetHostViewAura::ImeCompositionRangeChanged( |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 const ViewHostMsg_SelectionBounds_Params& params) { | 1111 const ViewHostMsg_SelectionBounds_Params& params) { |
| 1105 if (selection_anchor_rect_ == params.anchor_rect && | 1112 if (selection_anchor_rect_ == params.anchor_rect && |
| 1106 selection_focus_rect_ == params.focus_rect) | 1113 selection_focus_rect_ == params.focus_rect) |
| 1107 return; | 1114 return; |
| 1108 | 1115 |
| 1109 selection_anchor_rect_ = params.anchor_rect; | 1116 selection_anchor_rect_ = params.anchor_rect; |
| 1110 selection_focus_rect_ = params.focus_rect; | 1117 selection_focus_rect_ = params.focus_rect; |
| 1111 | 1118 |
| 1112 if (GetInputMethod()) | 1119 if (GetInputMethod()) |
| 1113 GetInputMethod()->OnCaretBoundsChanged(this); | 1120 GetInputMethod()->OnCaretBoundsChanged(this); |
| 1121 |
| 1122 if (touch_editing_client_) { |
| 1123 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, |
| 1124 selection_focus_rect_); |
| 1125 } |
| 1114 } | 1126 } |
| 1115 | 1127 |
| 1116 void RenderWidgetHostViewAura::ScrollOffsetChanged() { | 1128 void RenderWidgetHostViewAura::ScrollOffsetChanged() { |
| 1117 aura::RootWindow* root = window_->GetRootWindow(); | 1129 aura::RootWindow* root = window_->GetRootWindow(); |
| 1118 if (!root) | 1130 if (!root) |
| 1119 return; | 1131 return; |
| 1120 aura::client::CursorClient* cursor_client = | 1132 aura::client::CursorClient* cursor_client = |
| 1121 aura::client::GetCursorClient(root); | 1133 aura::client::GetCursorClient(root); |
| 1122 if (cursor_client && !cursor_client->IsCursorVisible()) | 1134 if (cursor_client && !cursor_client->IsCursorVisible()) |
| 1123 cursor_client->DisableMouseEvents(); | 1135 cursor_client->DisableMouseEvents(); |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1711 } | 1723 } |
| 1712 | 1724 |
| 1713 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) { | 1725 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) { |
| 1714 GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL); | 1726 GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL); |
| 1715 } | 1727 } |
| 1716 | 1728 |
| 1717 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { | 1729 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { |
| 1718 return window_->GetToplevelWindow()->GetBoundsInScreen(); | 1730 return window_->GetToplevelWindow()->GetBoundsInScreen(); |
| 1719 } | 1731 } |
| 1720 | 1732 |
| 1733 void RenderWidgetHostViewAura::GestureEventAck(int gesture_event_type) { |
| 1734 if (touch_editing_client_) |
| 1735 touch_editing_client_->GestureEventAck(gesture_event_type); |
| 1736 } |
| 1737 |
| 1721 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( | 1738 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( |
| 1722 const WebKit::WebTouchEvent& touch_event, InputEventAckState ack_result) { | 1739 const WebKit::WebTouchEvent& touch_event, InputEventAckState ack_result) { |
| 1723 ScopedVector<ui::TouchEvent> events; | 1740 ScopedVector<ui::TouchEvent> events; |
| 1724 if (!MakeUITouchEventsFromWebTouchEvents(touch_event, &events, | 1741 if (!MakeUITouchEventsFromWebTouchEvents(touch_event, &events, |
| 1725 SCREEN_COORDINATES)) | 1742 SCREEN_COORDINATES)) |
| 1726 return; | 1743 return; |
| 1727 | 1744 |
| 1728 aura::RootWindow* root = window_->GetRootWindow(); | 1745 aura::RootWindow* root = window_->GetRootWindow(); |
| 1729 // |root| is NULL during tests. | 1746 // |root| is NULL during tests. |
| 1730 if (!root) | 1747 if (!root) |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2052 const gfx::Point& location) { | 2069 const gfx::Point& location) { |
| 2053 return true; | 2070 return true; |
| 2054 } | 2071 } |
| 2055 | 2072 |
| 2056 bool RenderWidgetHostViewAura::CanFocus() { | 2073 bool RenderWidgetHostViewAura::CanFocus() { |
| 2057 return popup_type_ == WebKit::WebPopupTypeNone; | 2074 return popup_type_ == WebKit::WebPopupTypeNone; |
| 2058 } | 2075 } |
| 2059 | 2076 |
| 2060 void RenderWidgetHostViewAura::OnCaptureLost() { | 2077 void RenderWidgetHostViewAura::OnCaptureLost() { |
| 2061 host_->LostCapture(); | 2078 host_->LostCapture(); |
| 2079 if (touch_editing_client_) |
| 2080 touch_editing_client_->EndTouchEditing(); |
| 2062 } | 2081 } |
| 2063 | 2082 |
| 2064 void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { | 2083 void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { |
| 2065 bool is_compositing_active = host_->is_accelerated_compositing_active(); | 2084 bool is_compositing_active = host_->is_accelerated_compositing_active(); |
| 2066 bool has_backing_store = !!host_->GetBackingStore(false); | 2085 bool has_backing_store = !!host_->GetBackingStore(false); |
| 2067 if (is_compositing_active && current_dib_) { | 2086 if (is_compositing_active && current_dib_) { |
| 2068 const gfx::Size window_size = window_->bounds().size(); | 2087 const gfx::Size window_size = window_->bounds().size(); |
| 2069 const gfx::Size& frame_size = last_swapped_surface_size_; | 2088 const gfx::Size& frame_size = last_swapped_surface_size_; |
| 2070 | 2089 |
| 2071 SkBitmap bitmap; | 2090 SkBitmap bitmap; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2171 return scoped_refptr<ui::Texture>( | 2190 return scoped_refptr<ui::Texture>( |
| 2172 factory->CreateOwnedTexture( | 2191 factory->CreateOwnedTexture( |
| 2173 current_surface_->size(), current_device_scale_factor_, texture_id)); | 2192 current_surface_->size(), current_device_scale_factor_, texture_id)); |
| 2174 } | 2193 } |
| 2175 | 2194 |
| 2176 //////////////////////////////////////////////////////////////////////////////// | 2195 //////////////////////////////////////////////////////////////////////////////// |
| 2177 // RenderWidgetHostViewAura, ui::EventHandler implementation: | 2196 // RenderWidgetHostViewAura, ui::EventHandler implementation: |
| 2178 | 2197 |
| 2179 void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { | 2198 void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { |
| 2180 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnKeyEvent"); | 2199 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnKeyEvent"); |
| 2200 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) |
| 2201 return; |
| 2202 |
| 2181 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { | 2203 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { |
| 2182 popup_child_host_view_->OnKeyEvent(event); | 2204 popup_child_host_view_->OnKeyEvent(event); |
| 2183 if (event->handled()) | 2205 if (event->handled()) |
| 2184 return; | 2206 return; |
| 2185 } | 2207 } |
| 2186 | 2208 |
| 2187 // We need to handle the Escape key for Pepper Flash. | 2209 // We need to handle the Escape key for Pepper Flash. |
| 2188 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { | 2210 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { |
| 2189 // Focus the window we were created from. | 2211 // Focus the window we were created from. |
| 2190 if (host_tracker_.get() && !host_tracker_->windows().empty()) { | 2212 if (host_tracker_.get() && !host_tracker_->windows().empty()) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2220 NativeWebKeyboardEvent webkit_event(event); | 2242 NativeWebKeyboardEvent webkit_event(event); |
| 2221 host_->ForwardKeyboardEvent(webkit_event); | 2243 host_->ForwardKeyboardEvent(webkit_event); |
| 2222 } | 2244 } |
| 2223 } | 2245 } |
| 2224 event->SetHandled(); | 2246 event->SetHandled(); |
| 2225 } | 2247 } |
| 2226 | 2248 |
| 2227 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { | 2249 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { |
| 2228 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnMouseEvent"); | 2250 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnMouseEvent"); |
| 2229 | 2251 |
| 2252 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) |
| 2253 return; |
| 2254 |
| 2230 if (mouse_locked_) { | 2255 if (mouse_locked_) { |
| 2231 // Hide the cursor if someone else has shown it. | 2256 // Hide the cursor if someone else has shown it. |
| 2232 aura::client::CursorClient* cursor_client = | 2257 aura::client::CursorClient* cursor_client = |
| 2233 aura::client::GetCursorClient(window_->GetRootWindow()); | 2258 aura::client::GetCursorClient(window_->GetRootWindow()); |
| 2234 if (cursor_client && cursor_client->IsCursorVisible()) | 2259 if (cursor_client && cursor_client->IsCursorVisible()) |
| 2235 cursor_client->DisableMouseEvents(); | 2260 cursor_client->DisableMouseEvents(); |
| 2236 | 2261 |
| 2237 WebKit::WebMouseEvent mouse_event = MakeWebMouseEvent(event); | 2262 WebKit::WebMouseEvent mouse_event = MakeWebMouseEvent(event); |
| 2238 gfx::Point center(gfx::Rect(window_->bounds().size()).CenterPoint()); | 2263 gfx::Point center(gfx::Rect(window_->bounds().size()).CenterPoint()); |
| 2239 | 2264 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2324 if (!is_fullscreen_ && window_->parent()->delegate() && | 2349 if (!is_fullscreen_ && window_->parent()->delegate() && |
| 2325 !(event->flags() & ui::EF_FROM_TOUCH)) | 2350 !(event->flags() & ui::EF_FROM_TOUCH)) |
| 2326 window_->parent()->delegate()->OnMouseEvent(event); | 2351 window_->parent()->delegate()->OnMouseEvent(event); |
| 2327 | 2352 |
| 2328 if (!IsXButtonUpEvent(event)) | 2353 if (!IsXButtonUpEvent(event)) |
| 2329 event->SetHandled(); | 2354 event->SetHandled(); |
| 2330 } | 2355 } |
| 2331 | 2356 |
| 2332 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { | 2357 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { |
| 2333 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnScrollEvent"); | 2358 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnScrollEvent"); |
| 2359 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) |
| 2360 return; |
| 2361 |
| 2334 if (event->type() == ui::ET_SCROLL) { | 2362 if (event->type() == ui::ET_SCROLL) { |
| 2335 if (event->finger_count() != 2) | 2363 if (event->finger_count() != 2) |
| 2336 return; | 2364 return; |
| 2337 WebKit::WebGestureEvent gesture_event = | 2365 WebKit::WebGestureEvent gesture_event = |
| 2338 MakeWebGestureEventFlingCancel(); | 2366 MakeWebGestureEventFlingCancel(); |
| 2339 host_->ForwardGestureEvent(gesture_event); | 2367 host_->ForwardGestureEvent(gesture_event); |
| 2340 WebKit::WebMouseWheelEvent mouse_wheel_event = | 2368 WebKit::WebMouseWheelEvent mouse_wheel_event = |
| 2341 MakeWebMouseWheelEvent(static_cast<ui::ScrollEvent*>(event)); | 2369 MakeWebMouseWheelEvent(static_cast<ui::ScrollEvent*>(event)); |
| 2342 host_->ForwardWheelEvent(mouse_wheel_event); | 2370 host_->ForwardWheelEvent(mouse_wheel_event); |
| 2343 RecordAction(UserMetricsAction("TrackpadScroll")); | 2371 RecordAction(UserMetricsAction("TrackpadScroll")); |
| 2344 } else if (event->type() == ui::ET_SCROLL_FLING_START || | 2372 } else if (event->type() == ui::ET_SCROLL_FLING_START || |
| 2345 event->type() == ui::ET_SCROLL_FLING_CANCEL) { | 2373 event->type() == ui::ET_SCROLL_FLING_CANCEL) { |
| 2346 WebKit::WebGestureEvent gesture_event = | 2374 WebKit::WebGestureEvent gesture_event = |
| 2347 MakeWebGestureEvent(static_cast<ui::ScrollEvent*>(event)); | 2375 MakeWebGestureEvent(static_cast<ui::ScrollEvent*>(event)); |
| 2348 host_->ForwardGestureEvent(gesture_event); | 2376 host_->ForwardGestureEvent(gesture_event); |
| 2349 if (event->type() == ui::ET_SCROLL_FLING_START) | 2377 if (event->type() == ui::ET_SCROLL_FLING_START) |
| 2350 RecordAction(UserMetricsAction("TrackpadScrollFling")); | 2378 RecordAction(UserMetricsAction("TrackpadScrollFling")); |
| 2351 } | 2379 } |
| 2352 | 2380 |
| 2353 event->SetHandled(); | 2381 event->SetHandled(); |
| 2354 } | 2382 } |
| 2355 | 2383 |
| 2356 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { | 2384 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { |
| 2357 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnTouchEvent"); | 2385 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnTouchEvent"); |
| 2386 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) |
| 2387 return; |
| 2388 |
| 2358 // Update the touch event first. | 2389 // Update the touch event first. |
| 2359 WebKit::WebTouchPoint* point = UpdateWebTouchEventFromUIEvent(*event, | 2390 WebKit::WebTouchPoint* point = UpdateWebTouchEventFromUIEvent(*event, |
| 2360 &touch_event_); | 2391 &touch_event_); |
| 2361 | 2392 |
| 2362 // Forward the touch event only if a touch point was updated, and there's a | 2393 // Forward the touch event only if a touch point was updated, and there's a |
| 2363 // touch-event handler in the page, and no other touch-event is in the queue. | 2394 // touch-event handler in the page, and no other touch-event is in the queue. |
| 2364 // It is important to always consume the event if there is a touch-event | 2395 // It is important to always consume the event if there is a touch-event |
| 2365 // handler in the page, or some touch-event is already in the queue, even if | 2396 // handler in the page, or some touch-event is already in the queue, even if |
| 2366 // no point has been updated, to make sure that this event does not get | 2397 // no point has been updated, to make sure that this event does not get |
| 2367 // processed by the gesture recognizer before the events in the queue. | 2398 // processed by the gesture recognizer before the events in the queue. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2378 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { | 2409 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { |
| 2379 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnGestureEvent"); | 2410 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnGestureEvent"); |
| 2380 // Pinch gestures are currently disabled by default. See crbug.com/128477. | 2411 // Pinch gestures are currently disabled by default. See crbug.com/128477. |
| 2381 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || | 2412 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || |
| 2382 event->type() == ui::ET_GESTURE_PINCH_UPDATE || | 2413 event->type() == ui::ET_GESTURE_PINCH_UPDATE || |
| 2383 event->type() == ui::ET_GESTURE_PINCH_END) && !ShouldSendPinchGesture()) { | 2414 event->type() == ui::ET_GESTURE_PINCH_END) && !ShouldSendPinchGesture()) { |
| 2384 event->SetHandled(); | 2415 event->SetHandled(); |
| 2385 return; | 2416 return; |
| 2386 } | 2417 } |
| 2387 | 2418 |
| 2419 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) |
| 2420 return; |
| 2421 |
| 2388 RenderViewHostDelegate* delegate = NULL; | 2422 RenderViewHostDelegate* delegate = NULL; |
| 2389 if (popup_type_ == WebKit::WebPopupTypeNone && !is_fullscreen_) | 2423 if (popup_type_ == WebKit::WebPopupTypeNone && !is_fullscreen_) |
| 2390 delegate = RenderViewHost::From(host_)->GetDelegate(); | 2424 delegate = RenderViewHost::From(host_)->GetDelegate(); |
| 2391 | 2425 |
| 2392 if (delegate && event->type() == ui::ET_GESTURE_BEGIN && | 2426 if (delegate && event->type() == ui::ET_GESTURE_BEGIN && |
| 2393 event->details().touch_points() == 1) { | 2427 event->details().touch_points() == 1) { |
| 2394 delegate->HandleGestureBegin(); | 2428 delegate->HandleGestureBegin(); |
| 2395 } | 2429 } |
| 2396 | 2430 |
| 2397 WebKit::WebGestureEvent gesture = MakeWebGestureEvent(event); | 2431 WebKit::WebGestureEvent gesture = MakeWebGestureEvent(event); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2495 // window if we lose the focus to a window on another display. | 2529 // window if we lose the focus to a window on another display. |
| 2496 gfx::Screen* screen = gfx::Screen::GetScreenFor(window_); | 2530 gfx::Screen* screen = gfx::Screen::GetScreenFor(window_); |
| 2497 bool focusing_other_display = | 2531 bool focusing_other_display = |
| 2498 gained_focus && screen->GetNumDisplays() > 1 && | 2532 gained_focus && screen->GetNumDisplays() > 1 && |
| 2499 (screen->GetDisplayNearestWindow(window_).id() != | 2533 (screen->GetDisplayNearestWindow(window_).id() != |
| 2500 screen->GetDisplayNearestWindow(gained_focus).id()); | 2534 screen->GetDisplayNearestWindow(gained_focus).id()); |
| 2501 if (is_fullscreen_ && !in_shutdown_ && !focusing_other_display) { | 2535 if (is_fullscreen_ && !in_shutdown_ && !focusing_other_display) { |
| 2502 in_shutdown_ = true; | 2536 in_shutdown_ = true; |
| 2503 host_->Shutdown(); | 2537 host_->Shutdown(); |
| 2504 } | 2538 } |
| 2539 if (touch_editing_client_) |
| 2540 touch_editing_client_->EndTouchEditing(); |
| 2505 } | 2541 } |
| 2506 } | 2542 } |
| 2507 | 2543 |
| 2508 //////////////////////////////////////////////////////////////////////////////// | 2544 //////////////////////////////////////////////////////////////////////////////// |
| 2509 // RenderWidgetHostViewAura, aura::RootWindowObserver implementation: | 2545 // RenderWidgetHostViewAura, aura::RootWindowObserver implementation: |
| 2510 | 2546 |
| 2511 void RenderWidgetHostViewAura::OnRootWindowMoved(const aura::RootWindow* root, | 2547 void RenderWidgetHostViewAura::OnRootWindowMoved(const aura::RootWindow* root, |
| 2512 const gfx::Point& new_origin) { | 2548 const gfx::Point& new_origin) { |
| 2513 UpdateScreenInfo(window_); | 2549 UpdateScreenInfo(window_); |
| 2514 } | 2550 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2633 host_->CompositingSurfaceUpdated(); | 2669 host_->CompositingSurfaceUpdated(); |
| 2634 host_->ScheduleComposite(); | 2670 host_->ScheduleComposite(); |
| 2635 } | 2671 } |
| 2636 | 2672 |
| 2637 //////////////////////////////////////////////////////////////////////////////// | 2673 //////////////////////////////////////////////////////////////////////////////// |
| 2638 // RenderWidgetHostViewAura, private: | 2674 // RenderWidgetHostViewAura, private: |
| 2639 | 2675 |
| 2640 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { | 2676 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { |
| 2641 if (paint_observer_) | 2677 if (paint_observer_) |
| 2642 paint_observer_->OnViewDestroyed(); | 2678 paint_observer_->OnViewDestroyed(); |
| 2679 if (touch_editing_client_) |
| 2680 touch_editing_client_->OnViewDestroyed(); |
| 2643 if (!shared_surface_handle_.is_null()) { | 2681 if (!shared_surface_handle_.is_null()) { |
| 2644 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 2682 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 2645 factory->DestroySharedSurfaceHandle(shared_surface_handle_); | 2683 factory->DestroySharedSurfaceHandle(shared_surface_handle_); |
| 2646 factory->RemoveObserver(this); | 2684 factory->RemoveObserver(this); |
| 2647 } | 2685 } |
| 2648 window_observer_.reset(); | 2686 window_observer_.reset(); |
| 2649 #if defined(OS_WIN) | 2687 #if defined(OS_WIN) |
| 2650 transient_observer_.reset(); | 2688 transient_observer_.reset(); |
| 2651 #endif | 2689 #endif |
| 2652 if (window_->GetRootWindow()) | 2690 if (window_->GetRootWindow()) |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2845 RenderWidgetHost* widget) { | 2883 RenderWidgetHost* widget) { |
| 2846 return new RenderWidgetHostViewAura(widget); | 2884 return new RenderWidgetHostViewAura(widget); |
| 2847 } | 2885 } |
| 2848 | 2886 |
| 2849 // static | 2887 // static |
| 2850 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 2888 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2851 GetScreenInfoForWindow(results, NULL); | 2889 GetScreenInfoForWindow(results, NULL); |
| 2852 } | 2890 } |
| 2853 | 2891 |
| 2854 } // namespace content | 2892 } // namespace content |
| OLD | NEW |