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 14 matching lines...) Expand all Loading... | |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #include "config.h" | 29 #include "config.h" |
30 #include "core/accessibility/AccessibilityRenderObject.h" | 30 #include "core/accessibility/AccessibilityRenderObject.h" |
31 | 31 |
32 #include "bindings/v8/ExceptionStatePlaceholder.h" | 32 #include "bindings/v8/ExceptionStatePlaceholder.h" |
33 #include "core/accessibility/AXObjectCache.h" | 33 #include "core/accessibility/AXObjectCache.h" |
34 #include "core/accessibility/AccessibilityImageMapLink.h" | 34 #include "core/accessibility/AccessibilityImageMapLink.h" |
35 #include "core/accessibility/AccessibilityInlineTextBox.h" | |
35 #include "core/accessibility/AccessibilitySVGRoot.h" | 36 #include "core/accessibility/AccessibilitySVGRoot.h" |
36 #include "core/accessibility/AccessibilitySpinButton.h" | 37 #include "core/accessibility/AccessibilitySpinButton.h" |
37 #include "core/accessibility/AccessibilityTable.h" | 38 #include "core/accessibility/AccessibilityTable.h" |
38 #include "core/dom/ElementTraversal.h" | 39 #include "core/dom/ElementTraversal.h" |
39 #include "core/dom/shadow/ShadowRoot.h" | 40 #include "core/dom/shadow/ShadowRoot.h" |
40 #include "core/editing/FrameSelection.h" | 41 #include "core/editing/FrameSelection.h" |
41 #include "core/editing/RenderedPosition.h" | 42 #include "core/editing/RenderedPosition.h" |
42 #include "core/editing/VisibleUnits.h" | 43 #include "core/editing/VisibleUnits.h" |
43 #include "core/editing/htmlediting.h" | 44 #include "core/editing/htmlediting.h" |
44 #include "core/frame/Frame.h" | 45 #include "core/frame/Frame.h" |
45 #include "core/html/HTMLHtmlElement.h" | 46 #include "core/html/HTMLHtmlElement.h" |
46 #include "core/html/HTMLImageElement.h" | 47 #include "core/html/HTMLImageElement.h" |
47 #include "core/html/HTMLLabelElement.h" | 48 #include "core/html/HTMLLabelElement.h" |
48 #include "core/html/HTMLOptionElement.h" | 49 #include "core/html/HTMLOptionElement.h" |
49 #include "core/html/HTMLSelectElement.h" | 50 #include "core/html/HTMLSelectElement.h" |
50 #include "core/html/HTMLTextAreaElement.h" | 51 #include "core/html/HTMLTextAreaElement.h" |
51 #include "core/html/shadow/ShadowElementNames.h" | 52 #include "core/html/shadow/ShadowElementNames.h" |
52 #include "core/loader/ProgressTracker.h" | 53 #include "core/loader/ProgressTracker.h" |
53 #include "core/page/Page.h" | 54 #include "core/page/Page.h" |
54 #include "core/rendering/HitTestResult.h" | 55 #include "core/rendering/HitTestResult.h" |
56 #include "core/rendering/RenderFieldset.h" | |
55 #include "core/rendering/RenderFileUploadControl.h" | 57 #include "core/rendering/RenderFileUploadControl.h" |
56 #include "core/rendering/RenderHTMLCanvas.h" | 58 #include "core/rendering/RenderHTMLCanvas.h" |
57 #include "core/rendering/RenderImage.h" | 59 #include "core/rendering/RenderImage.h" |
58 #include "core/rendering/RenderInline.h" | 60 #include "core/rendering/RenderInline.h" |
59 #include "core/rendering/RenderLayer.h" | 61 #include "core/rendering/RenderLayer.h" |
60 #include "core/rendering/RenderListMarker.h" | 62 #include "core/rendering/RenderListMarker.h" |
61 #include "core/rendering/RenderMenuList.h" | 63 #include "core/rendering/RenderMenuList.h" |
62 #include "core/rendering/RenderTextControlSingleLine.h" | 64 #include "core/rendering/RenderTextControlSingleLine.h" |
63 #include "core/rendering/RenderTextFragment.h" | 65 #include "core/rendering/RenderTextFragment.h" |
64 #include "core/rendering/RenderView.h" | 66 #include "core/rendering/RenderView.h" |
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1465 | 1467 |
1466 for (RefPtr<AccessibilityObject> obj = firstChild(); obj; obj = obj->nextSib ling()) | 1468 for (RefPtr<AccessibilityObject> obj = firstChild(); obj; obj = obj->nextSib ling()) |
1467 addChild(obj.get()); | 1469 addChild(obj.get()); |
1468 | 1470 |
1469 addHiddenChildren(); | 1471 addHiddenChildren(); |
1470 addAttachmentChildren(); | 1472 addAttachmentChildren(); |
1471 addImageMapChildren(); | 1473 addImageMapChildren(); |
1472 addTextFieldChildren(); | 1474 addTextFieldChildren(); |
1473 addCanvasChildren(); | 1475 addCanvasChildren(); |
1474 addRemoteSVGChildren(); | 1476 addRemoteSVGChildren(); |
1477 addInlineTextBoxChildren(); | |
1475 } | 1478 } |
1476 | 1479 |
1477 bool AccessibilityRenderObject::canHaveChildren() const | 1480 bool AccessibilityRenderObject::canHaveChildren() const |
1478 { | 1481 { |
1479 if (!m_renderer) | 1482 if (!m_renderer) |
1480 return false; | 1483 return false; |
1481 | 1484 |
1482 return AccessibilityNodeObject::canHaveChildren(); | 1485 return AccessibilityNodeObject::canHaveChildren(); |
1483 } | 1486 } |
1484 | 1487 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1728 | 1731 |
1729 // Post that the row count changed. | 1732 // Post that the row count changed. |
1730 if (containerParent) | 1733 if (containerParent) |
1731 axObjectCache()->postNotification(containerParent, document(), AXObjectC ache::AXRowCountChanged, true); | 1734 axObjectCache()->postNotification(containerParent, document(), AXObjectC ache::AXRowCountChanged, true); |
1732 | 1735 |
1733 // Post that the specific row either collapsed or expanded. | 1736 // Post that the specific row either collapsed or expanded. |
1734 if (roleValue() == RowRole || roleValue() == TreeItemRole) | 1737 if (roleValue() == RowRole || roleValue() == TreeItemRole) |
1735 axObjectCache()->postNotification(this, document(), isExpanded() ? AXObj ectCache::AXRowExpanded : AXObjectCache::AXRowCollapsed, true); | 1738 axObjectCache()->postNotification(this, document(), isExpanded() ? AXObj ectCache::AXRowExpanded : AXObjectCache::AXRowCollapsed, true); |
1736 } | 1739 } |
1737 | 1740 |
1741 void AccessibilityRenderObject::textChanged() | |
1742 { | |
1743 if (!m_renderer) | |
1744 return; | |
1745 | |
1746 if (AXObjectCache::inlineTextBoxAccessibility() && roleValue() == StaticText Role) | |
1747 childrenChanged(); | |
1748 | |
1749 AccessibilityNodeObject::textChanged(); | |
aboxhall
2013/10/17 22:27:55
Why does this come last?
dmazzoni
2013/10/19 06:48:07
AccessibilityNodeObject::textChanged handles live
| |
1750 } | |
1751 | |
1738 // | 1752 // |
1739 // Text metrics. Most of these should be deprecated, needs major cleanup. | 1753 // Text metrics. Most of these should be deprecated, needs major cleanup. |
1740 // | 1754 // |
1741 | 1755 |
1742 // NOTE: Consider providing this utility method as AX API | 1756 // NOTE: Consider providing this utility method as AX API |
1743 int AccessibilityRenderObject::index(const VisiblePosition& position) const | 1757 int AccessibilityRenderObject::index(const VisiblePosition& position) const |
1744 { | 1758 { |
1745 if (position.isNull() || !isTextControl()) | 1759 if (position.isNull() || !isTextControl()) |
1746 return -1; | 1760 return -1; |
1747 | 1761 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1795 if (indexPosition.isNull() || highestEditableRoot(indexPosition, HasEditable AXRole) != node) | 1809 if (indexPosition.isNull() || highestEditableRoot(indexPosition, HasEditable AXRole) != node) |
1796 return 0; | 1810 return 0; |
1797 | 1811 |
1798 RefPtr<Range> range = Range::create(m_renderer->document()); | 1812 RefPtr<Range> range = Range::create(m_renderer->document()); |
1799 range->setStart(node, 0, IGNORE_EXCEPTION); | 1813 range->setStart(node, 0, IGNORE_EXCEPTION); |
1800 range->setEnd(indexPosition, IGNORE_EXCEPTION); | 1814 range->setEnd(indexPosition, IGNORE_EXCEPTION); |
1801 | 1815 |
1802 return TextIterator::rangeLength(range.get()); | 1816 return TextIterator::rangeLength(range.get()); |
1803 } | 1817 } |
1804 | 1818 |
1819 void AccessibilityRenderObject::addInlineTextBoxChildren() | |
1820 { | |
1821 if (!axObjectCache()->inlineTextBoxAccessibility()) | |
1822 return; | |
1823 | |
1824 if (!renderer() || !renderer()->isText()) | |
1825 return; | |
1826 | |
1827 RenderText* renderText = toRenderText(renderer()); | |
1828 if (renderText->needsLayout()) | |
1829 renderText->document().updateLayoutIgnorePendingStylesheets(); | |
1830 | |
1831 for (RefPtr<AbstractInlineTextBox> box = renderText->firstAbstractInlineText Box(); box.get(); box = box->nextInlineTextBox()) { | |
1832 AccessibilityObject* axObject = axObjectCache()->getOrCreate(box.get()); | |
1833 if (!axObject->accessibilityIsIgnored()) | |
1834 m_children.append(axObject); | |
1835 } | |
1836 } | |
1837 | |
1805 void AccessibilityRenderObject::lineBreaks(Vector<int>& lineBreaks) const | 1838 void AccessibilityRenderObject::lineBreaks(Vector<int>& lineBreaks) const |
1806 { | 1839 { |
1807 if (!isTextControl()) | 1840 if (!isTextControl()) |
1808 return; | 1841 return; |
1809 | 1842 |
1810 VisiblePosition visiblePos = visiblePositionForIndex(0); | 1843 VisiblePosition visiblePos = visiblePositionForIndex(0); |
1811 VisiblePosition savedVisiblePos = visiblePos; | 1844 VisiblePosition savedVisiblePos = visiblePos; |
1812 visiblePos = nextLinePosition(visiblePos, 0); | 1845 visiblePos = nextLinePosition(visiblePos, 0); |
1813 while (!visiblePos.isNull() && visiblePos != savedVisiblePos) { | 1846 while (!visiblePos.isNull() && visiblePos != savedVisiblePos) { |
1814 lineBreaks.append(indexForVisiblePosition(visiblePos)); | 1847 lineBreaks.append(indexForVisiblePosition(visiblePos)); |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2375 if (label && label->renderer()) { | 2408 if (label && label->renderer()) { |
2376 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); | 2409 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); |
2377 result.unite(labelRect); | 2410 result.unite(labelRect); |
2378 } | 2411 } |
2379 } | 2412 } |
2380 | 2413 |
2381 return result; | 2414 return result; |
2382 } | 2415 } |
2383 | 2416 |
2384 } // namespace WebCore | 2417 } // namespace WebCore |
OLD | NEW |