summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-18 06:18:58 +0000
committerhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-18 06:18:58 +0000
commite738ea51ac8011f8c16c10666fba1bb7b930fbb3 (patch)
tree65cdae9bce903f5a7717d1242e8d640d70ab51d0 /chrome
parent779aae5fa525671293b0db3ddad27cc3811a362a (diff)
downloadchromium_src-e738ea51ac8011f8c16c10666fba1bb7b930fbb3.zip
chromium_src-e738ea51ac8011f8c16c10666fba1bb7b930fbb3.tar.gz
chromium_src-e738ea51ac8011f8c16c10666fba1bb7b930fbb3.tar.bz2
Reverting 11953.
Review URL: http://codereview.chromium.org/48121 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11954 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/renderer_host/render_widget_host.cc17
-rw-r--r--chrome/browser/renderer_host/render_widget_host.h37
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.cc20
-rw-r--r--chrome/common/render_messages.h34
-rw-r--r--chrome/common/render_messages_internal.h13
-rw-r--r--chrome/renderer/render_view.h1
-rw-r--r--chrome/renderer/render_view_unittest.cc48
-rw-r--r--chrome/renderer/render_widget.cc8
-rw-r--r--chrome/renderer/render_widget.h2
9 files changed, 1 insertions, 179 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc
index f40fe08..83d7bcf 100644
--- a/chrome/browser/renderer_host/render_widget_host.cc
+++ b/chrome/browser/renderer_host/render_widget_host.cc
@@ -53,9 +53,7 @@ RenderWidgetHost::RenderWidgetHost(RenderProcessHost* process,
mouse_move_pending_(false),
needs_repainting_on_restore_(false),
is_unresponsive_(false),
- view_being_painted_(false),
- text_direction_updated_(false),
- text_direction_(WEB_TEXT_DIRECTION_LTR) {
+ view_being_painted_(false) {
if (routing_id_ == MSG_ROUTING_NONE)
routing_id_ = process_->GetNextRoutingID();
@@ -358,19 +356,6 @@ gfx::Rect RenderWidgetHost::GetRootWindowResizerRect() const {
return gfx::Rect();
}
-void RenderWidgetHost::UpdateTextDirection(WebTextDirection direction) {
- text_direction_updated_ = true;
- text_direction_ = direction;
-}
-
-void RenderWidgetHost::NotifyTextDirection() {
- if (text_direction_updated_) {
- text_direction_updated_ = false;
- Send(new ViewMsg_SetTextDirection(routing_id(),
- text_direction_));
- }
-}
-
void RenderWidgetHost::Destroy() {
NotificationService::current()->Notify(
NotificationType::RENDER_WIDGET_HOST_DESTROYED,
diff --git a/chrome/browser/renderer_host/render_widget_host.h b/chrome/browser/renderer_host/render_widget_host.h
index 01bd391..59235d0 100644
--- a/chrome/browser/renderer_host/render_widget_host.h
+++ b/chrome/browser/renderer_host/render_widget_host.h
@@ -15,7 +15,6 @@
#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;
@@ -216,38 +215,6 @@ class RenderWidgetHost : public IPC::Channel::Listener {
// And to also expose it to the RenderWidgetHostView.
virtual gfx::Rect GetRootWindowResizerRect() const;
- // 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 because either Firefox or IE cannot.
- void UpdateTextDirection(WebTextDirection direction);
- void NotifyTextDirection();
-
protected:
// Internal implementation of the public Forward*Event() methods.
void ForwardInputEvent(const WebInputEvent& input_event, int event_size);
@@ -396,10 +363,6 @@ class RenderWidgetHost : public IPC::Channel::Listener {
// back to whatever unhandled handler instead of the returned version.
KeyQueue key_queue_;
- // Set when we need to update the text direction.
- bool text_direction_updated_;
- WebTextDirection text_direction_;
-
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost);
};
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 52751ea..12dc1ba 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc
@@ -823,26 +823,6 @@ LRESULT RenderWidgetHostViewWin::OnKeyEvent(UINT message, WPARAM wparam,
return ::SendMessage(parent_hwnd_, message, wparam, lparam);
}
- if (wparam == VK_SHIFT || wparam == VK_CONTROL) {
- // Bug 1845: we need to update the text direction when a user releases
- // either a right-shift key or a right-control key after pressing both of
- // them. So, we just update the text direction while a user is pressing the
- // keys, and we notify the text direction when a user releases either of
- // them.
- if (message == WM_KEYDOWN) {
- const int kKeyDownMask = 0x8000;
- if ((GetKeyState(VK_RSHIFT) & kKeyDownMask) &&
- (GetKeyState(VK_RCONTROL) & kKeyDownMask)) {
- render_widget_host_->UpdateTextDirection(WEB_TEXT_DIRECTION_RTL);
- } else if ((GetKeyState(VK_LSHIFT) & kKeyDownMask) &&
- (GetKeyState(VK_LCONTROL) & kKeyDownMask)) {
- render_widget_host_->UpdateTextDirection(WEB_TEXT_DIRECTION_LTR);
- }
- } else if (message == WM_KEYUP) {
- render_widget_host_->NotifyTextDirection();
- }
- }
-
render_widget_host_->ForwardKeyboardEvent(
NativeWebKeyboardEvent(m_hWnd, message, wparam, lparam));
return 0;
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 4d67d88..ebac85c 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -38,7 +38,6 @@
#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)
@@ -1834,39 +1833,6 @@ 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
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 98006fd..dedf4774 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -24,7 +24,6 @@
#include "webkit/glue/webcursor.h"
#include "webkit/glue/webinputevent.h"
#include "webkit/glue/webplugin.h"
-#include "webkit/glue/webtextdirection.h"
// TODO(mpcomplete): rename ViewMsg and ViewHostMsg to something that makes
// more sense with our current design.
@@ -512,18 +511,6 @@ IPC_BEGIN_MESSAGES(View)
// Notification that a move or resize renderer's containing window has
// started.
IPC_MESSAGE_ROUTED0(ViewMsg_MoveOrResizeStarted)
-
- // Changes the text direction of a selected input field.
- // * direction (WebTextDirection)
- // Represents the new text direction.
- // Its possible values are listed below:
- // Value New Text Direction
- // WEB_TEXT_DIRECTION_DEFAULT NaturalWritingDirection ("inherit")
- // WEB_TEXT_DIRECTION_LTR LeftToRightWritingDirection ("rtl")
- // WEB_TEXT_DIRECTION_RTL RightToLeftWritingDirection ("ltr")
- IPC_MESSAGE_ROUTED1(ViewMsg_SetTextDirection,
- WebTextDirection /* direction */)
-
IPC_END_MESSAGES(View)
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index e60e301..7263cb7 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -374,7 +374,6 @@ class RenderView : public RenderWidget,
FRIEND_TEST(RenderViewTest, OnNavStateChanged);
FRIEND_TEST(RenderViewTest, OnImeStateChanged);
FRIEND_TEST(RenderViewTest, ImeComposition);
- FRIEND_TEST(RenderViewTest, OnSetTextDirection);
explicit RenderView(RenderThreadBase* render_thread);
diff --git a/chrome/renderer/render_view_unittest.cc b/chrome/renderer/render_view_unittest.cc
index a643052..e81cf4f 100644
--- a/chrome/renderer/render_view_unittest.cc
+++ b/chrome/renderer/render_view_unittest.cc
@@ -317,51 +317,3 @@ TEST_F(RenderViewTest, ImeComposition) {
}
}
}
-
-// Test that the RenderView::OnSetTextDirection() function can change the text
-// direction of the selected input element.
-TEST_F(RenderViewTest, OnSetTextDirection) {
- // Load an HTML page consisting of a <textarea> element and a <div> element.
- // This test changes the text direction of the <textarea> element, and
- // writes the values of its 'dir' attribute and its 'direction' property to
- // verify that the text direction is changed.
- view_->set_delay_seconds_for_form_state_sync(0);
- LoadHTML("<html>"
- "<head>"
- "</head>"
- "<body>"
- "<textarea id=\"test\"></textarea>"
- "<div id=\"result\" contenteditable=\"true\"></div>"
- "</body>"
- "</html>");
- render_thread_.sink().ClearMessages();
-
- static const struct {
- WebTextDirection direction;
- const wchar_t* expected_result;
- } kTextDirection[] = {
- {WEB_TEXT_DIRECTION_RTL, L"\x000A" L"rtl,rtl"},
- {WEB_TEXT_DIRECTION_LTR, L"\x000A" L"ltr,ltr"},
- };
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTextDirection); ++i) {
- // Set the text direction of the <textarea> element.
- ExecuteJavaScript("document.getElementById('test').focus();");
- view_->OnSetTextDirection(kTextDirection[i].direction);
-
- // Write the values of its DOM 'dir' attribute and its CSS 'direction'
- // property to the <div> element.
- ExecuteJavaScript("var result = document.getElementById('result');"
- "var node = document.getElementById('test');"
- "var style = getComputedStyle(node, null);"
- "result.innerText ="
- " node.getAttribute('dir') + ',' +"
- " style.getPropertyValue('direction');");
-
- // Copy the document content to std::wstring and compare with the
- // expected result.
- const int kMaxOutputCharacters = 16;
- std::wstring output;
- GetMainFrame()->GetContentAsPlainText(kMaxOutputCharacters, &output);
- EXPECT_EQ(output, kTextDirection[i].expected_result);
- }
-}
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc
index 6bfcb7b..a7ad380 100644
--- a/chrome/renderer/render_widget.cc
+++ b/chrome/renderer/render_widget.cc
@@ -119,7 +119,6 @@ IPC_DEFINE_MESSAGE_MAP(RenderWidget)
IPC_MESSAGE_HANDLER(ViewMsg_ImeSetInputMode, OnImeSetInputMode)
IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition)
IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnMsgRepaint)
- IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection)
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP()
@@ -636,13 +635,6 @@ void RenderWidget::OnMsgRepaint(const gfx::Size& size_to_paint) {
DidInvalidateRect(webwidget_, repaint_rect);
}
-void RenderWidget::OnSetTextDirection(WebTextDirection direction) {
- if (!webwidget_)
- return;
-
- webwidget_->SetTextDirection(direction);
-}
-
bool RenderWidget::next_paint_is_resize_ack() const {
return ViewHostMsg_PaintRect_Flags::is_resize_ack(next_paint_flags_);
}
diff --git a/chrome/renderer/render_widget.h b/chrome/renderer/render_widget.h
index 039b4da..4079a8b 100644
--- a/chrome/renderer/render_widget.h
+++ b/chrome/renderer/render_widget.h
@@ -19,7 +19,6 @@
#include "webkit/glue/webwidget_delegate.h"
#include "webkit/glue/webcursor.h"
-#include "webkit/glue/webtextdirection.h"
class RenderThreadBase;
struct WebPluginGeometry;
@@ -129,7 +128,6 @@ class RenderWidget : public IPC::Channel::Listener,
int target_start, int target_end,
const std::wstring& ime_string);
void OnMsgRepaint(const gfx::Size& size_to_paint);
- void OnSetTextDirection(WebTextDirection direction);
// True if a PaintRect_ACK message is pending.
bool paint_reply_pending() const {