Chromium Code Reviews| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 LayoutObject* prev = layoutObject; | 161 LayoutObject* prev = layoutObject; |
| 162 LayoutObject* cur = layoutObject; | 162 LayoutObject* cur = layoutObject; |
| 163 | 163 |
| 164 if (!cur->isLayoutInline() && !cur->isLayoutBlockFlow()) | 164 if (!cur->isLayoutInline() && !cur->isLayoutBlockFlow()) |
| 165 return layoutObject; | 165 return layoutObject; |
| 166 | 166 |
| 167 while (cur) { | 167 while (cur) { |
| 168 prev = cur; | 168 prev = cur; |
| 169 if (cur->isLayoutInline()) { | 169 if (cur->isLayoutInline()) { |
| 170 cur = toLayoutInline(cur)->inlineElementContinuation(); | 170 cur = toLayoutInline(cur)->inlineElementContinuation(); |
| 171 ASSERT(cur || !toLayoutInline(prev)->continuation()); | 171 DCHECK(cur || !toLayoutInline(prev)->continuation()); |
| 172 } else { | 172 } else { |
| 173 cur = toLayoutBlockFlow(cur)->inlineElementContinuation(); | 173 cur = toLayoutBlockFlow(cur)->inlineElementContinuation(); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 return prev; | 177 return prev; |
| 178 } | 178 } |
| 179 | 179 |
| 180 static inline bool lastChildHasContinuation(LayoutObject* layoutObject) { | 180 static inline bool lastChildHasContinuation(LayoutObject* layoutObject) { |
| 181 LayoutObject* lastChild = layoutObject->slowLastChild(); | 181 LayoutObject* lastChild = layoutObject->slowLastChild(); |
| 182 return lastChild && isInlineWithContinuation(lastChild); | 182 return lastChild && isInlineWithContinuation(lastChild); |
| 183 } | 183 } |
| 184 | 184 |
| 185 static LayoutBoxModelObject* nextContinuation(LayoutObject* layoutObject) { | 185 static LayoutBoxModelObject* nextContinuation(LayoutObject* layoutObject) { |
| 186 ASSERT(layoutObject); | 186 DCHECK(layoutObject); |
| 187 if (layoutObject->isLayoutInline() && !layoutObject->isAtomicInlineLevel()) | 187 if (layoutObject->isLayoutInline() && !layoutObject->isAtomicInlineLevel()) |
| 188 return toLayoutInline(layoutObject)->continuation(); | 188 return toLayoutInline(layoutObject)->continuation(); |
| 189 if (layoutObject->isLayoutBlockFlow()) | 189 if (layoutObject->isLayoutBlockFlow()) |
| 190 return toLayoutBlockFlow(layoutObject)->inlineElementContinuation(); | 190 return toLayoutBlockFlow(layoutObject)->inlineElementContinuation(); |
| 191 return 0; | 191 return 0; |
| 192 } | 192 } |
| 193 | 193 |
| 194 AXLayoutObject::AXLayoutObject(LayoutObject* layoutObject, | 194 AXLayoutObject::AXLayoutObject(LayoutObject* layoutObject, |
| 195 AXObjectCacheImpl& axObjectCache) | 195 AXObjectCacheImpl& axObjectCache) |
| 196 : AXNodeObject(layoutObject->node(), axObjectCache), | 196 : AXNodeObject(layoutObject->node(), axObjectCache), |
| 197 m_layoutObject(layoutObject) { | 197 m_layoutObject(layoutObject) { |
| 198 #if DCHECK_IS_ON() | 198 #if DCHECK_IS_ON() |
| 199 m_layoutObject->setHasAXObject(true); | 199 m_layoutObject->setHasAXObject(true); |
| 200 #endif | 200 #endif |
| 201 } | 201 } |
| 202 | 202 |
| 203 AXLayoutObject* AXLayoutObject::create(LayoutObject* layoutObject, | 203 AXLayoutObject* AXLayoutObject::create(LayoutObject* layoutObject, |
| 204 AXObjectCacheImpl& axObjectCache) { | 204 AXObjectCacheImpl& axObjectCache) { |
| 205 return new AXLayoutObject(layoutObject, axObjectCache); | 205 return new AXLayoutObject(layoutObject, axObjectCache); |
| 206 } | 206 } |
| 207 | 207 |
| 208 AXLayoutObject::~AXLayoutObject() { | 208 AXLayoutObject::~AXLayoutObject() { |
| 209 ASSERT(isDetached()); | 209 DCHECK(isDetached()); |
| 210 } | 210 } |
| 211 | 211 |
| 212 LayoutBoxModelObject* AXLayoutObject::getLayoutBoxModelObject() const { | 212 LayoutBoxModelObject* AXLayoutObject::getLayoutBoxModelObject() const { |
| 213 if (!m_layoutObject || !m_layoutObject->isBoxModelObject()) | 213 if (!m_layoutObject || !m_layoutObject->isBoxModelObject()) |
| 214 return 0; | 214 return 0; |
| 215 return toLayoutBoxModelObject(m_layoutObject); | 215 return toLayoutBoxModelObject(m_layoutObject); |
| 216 } | 216 } |
| 217 | 217 |
| 218 ScrollableArea* AXLayoutObject::getScrollableAreaIfScrollable() const { | 218 ScrollableArea* AXLayoutObject::getScrollableAreaIfScrollable() const { |
| 219 if (isWebArea()) | 219 if (isWebArea()) |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 388 return false; | 388 return false; |
| 389 | 389 |
| 390 return !toHTMLAnchorElement(*anchor).href().isEmpty(); | 390 return !toHTMLAnchorElement(*anchor).href().isEmpty(); |
| 391 } | 391 } |
| 392 | 392 |
| 393 bool AXLayoutObject::isLoaded() const { | 393 bool AXLayoutObject::isLoaded() const { |
| 394 return !m_layoutObject->document().parser(); | 394 return !m_layoutObject->document().parser(); |
| 395 } | 395 } |
| 396 | 396 |
| 397 bool AXLayoutObject::isOffScreen() const { | 397 bool AXLayoutObject::isOffScreen() const { |
| 398 ASSERT(m_layoutObject); | 398 DCHECK(m_layoutObject); |
| 399 IntRect contentRect = | 399 IntRect contentRect = |
| 400 pixelSnappedIntRect(m_layoutObject->absoluteVisualRect()); | 400 pixelSnappedIntRect(m_layoutObject->absoluteVisualRect()); |
| 401 FrameView* view = m_layoutObject->frame()->view(); | 401 FrameView* view = m_layoutObject->frame()->view(); |
| 402 IntRect viewRect = view->visibleContentRect(); | 402 IntRect viewRect = view->visibleContentRect(); |
| 403 viewRect.intersect(contentRect); | 403 viewRect.intersect(contentRect); |
| 404 return viewRect.isEmpty(); | 404 return viewRect.isEmpty(); |
| 405 } | 405 } |
| 406 | 406 |
| 407 bool AXLayoutObject::isReadOnly() const { | 407 bool AXLayoutObject::isReadOnly() const { |
| 408 ASSERT(m_layoutObject); | 408 DCHECK(m_layoutObject); |
| 409 | 409 |
| 410 if (isWebArea()) { | 410 if (isWebArea()) { |
| 411 Document& document = m_layoutObject->document(); | 411 Document& document = m_layoutObject->document(); |
| 412 HTMLElement* body = document.body(); | 412 HTMLElement* body = document.body(); |
| 413 if (body && hasEditableStyle(*body)) { | 413 if (body && hasEditableStyle(*body)) { |
| 414 AXObject* axBody = axObjectCache().getOrCreate(body); | 414 AXObject* axBody = axObjectCache().getOrCreate(body); |
| 415 return !axBody || axBody == axBody->ariaHiddenRoot(); | 415 return !axBody || axBody == axBody->ariaHiddenRoot(); |
| 416 } | 416 } |
| 417 | 417 |
| 418 return !hasEditableStyle(document); | 418 return !hasEditableStyle(document); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 499 ignoredReasons->push_back(IgnoredReason(AXNotVisible)); | 499 ignoredReasons->push_back(IgnoredReason(AXNotVisible)); |
| 500 return IgnoreObject; | 500 return IgnoreObject; |
| 501 } | 501 } |
| 502 | 502 |
| 503 return AXObject::defaultObjectInclusion(ignoredReasons); | 503 return AXObject::defaultObjectInclusion(ignoredReasons); |
| 504 } | 504 } |
| 505 | 505 |
| 506 bool AXLayoutObject::computeAccessibilityIsIgnored( | 506 bool AXLayoutObject::computeAccessibilityIsIgnored( |
| 507 IgnoredReasons* ignoredReasons) const { | 507 IgnoredReasons* ignoredReasons) const { |
| 508 #if DCHECK_IS_ON() | 508 #if DCHECK_IS_ON() |
| 509 ASSERT(m_initialized); | 509 DCHECK(m_initialized); |
| 510 #endif | 510 #endif |
| 511 | 511 |
| 512 if (!m_layoutObject) | 512 if (!m_layoutObject) |
| 513 return true; | 513 return true; |
| 514 | 514 |
| 515 // Check first if any of the common reasons cause this element to be ignored. | 515 // Check first if any of the common reasons cause this element to be ignored. |
| 516 // Then process other use cases that need to be applied to all the various | 516 // Then process other use cases that need to be applied to all the various |
| 517 // roles that AXLayoutObjects take on. | 517 // roles that AXLayoutObjects take on. |
| 518 AXObjectInclusion decision = defaultObjectInclusion(ignoredReasons); | 518 AXObjectInclusion decision = defaultObjectInclusion(ignoredReasons); |
| 519 if (decision == IncludeObject) | 519 if (decision == IncludeObject) |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1442 return remoteSVGElementHitTest(point); | 1442 return remoteSVGElementHitTest(point); |
| 1443 | 1443 |
| 1444 return AXObject::elementAccessibilityHitTest(point); | 1444 return AXObject::elementAccessibilityHitTest(point); |
| 1445 } | 1445 } |
| 1446 | 1446 |
| 1447 // | 1447 // |
| 1448 // High-level accessibility tree access. | 1448 // High-level accessibility tree access. |
| 1449 // | 1449 // |
| 1450 | 1450 |
| 1451 AXObject* AXLayoutObject::computeParent() const { | 1451 AXObject* AXLayoutObject::computeParent() const { |
| 1452 ASSERT(!isDetached()); | 1452 DCHECK(!isDetached()); |
| 1453 if (!m_layoutObject) | 1453 if (!m_layoutObject) |
| 1454 return 0; | 1454 return 0; |
| 1455 | 1455 |
| 1456 if (ariaRoleAttribute() == MenuBarRole) | 1456 if (ariaRoleAttribute() == MenuBarRole) |
| 1457 return axObjectCache().getOrCreate(m_layoutObject->parent()); | 1457 return axObjectCache().getOrCreate(m_layoutObject->parent()); |
| 1458 | 1458 |
| 1459 // menuButton and its corresponding menu are DOM siblings, but Accessibility | 1459 // menuButton and its corresponding menu are DOM siblings, but Accessibility |
| 1460 // needs them to be parent/child. | 1460 // needs them to be parent/child. |
| 1461 if (ariaRoleAttribute() == MenuRole) { | 1461 if (ariaRoleAttribute() == MenuRole) { |
| 1462 AXObject* parent = menuButtonForMenu(); | 1462 AXObject* parent = menuButtonForMenu(); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1572 } | 1572 } |
| 1573 } | 1573 } |
| 1574 | 1574 |
| 1575 if (!nextSibling) | 1575 if (!nextSibling) |
| 1576 return 0; | 1576 return 0; |
| 1577 | 1577 |
| 1578 return axObjectCache().getOrCreate(nextSibling); | 1578 return axObjectCache().getOrCreate(nextSibling); |
| 1579 } | 1579 } |
| 1580 | 1580 |
| 1581 void AXLayoutObject::addChildren() { | 1581 void AXLayoutObject::addChildren() { |
| 1582 ASSERT(!isDetached()); | 1582 DCHECK(!isDetached()); |
| 1583 // If the need to add more children in addition to existing children arises, | 1583 // If the need to add more children in addition to existing children arises, |
| 1584 // childrenChanged should have been called, leaving the object with no | 1584 // childrenChanged should have been called, leaving the object with no |
| 1585 // children. | 1585 // children. |
| 1586 ASSERT(!m_haveChildren); | 1586 DCHECK(!m_haveChildren); |
| 1587 | 1587 |
| 1588 m_haveChildren = true; | 1588 m_haveChildren = true; |
| 1589 | 1589 |
| 1590 if (!canHaveChildren()) | 1590 if (!canHaveChildren()) |
| 1591 return; | 1591 return; |
| 1592 | 1592 |
| 1593 HeapVector<Member<AXObject>> ownedChildren; | 1593 HeapVector<Member<AXObject>> ownedChildren; |
| 1594 computeAriaOwnsChildren(ownedChildren); | 1594 computeAriaOwnsChildren(ownedChildren); |
| 1595 | 1595 |
| 1596 for (AXObject* obj = rawFirstChild(); obj; obj = obj->rawNextSibling()) { | 1596 for (AXObject* obj = rawFirstChild(); obj; obj = obj->rawNextSibling()) { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1736 return AXRange(); | 1736 return AXRange(); |
| 1737 | 1737 |
| 1738 VisiblePosition visibleStart = selection.visibleStart(); | 1738 VisiblePosition visibleStart = selection.visibleStart(); |
| 1739 Position start = visibleStart.toParentAnchoredPosition(); | 1739 Position start = visibleStart.toParentAnchoredPosition(); |
| 1740 TextAffinity startAffinity = visibleStart.affinity(); | 1740 TextAffinity startAffinity = visibleStart.affinity(); |
| 1741 VisiblePosition visibleEnd = selection.visibleEnd(); | 1741 VisiblePosition visibleEnd = selection.visibleEnd(); |
| 1742 Position end = visibleEnd.toParentAnchoredPosition(); | 1742 Position end = visibleEnd.toParentAnchoredPosition(); |
| 1743 TextAffinity endAffinity = visibleEnd.affinity(); | 1743 TextAffinity endAffinity = visibleEnd.affinity(); |
| 1744 | 1744 |
| 1745 Node* anchorNode = start.anchorNode(); | 1745 Node* anchorNode = start.anchorNode(); |
| 1746 ASSERT(anchorNode); | 1746 DCHECK(anchorNode); |
| 1747 | 1747 |
| 1748 AXLayoutObject* anchorObject = nullptr; | 1748 AXLayoutObject* anchorObject = nullptr; |
| 1749 // Find the closest node that has a corresponding AXObject. | 1749 // Find the closest node that has a corresponding AXObject. |
| 1750 // This is because some nodes may be aria hidden or might not even have | 1750 // This is because some nodes may be aria hidden or might not even have |
| 1751 // a layout object if they are part of the shadow DOM. | 1751 // a layout object if they are part of the shadow DOM. |
| 1752 while (anchorNode) { | 1752 while (anchorNode) { |
| 1753 anchorObject = getUnignoredObjectFromNode(*anchorNode); | 1753 anchorObject = getUnignoredObjectFromNode(*anchorNode); |
| 1754 if (anchorObject) | 1754 if (anchorObject) |
| 1755 break; | 1755 break; |
| 1756 | 1756 |
| 1757 if (anchorNode->nextSibling()) | 1757 if (anchorNode->nextSibling()) |
| 1758 anchorNode = anchorNode->nextSibling(); | 1758 anchorNode = anchorNode->nextSibling(); |
| 1759 else | 1759 else |
| 1760 anchorNode = anchorNode->parentNode(); | 1760 anchorNode = anchorNode->parentNode(); |
| 1761 } | 1761 } |
| 1762 | 1762 |
| 1763 Node* focusNode = end.anchorNode(); | 1763 Node* focusNode = end.anchorNode(); |
| 1764 ASSERT(focusNode); | 1764 DCHECK(focusNode); |
| 1765 | 1765 |
| 1766 AXLayoutObject* focusObject = nullptr; | 1766 AXLayoutObject* focusObject = nullptr; |
| 1767 while (focusNode) { | 1767 while (focusNode) { |
| 1768 focusObject = getUnignoredObjectFromNode(*focusNode); | 1768 focusObject = getUnignoredObjectFromNode(*focusNode); |
| 1769 if (focusObject) | 1769 if (focusObject) |
| 1770 break; | 1770 break; |
| 1771 | 1771 |
| 1772 if (focusNode->previousSibling()) | 1772 if (focusNode->previousSibling()) |
| 1773 focusNode = focusNode->previousSibling(); | 1773 focusNode = focusNode->previousSibling(); |
| 1774 else | 1774 else |
| 1775 focusNode = focusNode->parentNode(); | 1775 focusNode = focusNode->parentNode(); |
| 1776 } | 1776 } |
| 1777 | 1777 |
| 1778 if (!anchorObject || !focusObject) | 1778 if (!anchorObject || !focusObject) |
| 1779 return AXRange(); | 1779 return AXRange(); |
| 1780 | 1780 |
| 1781 int anchorOffset = anchorObject->indexForVisiblePosition(visibleStart); | 1781 int anchorOffset = anchorObject->indexForVisiblePosition(visibleStart); |
| 1782 ASSERT(anchorOffset >= 0); | 1782 DCHECK(anchorOffset >= 0); |
|
tkent
2017/04/09 23:21:22
Use DCHECK_GE
| |
| 1783 int focusOffset = focusObject->indexForVisiblePosition(visibleEnd); | 1783 int focusOffset = focusObject->indexForVisiblePosition(visibleEnd); |
| 1784 ASSERT(focusOffset >= 0); | 1784 DCHECK(focusOffset >= 0); |
|
tkent
2017/04/09 23:21:22
Use DCHECK_GE
| |
| 1785 return AXRange(anchorObject, anchorOffset, startAffinity, focusObject, | 1785 return AXRange(anchorObject, anchorOffset, startAffinity, focusObject, |
| 1786 focusOffset, endAffinity); | 1786 focusOffset, endAffinity); |
| 1787 } | 1787 } |
| 1788 | 1788 |
| 1789 // Gets only the start and end offsets of the selection computed using the | 1789 // Gets only the start and end offsets of the selection computed using the |
| 1790 // current object as the starting point. Returns a null selection if there is | 1790 // current object as the starting point. Returns a null selection if there is |
| 1791 // no selection in the subtree rooted at this object. | 1791 // no selection in the subtree rooted at this object. |
| 1792 AXObject::AXRange AXLayoutObject::selectionUnderObject() const { | 1792 AXObject::AXRange AXLayoutObject::selectionUnderObject() const { |
| 1793 AXRange textSelection = textControlSelection(); | 1793 AXRange textSelection = textControlSelection(); |
| 1794 if (textSelection.isValid()) | 1794 if (textSelection.isValid()) |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 1810 || | 1810 || |
| 1811 !(parentNode && | 1811 !(parentNode && |
| 1812 selectionRange->comparePoint(parentNode, nodeIndex, | 1812 selectionRange->comparePoint(parentNode, nodeIndex, |
| 1813 IGNORE_EXCEPTION_FOR_TESTING) < 0 && | 1813 IGNORE_EXCEPTION_FOR_TESTING) < 0 && |
| 1814 selectionRange->comparePoint(parentNode, nodeIndex + 1, | 1814 selectionRange->comparePoint(parentNode, nodeIndex + 1, |
| 1815 IGNORE_EXCEPTION_FOR_TESTING) > 0)) { | 1815 IGNORE_EXCEPTION_FOR_TESTING) > 0)) { |
| 1816 return AXRange(); | 1816 return AXRange(); |
| 1817 } | 1817 } |
| 1818 | 1818 |
| 1819 int start = indexForVisiblePosition(selection.visibleStart()); | 1819 int start = indexForVisiblePosition(selection.visibleStart()); |
| 1820 ASSERT(start >= 0); | 1820 DCHECK(start >= 0); |
|
tkent
2017/04/09 23:21:22
Use DCHECK_GE
| |
| 1821 int end = indexForVisiblePosition(selection.visibleEnd()); | 1821 int end = indexForVisiblePosition(selection.visibleEnd()); |
| 1822 ASSERT(end >= 0); | 1822 DCHECK(end >= 0); |
|
tkent
2017/04/09 23:21:22
Use DCHECK_GE
| |
| 1823 | 1823 |
| 1824 return AXRange(start, end); | 1824 return AXRange(start, end); |
| 1825 } | 1825 } |
| 1826 | 1826 |
| 1827 AXObject::AXRange AXLayoutObject::textControlSelection() const { | 1827 AXObject::AXRange AXLayoutObject::textControlSelection() const { |
| 1828 if (!getLayoutObject()) | 1828 if (!getLayoutObject()) |
| 1829 return AXRange(); | 1829 return AXRange(); |
| 1830 | 1830 |
| 1831 LayoutObject* layout = nullptr; | 1831 LayoutObject* layout = nullptr; |
| 1832 if (getLayoutObject()->isTextControl()) { | 1832 if (getLayoutObject()->isTextControl()) { |
| 1833 layout = getLayoutObject(); | 1833 layout = getLayoutObject(); |
| 1834 } else { | 1834 } else { |
| 1835 Element* focusedElement = getDocument()->focusedElement(); | 1835 Element* focusedElement = getDocument()->focusedElement(); |
| 1836 if (focusedElement && focusedElement->layoutObject() && | 1836 if (focusedElement && focusedElement->layoutObject() && |
| 1837 focusedElement->layoutObject()->isTextControl()) | 1837 focusedElement->layoutObject()->isTextControl()) |
| 1838 layout = focusedElement->layoutObject(); | 1838 layout = focusedElement->layoutObject(); |
| 1839 } | 1839 } |
| 1840 | 1840 |
| 1841 if (!layout) | 1841 if (!layout) |
| 1842 return AXRange(); | 1842 return AXRange(); |
| 1843 | 1843 |
| 1844 AXObject* axObject = axObjectCache().getOrCreate(layout); | 1844 AXObject* axObject = axObjectCache().getOrCreate(layout); |
| 1845 if (!axObject || !axObject->isAXLayoutObject()) | 1845 if (!axObject || !axObject->isAXLayoutObject()) |
| 1846 return AXRange(); | 1846 return AXRange(); |
| 1847 | 1847 |
| 1848 VisibleSelection selection = | 1848 VisibleSelection selection = |
| 1849 layout->frame()->selection().computeVisibleSelectionInDOMTreeDeprecated(); | 1849 layout->frame()->selection().computeVisibleSelectionInDOMTreeDeprecated(); |
| 1850 TextControlElement* textControl = | 1850 TextControlElement* textControl = |
| 1851 toLayoutTextControl(layout)->textControlElement(); | 1851 toLayoutTextControl(layout)->textControlElement(); |
| 1852 ASSERT(textControl); | 1852 DCHECK(textControl); |
| 1853 int start = textControl->selectionStart(); | 1853 int start = textControl->selectionStart(); |
| 1854 int end = textControl->selectionEnd(); | 1854 int end = textControl->selectionEnd(); |
| 1855 | 1855 |
| 1856 return AXRange(axObject, start, selection.visibleStart().affinity(), axObject, | 1856 return AXRange(axObject, start, selection.visibleStart().affinity(), axObject, |
| 1857 end, selection.visibleEnd().affinity()); | 1857 end, selection.visibleEnd().affinity()); |
| 1858 } | 1858 } |
| 1859 | 1859 |
| 1860 int AXLayoutObject::indexForVisiblePosition( | 1860 int AXLayoutObject::indexForVisiblePosition( |
| 1861 const VisiblePosition& position) const { | 1861 const VisiblePosition& position) const { |
| 1862 if (getLayoutObject() && getLayoutObject()->isTextControl()) { | 1862 if (getLayoutObject() && getLayoutObject()->isTextControl()) { |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2452 if (!map) | 2452 if (!map) |
| 2453 return; | 2453 return; |
| 2454 | 2454 |
| 2455 for (HTMLAreaElement& area : | 2455 for (HTMLAreaElement& area : |
| 2456 Traversal<HTMLAreaElement>::descendantsOf(*map)) { | 2456 Traversal<HTMLAreaElement>::descendantsOf(*map)) { |
| 2457 // add an <area> element for this child if it has a link | 2457 // add an <area> element for this child if it has a link |
| 2458 AXObject* obj = axObjectCache().getOrCreate(&area); | 2458 AXObject* obj = axObjectCache().getOrCreate(&area); |
| 2459 if (obj) { | 2459 if (obj) { |
| 2460 AXImageMapLink* areaObject = toAXImageMapLink(obj); | 2460 AXImageMapLink* areaObject = toAXImageMapLink(obj); |
| 2461 areaObject->setParent(this); | 2461 areaObject->setParent(this); |
| 2462 ASSERT(areaObject->axObjectID() != 0); | 2462 DCHECK(areaObject->axObjectID() != 0); |
|
tkent
2017/04/09 23:21:22
Use DCHECK_NE
| |
| 2463 if (!areaObject->accessibilityIsIgnored()) | 2463 if (!areaObject->accessibilityIsIgnored()) |
| 2464 m_children.push_back(areaObject); | 2464 m_children.push_back(areaObject); |
| 2465 else | 2465 else |
| 2466 axObjectCache().remove(areaObject->axObjectID()); | 2466 axObjectCache().remove(areaObject->axObjectID()); |
| 2467 } | 2467 } |
| 2468 } | 2468 } |
| 2469 } | 2469 } |
| 2470 | 2470 |
| 2471 void AXLayoutObject::addCanvasChildren() { | 2471 void AXLayoutObject::addCanvasChildren() { |
| 2472 if (!isHTMLCanvasElement(getNode())) | 2472 if (!isHTMLCanvasElement(getNode())) |
| 2473 return; | 2473 return; |
| 2474 | 2474 |
| 2475 // If it's a canvas, it won't have laid out children, but it might have | 2475 // If it's a canvas, it won't have laid out children, but it might have |
| 2476 // accessible fallback content. Clear m_haveChildren because | 2476 // accessible fallback content. Clear m_haveChildren because |
| 2477 // AXNodeObject::addChildren will expect it to be false. | 2477 // AXNodeObject::addChildren will expect it to be false. |
| 2478 ASSERT(!m_children.size()); | 2478 DCHECK(!m_children.size()); |
| 2479 m_haveChildren = false; | 2479 m_haveChildren = false; |
| 2480 AXNodeObject::addChildren(); | 2480 AXNodeObject::addChildren(); |
| 2481 } | 2481 } |
| 2482 | 2482 |
| 2483 void AXLayoutObject::addPopupChildren() { | 2483 void AXLayoutObject::addPopupChildren() { |
| 2484 if (!isHTMLInputElement(getNode())) | 2484 if (!isHTMLInputElement(getNode())) |
| 2485 return; | 2485 return; |
| 2486 if (AXObject* axPopup = toHTMLInputElement(getNode())->popupRootAXObject()) | 2486 if (AXObject* axPopup = toHTMLInputElement(getNode())->popupRootAXObject()) |
| 2487 m_children.push_back(axPopup); | 2487 m_children.push_back(axPopup); |
| 2488 } | 2488 } |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 2504 | 2504 |
| 2505 bool AXLayoutObject::elementAttributeValue( | 2505 bool AXLayoutObject::elementAttributeValue( |
| 2506 const QualifiedName& attributeName) const { | 2506 const QualifiedName& attributeName) const { |
| 2507 if (!m_layoutObject) | 2507 if (!m_layoutObject) |
| 2508 return false; | 2508 return false; |
| 2509 | 2509 |
| 2510 return equalIgnoringASCIICase(getAttribute(attributeName), "true"); | 2510 return equalIgnoringASCIICase(getAttribute(attributeName), "true"); |
| 2511 } | 2511 } |
| 2512 | 2512 |
| 2513 } // namespace blink | 2513 } // namespace blink |
| OLD | NEW |