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

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

Issue 300323005: Route selection bounds updates through the compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates Created 6 years, 6 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 (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 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 #endif 1737 #endif
1738 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), p)); 1738 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), p));
1739 1739
1740 text_input_info_ = new_info; 1740 text_input_info_ = new_info;
1741 text_input_type_ = new_type; 1741 text_input_type_ = new_type;
1742 can_compose_inline_ = new_can_compose_inline; 1742 can_compose_inline_ = new_can_compose_inline;
1743 } 1743 }
1744 } 1744 }
1745 #endif 1745 #endif
1746 1746
1747 void RenderWidget::GetSelectionBounds(gfx::Rect* focus, gfx::Rect* anchor) { 1747 bool RenderWidget::GetSelectionBounds(gfx::Rect* focus, gfx::Rect* anchor) {
1748 WebRect focus_webrect; 1748 WebRect focus_webrect;
1749 WebRect anchor_webrect; 1749 WebRect anchor_webrect;
1750 webwidget_->selectionBounds(focus_webrect, anchor_webrect); 1750 webwidget_->selectionBounds(focus_webrect, anchor_webrect);
1751 *focus = focus_webrect; 1751 *focus = focus_webrect;
1752 *anchor = anchor_webrect; 1752 *anchor = anchor_webrect;
1753 return true;
1753 } 1754 }
1754 1755
1755 void RenderWidget::UpdateSelectionBounds() { 1756 void RenderWidget::UpdateSelectionBounds() {
1756 if (!webwidget_) 1757 if (!webwidget_)
1757 return; 1758 return;
1758 if (handling_ime_event_) 1759 if (handling_ime_event_)
1759 return; 1760 return;
1760 1761
1761 ViewHostMsg_SelectionBounds_Params params; 1762 gfx::Rect anchor_rect, focus_rect;
1762 GetSelectionBounds(&params.anchor_rect, &params.focus_rect); 1763 if (GetSelectionBounds(&anchor_rect, &focus_rect) &&
1763 if (selection_anchor_rect_ != params.anchor_rect || 1764 (selection_anchor_rect_ != anchor_rect ||
1764 selection_focus_rect_ != params.focus_rect) { 1765 selection_focus_rect_ != focus_rect)) {
1765 selection_anchor_rect_ = params.anchor_rect; 1766 selection_anchor_rect_ = anchor_rect;
1766 selection_focus_rect_ = params.focus_rect; 1767 selection_focus_rect_ = focus_rect;
1768
1769 ViewHostMsg_SelectionBounds_Params params;
1770 params.anchor_rect = anchor_rect;
1771 params.focus_rect = focus_rect;
1767 webwidget_->selectionTextDirection(params.focus_dir, params.anchor_dir); 1772 webwidget_->selectionTextDirection(params.focus_dir, params.anchor_dir);
1768 params.is_anchor_first = webwidget_->isSelectionAnchorFirst(); 1773 params.is_anchor_first = webwidget_->isSelectionAnchorFirst();
1774 params.is_anchor_visible = true;
1775 params.is_focus_visible = true;
1769 Send(new ViewHostMsg_SelectionBoundsChanged(routing_id_, params)); 1776 Send(new ViewHostMsg_SelectionBoundsChanged(routing_id_, params));
1770 } 1777 }
1778
1771 #if defined(OS_MACOSX) || defined(USE_AURA) 1779 #if defined(OS_MACOSX) || defined(USE_AURA)
1772 UpdateCompositionInfo(false); 1780 UpdateCompositionInfo(false);
1773 #endif 1781 #endif
1774 } 1782 }
1775 1783
1776 // Check blink::WebTextInputType and ui::TextInputType is kept in sync. 1784 // Check blink::WebTextInputType and ui::TextInputType is kept in sync.
1777 COMPILE_ASSERT(int(blink::WebTextInputTypeNone) == \ 1785 COMPILE_ASSERT(int(blink::WebTextInputTypeNone) == \
1778 int(ui::TEXT_INPUT_TYPE_NONE), mismatching_enums); 1786 int(ui::TEXT_INPUT_TYPE_NONE), mismatching_enums);
1779 COMPILE_ASSERT(int(blink::WebTextInputTypeText) == \ 1787 COMPILE_ASSERT(int(blink::WebTextInputTypeText) == \
1780 int(ui::TEXT_INPUT_TYPE_TEXT), mismatching_enums); 1788 int(ui::TEXT_INPUT_TYPE_TEXT), mismatching_enums);
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
2131 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2139 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2132 video_hole_frames_.AddObserver(frame); 2140 video_hole_frames_.AddObserver(frame);
2133 } 2141 }
2134 2142
2135 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2143 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2136 video_hole_frames_.RemoveObserver(frame); 2144 video_hole_frames_.RemoveObserver(frame);
2137 } 2145 }
2138 #endif // defined(VIDEO_HOLE) 2146 #endif // defined(VIDEO_HOLE)
2139 2147
2140 } // namespace content 2148 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698