| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 } | 264 } |
| 265 | 265 |
| 266 static PassRefPtr<AXObject> createFromRenderer(RenderObject* renderer) | 266 static PassRefPtr<AXObject> createFromRenderer(RenderObject* renderer) |
| 267 { | 267 { |
| 268 // FIXME: How could renderer->node() ever not be an Element? | 268 // FIXME: How could renderer->node() ever not be an Element? |
| 269 Node* node = renderer->node(); | 269 Node* node = renderer->node(); |
| 270 | 270 |
| 271 // If the node is aria role="list" or the aria role is empty and its a | 271 // If the node is aria role="list" or the aria role is empty and its a |
| 272 // ul/ol/dl type (it shouldn't be a list if aria says otherwise). | 272 // ul/ol/dl type (it shouldn't be a list if aria says otherwise). |
| 273 if (node && ((nodeHasRole(node, "list") || nodeHasRole(node, "directory")) | 273 if (node && ((nodeHasRole(node, "list") || nodeHasRole(node, "directory")) |
| 274 || (nodeHasRole(node, nullAtom) && (node->hasTagName(ulTag) || node->has
TagName(olTag) || node->hasTagName(dlTag))))) | 274 || (nodeHasRole(node, nullAtom) && (isHTMLUListElement(*node) || isHTMLO
ListElement(*node) || isHTMLDListElement(*node))))) |
| 275 return AXList::create(renderer); | 275 return AXList::create(renderer); |
| 276 | 276 |
| 277 // aria tables | 277 // aria tables |
| 278 if (nodeHasRole(node, "grid") || nodeHasRole(node, "treegrid")) | 278 if (nodeHasRole(node, "grid") || nodeHasRole(node, "treegrid")) |
| 279 return AXARIAGrid::create(renderer); | 279 return AXARIAGrid::create(renderer); |
| 280 if (nodeHasRole(node, "row")) | 280 if (nodeHasRole(node, "row")) |
| 281 return AXARIAGridRow::create(renderer); | 281 return AXARIAGridRow::create(renderer); |
| 282 if (nodeHasRole(node, "gridcell") || nodeHasRole(node, "columnheader") || no
deHasRole(node, "rowheader")) | 282 if (nodeHasRole(node, "gridcell") || nodeHasRole(node, "columnheader") || no
deHasRole(node, "rowheader")) |
| 283 return AXARIAGridCell::create(renderer); | 283 return AXARIAGridCell::create(renderer); |
| 284 | 284 |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 obj->notifyIfIgnoredValueChanged(); | 824 obj->notifyIfIgnoredValueChanged(); |
| 825 } | 825 } |
| 826 } | 826 } |
| 827 | 827 |
| 828 void AXObjectCache::handleAttributeChanged(const QualifiedName& attrName, Elemen
t* element) | 828 void AXObjectCache::handleAttributeChanged(const QualifiedName& attrName, Elemen
t* element) |
| 829 { | 829 { |
| 830 if (attrName == roleAttr) | 830 if (attrName == roleAttr) |
| 831 handleAriaRoleChanged(element); | 831 handleAriaRoleChanged(element); |
| 832 else if (attrName == altAttr || attrName == titleAttr) | 832 else if (attrName == altAttr || attrName == titleAttr) |
| 833 textChanged(element); | 833 textChanged(element); |
| 834 else if (attrName == forAttr && element->hasTagName(labelTag)) | 834 else if (attrName == forAttr && isHTMLLabelElement(*element)) |
| 835 labelChanged(element); | 835 labelChanged(element); |
| 836 | 836 |
| 837 if (!attrName.localName().string().startsWith("aria-")) | 837 if (!attrName.localName().string().startsWith("aria-")) |
| 838 return; | 838 return; |
| 839 | 839 |
| 840 if (attrName == aria_activedescendantAttr) | 840 if (attrName == aria_activedescendantAttr) |
| 841 handleActiveDescendantChanged(element); | 841 handleActiveDescendantChanged(element); |
| 842 else if (attrName == aria_valuenowAttr || attrName == aria_valuetextAttr) | 842 else if (attrName == aria_valuenowAttr || attrName == aria_valuetextAttr) |
| 843 postNotification(element, AXObjectCache::AXValueChanged, true); | 843 postNotification(element, AXObjectCache::AXValueChanged, true); |
| 844 else if (attrName == aria_labelAttr || attrName == aria_labeledbyAttr || att
rName == aria_labelledbyAttr) | 844 else if (attrName == aria_labelAttr || attrName == aria_labeledbyAttr || att
rName == aria_labelledbyAttr) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 | 913 |
| 914 if (visiblePos.isNull()) | 914 if (visiblePos.isNull()) |
| 915 return; | 915 return; |
| 916 | 916 |
| 917 Position deepPos = visiblePos.deepEquivalent(); | 917 Position deepPos = visiblePos.deepEquivalent(); |
| 918 Node* domNode = deepPos.deprecatedNode(); | 918 Node* domNode = deepPos.deprecatedNode(); |
| 919 ASSERT(domNode); | 919 ASSERT(domNode); |
| 920 if (!domNode) | 920 if (!domNode) |
| 921 return; | 921 return; |
| 922 | 922 |
| 923 if (domNode->hasTagName(inputTag) && toHTMLInputElement(domNode)->isPassword
Field()) | 923 if (isHTMLInputElement(*domNode) && toHTMLInputElement(*domNode).isPasswordF
ield()) |
| 924 return; | 924 return; |
| 925 | 925 |
| 926 // find or create an accessibility object for this node | 926 // find or create an accessibility object for this node |
| 927 AXObjectCache* cache = domNode->document().axObjectCache(); | 927 AXObjectCache* cache = domNode->document().axObjectCache(); |
| 928 RefPtr<AXObject> obj = cache->getOrCreate(domNode); | 928 RefPtr<AXObject> obj = cache->getOrCreate(domNode); |
| 929 | 929 |
| 930 textMarkerData.axID = obj.get()->axObjectID(); | 930 textMarkerData.axID = obj.get()->axObjectID(); |
| 931 textMarkerData.node = domNode; | 931 textMarkerData.node = domNode; |
| 932 textMarkerData.offset = deepPos.deprecatedEditingOffset(); | 932 textMarkerData.offset = deepPos.deprecatedEditingOffset(); |
| 933 textMarkerData.affinity = visiblePos.affinity(); | 933 textMarkerData.affinity = visiblePos.affinity(); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 { | 1034 { |
| 1035 postPlatformNotification(getOrCreate(scrollView), AXScrollPositionChanged); | 1035 postPlatformNotification(getOrCreate(scrollView), AXScrollPositionChanged); |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 void AXObjectCache::handleScrollPositionChanged(RenderObject* renderObject) | 1038 void AXObjectCache::handleScrollPositionChanged(RenderObject* renderObject) |
| 1039 { | 1039 { |
| 1040 postPlatformNotification(getOrCreate(renderObject), AXScrollPositionChanged)
; | 1040 postPlatformNotification(getOrCreate(renderObject), AXScrollPositionChanged)
; |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 } // namespace WebCore | 1043 } // namespace WebCore |
| OLD | NEW |