diff options
Diffstat (limited to 'chrome/browser')
5 files changed, 30 insertions, 25 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc index 80a48b7f..5fe6b98 100644 --- a/chrome/browser/renderer_host/render_widget_host.cc +++ b/chrome/browser/renderer_host/render_widget_host.cc @@ -17,7 +17,6 @@ #include "chrome/common/render_messages.h" #include "views/view.h" #include "webkit/glue/webcursor.h" -#include "webkit/glue/webtextdirection.h" #if defined(OS_WIN) #include "base/gfx/gdi_util.h" @@ -37,6 +36,7 @@ using WebKit::WebInputEvent; using WebKit::WebKeyboardEvent; using WebKit::WebMouseEvent; using WebKit::WebMouseWheelEvent; +using WebKit::WebTextDirection; #if defined (OS_MACOSX) using WebKit::WebScreenInfo; @@ -72,7 +72,7 @@ RenderWidgetHost::RenderWidgetHost(RenderProcessHost* process, in_get_backing_store_(false), view_being_painted_(false), text_direction_updated_(false), - text_direction_(WEB_TEXT_DIRECTION_LTR), + text_direction_(WebKit::WebTextDirectionLeftToRight), text_direction_canceled_(false) { if (routing_id_ == MSG_ROUTING_NONE) routing_id_ = process_->GetNextRoutingID(); @@ -452,8 +452,7 @@ void RenderWidgetHost::CancelUpdateTextDirection() { void RenderWidgetHost::NotifyTextDirection() { if (text_direction_updated_) { if (!text_direction_canceled_) - Send(new ViewMsg_SetTextDirection(routing_id(), - static_cast<int>(text_direction_))); + Send(new ViewMsg_SetTextDirection(routing_id(), text_direction_)); text_direction_updated_ = false; text_direction_canceled_ = false; } @@ -463,22 +462,26 @@ void RenderWidgetHost::ImeSetInputMode(bool activate) { Send(new ViewMsg_ImeSetInputMode(routing_id(), activate)); } -void RenderWidgetHost::ImeSetComposition(const std::wstring& ime_string, +void RenderWidgetHost::ImeSetComposition(const string16& ime_string, int cursor_position, int target_start, int target_end) { - Send(new ViewMsg_ImeSetComposition(routing_id(), 0, cursor_position, - target_start, target_end, ime_string)); + Send(new ViewMsg_ImeSetComposition(routing_id(), + WebKit::WebCompositionCommandSet, + cursor_position, target_start, target_end, + ime_string)); } -void RenderWidgetHost::ImeConfirmComposition(const std::wstring& ime_string) { - Send(new ViewMsg_ImeSetComposition(routing_id(), 1, -1, -1, -1, ime_string)); +void RenderWidgetHost::ImeConfirmComposition(const string16& ime_string) { + Send(new ViewMsg_ImeSetComposition(routing_id(), + WebKit::WebCompositionCommandConfirm, + -1, -1, -1, ime_string)); } void RenderWidgetHost::ImeCancelComposition() { - std::wstring empty_string; - Send(new ViewMsg_ImeSetComposition(routing_id(), -1, -1, -1, -1, - empty_string)); + Send(new ViewMsg_ImeSetComposition(routing_id(), + WebKit::WebCompositionCommandDiscard, + -1, -1, -1, string16())); } gfx::Rect RenderWidgetHost::GetRootWindowResizerRect() const { diff --git a/chrome/browser/renderer_host/render_widget_host.h b/chrome/browser/renderer_host/render_widget_host.h index 88bcf18..02b19fc 100644 --- a/chrome/browser/renderer_host/render_widget_host.h +++ b/chrome/browser/renderer_host/render_widget_host.h @@ -17,7 +17,7 @@ #include "chrome/common/native_web_keyboard_event.h" #include "chrome/common/property_bag.h" #include "testing/gtest/include/gtest/gtest_prod.h" -#include "webkit/glue/webtextdirection.h" +#include "webkit/api/public/WebTextDirection.h" namespace gfx { class Rect; @@ -280,7 +280,7 @@ class RenderWidgetHost : public IPC::Channel::Listener { // NotifyTextDirection(). (We may receive keydown events even after we // canceled updating the text direction because of auto-repeat.) // Note: we cannot undo this change for compatibility with Firefox and IE. - void UpdateTextDirection(WebTextDirection direction); + void UpdateTextDirection(WebKit::WebTextDirection direction); void CancelUpdateTextDirection(); void NotifyTextDirection(); @@ -307,7 +307,7 @@ class RenderWidgetHost : public IPC::Channel::Listener { // (on Windows); // * when it receives a "preedit_changed" signal of GtkIMContext (on Linux); // * when markedText of NSTextInput is called (on Mac). - void ImeSetComposition(const std::wstring& ime_string, + void ImeSetComposition(const string16& ime_string, int cursor_position, int target_start, int target_end); @@ -318,7 +318,7 @@ class RenderWidgetHost : public IPC::Channel::Listener { // (on Windows); // * when it receives a "commit" signal of GtkIMContext (on Linux); // * when insertText of NSTextInput is called (on Mac). - void ImeConfirmComposition(const std::wstring& ime_string); + void ImeConfirmComposition(const string16& ime_string); // Cancels an ongoing composition. void ImeCancelComposition(); @@ -507,7 +507,7 @@ class RenderWidgetHost : public IPC::Channel::Listener { // Set when we update the text direction of the selected input element. bool text_direction_updated_; - WebTextDirection text_direction_; + WebKit::WebTextDirection text_direction_; // Set when we cancel updating the text direction. // This flag also ignores succeeding update requests until we call diff --git a/chrome/browser/renderer_host/render_widget_host_view.h b/chrome/browser/renderer_host/render_widget_host_view.h index b5609e2..5685067 100644 --- a/chrome/browser/renderer_host/render_widget_host_view.h +++ b/chrome/browser/renderer_host/render_widget_host_view.h @@ -9,7 +9,6 @@ #include "base/shared_memory.h" #include "third_party/skia/include/core/SkBitmap.h" #include "webkit/glue/webplugin.h" -#include "webkit/glue/webwidget_delegate.h" namespace gfx { class Rect; diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc index 3bb7425..7980dffd 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc @@ -299,7 +299,7 @@ class RenderWidgetHostViewGtkWidget { static void InputMethodCommit(GtkIMContext* im_context, gchar* text, RenderWidgetHostViewGtk* host_view) { - std::wstring im_text = UTF8ToWide(text); + const string16& im_text = UTF8ToUTF16(text); if (!host_view->im_is_composing_cjk_text_ && im_text.length() == 1) { // Send a Char event when we input a composed character without IMEs so // that this event is to be dispatched to onkeypress() handlers, @@ -344,7 +344,7 @@ class RenderWidgetHostViewGtkWidget { gtk_im_context_get_preedit_string(im_context, &preedit_text, NULL, &cursor_position); host_view->GetRenderWidgetHost()->ImeSetComposition( - UTF8ToWide(preedit_text), cursor_position, -1, -1); + UTF8ToUTF16(preedit_text), cursor_position, -1, -1); g_free(preedit_text); } diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index 6c9b3c6..5e0f535 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -42,6 +42,7 @@ using base::TimeTicks; using WebKit::WebInputEvent; using WebKit::WebInputEventFactory; using WebKit::WebMouseEvent; +using WebKit::WebTextDirection; namespace { @@ -112,6 +113,7 @@ static bool IsRTLKeyboardLayoutInstalled() { // If only a control key and a right-shift key are down. // * WEB_TEXT_DIRECTION_LTR // If only a control key and a left-shift key are down. + static bool GetNewTextDirection(WebTextDirection* direction) { uint8_t keystate[256]; if (!GetKeyboardState(&keystate[0])) @@ -131,10 +133,10 @@ static bool GetNewTextDirection(WebTextDirection* direction) { if (keystate[VK_RSHIFT] & kKeyDownMask) { keystate[VK_RSHIFT] = 0; - *direction = WEB_TEXT_DIRECTION_RTL; + *direction = WebKit::WebTextDirectionRightToLeft; } else if (keystate[VK_LSHIFT] & kKeyDownMask) { keystate[VK_LSHIFT] = 0; - *direction = WEB_TEXT_DIRECTION_LTR; + *direction = WebKit::WebTextDirectionLeftToRight; } else { return false; } @@ -941,7 +943,7 @@ LRESULT RenderWidgetHostViewWin::OnImeComposition( ImeComposition composition; if (ime_input_.GetResult(m_hWnd, lparam, &composition)) { Send(new ViewMsg_ImeSetComposition(render_widget_host_->routing_id(), - 1, + WebKit::WebCompositionCommandConfirm, composition.cursor_position, composition.target_start, composition.target_end, @@ -956,7 +958,7 @@ LRESULT RenderWidgetHostViewWin::OnImeComposition( // composition and send it to a renderer process. if (ime_input_.GetComposition(m_hWnd, lparam, &composition)) { Send(new ViewMsg_ImeSetComposition(render_widget_host_->routing_id(), - 0, + WebKit::WebCompositionCommandSet, composition.cursor_position, composition.target_start, composition.target_end, @@ -977,7 +979,8 @@ LRESULT RenderWidgetHostViewWin::OnImeEndComposition( // of the renderer process. std::wstring empty_string; Send(new ViewMsg_ImeSetComposition(render_widget_host_->routing_id(), - -1, -1, -1, -1, empty_string)); + WebKit::WebCompositionCommandDiscard, + -1, -1, -1, empty_string)); ime_input_.ResetComposition(m_hWnd); } ime_input_.DestroyImeWindow(m_hWnd); |