OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 AccessibilityRole role = AriaRoleToWebCoreRole(aria_role); | 57 AccessibilityRole role = AriaRoleToWebCoreRole(aria_role); |
58 if (role) | 58 if (role) |
59 return role; | 59 return role; |
60 return kMenuListOptionRole; | 60 return kMenuListOptionRole; |
61 } | 61 } |
62 | 62 |
63 Element* AXMenuListOption::ActionElement() const { | 63 Element* AXMenuListOption::ActionElement() const { |
64 return element_; | 64 return element_; |
65 } | 65 } |
66 | 66 |
| 67 AXObjectImpl* AXMenuListOption::ComputeParent() const { |
| 68 Node* node = GetNode(); |
| 69 if (!node) |
| 70 return nullptr; |
| 71 HTMLSelectElement* select = toHTMLOptionElement(node)->OwnerSelectElement(); |
| 72 if (!select) |
| 73 return nullptr; |
| 74 AXObjectImpl* select_ax_object = AxObjectCache().GetOrCreate(select); |
| 75 if (select_ax_object->HasChildren()) { |
| 76 const auto& child_objects = select_ax_object->Children(); |
| 77 DCHECK(!child_objects.IsEmpty()); |
| 78 DCHECK_EQ(child_objects.size(), 1UL); |
| 79 DCHECK(child_objects[0]->IsMenuListPopup()); |
| 80 ToAXMenuListPopup(child_objects[0].Get())->UpdateChildrenIfNecessary(); |
| 81 } else { |
| 82 select_ax_object->UpdateChildrenIfNecessary(); |
| 83 } |
| 84 return parent_.Get(); |
| 85 } |
| 86 |
67 bool AXMenuListOption::IsEnabled() const { | 87 bool AXMenuListOption::IsEnabled() const { |
68 // isDisabledFormControl() returns true if the parent <select> element is | 88 // isDisabledFormControl() returns true if the parent <select> element is |
69 // disabled, which we don't want. | 89 // disabled, which we don't want. |
70 return element_ && !element_->OwnElementDisabled(); | 90 return element_ && !element_->OwnElementDisabled(); |
71 } | 91 } |
72 | 92 |
73 bool AXMenuListOption::IsVisible() const { | 93 bool AXMenuListOption::IsVisible() const { |
74 if (!parent_) | 94 if (!parent_) |
75 return false; | 95 return false; |
76 | 96 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 204 |
185 return 0; | 205 return 0; |
186 } | 206 } |
187 | 207 |
188 DEFINE_TRACE(AXMenuListOption) { | 208 DEFINE_TRACE(AXMenuListOption) { |
189 visitor->Trace(element_); | 209 visitor->Trace(element_); |
190 AXMockObject::Trace(visitor); | 210 AXMockObject::Trace(visitor); |
191 } | 211 } |
192 | 212 |
193 } // namespace blink | 213 } // namespace blink |
OLD | NEW |