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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 void AXNodeObject::changeValueByStep(bool increase) | 154 void AXNodeObject::changeValueByStep(bool increase) |
155 { | 155 { |
156 float step = stepValueForRange(); | 156 float step = stepValueForRange(); |
157 float value = valueForRange(); | 157 float value = valueForRange(); |
158 | 158 |
159 value += increase ? step : -step; | 159 value += increase ? step : -step; |
160 | 160 |
161 setValue(String::number(value)); | 161 setValue(String::number(value)); |
162 | 162 |
163 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged,
true); | 163 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged)
; |
164 } | 164 } |
165 | 165 |
166 bool AXNodeObject::computeAccessibilityIsIgnored() const | 166 bool AXNodeObject::computeAccessibilityIsIgnored() const |
167 { | 167 { |
168 #if ENABLE(ASSERT) | 168 #if ENABLE(ASSERT) |
169 // Double-check that an AXObject is never accessed before | 169 // Double-check that an AXObject is never accessed before |
170 // it's been initialized. | 170 // it's been initialized. |
171 ASSERT(m_initialized); | 171 ASSERT(m_initialized); |
172 #endif | 172 #endif |
173 | 173 |
(...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1841 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); | 1841 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); |
1842 alterSliderValue(false); | 1842 alterSliderValue(false); |
1843 } | 1843 } |
1844 | 1844 |
1845 void AXNodeObject::childrenChanged() | 1845 void AXNodeObject::childrenChanged() |
1846 { | 1846 { |
1847 // This method is meant as a quick way of marking a portion of the accessibi
lity tree dirty. | 1847 // This method is meant as a quick way of marking a portion of the accessibi
lity tree dirty. |
1848 if (!node() && !layoutObject()) | 1848 if (!node() && !layoutObject()) |
1849 return; | 1849 return; |
1850 | 1850 |
1851 axObjectCache()->postNotification(this, AXObjectCacheImpl::AXChildrenChanged
, true); | 1851 axObjectCache()->postNotification(this, AXObjectCacheImpl::AXChildrenChanged
); |
1852 | 1852 |
1853 // Go up the accessibility parent chain, but only if the element already exi
sts. This method is | 1853 // Go up the accessibility parent chain, but only if the element already exi
sts. This method is |
1854 // called during layout, minimal work should be done. | 1854 // called during layout, minimal work should be done. |
1855 // If AX elements are created now, they could interrogate the layout tree wh
ile it's in a funky state. | 1855 // If AX elements are created now, they could interrogate the layout tree wh
ile it's in a funky state. |
1856 // At the same time, process ARIA live region changes. | 1856 // At the same time, process ARIA live region changes. |
1857 for (AXObject* parent = this; parent; parent = parent->parentObjectIfExists(
)) { | 1857 for (AXObject* parent = this; parent; parent = parent->parentObjectIfExists(
)) { |
1858 parent->setNeedsToUpdateChildren(); | 1858 parent->setNeedsToUpdateChildren(); |
1859 | 1859 |
1860 // These notifications always need to be sent because screenreaders are
reliant on them to perform. | 1860 // These notifications always need to be sent because screenreaders are
reliant on them to perform. |
1861 // In other words, they need to be sent even when the screen reader has
not accessed this live region since the last update. | 1861 // In other words, they need to be sent even when the screen reader has
not accessed this live region since the last update. |
1862 | 1862 |
1863 // If this element supports ARIA live regions, then notify the AT of cha
nges. | 1863 // If this element supports ARIA live regions, then notify the AT of cha
nges. |
1864 if (parent->isLiveRegion()) | 1864 if (parent->isLiveRegion()) |
1865 axObjectCache()->postNotification(parent, AXObjectCacheImpl::AXLiveR
egionChanged, true); | 1865 axObjectCache()->postNotification(parent, AXObjectCacheImpl::AXLiveR
egionChanged); |
1866 | 1866 |
1867 // If this element is an ARIA text box or content editable, post a "valu
e changed" notification on it | 1867 // If this element is an ARIA text box or content editable, post a "valu
e changed" notification on it |
1868 // so that it behaves just like a native input element or textarea. | 1868 // so that it behaves just like a native input element or textarea. |
1869 if (isNonNativeTextControl()) | 1869 if (isNonNativeTextControl()) |
1870 axObjectCache()->postNotification(parent, AXObjectCacheImpl::AXValue
Changed, true); | 1870 axObjectCache()->postNotification(parent, AXObjectCacheImpl::AXValue
Changed); |
1871 } | 1871 } |
1872 } | 1872 } |
1873 | 1873 |
1874 void AXNodeObject::selectionChanged() | 1874 void AXNodeObject::selectionChanged() |
1875 { | 1875 { |
1876 // Post the selected text changed event on the first ancestor that's | 1876 // Post the selected text changed event on the first ancestor that's |
1877 // focused (to handle form controls, ARIA text boxes and contentEditable), | 1877 // focused (to handle form controls, ARIA text boxes and contentEditable), |
1878 // or the web area if the selection is just in the document somewhere. | 1878 // or the web area if the selection is just in the document somewhere. |
1879 if (isFocused() || isWebArea()) | 1879 if (isFocused() || isWebArea()) |
1880 axObjectCache()->postNotification(this, AXObjectCacheImpl::AXSelectedTex
tChanged, true); | 1880 axObjectCache()->postNotification(this, AXObjectCacheImpl::AXSelectedTex
tChanged); |
1881 else | 1881 else |
1882 AXObject::selectionChanged(); // Calls selectionChanged on parent. | 1882 AXObject::selectionChanged(); // Calls selectionChanged on parent. |
1883 } | 1883 } |
1884 | 1884 |
1885 void AXNodeObject::textChanged() | 1885 void AXNodeObject::textChanged() |
1886 { | 1886 { |
1887 // If this element supports ARIA live regions, or is part of a region with a
n ARIA editable role, | 1887 // If this element supports ARIA live regions, or is part of a region with a
n ARIA editable role, |
1888 // then notify the AT of changes. | 1888 // then notify the AT of changes. |
1889 AXObjectCacheImpl* cache = axObjectCache(); | 1889 AXObjectCacheImpl* cache = axObjectCache(); |
1890 for (Node* parentNode = node(); parentNode; parentNode = parentNode->parentN
ode()) { | 1890 for (Node* parentNode = node(); parentNode; parentNode = parentNode->parentN
ode()) { |
1891 AXObject* parent = cache->get(parentNode); | 1891 AXObject* parent = cache->get(parentNode); |
1892 if (!parent) | 1892 if (!parent) |
1893 continue; | 1893 continue; |
1894 | 1894 |
1895 if (parent->isLiveRegion()) | 1895 if (parent->isLiveRegion()) |
1896 cache->postNotification(parentNode, AXObjectCacheImpl::AXLiveRegionC
hanged, true); | 1896 cache->postNotification(parentNode, AXObjectCacheImpl::AXLiveRegionC
hanged); |
1897 | 1897 |
1898 // If this element is an ARIA text box or content editable, post a "valu
e changed" notification on it | 1898 // If this element is an ARIA text box or content editable, post a "valu
e changed" notification on it |
1899 // so that it behaves just like a native input element or textarea. | 1899 // so that it behaves just like a native input element or textarea. |
1900 if (parent->isNonNativeTextControl()) | 1900 if (parent->isNonNativeTextControl()) |
1901 cache->postNotification(parentNode, AXObjectCacheImpl::AXValueChange
d, true); | 1901 cache->postNotification(parentNode, AXObjectCacheImpl::AXValueChange
d); |
1902 } | 1902 } |
1903 } | 1903 } |
1904 | 1904 |
1905 void AXNodeObject::updateAccessibilityRole() | 1905 void AXNodeObject::updateAccessibilityRole() |
1906 { | 1906 { |
1907 bool ignoredStatus = accessibilityIsIgnored(); | 1907 bool ignoredStatus = accessibilityIsIgnored(); |
1908 m_role = determineAccessibilityRole(); | 1908 m_role = determineAccessibilityRole(); |
1909 | 1909 |
1910 // The AX hierarchy only needs to be updated if the ignored status of an ele
ment has changed. | 1910 // The AX hierarchy only needs to be updated if the ignored status of an ele
ment has changed. |
1911 if (ignoredStatus != accessibilityIsIgnored()) | 1911 if (ignoredStatus != accessibilityIsIgnored()) |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1993 } | 1993 } |
1994 | 1994 |
1995 void AXNodeObject::changeValueByPercent(float percentChange) | 1995 void AXNodeObject::changeValueByPercent(float percentChange) |
1996 { | 1996 { |
1997 float range = maxValueForRange() - minValueForRange(); | 1997 float range = maxValueForRange() - minValueForRange(); |
1998 float value = valueForRange(); | 1998 float value = valueForRange(); |
1999 | 1999 |
2000 value += range * (percentChange / 100); | 2000 value += range * (percentChange / 100); |
2001 setValue(String::number(value)); | 2001 setValue(String::number(value)); |
2002 | 2002 |
2003 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged,
true); | 2003 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged)
; |
2004 } | 2004 } |
2005 | 2005 |
2006 } // namespace blink | 2006 } // namespace blink |
OLD | NEW |