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