| 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 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 if (!m_layoutObject) | 1072 if (!m_layoutObject) |
| 1073 return String(); | 1073 return String(); |
| 1074 | 1074 |
| 1075 LayoutBoxModelObject* cssBox = layoutBoxModelObject(); | 1075 LayoutBoxModelObject* cssBox = layoutBoxModelObject(); |
| 1076 | 1076 |
| 1077 if (cssBox && cssBox->isMenuList()) { | 1077 if (cssBox && cssBox->isMenuList()) { |
| 1078 // LayoutMenuList will go straight to the text() of its selected item. | 1078 // LayoutMenuList will go straight to the text() of its selected item. |
| 1079 // This has to be overridden in the case where the selected item has an
ARIA label. | 1079 // This has to be overridden in the case where the selected item has an
ARIA label. |
| 1080 HTMLSelectElement* selectElement = toHTMLSelectElement(m_layoutObject->n
ode()); | 1080 HTMLSelectElement* selectElement = toHTMLSelectElement(m_layoutObject->n
ode()); |
| 1081 int selectedIndex = selectElement->selectedIndex(); | 1081 int selectedIndex = selectElement->selectedIndex(); |
| 1082 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems = sel
ectElement->listItems(); | 1082 const HeapVector<Member<HTMLElement>>& listItems = selectElement->listIt
ems(); |
| 1083 if (selectedIndex >= 0 && static_cast<size_t>(selectedIndex) < listItems
.size()) { | 1083 if (selectedIndex >= 0 && static_cast<size_t>(selectedIndex) < listItems
.size()) { |
| 1084 const AtomicString& overriddenDescription = listItems[selectedIndex]
->fastGetAttribute(aria_labelAttr); | 1084 const AtomicString& overriddenDescription = listItems[selectedIndex]
->fastGetAttribute(aria_labelAttr); |
| 1085 if (!overriddenDescription.isNull()) | 1085 if (!overriddenDescription.isNull()) |
| 1086 return overriddenDescription; | 1086 return overriddenDescription; |
| 1087 } | 1087 } |
| 1088 return toLayoutMenuList(m_layoutObject)->text(); | 1088 return toLayoutMenuList(m_layoutObject)->text(); |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 if (isWebArea()) { | 1091 if (isWebArea()) { |
| 1092 // FIXME: Why would a layoutObject exist when the Document isn't attache
d to a frame? | 1092 // FIXME: Why would a layoutObject exist when the Document isn't attache
d to a frame? |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1838 AXObject::AXRange AXLayoutObject::selectionUnderObject() const | 1838 AXObject::AXRange AXLayoutObject::selectionUnderObject() const |
| 1839 { | 1839 { |
| 1840 AXRange textSelection = textControlSelection(); | 1840 AXRange textSelection = textControlSelection(); |
| 1841 if (textSelection.isValid()) | 1841 if (textSelection.isValid()) |
| 1842 return textSelection; | 1842 return textSelection; |
| 1843 | 1843 |
| 1844 if (!node() || !layoutObject()->frame()) | 1844 if (!node() || !layoutObject()->frame()) |
| 1845 return AXRange(); | 1845 return AXRange(); |
| 1846 | 1846 |
| 1847 VisibleSelection selection = layoutObject()->frame()->selection().selection(
); | 1847 VisibleSelection selection = layoutObject()->frame()->selection().selection(
); |
| 1848 RefPtrWillBeRawPtr<Range> selectionRange = firstRangeOf(selection); | 1848 RawPtr<Range> selectionRange = firstRangeOf(selection); |
| 1849 ContainerNode* parentNode = node()->parentNode(); | 1849 ContainerNode* parentNode = node()->parentNode(); |
| 1850 int nodeIndex = node()->nodeIndex(); | 1850 int nodeIndex = node()->nodeIndex(); |
| 1851 if (!selectionRange | 1851 if (!selectionRange |
| 1852 // Selection is contained in node. | 1852 // Selection is contained in node. |
| 1853 || !(parentNode | 1853 || !(parentNode |
| 1854 && selectionRange->comparePoint(parentNode, nodeIndex, IGNORE_EXCEPTION)
< 0 | 1854 && selectionRange->comparePoint(parentNode, nodeIndex, IGNORE_EXCEPTION)
< 0 |
| 1855 && selectionRange->comparePoint(parentNode, nodeIndex + 1, IGNORE_EXCEPT
ION) > 0)) { | 1855 && selectionRange->comparePoint(parentNode, nodeIndex + 1, IGNORE_EXCEPT
ION) > 0)) { |
| 1856 return AXRange(); | 1856 return AXRange(); |
| 1857 } | 1857 } |
| 1858 | 1858 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1902 return textControl->indexForVisiblePosition(position); | 1902 return textControl->indexForVisiblePosition(position); |
| 1903 } | 1903 } |
| 1904 | 1904 |
| 1905 if (!node()) | 1905 if (!node()) |
| 1906 return 0; | 1906 return 0; |
| 1907 | 1907 |
| 1908 Position indexPosition = position.deepEquivalent(); | 1908 Position indexPosition = position.deepEquivalent(); |
| 1909 if (indexPosition.isNull()) | 1909 if (indexPosition.isNull()) |
| 1910 return 0; | 1910 return 0; |
| 1911 | 1911 |
| 1912 RefPtrWillBeRawPtr<Range> range = Range::create(*document()); | 1912 RawPtr<Range> range = Range::create(*document()); |
| 1913 range->setStart(node(), 0, IGNORE_EXCEPTION); | 1913 range->setStart(node(), 0, IGNORE_EXCEPTION); |
| 1914 range->setEnd(indexPosition, IGNORE_EXCEPTION); | 1914 range->setEnd(indexPosition, IGNORE_EXCEPTION); |
| 1915 | 1915 |
| 1916 return TextIterator::rangeLength(range->startPosition(), range->endPosition(
)); | 1916 return TextIterator::rangeLength(range->startPosition(), range->endPosition(
)); |
| 1917 } | 1917 } |
| 1918 | 1918 |
| 1919 AXLayoutObject* AXLayoutObject::getUnignoredObjectFromNode(Node& node) const | 1919 AXLayoutObject* AXLayoutObject::getUnignoredObjectFromNode(Node& node) const |
| 1920 { | 1920 { |
| 1921 if (isDetached()) | 1921 if (isDetached()) |
| 1922 return nullptr; | 1922 return nullptr; |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2208 if (!node || !node->isElementNode()) | 2208 if (!node || !node->isElementNode()) |
| 2209 return false; | 2209 return false; |
| 2210 | 2210 |
| 2211 // The ARIA spec says a tab item can also be selected if it is aria-labeled
by a tabpanel | 2211 // The ARIA spec says a tab item can also be selected if it is aria-labeled
by a tabpanel |
| 2212 // that has keyboard focus inside of it, or if a tabpanel in its aria-contro
ls list has KB | 2212 // that has keyboard focus inside of it, or if a tabpanel in its aria-contro
ls list has KB |
| 2213 // focus inside of it. | 2213 // focus inside of it. |
| 2214 AXObject* focusedElement = focusedUIElement(); | 2214 AXObject* focusedElement = focusedUIElement(); |
| 2215 if (!focusedElement) | 2215 if (!focusedElement) |
| 2216 return false; | 2216 return false; |
| 2217 | 2217 |
| 2218 WillBeHeapVector<RawPtrWillBeMember<Element>> elements; | 2218 HeapVector<Member<Element>> elements; |
| 2219 elementsFromAttribute(elements, aria_controlsAttr); | 2219 elementsFromAttribute(elements, aria_controlsAttr); |
| 2220 | 2220 |
| 2221 for (const auto& element : elements) { | 2221 for (const auto& element : elements) { |
| 2222 AXObject* tabPanel = axObjectCache().getOrCreate(element); | 2222 AXObject* tabPanel = axObjectCache().getOrCreate(element); |
| 2223 | 2223 |
| 2224 // A tab item should only control tab panels. | 2224 // A tab item should only control tab panels. |
| 2225 if (!tabPanel || tabPanel->roleValue() != TabPanelRole) | 2225 if (!tabPanel || tabPanel->roleValue() != TabPanelRole) |
| 2226 continue; | 2226 continue; |
| 2227 | 2227 |
| 2228 AXObject* checkFocusElement = focusedElement; | 2228 AXObject* checkFocusElement = focusedElement; |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2535 if (label && label->layoutObject()) { | 2535 if (label && label->layoutObject()) { |
| 2536 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); | 2536 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); |
| 2537 result.unite(labelRect); | 2537 result.unite(labelRect); |
| 2538 } | 2538 } |
| 2539 } | 2539 } |
| 2540 | 2540 |
| 2541 return result; | 2541 return result; |
| 2542 } | 2542 } |
| 2543 | 2543 |
| 2544 } // namespace blink | 2544 } // namespace blink |
| OLD | NEW |