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

Side by Side Diff: webkit/glue/webview_impl.cc

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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/webview_impl.h ('k') | webkit/glue/webwidget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2007 Google Inc. All Rights Reserved. 2 * Copyright 2007 Google Inc. All Rights Reserved.
3 * 3 *
4 * Portions Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 4 * Portions Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
5 * 5 *
6 * ***** BEGIN LICENSE BLOCK ***** 6 * ***** BEGIN LICENSE BLOCK *****
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 *enable_ime = node->shouldUseInputMethod() && 1229 *enable_ime = node->shouldUseInputMethod() &&
1230 !controller->isInPasswordField(); 1230 !controller->isInPasswordField();
1231 const FrameView* view = node->document()->view(); 1231 const FrameView* view = node->document()->view();
1232 if (!view) 1232 if (!view)
1233 return false; 1233 return false;
1234 const IntRect rect(view->contentsToWindow(controller->absoluteCaretBounds())); 1234 const IntRect rect(view->contentsToWindow(controller->absoluteCaretBounds()));
1235 caret_rect->SetRect(rect.x(), rect.y(), rect.width(), rect.height()); 1235 caret_rect->SetRect(rect.x(), rect.y(), rect.width(), rect.height());
1236 return true; 1236 return true;
1237 } 1237 }
1238 1238
1239 void WebViewImpl::SetTextDirection(WebTextDirection direction) {
1240 // The Editor::setBaseWritingDirection() function checks if we can change
1241 // the text direction of the selected node and updates its DOM "dir"
1242 // attribute and its CSS "direction" property.
1243 // So, we just call the function as Safari does.
1244 const Frame* focused = GetFocusedWebCoreFrame();
1245 if (!focused)
1246 return;
1247 Editor* editor = focused->editor();
1248 if (!editor || !editor->canEdit())
1249 return;
1250
1251 switch (direction) {
1252 case WEB_TEXT_DIRECTION_DEFAULT:
1253 editor->setBaseWritingDirection(WebCore::NaturalWritingDirection);
1254 break;
1255
1256 case WEB_TEXT_DIRECTION_LTR:
1257 editor->setBaseWritingDirection(WebCore::LeftToRightWritingDirection);
1258 break;
1259
1260 case WEB_TEXT_DIRECTION_RTL:
1261 editor->setBaseWritingDirection(WebCore::RightToLeftWritingDirection);
1262 break;
1263
1264 default:
1265 NOTIMPLEMENTED();
1266 break;
1267 }
1268 }
1269
1239 void WebViewImpl::RestoreFocus() { 1270 void WebViewImpl::RestoreFocus() {
1240 if (last_focused_frame_.get()) { 1271 if (last_focused_frame_.get()) {
1241 if (last_focused_frame_->page()) { 1272 if (last_focused_frame_->page()) {
1242 // last_focused_frame_ can be detached from the frame tree, thus, 1273 // last_focused_frame_ can be detached from the frame tree, thus,
1243 // its page can be null. 1274 // its page can be null.
1244 last_focused_frame_->page()->focusController()->setFocusedFrame( 1275 last_focused_frame_->page()->focusController()->setFocusedFrame(
1245 last_focused_frame_.get()); 1276 last_focused_frame_.get());
1246 } 1277 }
1247 if (last_focused_node_.get()) { 1278 if (last_focused_node_.get()) {
1248 // last_focused_node_ may be null, make sure it's valid before trying to 1279 // last_focused_node_ may be null, make sure it's valid before trying to
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 1790
1760 return document->focusedNode(); 1791 return document->focusedNode();
1761 } 1792 }
1762 1793
1763 HitTestResult WebViewImpl::HitTestResultForWindowPos(const IntPoint& pos) { 1794 HitTestResult WebViewImpl::HitTestResultForWindowPos(const IntPoint& pos) {
1764 IntPoint doc_point( 1795 IntPoint doc_point(
1765 page_->mainFrame()->view()->windowToContents(pos)); 1796 page_->mainFrame()->view()->windowToContents(pos));
1766 return page_->mainFrame()->eventHandler()-> 1797 return page_->mainFrame()->eventHandler()->
1767 hitTestResultAtPoint(doc_point, false); 1798 hitTestResultAtPoint(doc_point, false);
1768 } 1799 }
OLDNEW
« 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