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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 2057803002: Tracking SelectionBounds for all RenderWidgets on the Browser Side (Aura Only) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Compile Errors Created 4 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 83f8b72e9e5f6da780e6f80d54117f53f394f718..cd0eda7845cf1d65a031644354401498d7a448a1 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -1048,46 +1048,6 @@ gfx::Size RenderWidgetHostViewAura::GetRequestedRendererSize() const {
return delegated_frame_host_->GetRequestedRendererSize();
}
-void RenderWidgetHostViewAura::SelectionBoundsChanged(
- const ViewHostMsg_SelectionBounds_Params& params) {
- gfx::SelectionBound anchor_bound, focus_bound;
- anchor_bound.SetEdge(gfx::PointF(params.anchor_rect.origin()),
- gfx::PointF(params.anchor_rect.bottom_left()));
- focus_bound.SetEdge(gfx::PointF(params.focus_rect.origin()),
- gfx::PointF(params.focus_rect.bottom_left()));
-
- if (params.anchor_rect == params.focus_rect) {
- anchor_bound.set_type(gfx::SelectionBound::CENTER);
- focus_bound.set_type(gfx::SelectionBound::CENTER);
- } else {
- // Whether text is LTR at the anchor handle.
- bool anchor_LTR = params.anchor_dir == blink::WebTextDirectionLeftToRight;
- // Whether text is LTR at the focus handle.
- bool focus_LTR = params.focus_dir == blink::WebTextDirectionLeftToRight;
-
- if ((params.is_anchor_first && anchor_LTR) ||
- (!params.is_anchor_first && !anchor_LTR)) {
- anchor_bound.set_type(gfx::SelectionBound::LEFT);
- } else {
- anchor_bound.set_type(gfx::SelectionBound::RIGHT);
- }
- if ((params.is_anchor_first && focus_LTR) ||
- (!params.is_anchor_first && !focus_LTR)) {
- focus_bound.set_type(gfx::SelectionBound::RIGHT);
- } else {
- focus_bound.set_type(gfx::SelectionBound::LEFT);
- }
- }
-
- if (anchor_bound == selection_anchor_ && focus_bound == selection_focus_)
- return;
-
- selection_anchor_ = anchor_bound;
- selection_focus_ = focus_bound;
- if (GetInputMethod())
- GetInputMethod()->OnCaretBoundsChanged(this);
-}
-
void RenderWidgetHostViewAura::CopyFromCompositingSurface(
const gfx::Rect& src_subrect,
const gfx::Size& dst_size,
@@ -1571,8 +1531,9 @@ gfx::Rect RenderWidgetHostViewAura::ConvertRectFromScreen(
}
gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const {
- return ConvertRectToScreen(
- gfx::RectBetweenSelectionBounds(selection_anchor_, selection_focus_));
+ if (!text_input_manager_ || !text_input_manager_->GetActiveWidget())
+ return gfx::Rect();
+ return ConvertRectToScreen(text_input_manager_->GetSelectionBoundsRect());
}
bool RenderWidgetHostViewAura::GetCompositionCharacterBounds(
@@ -3030,6 +2991,13 @@ void RenderWidgetHostViewAura::OnUpdateTextInputStateCalled(
GetInputMethod()->ShowImeIfNeeded();
}
+void RenderWidgetHostViewAura::OnSelectionBoundsChanged(
+ TextInputManager* text_input_manager,
+ RenderWidgetHostViewBase* updated_view) {
+ if (GetInputMethod())
+ GetInputMethod()->OnCaretBoundsChanged(this);
+}
+
////////////////////////////////////////////////////////////////////////////////
// RenderWidgetHostViewBase, public:

Powered by Google App Engine
This is Rietveld 408576698