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

Unified Diff: chrome/browser/renderer_host/render_widget_host.h

Issue 42495: A tricky fix for Issue 1845 (Take 2).... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | « no previous file | chrome/browser/renderer_host/render_widget_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/render_widget_host.h
===================================================================
--- chrome/browser/renderer_host/render_widget_host.h (revision 12427)
+++ chrome/browser/renderer_host/render_widget_host.h (working copy)
@@ -15,6 +15,7 @@
#include "chrome/common/native_web_keyboard_event.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
#include "webkit/glue/webinputevent.h"
+#include "webkit/glue/webtextdirection.h"
namespace gfx {
class Rect;
@@ -211,6 +212,38 @@
void ForwardWheelEvent(const WebMouseWheelEvent& wheel_event);
void ForwardKeyboardEvent(const NativeWebKeyboardEvent& key_event);
+ // Update the text direction of the focused input element and notify it to a
+ // renderer process.
+ // These functions have two usage scenarios: changing the text direction
+ // from a menu (as Safari does), and; changing the text direction when a user
+ // presses a set of keys (as IE and Firefox do).
+ // 1. Change the text direction from a menu.
+ // In this scenario, we receive a menu event only once and we should update
+ // the text direction immediately when a user chooses a menu item. So, we
+ // should call both functions at once as listed in the following snippet.
+ // void RenderViewHost::SetTextDirection(WebTextDirection direction) {
+ // UpdateTextDirection(direction);
+ // NotifyTextDirection();
+ // }
+ // 2. Change the text direction when pressing a set of keys.
+ // Becauses of auto-repeat, we may receive the same key-press event many
+ // times while we presses the keys and it is nonsense to send the same IPC
+ // messsage every time when we receive a key-press event.
+ // To suppress the number of IPC messages, we just update the text direction
+ // when receiving a key-press event and send an IPC message when we release
+ // the keys as listed in the following snippet.
+ // if (key_event.type == WebKeyboardEvent::KEY_DOWN) {
+ // if (key_event.windows_key_code == 'A' &&
+ // key_event.modifiers == WebKeyboardEvent::CTRL_KEY) {
+ // UpdateTextDirection(dir);
+ // }
+ // } else if (key_event.type == WebKeyboardEvent::KEY_UP) {
+ // NotifyTextDirection();
+ // }
+ // Note: we cannot undo this change for compatibility with Firefox and IE.
+ void UpdateTextDirection(WebTextDirection direction);
+ void NotifyTextDirection();
+
// This is for derived classes to give us access to the resizer rect.
// And to also expose it to the RenderWidgetHostView.
virtual gfx::Rect GetRootWindowResizerRect() const;
@@ -363,6 +396,10 @@
// back to whatever unhandled handler instead of the returned version.
KeyQueue key_queue_;
+ // Set when we update the text direction of the selected input element.
+ bool text_direction_updated_;
+ WebTextDirection text_direction_;
+
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost);
};
« no previous file with comments | « no previous file | chrome/browser/renderer_host/render_widget_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698