Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 11593011: Add a new code/message path for moving an insertion handle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + function rename Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 is_hidden_(false), 131 is_hidden_(false),
132 is_fullscreen_(false), 132 is_fullscreen_(false),
133 is_accelerated_compositing_active_(false), 133 is_accelerated_compositing_active_(false),
134 repaint_ack_pending_(false), 134 repaint_ack_pending_(false),
135 resize_ack_pending_(false), 135 resize_ack_pending_(false),
136 should_auto_resize_(false), 136 should_auto_resize_(false),
137 waiting_for_screen_rects_ack_(false), 137 waiting_for_screen_rects_ack_(false),
138 mouse_move_pending_(false), 138 mouse_move_pending_(false),
139 mouse_wheel_pending_(false), 139 mouse_wheel_pending_(false),
140 select_range_pending_(false), 140 select_range_pending_(false),
141 move_caret_pending_(false),
141 needs_repainting_on_restore_(false), 142 needs_repainting_on_restore_(false),
142 is_unresponsive_(false), 143 is_unresponsive_(false),
143 in_flight_event_count_(0), 144 in_flight_event_count_(0),
144 in_get_backing_store_(false), 145 in_get_backing_store_(false),
145 abort_get_backing_store_(false), 146 abort_get_backing_store_(false),
146 view_being_painted_(false), 147 view_being_painted_(false),
147 ignore_input_events_(false), 148 ignore_input_events_(false),
148 text_direction_updated_(false), 149 text_direction_updated_(false),
149 text_direction_(WebKit::WebTextDirectionLeftToRight), 150 text_direction_(WebKit::WebTextDirectionLeftToRight),
150 text_direction_canceled_(false), 151 text_direction_canceled_(false),
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnSetTooltipText) 333 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnSetTooltipText)
333 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnPaintAtSizeAck) 334 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnPaintAtSizeAck)
334 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped, 335 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped,
335 OnCompositorSurfaceBuffersSwapped) 336 OnCompositorSurfaceBuffersSwapped)
336 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapCompositorFrame, OnSwapCompositorFrame) 337 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapCompositorFrame, OnSwapCompositorFrame)
337 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) 338 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect)
338 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnUpdateIsDelayed) 339 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnUpdateIsDelayed)
339 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnInputEventAck) 340 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnInputEventAck)
340 IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnBeginSmoothScroll) 341 IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnBeginSmoothScroll)
341 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnSelectRangeAck) 342 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnSelectRangeAck)
343 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveCaret_ACK, OnMsgMoveCaretAck)
342 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnFocus) 344 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnFocus)
343 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnBlur) 345 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnBlur)
344 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, 346 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers,
345 OnHasTouchEventHandlers) 347 OnHasTouchEventHandlers)
346 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) 348 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor)
347 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, 349 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
348 OnTextInputStateChanged) 350 OnTextInputStateChanged)
349 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged, 351 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged,
350 OnImeCompositionRangeChanged) 352 OnImeCompositionRangeChanged)
351 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, 353 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition,
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 // renderer. 1202 // renderer.
1201 mouse_move_pending_ = false; 1203 mouse_move_pending_ = false;
1202 next_mouse_move_.reset(); 1204 next_mouse_move_.reset();
1203 mouse_wheel_pending_ = false; 1205 mouse_wheel_pending_ = false;
1204 coalesced_mouse_wheel_events_.clear(); 1206 coalesced_mouse_wheel_events_.clear();
1205 1207
1206 // Must reset these to ensure that SelectRange works with a new renderer. 1208 // Must reset these to ensure that SelectRange works with a new renderer.
1207 select_range_pending_ = false; 1209 select_range_pending_ = false;
1208 next_selection_range_.reset(); 1210 next_selection_range_.reset();
1209 1211
1212 // Must reset these to ensure that MoveCaret works with a new renderer.
1213 move_caret_pending_ = false;
1214 next_move_caret_.reset();
1215
1210 touch_event_queue_->Reset(); 1216 touch_event_queue_->Reset();
1211 1217
1212 // Must reset these to ensure that gesture events work with a new renderer. 1218 // Must reset these to ensure that gesture events work with a new renderer.
1213 gesture_event_filter_->Reset(); 1219 gesture_event_filter_->Reset();
1214 1220
1215 if (overscroll_controller_.get()) 1221 if (overscroll_controller_.get())
1216 overscroll_controller_->Reset(); 1222 overscroll_controller_->Reset();
1217 1223
1218 // Must reset these to ensure that keyboard events work with a new renderer. 1224 // Must reset these to ensure that keyboard events work with a new renderer.
1219 key_queue_.clear(); 1225 key_queue_.clear();
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 } 1841 }
1836 1842
1837 void RenderWidgetHostImpl::OnSelectRangeAck() { 1843 void RenderWidgetHostImpl::OnSelectRangeAck() {
1838 select_range_pending_ = false; 1844 select_range_pending_ = false;
1839 if (next_selection_range_.get()) { 1845 if (next_selection_range_.get()) {
1840 scoped_ptr<SelectionRange> next(next_selection_range_.Pass()); 1846 scoped_ptr<SelectionRange> next(next_selection_range_.Pass());
1841 SelectRange(next->start, next->end); 1847 SelectRange(next->start, next->end);
1842 } 1848 }
1843 } 1849 }
1844 1850
1851 void RenderWidgetHostImpl::OnMsgMoveCaretAck() {
1852 move_caret_pending_ = false;
1853 if (next_move_caret_.get()) {
1854 scoped_ptr<gfx::Point> next(next_move_caret_.Pass());
1855 MoveCaret(*next);
1856 }
1857 }
1858
1845 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) { 1859 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) {
1846 mouse_wheel_pending_ = false; 1860 mouse_wheel_pending_ = false;
1847 1861
1848 if (overscroll_controller_.get()) 1862 if (overscroll_controller_.get())
1849 overscroll_controller_->ReceivedEventACK(current_wheel_event_, processed); 1863 overscroll_controller_->ReceivedEventACK(current_wheel_event_, processed);
1850 1864
1851 // Now send the next (coalesced) mouse wheel event. 1865 // Now send the next (coalesced) mouse wheel event.
1852 if (!coalesced_mouse_wheel_events_.empty()) { 1866 if (!coalesced_mouse_wheel_events_.empty()) {
1853 WebMouseWheelEvent next_wheel_event = 1867 WebMouseWheelEvent next_wheel_event =
1854 coalesced_mouse_wheel_events_.front(); 1868 coalesced_mouse_wheel_events_.front();
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
2218 } 2232 }
2219 next_selection_range_->start = start; 2233 next_selection_range_->start = start;
2220 next_selection_range_->end = end; 2234 next_selection_range_->end = end;
2221 return; 2235 return;
2222 } 2236 }
2223 2237
2224 select_range_pending_ = true; 2238 select_range_pending_ = true;
2225 Send(new ViewMsg_SelectRange(GetRoutingID(), start, end)); 2239 Send(new ViewMsg_SelectRange(GetRoutingID(), start, end));
2226 } 2240 }
2227 2241
2242 void RenderWidgetHostImpl::MoveCaret(const gfx::Point& point) {
2243 if (move_caret_pending_) {
2244 next_move_caret_.reset(new gfx::Point(point));
2245 return;
2246 }
2247
2248 move_caret_pending_ = true;
2249 Send(new ViewMsg_MoveCaret(GetRoutingID(), point));
2250 }
2251
2228 void RenderWidgetHostImpl::Undo() { 2252 void RenderWidgetHostImpl::Undo() {
2229 Send(new ViewMsg_Undo(GetRoutingID())); 2253 Send(new ViewMsg_Undo(GetRoutingID()));
2230 RecordAction(UserMetricsAction("Undo")); 2254 RecordAction(UserMetricsAction("Undo"));
2231 } 2255 }
2232 2256
2233 void RenderWidgetHostImpl::Redo() { 2257 void RenderWidgetHostImpl::Redo() {
2234 Send(new ViewMsg_Redo(GetRoutingID())); 2258 Send(new ViewMsg_Redo(GetRoutingID()));
2235 RecordAction(UserMetricsAction("Redo")); 2259 RecordAction(UserMetricsAction("Redo"));
2236 } 2260 }
2237 2261
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2336 return; 2360 return;
2337 2361
2338 OnRenderAutoResized(new_size); 2362 OnRenderAutoResized(new_size);
2339 } 2363 }
2340 2364
2341 void RenderWidgetHostImpl::DetachDelegate() { 2365 void RenderWidgetHostImpl::DetachDelegate() {
2342 delegate_ = NULL; 2366 delegate_ = NULL;
2343 } 2367 }
2344 2368
2345 } // namespace content 2369 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698