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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 657803002: Update touch selection to only modify one selection point at a time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix DCHECK Created 6 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo) 817 IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo)
818 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) 818 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo)
819 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut) 819 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut)
820 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy) 820 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy)
821 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste) 821 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste)
822 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) 822 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle)
823 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) 823 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete)
824 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) 824 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll)
825 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) 825 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange)
826 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect) 826 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect)
827 IPC_MESSAGE_HANDLER(InputMsg_MoveRangeSelectionExtent,
828 OnMoveRangeSelectionExtent)
827 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) 829 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace)
828 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) 830 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling)
829 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete, 831 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete,
830 OnExtendSelectionAndDelete) 832 OnExtendSelectionAndDelete)
831 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText, 833 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText,
832 OnSetCompositionFromExistingText) 834 OnSetCompositionFromExistingText)
833 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) 835 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest)
834 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, 836 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest,
835 OnJavaScriptExecuteRequest) 837 OnJavaScriptExecuteRequest)
836 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestForTests, 838 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestForTests,
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 1205
1204 void RenderFrameImpl::OnDelete() { 1206 void RenderFrameImpl::OnDelete() {
1205 frame_->executeCommand(WebString::fromUTF8("Delete"), GetFocusedElement()); 1207 frame_->executeCommand(WebString::fromUTF8("Delete"), GetFocusedElement());
1206 } 1208 }
1207 1209
1208 void RenderFrameImpl::OnSelectAll() { 1210 void RenderFrameImpl::OnSelectAll() {
1209 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); 1211 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1210 frame_->executeCommand(WebString::fromUTF8("SelectAll"), GetFocusedElement()); 1212 frame_->executeCommand(WebString::fromUTF8("SelectAll"), GetFocusedElement());
1211 } 1213 }
1212 1214
1213 void RenderFrameImpl::OnSelectRange(const gfx::Point& start, 1215 void RenderFrameImpl::OnSelectRange(const gfx::Point& base,
1214 const gfx::Point& end) { 1216 const gfx::Point& extent) {
1215 // This IPC is dispatched by RenderWidgetHost, so use its routing id. 1217 // This IPC is dispatched by RenderWidgetHost, so use its routing id.
1216 Send(new ViewHostMsg_SelectRange_ACK(GetRenderWidget()->routing_id())); 1218 Send(new InputHostMsg_SelectRange_ACK(GetRenderWidget()->routing_id()));
1217 1219
1218 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); 1220 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1219 frame_->selectRange(start, end); 1221 frame_->selectRange(base, extent);
1220 } 1222 }
1221 1223
1222 void RenderFrameImpl::OnUnselect() { 1224 void RenderFrameImpl::OnUnselect() {
1223 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); 1225 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1224 frame_->executeCommand(WebString::fromUTF8("Unselect"), GetFocusedElement()); 1226 frame_->executeCommand(WebString::fromUTF8("Unselect"), GetFocusedElement());
1225 } 1227 }
1226 1228
1229 void RenderFrameImpl::OnMoveRangeSelectionExtent(const gfx::Point& point) {
1230 // This IPC is dispatched by RenderWidgetHost, so use its routing id.
1231 Send(new InputHostMsg_MoveRangeSelectionExtent_ACK(
1232 GetRenderWidget()->routing_id()));
1233
1234 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1235 frame_->moveRangeSelectionExtent(point);
1236 }
1237
1227 void RenderFrameImpl::OnReplace(const base::string16& text) { 1238 void RenderFrameImpl::OnReplace(const base::string16& text) {
1228 if (!frame_->hasSelection()) 1239 if (!frame_->hasSelection())
1229 frame_->selectWordAroundCaret(); 1240 frame_->selectWordAroundCaret();
1230 1241
1231 frame_->replaceSelection(text); 1242 frame_->replaceSelection(text);
1232 } 1243 }
1233 1244
1234 void RenderFrameImpl::OnReplaceMisspelling(const base::string16& text) { 1245 void RenderFrameImpl::OnReplaceMisspelling(const base::string16& text) {
1235 if (!frame_->hasSelection()) 1246 if (!frame_->hasSelection())
1236 return; 1247 return;
(...skipping 2737 matching lines...) Expand 10 before | Expand all | Expand 10 after
3974 3985
3975 #if defined(ENABLE_BROWSER_CDMS) 3986 #if defined(ENABLE_BROWSER_CDMS)
3976 RendererCdmManager* RenderFrameImpl::GetCdmManager() { 3987 RendererCdmManager* RenderFrameImpl::GetCdmManager() {
3977 if (!cdm_manager_) 3988 if (!cdm_manager_)
3978 cdm_manager_ = new RendererCdmManager(this); 3989 cdm_manager_ = new RendererCdmManager(this);
3979 return cdm_manager_; 3990 return cdm_manager_;
3980 } 3991 }
3981 #endif // defined(ENABLE_BROWSER_CDMS) 3992 #endif // defined(ENABLE_BROWSER_CDMS)
3982 3993
3983 } // namespace content 3994 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698