| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/accessibility/browser_accessibility.h" | 5 #include "content/browser/accessibility/browser_accessibility.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 GetRole() == ui::AX_ROLE_ROW_HEADER); | 645 GetRole() == ui::AX_ROLE_ROW_HEADER); |
| 646 } | 646 } |
| 647 | 647 |
| 648 bool BrowserAccessibility::HasCaret() const { | 648 bool BrowserAccessibility::HasCaret() const { |
| 649 if (IsEditableText() && !HasState(ui::AX_STATE_RICHLY_EDITABLE) && | 649 if (IsEditableText() && !HasState(ui::AX_STATE_RICHLY_EDITABLE) && |
| 650 HasIntAttribute(ui::AX_ATTR_TEXT_SEL_START) && | 650 HasIntAttribute(ui::AX_ATTR_TEXT_SEL_START) && |
| 651 HasIntAttribute(ui::AX_ATTR_TEXT_SEL_END)) { | 651 HasIntAttribute(ui::AX_ATTR_TEXT_SEL_END)) { |
| 652 return true; | 652 return true; |
| 653 } | 653 } |
| 654 | 654 |
| 655 BrowserAccessibility* root = manager()->GetRoot(); | |
| 656 // The caret is always at the focus of the selection. | 655 // The caret is always at the focus of the selection. |
| 657 int32 focus_id; | 656 int32 focus_id = manager()->GetTreeData().sel_focus_object_id; |
| 658 if (!root || !root->GetIntAttribute(ui::AX_ATTR_FOCUS_OBJECT_ID, &focus_id)) | 657 if (focus_id == -1) |
| 659 return false; | 658 return false; |
| 660 | 659 |
| 661 BrowserAccessibility* focus_object = manager()->GetFromID(focus_id); | 660 BrowserAccessibility* focus_object = manager()->GetFromID(focus_id); |
| 662 if (!focus_object) | 661 if (!focus_object) |
| 663 return false; | 662 return false; |
| 664 | 663 |
| 665 if (!focus_object->IsDescendantOf(this)) | 664 if (!focus_object->IsDescendantOf(this)) |
| 666 return false; | 665 return false; |
| 667 | 666 |
| 668 return true; | 667 return true; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 } | 792 } |
| 794 need_to_offset_web_area = true; | 793 need_to_offset_web_area = true; |
| 795 } | 794 } |
| 796 parent = parent->GetParent(); | 795 parent = parent->GetParent(); |
| 797 } | 796 } |
| 798 | 797 |
| 799 return bounds; | 798 return bounds; |
| 800 } | 799 } |
| 801 | 800 |
| 802 } // namespace content | 801 } // namespace content |
| OLD | NEW |