Chromium Code Reviews| 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 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1838 parent_msg_lparam = MAKELPARAM(cursor_pos.x, cursor_pos.y); | 1838 parent_msg_lparam = MAKELPARAM(cursor_pos.x, cursor_pos.y); |
| 1839 } | 1839 } |
| 1840 if (SendMessage(GetParent(), message, wparam, parent_msg_lparam) != 0) { | 1840 if (SendMessage(GetParent(), message, wparam, parent_msg_lparam) != 0) { |
| 1841 TRACE_EVENT0("browser", "EarlyOut_SentToParent"); | 1841 TRACE_EVENT0("browser", "EarlyOut_SentToParent"); |
| 1842 return 1; | 1842 return 1; |
| 1843 } | 1843 } |
| 1844 } | 1844 } |
| 1845 } | 1845 } |
| 1846 } | 1846 } |
| 1847 | 1847 |
| 1848 if (message == WM_LBUTTONDOWN && GetBrowserAccessibilityManager()) | 1848 if (message == WM_LBUTTONDOWN && pointer_down_context_ && |
| 1849 GetBrowserAccessibilityManager()) | |
| 1849 GetBrowserAccessibilityManager()->GotMouseDown(); | 1850 GetBrowserAccessibilityManager()->GotMouseDown(); |
| 1850 | 1851 |
| 1851 if (message == WM_LBUTTONUP && ui::IsMouseEventFromTouch(message) && | 1852 if (message == WM_LBUTTONUP && ui::IsMouseEventFromTouch(message) && |
| 1852 base::win::IsMetroProcess()) | 1853 base::win::IsMetroProcess()) |
| 1853 pointer_down_context_ = false; | 1854 pointer_down_context_ = false; |
| 1854 | 1855 |
| 1855 ForwardMouseEventToRenderer(message, wparam, lparam); | 1856 ForwardMouseEventToRenderer(message, wparam, lparam); |
| 1856 return 0; | 1857 return 0; |
| 1857 } | 1858 } |
| 1858 | 1859 |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2204 size_t total = std::min(static_cast<int>(LOWORD(wparam)), | 2205 size_t total = std::min(static_cast<int>(LOWORD(wparam)), |
| 2205 static_cast<int>(WebKit::WebTouchEvent::touchesLengthCap)); | 2206 static_cast<int>(WebKit::WebTouchEvent::touchesLengthCap)); |
| 2206 TOUCHINPUT points[WebKit::WebTouchEvent::touchesLengthCap]; | 2207 TOUCHINPUT points[WebKit::WebTouchEvent::touchesLengthCap]; |
| 2207 | 2208 |
| 2208 if (!total || !GetTouchInputInfo((HTOUCHINPUT)lparam, total, | 2209 if (!total || !GetTouchInputInfo((HTOUCHINPUT)lparam, total, |
| 2209 points, sizeof(TOUCHINPUT))) { | 2210 points, sizeof(TOUCHINPUT))) { |
| 2210 TRACE_EVENT0("browser", "EarlyOut_NothingToDo"); | 2211 TRACE_EVENT0("browser", "EarlyOut_NothingToDo"); |
| 2211 return 0; | 2212 return 0; |
| 2212 } | 2213 } |
| 2213 | 2214 |
| 2215 if (total == 1) { | |
|
sky
2012/09/20 20:08:14
combine into a single if.
ananta
2012/09/20 22:00:11
Done.
| |
| 2216 if (points[0].dwFlags & TOUCHEVENTF_DOWN) | |
| 2217 pointer_down_context_ = true; | |
| 2218 } | |
| 2219 | |
| 2214 bool has_touch_handler = render_widget_host_->has_touch_handler() && | 2220 bool has_touch_handler = render_widget_host_->has_touch_handler() && |
| 2215 touch_events_enabled_; | 2221 touch_events_enabled_; |
| 2216 | 2222 |
| 2217 // Send a copy of the touch events on to the gesture recognizer. | 2223 // Send a copy of the touch events on to the gesture recognizer. |
| 2218 for (size_t start = 0; start < total;) { | 2224 for (size_t start = 0; start < total;) { |
| 2219 start += touch_state_->UpdateTouchPoints(points + start, total - start); | 2225 start += touch_state_->UpdateTouchPoints(points + start, total - start); |
| 2220 if (has_touch_handler) { | 2226 if (has_touch_handler) { |
| 2221 if (touch_state_->is_changed()) { | 2227 if (touch_state_->is_changed()) { |
| 2222 render_widget_host_->ForwardTouchEvent(touch_state_->touch_event()); | 2228 render_widget_host_->ForwardTouchEvent(touch_state_->touch_event()); |
| 2223 touch_state_->QueueEvents(this, gesture_recognizer_.get()); | 2229 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"); | 2689 TRACE_EVENT0("browser", "RenderWidgetHostViewWin::OnPointerMessage"); |
| 2684 POINT point = {0}; | 2690 POINT point = {0}; |
| 2685 | 2691 |
| 2686 point.x = GET_X_LPARAM(lparam); | 2692 point.x = GET_X_LPARAM(lparam); |
| 2687 point.y = GET_Y_LPARAM(lparam); | 2693 point.y = GET_Y_LPARAM(lparam); |
| 2688 ScreenToClient(&point); | 2694 ScreenToClient(&point); |
| 2689 | 2695 |
| 2690 lparam = MAKELPARAM(point.x, point.y); | 2696 lparam = MAKELPARAM(point.x, point.y); |
| 2691 | 2697 |
| 2692 if (message == WM_POINTERDOWN) { | 2698 if (message == WM_POINTERDOWN) { |
| 2693 pointer_down_context_ = true; | |
| 2694 if (!base::win::IsMetroProcess()) { | 2699 if (!base::win::IsMetroProcess()) { |
| 2700 pointer_down_context_ = true; | |
|
sky
2012/09/20 20:08:14
One other question, should we force to false in ca
ananta
2012/09/20 22:00:11
Good point. Done.
| |
| 2695 SetFocus(); | 2701 SetFocus(); |
| 2696 received_focus_change_after_pointer_down_ = false; | 2702 received_focus_change_after_pointer_down_ = false; |
| 2697 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 2703 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 2698 base::Bind(&RenderWidgetHostViewWin::ResetPointerDownContext, | 2704 base::Bind(&RenderWidgetHostViewWin::ResetPointerDownContext, |
| 2699 weak_factory_.GetWeakPtr()), | 2705 weak_factory_.GetWeakPtr()), |
| 2700 base::TimeDelta::FromMilliseconds(kPointerDownContextResetDelay)); | 2706 base::TimeDelta::FromMilliseconds(kPointerDownContextResetDelay)); |
| 2701 } | 2707 } |
| 2702 } | 2708 } |
| 2703 handled = FALSE; | 2709 handled = FALSE; |
| 2704 return 0; | 2710 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 | 3108 // 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 | 3109 // that the pointer down message occurred on the edit field and we should |
| 3104 // display the on screen keyboard | 3110 // display the on screen keyboard |
| 3105 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) | 3111 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) |
| 3106 DisplayOnScreenKeyboardIfNeeded(); | 3112 DisplayOnScreenKeyboardIfNeeded(); |
| 3107 received_focus_change_after_pointer_down_ = false; | 3113 received_focus_change_after_pointer_down_ = false; |
| 3108 pointer_down_context_ = false; | 3114 pointer_down_context_ = false; |
| 3109 } | 3115 } |
| 3110 | 3116 |
| 3111 } // namespace content | 3117 } // namespace content |
| OLD | NEW |