| 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 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 // 2. Retrieve the caret rectangle from the controller; | 1123 // 2. Retrieve the caret rectangle from the controller; |
| 1124 // 3. Convert the rectangle, which is relative to the parent view, to the | 1124 // 3. Convert the rectangle, which is relative to the parent view, to the |
| 1125 // one relative to the client window, and; | 1125 // one relative to the client window, and; |
| 1126 // 4. Store the converted rectangle. | 1126 // 4. Store the converted rectangle. |
| 1127 const Frame* focused = GetFocusedWebCoreFrame(); | 1127 const Frame* focused = GetFocusedWebCoreFrame(); |
| 1128 if (!focused) | 1128 if (!focused) |
| 1129 return false; | 1129 return false; |
| 1130 const Editor* editor = focused->editor(); | 1130 const Editor* editor = focused->editor(); |
| 1131 if (!editor || !editor->canEdit()) | 1131 if (!editor || !editor->canEdit()) |
| 1132 return false; | 1132 return false; |
| 1133 const SelectionController* controller = focused->selection(); | 1133 SelectionController* controller = focused->selection(); |
| 1134 if (!controller) | 1134 if (!controller) |
| 1135 return false; | 1135 return false; |
| 1136 const Node* node = controller->start().node(); | 1136 const Node* node = controller->start().node(); |
| 1137 if (!node) | 1137 if (!node) |
| 1138 return false; | 1138 return false; |
| 1139 *enable_ime = node->shouldUseInputMethod() && | 1139 *enable_ime = node->shouldUseInputMethod() && |
| 1140 !controller->isInPasswordField(); | 1140 !controller->isInPasswordField(); |
| 1141 const FrameView* view = node->document()->view(); | 1141 const IntRect rect(controller->absoluteCaretBounds()); |
| 1142 if (!view) | |
| 1143 return false; | |
| 1144 const IntRect rect(view->contentsToWindow(controller->localCaretRect())); | |
| 1145 caret_rect->SetRect(rect.x(), rect.y(), rect.width(), rect.height()); | 1142 caret_rect->SetRect(rect.x(), rect.y(), rect.width(), rect.height()); |
| 1146 return true; | 1143 return true; |
| 1147 } | 1144 } |
| 1148 | 1145 |
| 1149 void WebViewImpl::RestoreFocus() { | 1146 void WebViewImpl::RestoreFocus() { |
| 1150 if (last_focused_frame_.get()) { | 1147 if (last_focused_frame_.get()) { |
| 1151 if (last_focused_frame_->page()) { | 1148 if (last_focused_frame_->page()) { |
| 1152 // last_focused_frame_ can be detached from the frame tree, thus, | 1149 // last_focused_frame_ can be detached from the frame tree, thus, |
| 1153 // its page can be null. | 1150 // its page can be null. |
| 1154 last_focused_frame_->page()->focusController()->setFocusedFrame( | 1151 last_focused_frame_->page()->focusController()->setFocusedFrame( |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1630 Frame* frame = page_->focusController()->focusedFrame(); | 1627 Frame* frame = page_->focusController()->focusedFrame(); |
| 1631 if (!frame) | 1628 if (!frame) |
| 1632 return NULL; | 1629 return NULL; |
| 1633 | 1630 |
| 1634 Document* document = frame->document(); | 1631 Document* document = frame->document(); |
| 1635 if (!document) | 1632 if (!document) |
| 1636 return NULL; | 1633 return NULL; |
| 1637 | 1634 |
| 1638 return document->focusedNode(); | 1635 return document->focusedNode(); |
| 1639 } | 1636 } |
| OLD | NEW |