| 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_win.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_win.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <peninputpanel_i.c> | 9 #include <peninputpanel_i.c> |
| 10 #include <stack> | 10 #include <stack> |
| (...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 render_widget_host_->Blur(); | 1527 render_widget_host_->Blur(); |
| 1528 | 1528 |
| 1529 if (base::win::IsTsfAwareRequired()) | 1529 if (base::win::IsTsfAwareRequired()) |
| 1530 ui::TsfBridge::GetInstance()->RemoveFocusedClient(this); | 1530 ui::TsfBridge::GetInstance()->RemoveFocusedClient(this); |
| 1531 } | 1531 } |
| 1532 | 1532 |
| 1533 void RenderWidgetHostViewWin::OnCaptureChanged(HWND window) { | 1533 void RenderWidgetHostViewWin::OnCaptureChanged(HWND window) { |
| 1534 TRACE_EVENT0("browser", "RenderWidgetHostViewWin::OnCaptureChanged"); | 1534 TRACE_EVENT0("browser", "RenderWidgetHostViewWin::OnCaptureChanged"); |
| 1535 if (render_widget_host_) | 1535 if (render_widget_host_) |
| 1536 render_widget_host_->LostCapture(); | 1536 render_widget_host_->LostCapture(); |
| 1537 pointer_down_context_ = false; |
| 1537 } | 1538 } |
| 1538 | 1539 |
| 1539 void RenderWidgetHostViewWin::OnCancelMode() { | 1540 void RenderWidgetHostViewWin::OnCancelMode() { |
| 1540 TRACE_EVENT0("browser", "RenderWidgetHostViewWin::OnCancelMode"); | 1541 TRACE_EVENT0("browser", "RenderWidgetHostViewWin::OnCancelMode"); |
| 1541 if (render_widget_host_) | 1542 if (render_widget_host_) |
| 1542 render_widget_host_->LostCapture(); | 1543 render_widget_host_->LostCapture(); |
| 1543 | 1544 |
| 1544 if ((is_fullscreen_ || close_on_deactivate_) && | 1545 if ((is_fullscreen_ || close_on_deactivate_) && |
| 1545 !weak_factory_.HasWeakPtrs()) { | 1546 !weak_factory_.HasWeakPtrs()) { |
| 1546 // Dismiss popups and menus. We do this asynchronously to avoid changing | 1547 // Dismiss popups and menus. We do this asynchronously to avoid changing |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1838 parent_msg_lparam = MAKELPARAM(cursor_pos.x, cursor_pos.y); | 1839 parent_msg_lparam = MAKELPARAM(cursor_pos.x, cursor_pos.y); |
| 1839 } | 1840 } |
| 1840 if (SendMessage(GetParent(), message, wparam, parent_msg_lparam) != 0) { | 1841 if (SendMessage(GetParent(), message, wparam, parent_msg_lparam) != 0) { |
| 1841 TRACE_EVENT0("browser", "EarlyOut_SentToParent"); | 1842 TRACE_EVENT0("browser", "EarlyOut_SentToParent"); |
| 1842 return 1; | 1843 return 1; |
| 1843 } | 1844 } |
| 1844 } | 1845 } |
| 1845 } | 1846 } |
| 1846 } | 1847 } |
| 1847 | 1848 |
| 1848 if (message == WM_LBUTTONDOWN && GetBrowserAccessibilityManager()) | 1849 if (message == WM_LBUTTONDOWN && pointer_down_context_ && |
| 1850 GetBrowserAccessibilityManager()) |
| 1849 GetBrowserAccessibilityManager()->GotMouseDown(); | 1851 GetBrowserAccessibilityManager()->GotMouseDown(); |
| 1850 | 1852 |
| 1851 if (message == WM_LBUTTONUP && ui::IsMouseEventFromTouch(message) && | 1853 if (message == WM_LBUTTONUP && ui::IsMouseEventFromTouch(message) && |
| 1852 base::win::IsMetroProcess()) | 1854 base::win::IsMetroProcess()) |
| 1853 pointer_down_context_ = false; | 1855 pointer_down_context_ = false; |
| 1854 | 1856 |
| 1855 ForwardMouseEventToRenderer(message, wparam, lparam); | 1857 ForwardMouseEventToRenderer(message, wparam, lparam); |
| 1856 return 0; | 1858 return 0; |
| 1857 } | 1859 } |
| 1858 | 1860 |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2204 size_t total = std::min(static_cast<int>(LOWORD(wparam)), | 2206 size_t total = std::min(static_cast<int>(LOWORD(wparam)), |
| 2205 static_cast<int>(WebKit::WebTouchEvent::touchesLengthCap)); | 2207 static_cast<int>(WebKit::WebTouchEvent::touchesLengthCap)); |
| 2206 TOUCHINPUT points[WebKit::WebTouchEvent::touchesLengthCap]; | 2208 TOUCHINPUT points[WebKit::WebTouchEvent::touchesLengthCap]; |
| 2207 | 2209 |
| 2208 if (!total || !GetTouchInputInfo((HTOUCHINPUT)lparam, total, | 2210 if (!total || !GetTouchInputInfo((HTOUCHINPUT)lparam, total, |
| 2209 points, sizeof(TOUCHINPUT))) { | 2211 points, sizeof(TOUCHINPUT))) { |
| 2210 TRACE_EVENT0("browser", "EarlyOut_NothingToDo"); | 2212 TRACE_EVENT0("browser", "EarlyOut_NothingToDo"); |
| 2211 return 0; | 2213 return 0; |
| 2212 } | 2214 } |
| 2213 | 2215 |
| 2216 if (total == 1 && (points[0].dwFlags & TOUCHEVENTF_DOWN)) |
| 2217 pointer_down_context_ = true; |
| 2218 |
| 2214 bool has_touch_handler = render_widget_host_->has_touch_handler() && | 2219 bool has_touch_handler = render_widget_host_->has_touch_handler() && |
| 2215 touch_events_enabled_; | 2220 touch_events_enabled_; |
| 2216 | 2221 |
| 2217 // Send a copy of the touch events on to the gesture recognizer. | 2222 // Send a copy of the touch events on to the gesture recognizer. |
| 2218 for (size_t start = 0; start < total;) { | 2223 for (size_t start = 0; start < total;) { |
| 2219 start += touch_state_->UpdateTouchPoints(points + start, total - start); | 2224 start += touch_state_->UpdateTouchPoints(points + start, total - start); |
| 2220 if (has_touch_handler) { | 2225 if (has_touch_handler) { |
| 2221 if (touch_state_->is_changed()) { | 2226 if (touch_state_->is_changed()) { |
| 2222 render_widget_host_->ForwardTouchEvent(touch_state_->touch_event()); | 2227 render_widget_host_->ForwardTouchEvent(touch_state_->touch_event()); |
| 2223 touch_state_->QueueEvents(this, gesture_recognizer_.get()); | 2228 touch_state_->QueueEvents(this, gesture_recognizer_.get()); |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2683 TRACE_EVENT0("browser", "RenderWidgetHostViewWin::OnPointerMessage"); | 2688 TRACE_EVENT0("browser", "RenderWidgetHostViewWin::OnPointerMessage"); |
| 2684 POINT point = {0}; | 2689 POINT point = {0}; |
| 2685 | 2690 |
| 2686 point.x = GET_X_LPARAM(lparam); | 2691 point.x = GET_X_LPARAM(lparam); |
| 2687 point.y = GET_Y_LPARAM(lparam); | 2692 point.y = GET_Y_LPARAM(lparam); |
| 2688 ScreenToClient(&point); | 2693 ScreenToClient(&point); |
| 2689 | 2694 |
| 2690 lparam = MAKELPARAM(point.x, point.y); | 2695 lparam = MAKELPARAM(point.x, point.y); |
| 2691 | 2696 |
| 2692 if (message == WM_POINTERDOWN) { | 2697 if (message == WM_POINTERDOWN) { |
| 2693 pointer_down_context_ = true; | |
| 2694 if (!base::win::IsMetroProcess()) { | 2698 if (!base::win::IsMetroProcess()) { |
| 2699 pointer_down_context_ = true; |
| 2695 SetFocus(); | 2700 SetFocus(); |
| 2696 received_focus_change_after_pointer_down_ = false; | 2701 received_focus_change_after_pointer_down_ = false; |
| 2697 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 2702 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 2698 base::Bind(&RenderWidgetHostViewWin::ResetPointerDownContext, | 2703 base::Bind(&RenderWidgetHostViewWin::ResetPointerDownContext, |
| 2699 weak_factory_.GetWeakPtr()), | 2704 weak_factory_.GetWeakPtr()), |
| 2700 base::TimeDelta::FromMilliseconds(kPointerDownContextResetDelay)); | 2705 base::TimeDelta::FromMilliseconds(kPointerDownContextResetDelay)); |
| 2701 } | 2706 } |
| 2702 } | 2707 } |
| 2703 handled = FALSE; | 2708 handled = FALSE; |
| 2704 return 0; | 2709 return 0; |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3102 // receive a focus change in the context of a pointer down message, it means | 3107 // receive a focus change in the context of a pointer down message, it means |
| 3103 // that the pointer down message occurred on the edit field and we should | 3108 // that the pointer down message occurred on the edit field and we should |
| 3104 // display the on screen keyboard | 3109 // display the on screen keyboard |
| 3105 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) | 3110 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) |
| 3106 DisplayOnScreenKeyboardIfNeeded(); | 3111 DisplayOnScreenKeyboardIfNeeded(); |
| 3107 received_focus_change_after_pointer_down_ = false; | 3112 received_focus_change_after_pointer_down_ = false; |
| 3108 pointer_down_context_ = false; | 3113 pointer_down_context_ = false; |
| 3109 } | 3114 } |
| 3110 | 3115 |
| 3111 } // namespace content | 3116 } // namespace content |
| OLD | NEW |