summaryrefslogtreecommitdiffstats
path: root/chrome/common/render_messages.h
diff options
context:
space:
mode:
authorhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-18 05:46:29 +0000
committerhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-18 05:46:29 +0000
commit779aae5fa525671293b0db3ddad27cc3811a362a (patch)
treecc943534ce00344cfd998db989985de37a7e8927 /chrome/common/render_messages.h
parentc285cf2c3dc3eb128541f07065974010dae1b408 (diff)
downloadchromium_src-779aae5fa525671293b0db3ddad27cc3811a362a.zip
chromium_src-779aae5fa525671293b0db3ddad27cc3811a362a.tar.gz
chromium_src-779aae5fa525671293b0db3ddad27cc3811a362a.tar.bz2
A tricky fix for Issue 1845.
This change is a very tricky fix for Issue 1845 in chromium: cant alignt text to the right using right shift and right ctrl.This change consists of two parts listed below. 1. Emulating the implementation of Safari that changes the text-direction of an input element. Safari uses context menus to change the text direction. This change adds an IPC message 'ViewMsg_SetTextDirection', which notifies the new text direction. Also, it adds two functions: RenderWidgetHost::UpdateTextDirection() and RenderWidgetHost::NotifyTextDirection(). They encapsulate the new IPC message so that we can use them both when we presses a set of keys and when we add context-menu items which change the text direction. 2. Calling the above interface when pressing right-shift and right-control keys, or when left-shift and left-control keys. This modifies the RenderWidgetHostViewWin::OnKeyEvent() function and call the above text-direction interfaces when a user finishes pressing the keys. As you can imagine, if we send an IPC message every time when we receive a WM_KEYDOWN event, we continue sending IPC messages while a user is pressing the keys. BUG=1845 Review URL: http://codereview.chromium.org/39252 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11953 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/render_messages.h')
-rw-r--r--chrome/common/render_messages.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index ebac85c..4d67d88 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -38,6 +38,7 @@
#include "webkit/glue/webinputevent.h"
#include "webkit/glue/webplugin.h"
#include "webkit/glue/webpreferences.h"
+#include "webkit/glue/webtextdirection.h"
#include "webkit/glue/webview_delegate.h"
#if defined(OS_POSIX)
@@ -1833,6 +1834,39 @@ struct ParamTraits<AudioOutputStream::State> {
}
};
+template <>
+struct ParamTraits<WebTextDirection> {
+ typedef WebTextDirection param_type;
+ static void Write(Message* m, const param_type& p) {
+ m->WriteInt(p);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ int type;
+ if (!m->ReadInt(iter, &type))
+ return false;
+ *p = static_cast<WebTextDirection>(type);
+ return true;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ std::wstring control;
+ switch (p) {
+ case WEB_TEXT_DIRECTION_DEFAULT:
+ control = L"WEB_TEXT_DIRECTION_DEFAULT";
+ break;
+ case WEB_TEXT_DIRECTION_RTL:
+ control = L"WEB_TEXT_DIRECTION_RTL";
+ break;
+ case WEB_TEXT_DIRECTION_LTR:
+ control = L"WEB_TEXT_DIRECTION_LTR";
+ break;
+ default:
+ control = L"UNKNOWN";
+ break;
+ }
+
+ LogParam(control, l);
+ }
+};
} // namespace IPC