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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 continue; | 1320 continue; |
1321 } | 1321 } |
1322 } | 1322 } |
1323 | 1323 |
1324 // If we're going between two layoutObjects that are in separate LayoutB
oxes, add | 1324 // If we're going between two layoutObjects that are in separate LayoutB
oxes, add |
1325 // whitespace if it wasn't there already. Intuitively if you have | 1325 // whitespace if it wasn't there already. Intuitively if you have |
1326 // <span>Hello</span><span>World</span>, those are part of the same Layo
utBox | 1326 // <span>Hello</span><span>World</span>, those are part of the same Layo
utBox |
1327 // so we should return "HelloWorld", but given <div>Hello</div><div>Worl
d</div> the | 1327 // so we should return "HelloWorld", but given <div>Hello</div><div>Worl
d</div> the |
1328 // strings are in separate boxes so we should return "Hello World". | 1328 // strings are in separate boxes so we should return "Hello World". |
1329 if (previous && builder.length() && !isHTMLSpace(builder[builder.length(
) - 1])) { | 1329 if (previous && builder.length() && !isHTMLSpace(builder[builder.length(
) - 1])) { |
1330 if (!isSameLayoutBox(child->renderer(), previous->renderer())) | 1330 if (!isSameLayoutBox(child->layoutObject(), previous->layoutObject()
)) |
1331 builder.append(' '); | 1331 builder.append(' '); |
1332 } | 1332 } |
1333 | 1333 |
1334 builder.append(child->textUnderElement(mode)); | 1334 builder.append(child->textUnderElement(mode)); |
1335 previous = child; | 1335 previous = child; |
1336 | 1336 |
1337 if (mode == TextUnderElementAny && !builder.isEmpty()) | 1337 if (mode == TextUnderElementAny && !builder.isEmpty()) |
1338 break; | 1338 break; |
1339 } | 1339 } |
1340 | 1340 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 // If the need to add more children in addition to existing children arises, | 1620 // If the need to add more children in addition to existing children arises, |
1621 // childrenChanged should have been called, leaving the object with no child
ren. | 1621 // childrenChanged should have been called, leaving the object with no child
ren. |
1622 ASSERT(!m_haveChildren); | 1622 ASSERT(!m_haveChildren); |
1623 | 1623 |
1624 if (!m_node) | 1624 if (!m_node) |
1625 return; | 1625 return; |
1626 | 1626 |
1627 m_haveChildren = true; | 1627 m_haveChildren = true; |
1628 | 1628 |
1629 // The only time we add children from the DOM tree to a node with a layoutOb
ject is when it's a canvas. | 1629 // The only time we add children from the DOM tree to a node with a layoutOb
ject is when it's a canvas. |
1630 if (renderer() && !isHTMLCanvasElement(*m_node)) | 1630 if (layoutObject() && !isHTMLCanvasElement(*m_node)) |
1631 return; | 1631 return; |
1632 | 1632 |
1633 for (Node* child = m_node->firstChild(); child; child = child->nextSibling()
) | 1633 for (Node* child = m_node->firstChild(); child; child = child->nextSibling()
) |
1634 addChild(axObjectCache()->getOrCreate(child)); | 1634 addChild(axObjectCache()->getOrCreate(child)); |
1635 | 1635 |
1636 for (unsigned i = 0; i < m_children.size(); ++i) | 1636 for (unsigned i = 0; i < m_children.size(); ++i) |
1637 m_children[i].get()->setParent(this); | 1637 m_children[i].get()->setParent(this); |
1638 } | 1638 } |
1639 | 1639 |
1640 void AXNodeObject::addChild(AXObject* child) | 1640 void AXNodeObject::addChild(AXObject* child) |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1739 { | 1739 { |
1740 Node* node = this->node(); | 1740 Node* node = this->node(); |
1741 if (!node) | 1741 if (!node) |
1742 return 0; | 1742 return 0; |
1743 | 1743 |
1744 AXObjectCacheImpl* cache = axObjectCache(); | 1744 AXObjectCacheImpl* cache = axObjectCache(); |
1745 | 1745 |
1746 // search up the DOM tree for an anchor element | 1746 // search up the DOM tree for an anchor element |
1747 // NOTE: this assumes that any non-image with an anchor is an HTMLAnchorElem
ent | 1747 // NOTE: this assumes that any non-image with an anchor is an HTMLAnchorElem
ent |
1748 for ( ; node; node = node->parentNode()) { | 1748 for ( ; node; node = node->parentNode()) { |
1749 if (isHTMLAnchorElement(*node) || (node->renderer() && cache->getOrCreat
e(node->renderer())->isAnchor())) | 1749 if (isHTMLAnchorElement(*node) || (node->layoutObject() && cache->getOrC
reate(node->layoutObject())->isAnchor())) |
1750 return toElement(node); | 1750 return toElement(node); |
1751 } | 1751 } |
1752 | 1752 |
1753 return 0; | 1753 return 0; |
1754 } | 1754 } |
1755 | 1755 |
1756 Document* AXNodeObject::document() const | 1756 Document* AXNodeObject::document() const |
1757 { | 1757 { |
1758 if (!node()) | 1758 if (!node()) |
1759 return 0; | 1759 return 0; |
(...skipping 10 matching lines...) Expand all Loading... |
1770 HTMLLabelElement* labelElement = labelElementContainer(); | 1770 HTMLLabelElement* labelElement = labelElementContainer(); |
1771 if (!labelElement) | 1771 if (!labelElement) |
1772 return 0; | 1772 return 0; |
1773 | 1773 |
1774 HTMLElement* correspondingControl = labelElement->control(); | 1774 HTMLElement* correspondingControl = labelElement->control(); |
1775 if (!correspondingControl) | 1775 if (!correspondingControl) |
1776 return 0; | 1776 return 0; |
1777 | 1777 |
1778 // Make sure the corresponding control isn't a descendant of this label | 1778 // Make sure the corresponding control isn't a descendant of this label |
1779 // that's in the middle of being destroyed. | 1779 // that's in the middle of being destroyed. |
1780 if (correspondingControl->renderer() && !correspondingControl->renderer()->p
arent()) | 1780 if (correspondingControl->layoutObject() && !correspondingControl->layoutObj
ect()->parent()) |
1781 return 0; | 1781 return 0; |
1782 | 1782 |
1783 return axObjectCache()->getOrCreate(correspondingControl); | 1783 return axObjectCache()->getOrCreate(correspondingControl); |
1784 } | 1784 } |
1785 | 1785 |
1786 HTMLLabelElement* AXNodeObject::labelElementContainer() const | 1786 HTMLLabelElement* AXNodeObject::labelElementContainer() const |
1787 { | 1787 { |
1788 if (!node()) | 1788 if (!node()) |
1789 return 0; | 1789 return 0; |
1790 | 1790 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1832 | 1832 |
1833 void AXNodeObject::decrement() | 1833 void AXNodeObject::decrement() |
1834 { | 1834 { |
1835 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); | 1835 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); |
1836 alterSliderValue(false); | 1836 alterSliderValue(false); |
1837 } | 1837 } |
1838 | 1838 |
1839 void AXNodeObject::childrenChanged() | 1839 void AXNodeObject::childrenChanged() |
1840 { | 1840 { |
1841 // This method is meant as a quick way of marking a portion of the accessibi
lity tree dirty. | 1841 // This method is meant as a quick way of marking a portion of the accessibi
lity tree dirty. |
1842 if (!node() && !renderer()) | 1842 if (!node() && !layoutObject()) |
1843 return; | 1843 return; |
1844 | 1844 |
1845 axObjectCache()->postNotification(this, document(), AXObjectCacheImpl::AXChi
ldrenChanged, true); | 1845 axObjectCache()->postNotification(this, document(), AXObjectCacheImpl::AXChi
ldrenChanged, true); |
1846 | 1846 |
1847 // Go up the accessibility parent chain, but only if the element already exi
sts. This method is | 1847 // Go up the accessibility parent chain, but only if the element already exi
sts. This method is |
1848 // called during layout, minimal work should be done. | 1848 // called during layout, minimal work should be done. |
1849 // If AX elements are created now, they could interrogate the layout tree wh
ile it's in a funky state. | 1849 // If AX elements are created now, they could interrogate the layout tree wh
ile it's in a funky state. |
1850 // At the same time, process ARIA live region changes. | 1850 // At the same time, process ARIA live region changes. |
1851 for (AXObject* parent = this; parent; parent = parent->parentObjectIfExists(
)) { | 1851 for (AXObject* parent = this; parent; parent = parent->parentObjectIfExists(
)) { |
1852 parent->setNeedsToUpdateChildren(); | 1852 parent->setNeedsToUpdateChildren(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1992 float range = maxValueForRange() - minValueForRange(); | 1992 float range = maxValueForRange() - minValueForRange(); |
1993 float value = valueForRange(); | 1993 float value = valueForRange(); |
1994 | 1994 |
1995 value += range * (percentChange / 100); | 1995 value += range * (percentChange / 100); |
1996 setValue(String::number(value)); | 1996 setValue(String::number(value)); |
1997 | 1997 |
1998 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged,
true); | 1998 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged,
true); |
1999 } | 1999 } |
2000 | 2000 |
2001 } // namespace blink | 2001 } // namespace blink |
OLD | NEW |