OLD | NEW |
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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 #endif | 1734 #endif |
1735 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), p)); | 1735 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), p)); |
1736 | 1736 |
1737 text_input_info_ = new_info; | 1737 text_input_info_ = new_info; |
1738 text_input_type_ = new_type; | 1738 text_input_type_ = new_type; |
1739 can_compose_inline_ = new_can_compose_inline; | 1739 can_compose_inline_ = new_can_compose_inline; |
1740 } | 1740 } |
1741 } | 1741 } |
1742 #endif | 1742 #endif |
1743 | 1743 |
1744 void RenderWidget::GetSelectionBounds(gfx::Rect* focus, gfx::Rect* anchor) { | 1744 bool RenderWidget::GetSelectionBounds(gfx::Rect* focus, gfx::Rect* anchor) { |
1745 WebRect focus_webrect; | 1745 WebRect focus_webrect; |
1746 WebRect anchor_webrect; | 1746 WebRect anchor_webrect; |
1747 webwidget_->selectionBounds(focus_webrect, anchor_webrect); | 1747 webwidget_->selectionBounds(focus_webrect, anchor_webrect); |
1748 *focus = focus_webrect; | 1748 *focus = focus_webrect; |
1749 *anchor = anchor_webrect; | 1749 *anchor = anchor_webrect; |
| 1750 return true; |
1750 } | 1751 } |
1751 | 1752 |
1752 void RenderWidget::UpdateSelectionBounds() { | 1753 void RenderWidget::UpdateSelectionBounds() { |
1753 if (!webwidget_) | 1754 if (!webwidget_) |
1754 return; | 1755 return; |
1755 if (handling_ime_event_) | 1756 if (handling_ime_event_) |
1756 return; | 1757 return; |
1757 | 1758 |
1758 ViewHostMsg_SelectionBounds_Params params; | 1759 ViewHostMsg_SelectionBounds_Params params; |
1759 GetSelectionBounds(¶ms.anchor_rect, ¶ms.focus_rect); | 1760 if (GetSelectionBounds(¶ms.anchor_rect, ¶ms.focus_rect) && |
1760 if (selection_anchor_rect_ != params.anchor_rect || | 1761 (selection_anchor_rect_ != params.anchor_rect || |
1761 selection_focus_rect_ != params.focus_rect) { | 1762 selection_focus_rect_ != params.focus_rect)) { |
1762 selection_anchor_rect_ = params.anchor_rect; | 1763 selection_anchor_rect_ = params.anchor_rect; |
1763 selection_focus_rect_ = params.focus_rect; | 1764 selection_focus_rect_ = params.focus_rect; |
1764 webwidget_->selectionTextDirection(params.focus_dir, params.anchor_dir); | 1765 webwidget_->selectionTextDirection(params.focus_dir, params.anchor_dir); |
1765 params.is_anchor_first = webwidget_->isSelectionAnchorFirst(); | 1766 params.is_anchor_first = webwidget_->isSelectionAnchorFirst(); |
1766 Send(new ViewHostMsg_SelectionBoundsChanged(routing_id_, params)); | 1767 Send(new ViewHostMsg_SelectionBoundsChanged(routing_id_, params)); |
1767 } | 1768 } |
1768 #if defined(OS_MACOSX) || defined(USE_AURA) | 1769 #if defined(OS_MACOSX) || defined(USE_AURA) |
1769 UpdateCompositionInfo(false); | 1770 UpdateCompositionInfo(false); |
1770 #endif | 1771 #endif |
1771 } | 1772 } |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2113 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2114 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
2114 video_hole_frames_.AddObserver(frame); | 2115 video_hole_frames_.AddObserver(frame); |
2115 } | 2116 } |
2116 | 2117 |
2117 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2118 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
2118 video_hole_frames_.RemoveObserver(frame); | 2119 video_hole_frames_.RemoveObserver(frame); |
2119 } | 2120 } |
2120 #endif // defined(VIDEO_HOLE) | 2121 #endif // defined(VIDEO_HOLE) |
2121 | 2122 |
2122 } // namespace content | 2123 } // namespace content |
OLD | NEW |