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

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

Issue 2132633002: Tracking composition range on the browser side (Aura) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing creis@'s comments and changing a test method Created 4 years, 5 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.h » ('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 3029d932d0a91d01e6d0ce3553047f800bd56054..eed20121103d96cdaaec68cdcafea5ecacc241a6 100644
--- a/content/browser/renderer_host/text_input_manager.cc
+++ b/content/browser/renderer_host/text_input_manager.cc
@@ -7,6 +7,7 @@
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/common/view_messages.h"
+#include "ui/gfx/geometry/rect.h"
namespace content {
@@ -45,16 +46,16 @@ TextInputManager::~TextInputManager() {
Unregister(view);
}
-const TextInputState* TextInputManager::GetTextInputState() {
- return !!active_view_ ? &text_input_state_map_[active_view_] : nullptr;
-}
-
RenderWidgetHostImpl* TextInputManager::GetActiveWidget() const {
return !!active_view_ ? static_cast<RenderWidgetHostImpl*>(
active_view_->GetRenderWidgetHost())
: nullptr;
}
+const TextInputState* TextInputManager::GetTextInputState() {
+ return !!active_view_ ? &text_input_state_map_[active_view_] : nullptr;
+}
+
gfx::Rect TextInputManager::GetSelectionBoundsRect() {
if (!active_view_)
return gfx::Rect();
@@ -64,6 +65,13 @@ gfx::Rect TextInputManager::GetSelectionBoundsRect() {
selection_region_map_[active_view_].focus);
}
+const std::vector<gfx::Rect>*
+TextInputManager::GetCompositionCharacterBounds() {
+ return !!active_view_
+ ? &composition_range_info_map_[active_view_].character_bounds
+ : nullptr;
+}
+
void TextInputManager::UpdateTextInputState(
RenderWidgetHostViewBase* view,
const TextInputState& text_input_state) {
@@ -148,6 +156,24 @@ void TextInputManager::SelectionBoundsChanged(
#endif
}
+void TextInputManager::ImeCompositionRangeChanged(
+ RenderWidgetHostViewBase* view,
+ const gfx::Range& range,
+ const std::vector<gfx::Rect>& character_bounds) {
+ DCHECK(IsRegistered(view));
+ composition_range_info_map_[view].character_bounds.clear();
+
+ // The values for the bounds should be converted to root view's coordinates
+ // before being stored.
+ for (auto rect : character_bounds) {
+ composition_range_info_map_[view].character_bounds.emplace_back(gfx::Rect(
+ view->TransformPointToRootCoordSpace(rect.origin()), rect.size()));
+ }
+
+ FOR_EACH_OBSERVER(Observer, observer_list_,
+ OnImeCompositionRangeChanged(this, view));
+}
+
void TextInputManager::Register(RenderWidgetHostViewBase* view) {
DCHECK(!IsRegistered(view));
@@ -200,4 +226,11 @@ TextInputManager::SelectionRegion::SelectionRegion() {}
TextInputManager::SelectionRegion::SelectionRegion(
const SelectionRegion& other) = default;
+TextInputManager::CompositionRangeInfo::CompositionRangeInfo() {}
+
+TextInputManager::CompositionRangeInfo::CompositionRangeInfo(
+ const CompositionRangeInfo& other) = default;
+
+TextInputManager::CompositionRangeInfo::~CompositionRangeInfo() {}
+
} // namespace content
« no previous file with comments | « content/browser/renderer_host/text_input_manager.h ('k') | content/public/test/text_input_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698