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

Unified Diff: content/public/test/text_input_test_utils.cc

Issue 2208583005: Request to start/stop calculating composition info from RenderWidget when it is active/inactive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased (nona@'s patch relanded) 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/public/test/text_input_test_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/text_input_test_utils.cc
diff --git a/content/public/test/text_input_test_utils.cc b/content/public/test/text_input_test_utils.cc
index 79ab7378dac83b8c25ea529e0cac44d611cc9a7b..aafccd5e609f15fa7c5297c102414873679aad68 100644
--- a/content/public/test/text_input_test_utils.cc
+++ b/content/public/test/text_input_test_utils.cc
@@ -12,6 +12,7 @@
#include "content/browser/renderer_host/render_widget_host_view_base_observer.h"
#include "content/browser/renderer_host/text_input_manager.h"
#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/common/input_messages.h"
#include "content/common/text_input_state.h"
#include "content/common/view_messages.h"
#include "content/public/browser/render_widget_host_view.h"
@@ -244,23 +245,15 @@ bool GetTextInputTypeForView(WebContents* web_contents,
return true;
}
-void SetCompositionForRenderWidgetHost(
- RenderWidgetHost* render_widget_host,
- const base::string16& text,
- const std::vector<ui::CompositionUnderline>& underlines,
- const gfx::Range& replacement_range,
- int selection_start,
- int selection_end) {
- std::vector<blink::WebCompositionUnderline> web_underlines;
- for (auto underline : underlines) {
- web_underlines.emplace_back(blink::WebCompositionUnderline(
- underline.start_offset, underline.end_offset, underline.color,
- underline.thick, underline.background_color));
- }
+bool RequestCompositionInfoFromActiveWidget(WebContents* web_contents) {
+ TextInputManager* manager =
+ static_cast<WebContentsImpl*>(web_contents)->GetTextInputManager();
+ if (!manager || !manager->GetActiveWidget())
+ return false;
- static_cast<RenderWidgetHostImpl*>(render_widget_host)
- ->ImeSetComposition(text, web_underlines, replacement_range,
- selection_start, selection_end);
+ manager->GetActiveWidget()->Send(new InputMsg_RequestCompositionUpdate(
+ manager->GetActiveWidget()->GetRoutingID(), true, true));
+ return true;
}
size_t GetRegisteredViewsCountFromTextInputManager(WebContents* web_contents) {
« no previous file with comments | « content/public/test/text_input_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698