| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, Google 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 role = RemapAriaRoleDueToParent(role); | 715 role = RemapAriaRoleDueToParent(role); |
| 716 | 716 |
| 717 if (role) | 717 if (role) |
| 718 return role; | 718 return role; |
| 719 | 719 |
| 720 return kUnknownRole; | 720 return kUnknownRole; |
| 721 } | 721 } |
| 722 | 722 |
| 723 void AXNodeObject::AccessibilityChildrenFromAttribute( | 723 void AXNodeObject::AccessibilityChildrenFromAttribute( |
| 724 QualifiedName attr, | 724 QualifiedName attr, |
| 725 AXObjectImpl::AXObjectVector& children) const { | 725 AXObjectImpl::AXObjectImplVector& children) const { |
| 726 HeapVector<Member<Element>> elements; | 726 HeapVector<Member<Element>> elements; |
| 727 ElementsFromAttribute(elements, attr); | 727 ElementsFromAttribute(elements, attr); |
| 728 | 728 |
| 729 AXObjectCacheImpl& cache = AxObjectCache(); | 729 AXObjectCacheImpl& cache = AxObjectCache(); |
| 730 for (const auto& element : elements) { | 730 for (const auto& element : elements) { |
| 731 if (AXObjectImpl* child = cache.GetOrCreate(element)) { | 731 if (AXObjectImpl* child = cache.GetOrCreate(element)) { |
| 732 // Only aria-labelledby and aria-describedby can target hidden elements. | 732 // Only aria-labelledby and aria-describedby can target hidden elements. |
| 733 if (child->AccessibilityIsIgnored() && attr != aria_labelledbyAttr && | 733 if (child->AccessibilityIsIgnored() && attr != aria_labelledbyAttr && |
| 734 attr != aria_labeledbyAttr && attr != aria_describedbyAttr) { | 734 attr != aria_labeledbyAttr && attr != aria_describedbyAttr) { |
| 735 continue; | 735 continue; |
| (...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1503 | 1503 |
| 1504 return orientation; | 1504 return orientation; |
| 1505 case kRadioGroupRole: | 1505 case kRadioGroupRole: |
| 1506 case kTreeGridRole: | 1506 case kTreeGridRole: |
| 1507 return orientation; | 1507 return orientation; |
| 1508 default: | 1508 default: |
| 1509 return AXObjectImpl::Orientation(); | 1509 return AXObjectImpl::Orientation(); |
| 1510 } | 1510 } |
| 1511 } | 1511 } |
| 1512 | 1512 |
| 1513 AXObjectImpl::AXObjectVector AXNodeObject::RadioButtonsInGroup() const { | 1513 AXObjectImpl::AXObjectImplVector AXNodeObject::RadioButtonsInGroup() const { |
| 1514 AXObjectVector radio_buttons; | 1514 AXObjectImplVector radio_buttons; |
| 1515 if (!node_ || RoleValue() != kRadioButtonRole) | 1515 if (!node_ || RoleValue() != kRadioButtonRole) |
| 1516 return radio_buttons; | 1516 return radio_buttons; |
| 1517 | 1517 |
| 1518 if (isHTMLInputElement(node_)) { | 1518 if (isHTMLInputElement(node_)) { |
| 1519 HTMLInputElement* radio_button = toHTMLInputElement(node_); | 1519 HTMLInputElement* radio_button = toHTMLInputElement(node_); |
| 1520 HeapVector<Member<HTMLInputElement>> html_radio_buttons = | 1520 HeapVector<Member<HTMLInputElement>> html_radio_buttons = |
| 1521 FindAllRadioButtonsWithSameName(radio_button); | 1521 FindAllRadioButtonsWithSameName(radio_button); |
| 1522 for (size_t i = 0; i < html_radio_buttons.size(); ++i) { | 1522 for (size_t i = 0; i < html_radio_buttons.size(); ++i) { |
| 1523 AXObjectImpl* ax_radio_button = | 1523 AXObjectImpl* ax_radio_button = |
| 1524 AxObjectCache().GetOrCreate(html_radio_buttons[i]); | 1524 AxObjectCache().GetOrCreate(html_radio_buttons[i]); |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1944 } | 1944 } |
| 1945 | 1945 |
| 1946 String AXNodeObject::TextFromDescendants(AXObjectSet& visited, | 1946 String AXNodeObject::TextFromDescendants(AXObjectSet& visited, |
| 1947 bool recursive) const { | 1947 bool recursive) const { |
| 1948 if (!CanHaveChildren() && recursive) | 1948 if (!CanHaveChildren() && recursive) |
| 1949 return String(); | 1949 return String(); |
| 1950 | 1950 |
| 1951 StringBuilder accumulated_text; | 1951 StringBuilder accumulated_text; |
| 1952 AXObjectImpl* previous = nullptr; | 1952 AXObjectImpl* previous = nullptr; |
| 1953 | 1953 |
| 1954 AXObjectVector children; | 1954 AXObjectImplVector children; |
| 1955 | 1955 |
| 1956 HeapVector<Member<AXObjectImpl>> owned_children; | 1956 HeapVector<Member<AXObjectImpl>> owned_children; |
| 1957 ComputeAriaOwnsChildren(owned_children); | 1957 ComputeAriaOwnsChildren(owned_children); |
| 1958 for (AXObjectImpl* obj = RawFirstChild(); obj; obj = obj->RawNextSibling()) { | 1958 for (AXObjectImpl* obj = RawFirstChild(); obj; obj = obj->RawNextSibling()) { |
| 1959 if (!AxObjectCache().IsAriaOwned(obj)) | 1959 if (!AxObjectCache().IsAriaOwned(obj)) |
| 1960 children.push_back(obj); | 1960 children.push_back(obj); |
| 1961 } | 1961 } |
| 1962 for (const auto& owned_child : owned_children) | 1962 for (const auto& owned_child : owned_children) |
| 1963 children.push_back(owned_child); | 1963 children.push_back(owned_child); |
| 1964 | 1964 |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2995 } else { | 2995 } else { |
| 2996 return text_alternative; | 2996 return text_alternative; |
| 2997 } | 2997 } |
| 2998 } | 2998 } |
| 2999 } | 2999 } |
| 3000 } | 3000 } |
| 3001 | 3001 |
| 3002 return text_alternative; | 3002 return text_alternative; |
| 3003 } | 3003 } |
| 3004 | 3004 |
| 3005 String AXNodeObject::Description(AXNameFrom name_from, | 3005 String AXNodeObject::Description( |
| 3006 AXDescriptionFrom& description_from, | 3006 AXNameFrom name_from, |
| 3007 AXObjectVector* description_objects) const { | 3007 AXDescriptionFrom& description_from, |
| 3008 AXObjectImplVector* description_objects) const { |
| 3008 AXRelatedObjectVector related_objects; | 3009 AXRelatedObjectVector related_objects; |
| 3009 String result = | 3010 String result = |
| 3010 Description(name_from, description_from, nullptr, &related_objects); | 3011 Description(name_from, description_from, nullptr, &related_objects); |
| 3011 if (description_objects) { | 3012 if (description_objects) { |
| 3012 description_objects->clear(); | 3013 description_objects->clear(); |
| 3013 for (size_t i = 0; i < related_objects.size(); i++) | 3014 for (size_t i = 0; i < related_objects.size(); i++) |
| 3014 description_objects->push_back(related_objects[i]->object); | 3015 description_objects->push_back(related_objects[i]->object); |
| 3015 } | 3016 } |
| 3016 | 3017 |
| 3017 return CollapseWhitespace(result); | 3018 return CollapseWhitespace(result); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3233 return String(); | 3234 return String(); |
| 3234 return ToTextControlElement(node)->StrippedPlaceholder(); | 3235 return ToTextControlElement(node)->StrippedPlaceholder(); |
| 3235 } | 3236 } |
| 3236 | 3237 |
| 3237 DEFINE_TRACE(AXNodeObject) { | 3238 DEFINE_TRACE(AXNodeObject) { |
| 3238 visitor->Trace(node_); | 3239 visitor->Trace(node_); |
| 3239 AXObjectImpl::Trace(visitor); | 3240 AXObjectImpl::Trace(visitor); |
| 3240 } | 3241 } |
| 3241 | 3242 |
| 3242 } // namespace blink | 3243 } // namespace blink |
| OLD | NEW |