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)) | |
659 return false; | |
660 | |
661 BrowserAccessibility* focus_object = manager()->GetFromID(focus_id); | 657 BrowserAccessibility* focus_object = manager()->GetFromID(focus_id); |
662 if (!focus_object) | 658 if (!focus_object) |
663 return false; | 659 return false; |
664 | 660 |
665 if (!focus_object->IsDescendantOf(this)) | 661 if (!focus_object->IsDescendantOf(this)) |
666 return false; | 662 return false; |
667 | 663 |
668 return true; | 664 return true; |
669 } | 665 } |
670 | 666 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 } | 789 } |
794 need_to_offset_web_area = true; | 790 need_to_offset_web_area = true; |
795 } | 791 } |
796 parent = parent->GetParent(); | 792 parent = parent->GetParent(); |
797 } | 793 } |
798 | 794 |
799 return bounds; | 795 return bounds; |
800 } | 796 } |
801 | 797 |
802 } // namespace content | 798 } // namespace content |
OLD | NEW |