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

Unified Diff: content/renderer/render_widget.cc

Issue 7041003: Show composition text on IME panel when Pepper plugin is focused (Linux). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: A todo comment is reworded to be more correct. Created 9 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
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index f02b920abde7000de2a5ee51d835dd371f6a1d2f..38adaf322172c5a7292b8ef1eee49fc8f1e5e6a8 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -58,7 +58,6 @@ using WebKit::WebRect;
using WebKit::WebScreenInfo;
using WebKit::WebSize;
using WebKit::WebTextDirection;
-using WebKit::WebTextInputType;
using WebKit::WebVector;
using WebKit::WebWidget;
@@ -83,7 +82,8 @@ RenderWidget::RenderWidget(RenderThreadBase* render_thread,
closing_(false),
is_swapped_out_(false),
input_method_is_active_(false),
- text_input_type_(WebKit::WebTextInputTypeNone),
+ text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
+ can_compose_inline_(true),
popup_type_(popup_type),
pending_window_rect_count_(0),
suppress_next_char_events_(false),
@@ -1278,7 +1278,8 @@ void RenderWidget::UpdateInputMethod() {
if (!input_method_is_active_)
return;
- WebTextInputType new_type = GetTextInputType();
+ ui::TextInputType new_type = GetTextInputType();
+ bool new_can_compose_inline = CanComposeInline();
WebRect new_caret_bounds;
if (webwidget_)
@@ -1286,18 +1287,36 @@ void RenderWidget::UpdateInputMethod() {
// Only sends text input type and caret bounds to the browser process if they
// are changed.
- if (text_input_type_ != new_type || caret_bounds_ != new_caret_bounds) {
+ if (text_input_type_ != new_type || caret_bounds_ != new_caret_bounds ||
+ can_compose_inline_ != new_can_compose_inline) {
text_input_type_ = new_type;
+ can_compose_inline_ = new_can_compose_inline;
caret_bounds_ = new_caret_bounds;
Send(new ViewHostMsg_ImeUpdateTextInputState(
- routing_id(), new_type, new_caret_bounds));
+ routing_id(), new_type, new_can_compose_inline, new_caret_bounds));
}
}
-WebKit::WebTextInputType RenderWidget::GetTextInputType() {
- if (webwidget_)
- return webwidget_->textInputType();
- return WebKit::WebTextInputTypeNone;
+COMPILE_ASSERT(int(WebKit::WebTextInputTypeNone) == \
+ int(ui::TEXT_INPUT_TYPE_NONE), mismatching_enums);
+COMPILE_ASSERT(int(WebKit::WebTextInputTypeText) == \
+ int(ui::TEXT_INPUT_TYPE_TEXT), mismatching_enums);
+COMPILE_ASSERT(int(WebKit::WebTextInputTypePassword) == \
+ int(ui::TEXT_INPUT_TYPE_PASSWORD), mismatching_enums);
+
+ui::TextInputType RenderWidget::GetTextInputType() {
+ if (webwidget_) {
+ int type = webwidget_->textInputType();
+ // Check the type is in the range representable by ui::TextInputType.
+ DCHECK(type <= ui::TEXT_INPUT_TYPE_PASSWORD) <<
+ "WebKit::WebTextInputType and ui::TextInputType not synchronized";
+ return static_cast<ui::TextInputType>(type);
+ }
+ return ui::TEXT_INPUT_TYPE_NONE;
+}
+
+bool RenderWidget::CanComposeInline() {
+ return true;
}
WebScreenInfo RenderWidget::screenInfo() {
@@ -1312,7 +1331,7 @@ void RenderWidget::resetInputMethod() {
// If the last text input type is not None, then we should finish any
// ongoing composition regardless of the new text input type.
- if (text_input_type_ != WebKit::WebTextInputTypeNone) {
+ if (text_input_type_ != ui::TEXT_INPUT_TYPE_NONE) {
// If a composition text exists, then we need to let the browser process
// to cancel the input method's ongoing composition session.
if (webwidget_->confirmComposition())
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698