| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 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 * | 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 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1250 | 1250 |
| 1251 return AXNodeObject::TextAlternative(recursive, in_aria_labelled_by_traversal, | 1251 return AXNodeObject::TextAlternative(recursive, in_aria_labelled_by_traversal, |
| 1252 visited, name_from, related_objects, | 1252 visited, name_from, related_objects, |
| 1253 name_sources); | 1253 name_sources); |
| 1254 } | 1254 } |
| 1255 | 1255 |
| 1256 // | 1256 // |
| 1257 // ARIA attributes. | 1257 // ARIA attributes. |
| 1258 // | 1258 // |
| 1259 | 1259 |
| 1260 void AXLayoutObject::AriaOwnsElements(AXObjectVector& owns) const { | 1260 void AXLayoutObject::AriaOwnsElements(AXObjectImplVector& owns) const { |
| 1261 AccessibilityChildrenFromAttribute(aria_ownsAttr, owns); | 1261 AccessibilityChildrenFromAttribute(aria_ownsAttr, owns); |
| 1262 } | 1262 } |
| 1263 | 1263 |
| 1264 void AXLayoutObject::AriaDescribedbyElements( | 1264 void AXLayoutObject::AriaDescribedbyElements( |
| 1265 AXObjectVector& describedby) const { | 1265 AXObjectImplVector& describedby) const { |
| 1266 AccessibilityChildrenFromAttribute(aria_describedbyAttr, describedby); | 1266 AccessibilityChildrenFromAttribute(aria_describedbyAttr, describedby); |
| 1267 } | 1267 } |
| 1268 | 1268 |
| 1269 void AXLayoutObject::AriaLabelledbyElements(AXObjectVector& labelledby) const { | 1269 void AXLayoutObject::AriaLabelledbyElements( |
| 1270 AXObjectImplVector& labelledby) const { |
| 1270 AccessibilityChildrenFromAttribute(aria_labelledbyAttr, labelledby); | 1271 AccessibilityChildrenFromAttribute(aria_labelledbyAttr, labelledby); |
| 1271 } | 1272 } |
| 1272 | 1273 |
| 1273 bool AXLayoutObject::AriaHasPopup() const { | 1274 bool AXLayoutObject::AriaHasPopup() const { |
| 1274 return ElementAttributeValue(aria_haspopupAttr); | 1275 return ElementAttributeValue(aria_haspopupAttr); |
| 1275 } | 1276 } |
| 1276 | 1277 |
| 1277 bool AXLayoutObject::AriaRoleHasPresentationalChildren() const { | 1278 bool AXLayoutObject::AriaRoleHasPresentationalChildren() const { |
| 1278 switch (aria_role_) { | 1279 switch (aria_role_) { |
| 1279 case kButtonRole: | 1280 case kButtonRole: |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1721 return ToElement(&runner); | 1722 return ToElement(&runner); |
| 1722 } | 1723 } |
| 1723 | 1724 |
| 1724 return 0; | 1725 return 0; |
| 1725 } | 1726 } |
| 1726 | 1727 |
| 1727 // | 1728 // |
| 1728 // Functions that retrieve the current selection. | 1729 // Functions that retrieve the current selection. |
| 1729 // | 1730 // |
| 1730 | 1731 |
| 1731 AXObjectImpl::AXRange AXLayoutObject::Selection() const { | 1732 AXObject::AXRange AXLayoutObject::Selection() const { |
| 1732 AXRange text_selection = TextControlSelection(); | 1733 AXRange text_selection = TextControlSelection(); |
| 1733 if (text_selection.IsValid()) | 1734 if (text_selection.IsValid()) |
| 1734 return text_selection; | 1735 return text_selection; |
| 1735 | 1736 |
| 1736 if (!GetLayoutObject() || !GetLayoutObject()->GetFrame()) | 1737 if (!GetLayoutObject() || !GetLayoutObject()->GetFrame()) |
| 1737 return AXRange(); | 1738 return AXRange(); |
| 1738 | 1739 |
| 1739 VisibleSelection selection = | 1740 VisibleSelection selection = |
| 1740 GetLayoutObject() | 1741 GetLayoutObject() |
| 1741 ->GetFrame() | 1742 ->GetFrame() |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1791 DCHECK_GE(anchor_offset, 0); | 1792 DCHECK_GE(anchor_offset, 0); |
| 1792 int focus_offset = focus_object->IndexForVisiblePosition(visible_end); | 1793 int focus_offset = focus_object->IndexForVisiblePosition(visible_end); |
| 1793 DCHECK_GE(focus_offset, 0); | 1794 DCHECK_GE(focus_offset, 0); |
| 1794 return AXRange(anchor_object, anchor_offset, start_affinity, focus_object, | 1795 return AXRange(anchor_object, anchor_offset, start_affinity, focus_object, |
| 1795 focus_offset, end_affinity); | 1796 focus_offset, end_affinity); |
| 1796 } | 1797 } |
| 1797 | 1798 |
| 1798 // Gets only the start and end offsets of the selection computed using the | 1799 // Gets only the start and end offsets of the selection computed using the |
| 1799 // current object as the starting point. Returns a null selection if there is | 1800 // current object as the starting point. Returns a null selection if there is |
| 1800 // no selection in the subtree rooted at this object. | 1801 // no selection in the subtree rooted at this object. |
| 1801 AXObjectImpl::AXRange AXLayoutObject::SelectionUnderObject() const { | 1802 AXObject::AXRange AXLayoutObject::SelectionUnderObject() const { |
| 1802 AXRange text_selection = TextControlSelection(); | 1803 AXRange text_selection = TextControlSelection(); |
| 1803 if (text_selection.IsValid()) | 1804 if (text_selection.IsValid()) |
| 1804 return text_selection; | 1805 return text_selection; |
| 1805 | 1806 |
| 1806 if (!GetNode() || !GetLayoutObject()->GetFrame()) | 1807 if (!GetNode() || !GetLayoutObject()->GetFrame()) |
| 1807 return AXRange(); | 1808 return AXRange(); |
| 1808 | 1809 |
| 1809 VisibleSelection selection = | 1810 VisibleSelection selection = |
| 1810 GetLayoutObject() | 1811 GetLayoutObject() |
| 1811 ->GetFrame() | 1812 ->GetFrame() |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1825 } | 1826 } |
| 1826 | 1827 |
| 1827 int start = IndexForVisiblePosition(selection.VisibleStart()); | 1828 int start = IndexForVisiblePosition(selection.VisibleStart()); |
| 1828 DCHECK_GE(start, 0); | 1829 DCHECK_GE(start, 0); |
| 1829 int end = IndexForVisiblePosition(selection.VisibleEnd()); | 1830 int end = IndexForVisiblePosition(selection.VisibleEnd()); |
| 1830 DCHECK_GE(end, 0); | 1831 DCHECK_GE(end, 0); |
| 1831 | 1832 |
| 1832 return AXRange(start, end); | 1833 return AXRange(start, end); |
| 1833 } | 1834 } |
| 1834 | 1835 |
| 1835 AXObjectImpl::AXRange AXLayoutObject::TextControlSelection() const { | 1836 AXObject::AXRange AXLayoutObject::TextControlSelection() const { |
| 1836 if (!GetLayoutObject()) | 1837 if (!GetLayoutObject()) |
| 1837 return AXRange(); | 1838 return AXRange(); |
| 1838 | 1839 |
| 1839 LayoutObject* layout = nullptr; | 1840 LayoutObject* layout = nullptr; |
| 1840 if (GetLayoutObject()->IsTextControl()) { | 1841 if (GetLayoutObject()->IsTextControl()) { |
| 1841 layout = GetLayoutObject(); | 1842 layout = GetLayoutObject(); |
| 1842 } else { | 1843 } else { |
| 1843 Element* focused_element = GetDocument()->FocusedElement(); | 1844 Element* focused_element = GetDocument()->FocusedElement(); |
| 1844 if (focused_element && focused_element->GetLayoutObject() && | 1845 if (focused_element && focused_element->GetLayoutObject() && |
| 1845 focused_element->GetLayoutObject()->IsTextControl()) | 1846 focused_element->GetLayoutObject()->IsTextControl()) |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2521 | 2522 |
| 2522 bool AXLayoutObject::ElementAttributeValue( | 2523 bool AXLayoutObject::ElementAttributeValue( |
| 2523 const QualifiedName& attribute_name) const { | 2524 const QualifiedName& attribute_name) const { |
| 2524 if (!layout_object_) | 2525 if (!layout_object_) |
| 2525 return false; | 2526 return false; |
| 2526 | 2527 |
| 2527 return EqualIgnoringASCIICase(GetAttribute(attribute_name), "true"); | 2528 return EqualIgnoringASCIICase(GetAttribute(attribute_name), "true"); |
| 2528 } | 2529 } |
| 2529 | 2530 |
| 2530 } // namespace blink | 2531 } // namespace blink |
| OLD | NEW |