OLD | NEW |
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 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 if (!editor || !editor->canEdit()) | 1176 if (!editor || !editor->canEdit()) |
1177 return false; | 1177 return false; |
1178 SelectionController* controller = focused->selection(); | 1178 SelectionController* controller = focused->selection(); |
1179 if (!controller) | 1179 if (!controller) |
1180 return false; | 1180 return false; |
1181 const Node* node = controller->start().node(); | 1181 const Node* node = controller->start().node(); |
1182 if (!node) | 1182 if (!node) |
1183 return false; | 1183 return false; |
1184 *enable_ime = node->shouldUseInputMethod() && | 1184 *enable_ime = node->shouldUseInputMethod() && |
1185 !controller->isInPasswordField(); | 1185 !controller->isInPasswordField(); |
1186 const IntRect rect(controller->absoluteCaretBounds()); | 1186 const FrameView* view = node->document()->view(); |
| 1187 if (!view) |
| 1188 return false; |
| 1189 const IntRect rect(view->contentsToWindow(controller->absoluteCaretBounds())); |
1187 caret_rect->SetRect(rect.x(), rect.y(), rect.width(), rect.height()); | 1190 caret_rect->SetRect(rect.x(), rect.y(), rect.width(), rect.height()); |
1188 return true; | 1191 return true; |
1189 } | 1192 } |
1190 | 1193 |
1191 void WebViewImpl::RestoreFocus() { | 1194 void WebViewImpl::RestoreFocus() { |
1192 if (last_focused_frame_.get()) { | 1195 if (last_focused_frame_.get()) { |
1193 if (last_focused_frame_->page()) { | 1196 if (last_focused_frame_->page()) { |
1194 // last_focused_frame_ can be detached from the frame tree, thus, | 1197 // last_focused_frame_ can be detached from the frame tree, thus, |
1195 // its page can be null. | 1198 // its page can be null. |
1196 last_focused_frame_->page()->focusController()->setFocusedFrame( | 1199 last_focused_frame_->page()->focusController()->setFocusedFrame( |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1674 Frame* frame = page_->focusController()->focusedFrame(); | 1677 Frame* frame = page_->focusController()->focusedFrame(); |
1675 if (!frame) | 1678 if (!frame) |
1676 return NULL; | 1679 return NULL; |
1677 | 1680 |
1678 Document* document = frame->document(); | 1681 Document* document = frame->document(); |
1679 if (!document) | 1682 if (!document) |
1680 return NULL; | 1683 return NULL; |
1681 | 1684 |
1682 return document->focusedNode(); | 1685 return document->focusedNode(); |
1683 } | 1686 } |
OLD | NEW |