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_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1130 // renderer. | 1130 // renderer. |
1131 mouse_move_pending_ = false; | 1131 mouse_move_pending_ = false; |
1132 next_mouse_move_.reset(); | 1132 next_mouse_move_.reset(); |
1133 mouse_wheel_pending_ = false; | 1133 mouse_wheel_pending_ = false; |
1134 coalesced_mouse_wheel_events_.clear(); | 1134 coalesced_mouse_wheel_events_.clear(); |
1135 | 1135 |
1136 // Must reset these to ensure that SelectRange works with a new renderer. | 1136 // Must reset these to ensure that SelectRange works with a new renderer. |
1137 select_range_pending_ = false; | 1137 select_range_pending_ = false; |
1138 next_selection_range_.reset(); | 1138 next_selection_range_.reset(); |
1139 | 1139 |
1140 touch_event_queue_->Reset(); | |
1141 | |
1140 // Must reset these to ensure that gesture events work with a new renderer. | 1142 // Must reset these to ensure that gesture events work with a new renderer. |
1141 gesture_event_filter_->Reset(); | 1143 gesture_event_filter_->Reset(); |
1142 | 1144 |
1143 // Must reset these to ensure that keyboard events work with a new renderer. | 1145 // Must reset these to ensure that keyboard events work with a new renderer. |
1144 key_queue_.clear(); | 1146 key_queue_.clear(); |
1145 suppress_next_char_events_ = false; | 1147 suppress_next_char_events_ = false; |
1146 | 1148 |
1147 // Reset some fields in preparation for recovering from a crash. | 1149 // Reset some fields in preparation for recovering from a crash. |
1148 ResetSizeAndRepaintPendingFlags(); | 1150 ResetSizeAndRepaintPendingFlags(); |
1149 current_size_.SetSize(0, 0); | 1151 current_size_.SetSize(0, 0); |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1749 GetProcess()->ReceivedBadMessage(); | 1751 GetProcess()->ReceivedBadMessage(); |
1750 } | 1752 } |
1751 | 1753 |
1752 void RenderWidgetHostImpl::OnMsgBlur() { | 1754 void RenderWidgetHostImpl::OnMsgBlur() { |
1753 // Only RenderViewHost can deal with that message. | 1755 // Only RenderViewHost can deal with that message. |
1754 RecordAction(UserMetricsAction("BadMessageTerminate_RWH5")); | 1756 RecordAction(UserMetricsAction("BadMessageTerminate_RWH5")); |
1755 GetProcess()->ReceivedBadMessage(); | 1757 GetProcess()->ReceivedBadMessage(); |
1756 } | 1758 } |
1757 | 1759 |
1758 void RenderWidgetHostImpl::OnMsgHasTouchEventHandlers(bool has_handlers) { | 1760 void RenderWidgetHostImpl::OnMsgHasTouchEventHandlers(bool has_handlers) { |
1761 if (has_touch_handler_ == has_handlers) | |
1762 return; | |
1759 has_touch_handler_ = has_handlers; | 1763 has_touch_handler_ = has_handlers; |
1764 if (!has_touch_handler_) | |
1765 touch_event_queue_->FlushQueue(); | |
1760 } | 1766 } |
1761 | 1767 |
1762 void RenderWidgetHostImpl::OnMsgSetCursor(const WebCursor& cursor) { | 1768 void RenderWidgetHostImpl::OnMsgSetCursor(const WebCursor& cursor) { |
1763 if (!view_) { | 1769 if (!view_) { |
1764 return; | 1770 return; |
1765 } | 1771 } |
1766 view_->UpdateCursor(cursor); | 1772 view_->UpdateCursor(cursor); |
1767 } | 1773 } |
1768 | 1774 |
1769 void RenderWidgetHostImpl::OnMsgTextInputStateChanged( | 1775 void RenderWidgetHostImpl::OnMsgTextInputStateChanged( |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1943 } | 1949 } |
1944 | 1950 |
1945 deferred_plugin_handles_.clear(); | 1951 deferred_plugin_handles_.clear(); |
1946 #endif | 1952 #endif |
1947 } | 1953 } |
1948 | 1954 |
1949 const gfx::Point& RenderWidgetHostImpl::GetLastScrollOffset() const { | 1955 const gfx::Point& RenderWidgetHostImpl::GetLastScrollOffset() const { |
1950 return last_scroll_offset_; | 1956 return last_scroll_offset_; |
1951 } | 1957 } |
1952 | 1958 |
1959 bool RenderWidgetHostImpl::ShouldForwardTouchEvent() const { | |
1960 // Always send a touch event if the renderer has a touch-event handler. It is | |
1961 // possible that a renderer stops listening to touch-events while there are | |
1962 // still events in the touch-queue. In such cases, the new events should still | |
1963 // get into the queue. | |
1964 return has_touch_handler_ || !touch_event_queue_->empty(); | |
aelias_OOO_until_Jul13
2012/10/17 01:52:57
Should the queue class hold the has_touch_handler_
sadrul
2012/10/17 02:18:00
I kind of feel like has_touch_handler_ would be ou
| |
1965 } | |
1966 | |
1953 void RenderWidgetHostImpl::StartUserGesture() { | 1967 void RenderWidgetHostImpl::StartUserGesture() { |
1954 OnUserGesture(); | 1968 OnUserGesture(); |
1955 } | 1969 } |
1956 | 1970 |
1957 void RenderWidgetHostImpl::Stop() { | 1971 void RenderWidgetHostImpl::Stop() { |
1958 Send(new ViewMsg_Stop(GetRoutingID())); | 1972 Send(new ViewMsg_Stop(GetRoutingID())); |
1959 } | 1973 } |
1960 | 1974 |
1961 void RenderWidgetHostImpl::SetBackground(const SkBitmap& background) { | 1975 void RenderWidgetHostImpl::SetBackground(const SkBitmap& background) { |
1962 Send(new ViewMsg_SetBackground(GetRoutingID(), background)); | 1976 Send(new ViewMsg_SetBackground(GetRoutingID(), background)); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2130 return; | 2144 return; |
2131 | 2145 |
2132 OnRenderAutoResized(new_size); | 2146 OnRenderAutoResized(new_size); |
2133 } | 2147 } |
2134 | 2148 |
2135 void RenderWidgetHostImpl::DetachDelegate() { | 2149 void RenderWidgetHostImpl::DetachDelegate() { |
2136 delegate_ = NULL; | 2150 delegate_ = NULL; |
2137 } | 2151 } |
2138 | 2152 |
2139 } // namespace content | 2153 } // namespace content |
OLD | NEW |