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

Unified Diff: webkit/glue/webview_impl.cc

Issue 39252: A tricky fix for Issue 1845.... (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 | « webkit/glue/webview_impl.h ('k') | webkit/glue/webwidget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webview_impl.cc
===================================================================
--- webkit/glue/webview_impl.cc (revision 11937)
+++ webkit/glue/webview_impl.cc (working copy)
@@ -1192,6 +1192,37 @@
return true;
}
+void WebViewImpl::SetTextDirection(WebTextDirection direction) {
+ // The Editor::setBaseWritingDirection() function checks if we can change
+ // the text direction of the selected node and updates its DOM "dir"
+ // attribute and its CSS "direction" property.
+ // So, we just call the function as Safari does.
+ const Frame* focused = GetFocusedWebCoreFrame();
+ if (!focused)
+ return;
+ Editor* editor = focused->editor();
+ if (!editor || !editor->canEdit())
+ return;
+
+ switch (direction) {
+ case WEB_TEXT_DIRECTION_DEFAULT:
+ editor->setBaseWritingDirection(WebCore::NaturalWritingDirection);
+ break;
+
+ case WEB_TEXT_DIRECTION_LTR:
+ editor->setBaseWritingDirection(WebCore::LeftToRightWritingDirection);
+ break;
+
+ case WEB_TEXT_DIRECTION_RTL:
+ editor->setBaseWritingDirection(WebCore::RightToLeftWritingDirection);
+ break;
+
+ default:
+ NOTIMPLEMENTED();
+ break;
+ }
+}
+
void WebViewImpl::RestoreFocus() {
if (last_focused_frame_.get()) {
if (last_focused_frame_->page()) {
« no previous file with comments | « webkit/glue/webview_impl.h ('k') | webkit/glue/webwidget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698