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

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

Issue 2235283003: Track composition range and character bounds on the browser side (Mac) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased to fix some crashing tests Created 4 years, 4 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
« no previous file with comments | « content/browser/renderer_host/text_input_manager.h ('k') | content/public/test/text_input_test_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/text_input_manager.cc
diff --git a/content/browser/renderer_host/text_input_manager.cc b/content/browser/renderer_host/text_input_manager.cc
index a587d2a8744c257b0e3e926b70bd9a12d5361bf9..aa2522f91ca74f1272bd1cbd63eff233b51f6607 100644
--- a/content/browser/renderer_host/text_input_manager.cc
+++ b/content/browser/renderer_host/text_input_manager.cc
@@ -70,11 +70,13 @@ gfx::Rect TextInputManager::GetSelectionBoundsRect() const {
selection_region_map_.at(active_view_).focus);
}
-const std::vector<gfx::Rect>* TextInputManager::GetCompositionCharacterBounds()
- const {
- return !!active_view_
- ? &composition_range_info_map_.at(active_view_).character_bounds
- : nullptr;
+const TextInputManager::CompositionRangeInfo*
+TextInputManager::GetCompositionRangeInfo(
+ RenderWidgetHostViewBase* view) const {
+ DCHECK(!view || IsRegistered(view));
+ if (!view)
+ view = active_view_;
+ return active_view_ ? &composition_range_info_map_.at(active_view_) : nullptr;
}
const TextInputManager::TextSelection* TextInputManager::GetTextSelection(
@@ -197,6 +199,9 @@ void TextInputManager::SelectionBoundsChanged(
#endif
}
+// TODO(ekaramad): We use |range| only on Mac OS; but we still track its value
+// here for other platforms. See if there is a nice way around this with minimal
+// #ifdefs for platform specific code (https://crbug.com/602427).
void TextInputManager::ImeCompositionRangeChanged(
RenderWidgetHostViewBase* view,
const gfx::Range& range,
@@ -211,6 +216,9 @@ void TextInputManager::ImeCompositionRangeChanged(
view->TransformPointToRootCoordSpace(rect.origin()), rect.size()));
}
+ composition_range_info_map_[view].range.set_start(range.start());
+ composition_range_info_map_[view].range.set_end(range.end());
+
FOR_EACH_OBSERVER(Observer, observer_list_,
OnImeCompositionRangeChanged(this, view));
}
« no previous file with comments | « content/browser/renderer_host/text_input_manager.h ('k') | content/public/test/text_input_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698