OLD | NEW |
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 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1763 | 1763 |
1764 void RenderFrameImpl::OnSelectAll() { | 1764 void RenderFrameImpl::OnSelectAll() { |
1765 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); | 1765 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); |
1766 frame_->executeCommand(WebString::fromUTF8("SelectAll"), GetFocusedElement()); | 1766 frame_->executeCommand(WebString::fromUTF8("SelectAll"), GetFocusedElement()); |
1767 } | 1767 } |
1768 | 1768 |
1769 void RenderFrameImpl::OnSelectRange(const gfx::Point& base, | 1769 void RenderFrameImpl::OnSelectRange(const gfx::Point& base, |
1770 const gfx::Point& extent) { | 1770 const gfx::Point& extent) { |
1771 // This IPC is dispatched by RenderWidgetHost, so use its routing id. | 1771 // This IPC is dispatched by RenderWidgetHost, so use its routing id. |
1772 Send(new InputHostMsg_SelectRange_ACK(GetRenderWidget()->routing_id())); | 1772 Send(new InputHostMsg_SelectRange_ACK(GetRenderWidget()->routing_id())); |
1773 | |
1774 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); | 1773 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); |
1775 frame_->selectRange(base, extent); | 1774 frame_->selectRange(render_view_->ConvertWindowPointToViewport(base), |
| 1775 render_view_->ConvertWindowPointToViewport(extent)); |
1776 } | 1776 } |
1777 | 1777 |
1778 void RenderFrameImpl::OnAdjustSelectionByCharacterOffset(int start_adjust, | 1778 void RenderFrameImpl::OnAdjustSelectionByCharacterOffset(int start_adjust, |
1779 int end_adjust) { | 1779 int end_adjust) { |
1780 size_t start, length; | 1780 size_t start, length; |
1781 if (!GetRenderWidget()->webwidget()->caretOrSelectionRange( | 1781 if (!GetRenderWidget()->webwidget()->caretOrSelectionRange( |
1782 &start, &length)) { | 1782 &start, &length)) { |
1783 return; | 1783 return; |
1784 } | 1784 } |
1785 | 1785 |
(...skipping 15 matching lines...) Expand all Loading... |
1801 | 1801 |
1802 void RenderFrameImpl::OnUnselect() { | 1802 void RenderFrameImpl::OnUnselect() { |
1803 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); | 1803 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); |
1804 frame_->executeCommand(WebString::fromUTF8("Unselect"), GetFocusedElement()); | 1804 frame_->executeCommand(WebString::fromUTF8("Unselect"), GetFocusedElement()); |
1805 } | 1805 } |
1806 | 1806 |
1807 void RenderFrameImpl::OnMoveRangeSelectionExtent(const gfx::Point& point) { | 1807 void RenderFrameImpl::OnMoveRangeSelectionExtent(const gfx::Point& point) { |
1808 // This IPC is dispatched by RenderWidgetHost, so use its routing id. | 1808 // This IPC is dispatched by RenderWidgetHost, so use its routing id. |
1809 Send(new InputHostMsg_MoveRangeSelectionExtent_ACK( | 1809 Send(new InputHostMsg_MoveRangeSelectionExtent_ACK( |
1810 GetRenderWidget()->routing_id())); | 1810 GetRenderWidget()->routing_id())); |
1811 | |
1812 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); | 1811 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); |
1813 frame_->moveRangeSelectionExtent(point); | 1812 frame_->moveRangeSelectionExtent( |
| 1813 render_view_->ConvertWindowPointToViewport(point)); |
1814 } | 1814 } |
1815 | 1815 |
1816 void RenderFrameImpl::OnReplace(const base::string16& text) { | 1816 void RenderFrameImpl::OnReplace(const base::string16& text) { |
1817 if (!frame_->hasSelection()) | 1817 if (!frame_->hasSelection()) |
1818 frame_->selectWordAroundCaret(); | 1818 frame_->selectWordAroundCaret(); |
1819 | 1819 |
1820 frame_->replaceSelection(text); | 1820 frame_->replaceSelection(text); |
1821 SyncSelectionIfRequired(); | 1821 SyncSelectionIfRequired(); |
1822 } | 1822 } |
1823 | 1823 |
(...skipping 4274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6098 int match_count, | 6098 int match_count, |
6099 int ordinal, | 6099 int ordinal, |
6100 const WebRect& selection_rect, | 6100 const WebRect& selection_rect, |
6101 bool final_status_update) { | 6101 bool final_status_update) { |
6102 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, | 6102 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, |
6103 selection_rect, ordinal, | 6103 selection_rect, ordinal, |
6104 final_status_update)); | 6104 final_status_update)); |
6105 } | 6105 } |
6106 | 6106 |
6107 } // namespace content | 6107 } // namespace content |
OLD | NEW |