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

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

Issue 2734943005: Remove moveCursorToSelectionEnd() (Closed)
Patch Set: For dtrainor@'s review Created 3 years, 9 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
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) 1516 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo)
1517 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut) 1517 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut)
1518 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy) 1518 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy)
1519 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste) 1519 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste)
1520 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) 1520 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle)
1521 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) 1521 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete)
1522 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) 1522 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll)
1523 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) 1523 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange)
1524 IPC_MESSAGE_HANDLER(InputMsg_AdjustSelectionByCharacterOffset, 1524 IPC_MESSAGE_HANDLER(InputMsg_AdjustSelectionByCharacterOffset,
1525 OnAdjustSelectionByCharacterOffset) 1525 OnAdjustSelectionByCharacterOffset)
1526 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect) 1526 IPC_MESSAGE_HANDLER(InputMsg_CollapseSelection, OnCollapseSelection)
1527 IPC_MESSAGE_HANDLER(InputMsg_MoveRangeSelectionExtent, 1527 IPC_MESSAGE_HANDLER(InputMsg_MoveRangeSelectionExtent,
1528 OnMoveRangeSelectionExtent) 1528 OnMoveRangeSelectionExtent)
1529 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) 1529 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace)
1530 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) 1530 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling)
1531 IPC_MESSAGE_HANDLER(FrameMsg_CopyImageAt, OnCopyImageAt) 1531 IPC_MESSAGE_HANDLER(FrameMsg_CopyImageAt, OnCopyImageAt)
1532 IPC_MESSAGE_HANDLER(FrameMsg_SaveImageAt, OnSaveImageAt) 1532 IPC_MESSAGE_HANDLER(FrameMsg_SaveImageAt, OnSaveImageAt)
1533 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete, 1533 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete,
1534 OnExtendSelectionAndDelete) 1534 OnExtendSelectionAndDelete)
1535 IPC_MESSAGE_HANDLER(InputMsg_DeleteSurroundingText, OnDeleteSurroundingText) 1535 IPC_MESSAGE_HANDLER(InputMsg_DeleteSurroundingText, OnDeleteSurroundingText)
1536 IPC_MESSAGE_HANDLER(InputMsg_DeleteSurroundingTextInCodePoints, 1536 IPC_MESSAGE_HANDLER(InputMsg_DeleteSurroundingTextInCodePoints,
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1891 1891
1892 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); 1892 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1893 1893
1894 // A negative adjust amount moves the selection towards the beginning of 1894 // A negative adjust amount moves the selection towards the beginning of
1895 // the document, a positive amount moves the selection towards the end of 1895 // the document, a positive amount moves the selection towards the end of
1896 // the document. 1896 // the document.
1897 frame_->selectRange(WebRange(range.startOffset() + start_adjust, 1897 frame_->selectRange(WebRange(range.startOffset() + start_adjust,
1898 range.length() + end_adjust - start_adjust)); 1898 range.length() + end_adjust - start_adjust));
1899 } 1899 }
1900 1900
1901 void RenderFrameImpl::OnUnselect() { 1901 void RenderFrameImpl::OnCollapseSelection() {
1902 const WebRange& range =
1903 GetRenderWidget()->GetWebWidget()->caretOrSelectionRange();
1904 if (range.isNull())
1905 return;
1906
1902 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); 1907 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1903 frame_->executeCommand(WebString::fromUTF8("Unselect")); 1908 frame_->selectRange(WebRange(range.endOffset(), 0));
1904 } 1909 }
1905 1910
1906 void RenderFrameImpl::OnMoveRangeSelectionExtent(const gfx::Point& point) { 1911 void RenderFrameImpl::OnMoveRangeSelectionExtent(const gfx::Point& point) {
1907 // This IPC is dispatched by RenderWidgetHost, so use its routing id. 1912 // This IPC is dispatched by RenderWidgetHost, so use its routing id.
1908 Send(new InputHostMsg_MoveRangeSelectionExtent_ACK( 1913 Send(new InputHostMsg_MoveRangeSelectionExtent_ACK(
1909 GetRenderWidget()->routing_id())); 1914 GetRenderWidget()->routing_id()));
1910 1915
1911 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); 1916 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1912 frame_->moveRangeSelectionExtent( 1917 frame_->moveRangeSelectionExtent(
1913 render_view_->ConvertWindowPointToViewport(point)); 1918 render_view_->ConvertWindowPointToViewport(point));
(...skipping 3712 matching lines...) Expand 10 before | Expand all | Expand 10 after
5626 gfx::Rect(), true /* final_status_update */); 5631 gfx::Rect(), true /* final_status_update */);
5627 } 5632 }
5628 } 5633 }
5629 return; 5634 return;
5630 } 5635 }
5631 5636
5632 frame_->requestFind(request_id, WebString::fromUTF16(search_text), options); 5637 frame_->requestFind(request_id, WebString::fromUTF16(search_text), options);
5633 } 5638 }
5634 5639
5635 void RenderFrameImpl::OnClearActiveFindMatch() { 5640 void RenderFrameImpl::OnClearActiveFindMatch() {
5636 frame_->executeCommand(WebString::fromUTF8("Unselect")); 5641 frame_->executeCommand(WebString::fromUTF8("CollapseSelection"));
5637 frame_->clearActiveFindMatch(); 5642 frame_->clearActiveFindMatch();
5638 } 5643 }
5639 5644
5640 // Ensure that content::StopFindAction and blink::WebLocalFrame::StopFindAction 5645 // Ensure that content::StopFindAction and blink::WebLocalFrame::StopFindAction
5641 // are kept in sync. 5646 // are kept in sync.
5642 STATIC_ASSERT_ENUM(STOP_FIND_ACTION_CLEAR_SELECTION, 5647 STATIC_ASSERT_ENUM(STOP_FIND_ACTION_CLEAR_SELECTION,
5643 WebLocalFrame::StopFindActionClearSelection); 5648 WebLocalFrame::StopFindActionClearSelection);
5644 STATIC_ASSERT_ENUM(STOP_FIND_ACTION_KEEP_SELECTION, 5649 STATIC_ASSERT_ENUM(STOP_FIND_ACTION_KEEP_SELECTION,
5645 WebLocalFrame::StopFindActionKeepSelection); 5650 WebLocalFrame::StopFindActionKeepSelection);
5646 STATIC_ASSERT_ENUM(STOP_FIND_ACTION_ACTIVATE_SELECTION, 5651 STATIC_ASSERT_ENUM(STOP_FIND_ACTION_ACTIVATE_SELECTION,
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
6862 // event target. Potentially a Pepper plugin will receive the event. 6867 // event target. Potentially a Pepper plugin will receive the event.
6863 // In order to tell whether a plugin gets the last mouse event and which it 6868 // In order to tell whether a plugin gets the last mouse event and which it
6864 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6869 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6865 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6870 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6866 // |pepper_last_mouse_event_target_|. 6871 // |pepper_last_mouse_event_target_|.
6867 pepper_last_mouse_event_target_ = nullptr; 6872 pepper_last_mouse_event_target_ = nullptr;
6868 #endif 6873 #endif
6869 } 6874 }
6870 6875
6871 } // namespace content 6876 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698