| Differences between
and this patch
- Source/WebCore/ChangeLog +119 lines
Lines 1-3 Source/WebCore/ChangeLog_sec1
1
2012-07-26  Dominic Mazzoni  <dmazzoni@google.com>
2
3
        AX: Calls to AXObjectCache should prefer Node over Renderer
4
        https://bugs.webkit.org/show_bug.cgi?id=91794
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Now that it's possible for nodes inside a canvas subtree to be focused and
9
        represent accessible content, accessibility notifications should be triggered
10
        with a Node* rather than with a RenderObject* whenever possible.
11
12
        Every public API in AXObjectCache that took a RenderObject* before now either
13
        takes a Node* instead, or has a parallel method that takes a Node*.
14
15
        Tests: accessibility/accessibility-node-memory-management.html
16
               accessibility/accessibility-node-reparent.html
17
               accessibility/canvas-fallback-content.html
18
19
        * accessibility/AXObjectCache.cpp:
20
        (WebCore::AXObjectCache::focusedImageMapUIElement):
21
        (WebCore::AXObjectCache::focusedUIElementForPage):
22
        (WebCore::AXObjectCache::getOrCreate):
23
        (WebCore::AXObjectCache::contentChanged):
24
        (WebCore):
25
        (WebCore::AXObjectCache::childrenChanged):
26
        (WebCore::AXObjectCache::postNotification):
27
        (WebCore::AXObjectCache::checkedStateChanged):
28
        (WebCore::AXObjectCache::selectedChildrenChanged):
29
        (WebCore::AXObjectCache::nodeTextChangeNotification):
30
        (WebCore::AXObjectCache::handleAriaExpandedChange):
31
        (WebCore::AXObjectCache::handleActiveDescendantChanged):
32
        (WebCore::AXObjectCache::handleAriaRoleChanged):
33
        (WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
34
        (WebCore::AXObjectCache::rootAXEditableElement):
35
        (WebCore::AXObjectCache::nodeIsTextControl):
36
        * accessibility/AXObjectCache.h:
37
        (AXObjectCache):
38
        (WebCore::AXObjectCache::setNodeInUse):
39
        (WebCore::AXObjectCache::removeNodeForUse):
40
        (WebCore::AXObjectCache::isNodeInUse):
41
        (WebCore::AXObjectCache::checkedStateChanged):
42
        (WebCore::AXObjectCache::childrenChanged):
43
        (WebCore::AXObjectCache::contentChanged):
44
        (WebCore::AXObjectCache::handleActiveDescendantChanged):
45
        (WebCore::AXObjectCache::handleAriaExpandedChange):
46
        (WebCore::AXObjectCache::handleAriaRoleChanged):
47
        (WebCore::AXObjectCache::handleFocusedUIElementChanged):
48
        (WebCore::AXObjectCache::postNotification):
49
        (WebCore::AXObjectCache::selectedChildrenChanged):
50
        * accessibility/AccessibilityListBoxOption.cpp:
51
        (WebCore::AccessibilityListBoxOption::parentObject):
52
        * accessibility/AccessibilityObject.cpp:
53
        (WebCore::appendAccessibilityObject):
54
        (WebCore::replacedNodeNeedsCharacter):
55
        * accessibility/AccessibilityRenderObject.cpp:
56
        (WebCore::AccessibilityRenderObject::menuForMenuButton):
57
        (WebCore::AccessibilityRenderObject::menuButtonForMenu):
58
        (WebCore::AccessibilityRenderObject::checkboxOrRadioRect):
59
        (WebCore::AccessibilityRenderObject::addRadioButtonGroupMembers):
60
        (WebCore::AccessibilityRenderObject::titleUIElement):
61
        (WebCore::AccessibilityRenderObject::isTabItemSelected):
62
        (WebCore::AccessibilityRenderObject::accessibilityParentForImageMap):
63
        (WebCore::AccessibilityRenderObject::nodeIsTextControl):
64
        (WebCore::AccessibilityRenderObject::activeDescendant):
65
        (WebCore::AccessibilityRenderObject::correspondingControlForLabelElement):
66
        (WebCore::AccessibilityRenderObject::correspondingLabelForControlElement):
67
        * accessibility/AccessibilityRenderObject.h:
68
        (AccessibilityRenderObject):
69
        * accessibility/AccessibilityScrollView.cpp:
70
        (WebCore::AccessibilityScrollView::webAreaObject):
71
        (WebCore::AccessibilityScrollView::parentObject):
72
        (WebCore::AccessibilityScrollView::parentObjectIfExists):
73
        * accessibility/chromium/AXObjectCacheChromium.cpp:
74
        (WebCore::AXObjectCache::handleFocusedUIElementChanged):
75
        * accessibility/gtk/AXObjectCacheAtk.cpp:
76
        (WebCore::AXObjectCache::handleFocusedUIElementChanged):
77
        * accessibility/mac/AXObjectCacheMac.mm:
78
        (WebCore::AXObjectCache::handleFocusedUIElementChanged):
79
        * accessibility/win/AXObjectCacheWin.cpp:
80
        (WebCore::AXObjectCache::handleFocusedUIElementChanged):
81
        * bindings/cpp/WebDOMCustomVoidCallback.cpp:
82
        (toWebCore):
83
        * dom/Document.cpp:
84
        (WebCore::Document::setFocusedNode):
85
        * dom/Element.cpp:
86
        (WebCore::Element::attributeChanged):
87
        * dom/Node.cpp:
88
        (WebCore::Node::~Node):
89
        (WebCore::Node::detach):
90
        * editing/AppendNodeCommand.cpp:
91
        (WebCore::sendAXTextChangedIgnoringLineBreaks):
92
        * editing/DeleteFromTextNodeCommand.cpp:
93
        (WebCore::DeleteFromTextNodeCommand::doApply):
94
        (WebCore::DeleteFromTextNodeCommand::doUnapply):
95
        * editing/Editor.cpp:
96
        (WebCore::Editor::respondToChangedContents):
97
        (WebCore::Editor::markAndReplaceFor):
98
        * editing/InsertIntoTextNodeCommand.cpp:
99
        (WebCore::InsertIntoTextNodeCommand::doApply):
100
        (WebCore::InsertIntoTextNodeCommand::doUnapply):
101
        * editing/InsertNodeBeforeCommand.cpp:
102
        (WebCore::InsertNodeBeforeCommand::doApply):
103
        (WebCore::InsertNodeBeforeCommand::doUnapply):
104
        * editing/chromium/FrameSelectionChromium.cpp:
105
        (WebCore::FrameSelection::notifyAccessibilityForSelectionChange):
106
        * html/HTMLInputElement.cpp:
107
        (WebCore::HTMLInputElement::setChecked):
108
        * html/HTMLSelectElement.cpp:
109
        (WebCore::HTMLSelectElement::childrenChanged):
110
        (WebCore::HTMLSelectElement::optionElementChildrenChanged):
111
        * html/HTMLTextFormControlElement.cpp:
112
        (WebCore::HTMLTextFormControlElement::setInnerTextValue):
113
        * html/InputType.cpp:
114
        (WebCore::InputType::applyStep):
115
        * html/RangeInputType.cpp:
116
        (WebCore::RangeInputType::handleKeydownEvent):
117
        * page/FocusController.cpp:
118
        (WebCore::FocusController::setInitialFocus):
119
1
2012-07-25  MORITA Hajime  <morrita@google.com>
120
2012-07-25  MORITA Hajime  <morrita@google.com>
2
121
3
        [Chromium][Win] <progress> animation on RTL direction is reverse
122
        [Chromium][Win] <progress> animation on RTL direction is reverse
- Source/WebCore/accessibility/AXObjectCache.cpp -49 / +77 lines
Lines 112-118 AccessibilityObject* AXObjectCache::focu Source/WebCore/accessibility/AXObjectCache.cpp_sec1
112
    if (!imageElement)
112
    if (!imageElement)
113
        return 0;
113
        return 0;
114
    
114
    
115
    AccessibilityObject* axRenderImage = areaElement->document()->axObjectCache()->getOrCreate(imageElement->renderer());
115
    AccessibilityObject* axRenderImage = areaElement->document()->axObjectCache()->getOrCreate(imageElement);
116
    if (!axRenderImage)
116
    if (!axRenderImage)
117
        return 0;
117
        return 0;
118
    
118
    
Lines 144-154 AccessibilityObject* AXObjectCache::focu Source/WebCore/accessibility/AXObjectCache.cpp_sec2
144
    if (focusedNode->hasTagName(areaTag))
144
    if (focusedNode->hasTagName(areaTag))
145
        return focusedImageMapUIElement(static_cast<HTMLAreaElement*>(focusedNode));
145
        return focusedImageMapUIElement(static_cast<HTMLAreaElement*>(focusedNode));
146
    
146
    
147
    RenderObject* focusedNodeRenderer = focusedNode->renderer();
147
    AccessibilityObject* obj = focusedNode->document()->axObjectCache()->getOrCreate(focusedNode);
148
    if (!focusedNodeRenderer)
149
        return 0;
150
151
    AccessibilityObject* obj = focusedNodeRenderer->document()->axObjectCache()->getOrCreate(focusedNodeRenderer);
152
148
153
    if (obj->shouldFocusActiveDescendant()) {
149
    if (obj->shouldFocusActiveDescendant()) {
154
        if (AccessibilityObject* descendant = obj->activeDescendant())
150
        if (AccessibilityObject* descendant = obj->activeDescendant())
Lines 301-311 AccessibilityObject* AXObjectCache::getO Source/WebCore/accessibility/AXObjectCache.cpp_sec3
301
    if (!node)
297
    if (!node)
302
        return 0;
298
        return 0;
303
299
304
    if (AccessibilityObject* obj = get(node))
300
    AccessibilityObject* nodeObj = get(node);
305
        return obj;
301
    AccessibilityObject* rendererObj = getOrCreate(node->renderer());
306
302
307
    if (node->renderer())
303
    if (nodeObj && rendererObj && nodeObj != rendererObj) {
308
        return getOrCreate(node->renderer());
304
        // This can happen if an AccessibilityNodeObject is created for a node that's not
305
        // rendered, but later something changes and it gets a renderer (like if it's
306
        // reparented). Detach the AccessibilityNodeObject and return the AccessibilityRenderObject.
307
        nodeObj->detach();
308
        return rendererObj;
309
    }
310
311
    if (nodeObj)
312
        return nodeObj;
313
314
    if (rendererObj)
315
        return rendererObj;
309
316
310
    // It's only allowed to create an AccessibilityObject from a Node if it's in a canvas subtree.
317
    // It's only allowed to create an AccessibilityObject from a Node if it's in a canvas subtree.
311
    if (!node->parentElement() || !node->parentElement()->isInCanvasSubtree())
318
    if (!node->parentElement() || !node->parentElement()->isInCanvasSubtree())
Lines 512-517 void AXObjectCache::removeAXID(Accessibi Source/WebCore/accessibility/AXObjectCache.cpp_sec4
512
    m_idsInUse.remove(objID);
519
    m_idsInUse.remove(objID);
513
}
520
}
514
521
522
void AXObjectCache::contentChanged(Node* node)
523
{
524
    AccessibilityObject* object = getOrCreate(node);
525
    if (object)
526
        object->contentChanged(); 
527
}
528
515
void AXObjectCache::contentChanged(RenderObject* renderer)
529
void AXObjectCache::contentChanged(RenderObject* renderer)
516
{
530
{
517
    AccessibilityObject* object = getOrCreate(renderer);
531
    AccessibilityObject* object = getOrCreate(renderer);
Lines 519-534 void AXObjectCache::contentChanged(Rende Source/WebCore/accessibility/AXObjectCache.cpp_sec5
519
        object->contentChanged(); 
533
        object->contentChanged(); 
520
}
534
}
521
535
536
void AXObjectCache::childrenChanged(Node* node)
537
{
538
    AccessibilityObject* obj = get(node);
539
    if (obj)
540
        obj->childrenChanged();
541
}
542
522
void AXObjectCache::childrenChanged(RenderObject* renderer)
543
void AXObjectCache::childrenChanged(RenderObject* renderer)
523
{
544
{
524
    if (!renderer)
545
    AccessibilityObject* obj = get(renderer);
525
        return;
526
 
527
    AXID axID = m_renderObjectMapping.get(renderer);
528
    if (!axID)
529
        return;
530
    
531
    AccessibilityObject* obj = m_objects.get(axID).get();
532
    if (obj)
546
    if (obj)
533
        obj->childrenChanged();
547
        obj->childrenChanged();
534
}
548
}
Lines 559-566 void AXObjectCache::notificationPostTime Source/WebCore/accessibility/AXObjectCache.cpp_sec6
559
    
573
    
560
void AXObjectCache::postNotification(RenderObject* renderer, AXNotification notification, bool postToElement, PostType postType)
574
void AXObjectCache::postNotification(RenderObject* renderer, AXNotification notification, bool postToElement, PostType postType)
561
{
575
{
562
    // Notifications for text input objects are sent to that object.
563
    // All others are sent to the top WebArea.
564
    if (!renderer)
576
    if (!renderer)
565
        return;
577
        return;
566
    
578
    
Lines 578-583 void AXObjectCache::postNotification(Ren Source/WebCore/accessibility/AXObjectCache.cpp_sec7
578
    postNotification(object.get(), renderer->document(), notification, postToElement, postType);
590
    postNotification(object.get(), renderer->document(), notification, postToElement, postType);
579
}
591
}
580
592
593
void AXObjectCache::postNotification(Node* node, AXNotification notification, bool postToElement, PostType postType)
594
{
595
    if (!node)
596
        return;
597
    
598
    // Get an accessibility object that already exists. One should not be created here
599
    // because a render update may be in progress and creating an AX object can re-trigger a layout
600
    RefPtr<AccessibilityObject> object = get(node);
601
    while (!object && node) {
602
        node = node->parentNode();
603
        object = get(node);
604
    }
605
    
606
    if (!node)
607
        return;
608
    
609
    postNotification(object.get(), node->document(), notification, postToElement, postType);
610
}
611
581
void AXObjectCache::postNotification(AccessibilityObject* object, Document* document, AXNotification notification, bool postToElement, PostType postType)
612
void AXObjectCache::postNotification(AccessibilityObject* object, Document* document, AXNotification notification, bool postToElement, PostType postType)
582
{
613
{
583
    if (object && !postToElement)
614
    if (object && !postToElement)
Lines 597-605 void AXObjectCache::postNotification(Acc Source/WebCore/accessibility/AXObjectCache.cpp_sec8
597
        postPlatformNotification(object, notification);
628
        postPlatformNotification(object, notification);
598
}
629
}
599
630
600
void AXObjectCache::checkedStateChanged(RenderObject* renderer)
631
void AXObjectCache::checkedStateChanged(Node* node)
632
{
633
    postNotification(node, AXObjectCache::AXCheckedStateChanged, true);
634
}
635
636
void AXObjectCache::selectedChildrenChanged(Node* node)
601
{
637
{
602
    postNotification(renderer, AXObjectCache::AXCheckedStateChanged, true);
638
    // postToElement is false so that you can pass in any child of an element and it will go up the parent tree
639
    // to find the container which should send out the notification.
640
    postNotification(node, AXSelectedChildrenChanged, false);
603
}
641
}
604
642
605
void AXObjectCache::selectedChildrenChanged(RenderObject* renderer)
643
void AXObjectCache::selectedChildrenChanged(RenderObject* renderer)
Lines 609-621 void AXObjectCache::selectedChildrenChan Source/WebCore/accessibility/AXObjectCache.cpp_sec9
609
    postNotification(renderer, AXSelectedChildrenChanged, false);
647
    postNotification(renderer, AXSelectedChildrenChanged, false);
610
}
648
}
611
649
612
void AXObjectCache::nodeTextChangeNotification(RenderObject* renderer, AXTextChange textChange, unsigned offset, const String& text)
650
void AXObjectCache::nodeTextChangeNotification(Node* node, AXTextChange textChange, unsigned offset, const String& text)
613
{
651
{
614
    if (!renderer)
652
    if (!node)
615
        return;
653
        return;
616
654
617
    // Delegate on the right platform
655
    // Delegate on the right platform
618
    AccessibilityObject* obj = getOrCreate(renderer);
656
    AccessibilityObject* obj = getOrCreate(node);
619
    nodeTextChangePlatformNotification(obj, textChange, offset, text);
657
    nodeTextChangePlatformNotification(obj, textChange, offset, text);
620
}
658
}
621
659
Lines 644-674 void AXObjectCache::handleScrollbarUpdat Source/WebCore/accessibility/AXObjectCache.cpp_sec10
644
        scrollViewObject->updateChildrenIfNecessary();
682
        scrollViewObject->updateChildrenIfNecessary();
645
}
683
}
646
    
684
    
647
void AXObjectCache::handleAriaExpandedChange(RenderObject *renderer)
685
void AXObjectCache::handleAriaExpandedChange(Node* node)
648
{
686
{
649
    if (!renderer)
687
    AccessibilityObject* obj = getOrCreate(node);
650
        return;
651
    AccessibilityObject* obj = getOrCreate(renderer);
652
    if (obj)
688
    if (obj)
653
        obj->handleAriaExpandedChanged();
689
        obj->handleAriaExpandedChanged();
654
}
690
}
655
    
691
    
656
void AXObjectCache::handleActiveDescendantChanged(RenderObject* renderer)
692
void AXObjectCache::handleActiveDescendantChanged(Node* node)
657
{
693
{
658
    if (!renderer)
694
    AccessibilityObject* obj = getOrCreate(node);
659
        return;
660
    AccessibilityObject* obj = getOrCreate(renderer);
661
    if (obj)
695
    if (obj)
662
        obj->handleActiveDescendantChanged();
696
        obj->handleActiveDescendantChanged();
663
}
697
}
664
698
665
void AXObjectCache::handleAriaRoleChanged(RenderObject* renderer)
699
void AXObjectCache::handleAriaRoleChanged(Node* node)
666
{
700
{
667
    if (!renderer)
701
    AccessibilityObject* obj = getOrCreate(node);
668
        return;
702
    if (obj && obj->isAccessibilityNodeObject())
669
    AccessibilityObject* obj = getOrCreate(renderer);
703
        static_cast<AccessibilityNodeObject*>(obj)->updateAccessibilityRole();
670
    if (obj && obj->isAccessibilityRenderObject())
671
        static_cast<AccessibilityRenderObject*>(obj)->updateAccessibilityRole();
672
}
704
}
673
705
674
VisiblePosition AXObjectCache::visiblePositionForTextMarkerData(TextMarkerData& textMarkerData)
706
VisiblePosition AXObjectCache::visiblePositionForTextMarkerData(TextMarkerData& textMarkerData)
Lines 717-729 void AXObjectCache::textMarkerDataForVis Source/WebCore/accessibility/AXObjectCache.cpp_sec11
717
            return;
749
            return;
718
    }
750
    }
719
    
751
    
720
    // locate the renderer, which must exist for a visible dom node
752
    // find or create an accessibility object for this node
721
    RenderObject* renderer = domNode->renderer();
753
    AXObjectCache* cache = domNode->document()->axObjectCache();
722
    ASSERT(renderer);
754
    RefPtr<AccessibilityObject> obj = cache->getOrCreate(domNode);
723
    
724
    // find or create an accessibility object for this renderer
725
    AXObjectCache* cache = renderer->document()->axObjectCache();
726
    RefPtr<AccessibilityObject> obj = cache->getOrCreate(renderer);
727
    
755
    
728
    textMarkerData.axID = obj.get()->axObjectID();
756
    textMarkerData.axID = obj.get()->axObjectID();
729
    textMarkerData.node = domNode;
757
    textMarkerData.node = domNode;
Lines 739-757 const Element* AXObjectCache::rootAXEdit Source/WebCore/accessibility/AXObjectCache.cpp_sec12
739
    const Element* element = node->isElementNode() ? toElement(node) : node->parentElement();
767
    const Element* element = node->isElementNode() ? toElement(node) : node->parentElement();
740
768
741
    for (; element; element = element->parentElement()) {
769
    for (; element; element = element->parentElement()) {
742
        if (nodeIsTextControl(element))
770
        if (nodeIsTextControl(const_cast<Element*>(element)))
743
            result = element;
771
            result = element;
744
    }
772
    }
745
773
746
    return result;
774
    return result;
747
}
775
}
748
776
749
bool AXObjectCache::nodeIsTextControl(const Node* node)
777
bool AXObjectCache::nodeIsTextControl(Node* node)
750
{
778
{
751
    if (!node)
779
    if (!node)
752
        return false;
780
        return false;
753
781
754
    const AccessibilityObject* axObject = getOrCreate(node->renderer());
782
    const AccessibilityObject* axObject = getOrCreate(node);
755
    return axObject && axObject->isTextControl();
783
    return axObject && axObject->isTextControl();
756
}
784
}
757
785
- Source/WebCore/accessibility/AXObjectCache.h -17 / +25 lines
Lines 87-103 public: Source/WebCore/accessibility/AXObjectCache.h_sec1
87
87
88
    void detachWrapper(AccessibilityObject*);
88
    void detachWrapper(AccessibilityObject*);
89
    void attachWrapper(AccessibilityObject*);
89
    void attachWrapper(AccessibilityObject*);
90
    void childrenChanged(Node*);
90
    void childrenChanged(RenderObject*);
91
    void childrenChanged(RenderObject*);
91
    void checkedStateChanged(RenderObject*);
92
    void checkedStateChanged(Node*);
93
    void selectedChildrenChanged(Node*);
92
    void selectedChildrenChanged(RenderObject*);
94
    void selectedChildrenChanged(RenderObject*);
93
    // Called by a node when text or a text equivalent (e.g. alt) attribute is changed.
95
    // Called by a node when text or a text equivalent (e.g. alt) attribute is changed.
96
    void contentChanged(Node*);
94
    void contentChanged(RenderObject*);
97
    void contentChanged(RenderObject*);
95
    
98
    
96
    void handleActiveDescendantChanged(RenderObject*);
99
    void handleActiveDescendantChanged(Node*);
97
    void handleAriaRoleChanged(RenderObject*);
100
    void handleAriaRoleChanged(Node*);
98
    void handleFocusedUIElementChanged(RenderObject* oldFocusedRenderer, RenderObject* newFocusedRenderer);
101
    void handleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFocusedNode);
99
    void handleScrolledToAnchor(const Node* anchorNode);
102
    void handleScrolledToAnchor(const Node* anchorNode);
100
    void handleAriaExpandedChange(RenderObject*);
103
    void handleAriaExpandedChange(Node*);
101
    void handleScrollbarUpdate(ScrollView*);
104
    void handleScrollbarUpdate(ScrollView*);
102
105
103
#if HAVE(ACCESSIBILITY)
106
#if HAVE(ACCESSIBILITY)
Lines 119-134 public: Source/WebCore/accessibility/AXObjectCache.h_sec2
119
122
120
    Element* rootAXEditableElement(Node*);
123
    Element* rootAXEditableElement(Node*);
121
    const Element* rootAXEditableElement(const Node*);
124
    const Element* rootAXEditableElement(const Node*);
122
    bool nodeIsTextControl(const Node*);
125
    bool nodeIsTextControl(Node*);
123
126
124
    AXID platformGenerateAXID() const;
127
    AXID platformGenerateAXID() const;
125
    AccessibilityObject* objectFromAXID(AXID id) const { return m_objects.get(id).get(); }
128
    AccessibilityObject* objectFromAXID(AXID id) const { return m_objects.get(id).get(); }
126
129
127
    // This is a weak reference cache for knowing if Nodes used by TextMarkers are valid.
128
    void setNodeInUse(Node* n) { m_textMarkerNodes.add(n); }
129
    void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); }
130
    bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); }
131
    
132
    // Text marker utilities.
130
    // Text marker utilities.
133
    void textMarkerDataForVisiblePosition(TextMarkerData&, const VisiblePosition&);
131
    void textMarkerDataForVisiblePosition(TextMarkerData&, const VisiblePosition&);
134
    VisiblePosition visiblePositionForTextMarkerData(TextMarkerData&);
132
    VisiblePosition visiblePositionForTextMarkerData(TextMarkerData&);
Lines 155-160 public: Source/WebCore/accessibility/AXObjectCache.h_sec3
155
    };
153
    };
156
154
157
    void postNotification(RenderObject*, AXNotification, bool postToElement, PostType = PostAsynchronously);
155
    void postNotification(RenderObject*, AXNotification, bool postToElement, PostType = PostAsynchronously);
156
    void postNotification(Node*, AXNotification, bool postToElement, PostType = PostAsynchronously);
158
    void postNotification(AccessibilityObject*, Document*, AXNotification, bool postToElement, PostType = PostAsynchronously);
157
    void postNotification(AccessibilityObject*, Document*, AXNotification, bool postToElement, PostType = PostAsynchronously);
159
158
160
    enum AXTextChange {
159
    enum AXTextChange {
Lines 162-168 public: Source/WebCore/accessibility/AXObjectCache.h_sec4
162
        AXTextDeleted,
161
        AXTextDeleted,
163
    };
162
    };
164
163
165
    void nodeTextChangeNotification(RenderObject*, AXTextChange, unsigned offset, const String&);
164
    void nodeTextChangeNotification(Node*, AXTextChange, unsigned offset, const String&);
166
165
167
    enum AXLoadingEvent {
166
    enum AXLoadingEvent {
168
        AXLoadingStarted,
167
        AXLoadingStarted,
Lines 180-185 protected: Source/WebCore/accessibility/AXObjectCache.h_sec5
180
    void nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned offset, const String&);
179
    void nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned offset, const String&);
181
    void frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent);
180
    void frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent);
182
181
182
    // This is a weak reference cache for knowing if Nodes used by TextMarkers are valid.
183
    void setNodeInUse(Node* n) { m_textMarkerNodes.add(n); }
184
    void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); }
185
    bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); }
186
183
private:
187
private:
184
    Document* m_document;
188
    Document* m_document;
185
    HashMap<AXID, RefPtr<AccessibilityObject> > m_objects;
189
    HashMap<AXID, RefPtr<AccessibilityObject> > m_objects;
Lines 220-247 inline Element* AXObjectCache::rootAXEdi Source/WebCore/accessibility/AXObjectCache.h_sec6
220
inline bool nodeHasRole(Node*, const String&) { return false; }
224
inline bool nodeHasRole(Node*, const String&) { return false; }
221
inline const Element* AXObjectCache::rootAXEditableElement(const Node*) { return 0; }
225
inline const Element* AXObjectCache::rootAXEditableElement(const Node*) { return 0; }
222
inline void AXObjectCache::attachWrapper(AccessibilityObject*) { }
226
inline void AXObjectCache::attachWrapper(AccessibilityObject*) { }
223
inline void AXObjectCache::checkedStateChanged(RenderObject*) { }
227
inline void AXObjectCache::checkedStateChanged(Node*) { }
224
inline void AXObjectCache::childrenChanged(RenderObject*) { }
228
inline void AXObjectCache::childrenChanged(RenderObject*) { }
229
inline void AXObjectCache::childrenChanged(Node*) { }
225
inline void AXObjectCache::contentChanged(RenderObject*) { }
230
inline void AXObjectCache::contentChanged(RenderObject*) { }
231
inline void AXObjectCache::contentChanged(Node*) { }
226
inline void AXObjectCache::detachWrapper(AccessibilityObject*) { }
232
inline void AXObjectCache::detachWrapper(AccessibilityObject*) { }
227
inline void AXObjectCache::frameLoadingEventNotification(Frame*, AXLoadingEvent) { }
233
inline void AXObjectCache::frameLoadingEventNotification(Frame*, AXLoadingEvent) { }
228
inline void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent) { }
234
inline void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent) { }
229
inline void AXObjectCache::handleActiveDescendantChanged(RenderObject*) { }
235
inline void AXObjectCache::handleActiveDescendantChanged(Node*) { }
230
inline void AXObjectCache::handleAriaExpandedChange(RenderObject*) { }
236
inline void AXObjectCache::handleAriaExpandedChange(Node*) { }
231
inline void AXObjectCache::handleAriaRoleChanged(RenderObject*) { }
237
inline void AXObjectCache::handleAriaRoleChanged(Node*) { }
232
inline void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject*) { }
238
inline void AXObjectCache::handleFocusedUIElementChanged(Node*, Node*) { }
233
inline void AXObjectCache::handleScrollbarUpdate(ScrollView*) { }
239
inline void AXObjectCache::handleScrollbarUpdate(ScrollView*) { }
234
inline void AXObjectCache::handleScrolledToAnchor(const Node*) { }
240
inline void AXObjectCache::handleScrolledToAnchor(const Node*) { }
235
inline void AXObjectCache::nodeTextChangeNotification(RenderObject*, AXTextChange, unsigned, const String&) { }
241
inline void AXObjectCache::nodeTextChangeNotification(RenderObject*, AXTextChange, unsigned, const String&) { }
236
inline void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, const String&) { }
242
inline void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, const String&) { }
237
inline void AXObjectCache::postNotification(AccessibilityObject*, Document*, AXNotification, bool postToElement, PostType) { }
243
inline void AXObjectCache::postNotification(AccessibilityObject*, Document*, AXNotification, bool postToElement, PostType) { }
238
inline void AXObjectCache::postNotification(RenderObject*, AXNotification, bool postToElement, PostType) { }
244
inline void AXObjectCache::postNotification(RenderObject*, AXNotification, bool postToElement, PostType) { }
245
inline void AXObjectCache::postNotification(Node*, AXNotification, bool postToElement, PostType) { }
239
inline void AXObjectCache::postPlatformNotification(AccessibilityObject*, AXNotification) { }
246
inline void AXObjectCache::postPlatformNotification(AccessibilityObject*, AXNotification) { }
240
inline void AXObjectCache::remove(AXID) { }
247
inline void AXObjectCache::remove(AXID) { }
241
inline void AXObjectCache::remove(RenderObject*) { }
248
inline void AXObjectCache::remove(RenderObject*) { }
242
inline void AXObjectCache::remove(Node*) { }
249
inline void AXObjectCache::remove(Node*) { }
243
inline void AXObjectCache::remove(Widget*) { }
250
inline void AXObjectCache::remove(Widget*) { }
244
inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { }
251
inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { }
252
inline void AXObjectCache::selectedChildrenChanged(Node*) { }
245
#endif
253
#endif
246
254
247
}
255
}
- Source/WebCore/accessibility/AccessibilityListBoxOption.cpp -1 / +1 lines
Lines 172-178 AccessibilityObject* AccessibilityListBo Source/WebCore/accessibility/AccessibilityListBoxOption.cpp_sec1
172
    if (!parentNode)
172
    if (!parentNode)
173
        return 0;
173
        return 0;
174
    
174
    
175
    return m_optionElement->document()->axObjectCache()->getOrCreate(parentNode->renderer());
175
    return m_optionElement->document()->axObjectCache()->getOrCreate(parentNode);
176
}
176
}
177
177
178
void AccessibilityListBoxOption::setSelected(bool selected)
178
void AccessibilityListBoxOption::setSelected(bool selected)
- Source/WebCore/accessibility/AccessibilityObject.cpp -2 / +2 lines
Lines 384-390 static void appendAccessibilityObject(Ac Source/WebCore/accessibility/AccessibilityObject.cpp_sec1
384
        if (!doc || !doc->renderer())
384
        if (!doc || !doc->renderer())
385
            return;
385
            return;
386
        
386
        
387
        object = object->axObjectCache()->getOrCreate(doc->renderer());
387
        object = object->axObjectCache()->getOrCreate(doc);
388
    }
388
    }
389
389
390
    if (object)
390
    if (object)
Lines 779-785 static bool replacedNodeNeedsCharacter(N Source/WebCore/accessibility/AccessibilityObject.cpp_sec2
779
        return false;
779
        return false;
780
780
781
    // create an AX object, but skip it if it is not supposed to be seen
781
    // create an AX object, but skip it if it is not supposed to be seen
782
    AccessibilityObject* object = replacedNode->renderer()->document()->axObjectCache()->getOrCreate(replacedNode->renderer());
782
    AccessibilityObject* object = replacedNode->renderer()->document()->axObjectCache()->getOrCreate(replacedNode);
783
    if (object->accessibilityIsIgnored())
783
    if (object->accessibilityIsIgnored())
784
        return false;
784
        return false;
785
785
- Source/WebCore/accessibility/AccessibilityRenderObject.cpp -13 / +13 lines
Lines 998-1004 AccessibilityObject* AccessibilityRender Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec1
998
{
998
{
999
    Element* menu = menuElementForMenuButton();
999
    Element* menu = menuElementForMenuButton();
1000
    if (menu && menu->renderer())
1000
    if (menu && menu->renderer())
1001
        return axObjectCache()->getOrCreate(menu->renderer());
1001
        return axObjectCache()->getOrCreate(menu);
1002
    return 0;
1002
    return 0;
1003
}
1003
}
1004
1004
Lines 1016-1022 AccessibilityObject* AccessibilityRender Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec2
1016
1016
1017
    if (menuItem && menuItem->renderer()) {
1017
    if (menuItem && menuItem->renderer()) {
1018
        // ARIA just has generic menu items.  AppKit needs to know if this is a top level items like MenuBarButton or MenuBarItem
1018
        // ARIA just has generic menu items.  AppKit needs to know if this is a top level items like MenuBarButton or MenuBarItem
1019
        AccessibilityObject* menuItemAX = axObjectCache()->getOrCreate(menuItem->renderer());
1019
        AccessibilityObject* menuItemAX = axObjectCache()->getOrCreate(menuItem);
1020
        if (menuItemAX->isMenuButton())
1020
        if (menuItemAX->isMenuButton())
1021
            return menuItemAX;
1021
            return menuItemAX;
1022
    }
1022
    }
Lines 1539-1545 LayoutRect AccessibilityRenderObject::ch Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec3
1539
    if (!label || !label->renderer())
1539
    if (!label || !label->renderer())
1540
        return boundingBoxRect();
1540
        return boundingBoxRect();
1541
    
1541
    
1542
    LayoutRect labelRect = axObjectCache()->getOrCreate(label->renderer())->elementRect();
1542
    LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementRect();
1543
    labelRect.unite(boundingBoxRect());
1543
    labelRect.unite(boundingBoxRect());
1544
    return labelRect;
1544
    return labelRect;
1545
}
1545
}
Lines 1627-1633 void AccessibilityRenderObject::addRadio Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec4
1627
        unsigned len = formElements.size();
1627
        unsigned len = formElements.size();
1628
        for (unsigned i = 0; i < len; ++i) {
1628
        for (unsigned i = 0; i < len; ++i) {
1629
            Node* associateElement = formElements[i].get();
1629
            Node* associateElement = formElements[i].get();
1630
            if (AccessibilityObject* object = axObjectCache()->getOrCreate(associateElement->renderer()))
1630
            if (AccessibilityObject* object = axObjectCache()->getOrCreate(associateElement))
1631
                linkedUIElements.append(object);        
1631
                linkedUIElements.append(object);        
1632
        } 
1632
        } 
1633
    } else {
1633
    } else {
Lines 1637-1643 void AccessibilityRenderObject::addRadio Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec5
1637
            if (list->item(i)->hasTagName(inputTag)) {
1637
            if (list->item(i)->hasTagName(inputTag)) {
1638
                HTMLInputElement* associateElement = static_cast<HTMLInputElement*>(list->item(i));
1638
                HTMLInputElement* associateElement = static_cast<HTMLInputElement*>(list->item(i));
1639
                if (associateElement->isRadioButton() && associateElement->name() == input->name()) {
1639
                if (associateElement->isRadioButton() && associateElement->name() == input->name()) {
1640
                    if (AccessibilityObject* object = axObjectCache()->getOrCreate(associateElement->renderer()))
1640
                    if (AccessibilityObject* object = axObjectCache()->getOrCreate(associateElement))
1641
                        linkedUIElements.append(object);
1641
                        linkedUIElements.append(object);
1642
                }
1642
                }
1643
            }
1643
            }
Lines 1764-1770 AccessibilityObject* AccessibilityRender Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec6
1764
        return 0;
1764
        return 0;
1765
    HTMLLabelElement* label = labelForElement(static_cast<Element*>(element));
1765
    HTMLLabelElement* label = labelForElement(static_cast<Element*>(element));
1766
    if (label && label->renderer())
1766
    if (label && label->renderer())
1767
        return axObjectCache()->getOrCreate(label->renderer());
1767
        return axObjectCache()->getOrCreate(label);
1768
1768
1769
    return 0;   
1769
    return 0;   
1770
}
1770
}
Lines 2249-2255 bool AccessibilityRenderObject::isTabIte Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec7
2249
    unsigned count = elements.size();
2249
    unsigned count = elements.size();
2250
    for (unsigned k = 0; k < count; ++k) {
2250
    for (unsigned k = 0; k < count; ++k) {
2251
        Element* element = elements[k];
2251
        Element* element = elements[k];
2252
        AccessibilityObject* tabPanel = axObjectCache()->getOrCreate(element->renderer());
2252
        AccessibilityObject* tabPanel = axObjectCache()->getOrCreate(element);
2253
2253
2254
        // A tab item should only control tab panels.
2254
        // A tab item should only control tab panels.
2255
        if (!tabPanel || tabPanel->roleValue() != TabPanelRole)
2255
        if (!tabPanel || tabPanel->roleValue() != TabPanelRole)
Lines 2448-2454 AccessibilityObject* AccessibilityRender Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec8
2448
    if (!imageElement)
2448
    if (!imageElement)
2449
        return 0;
2449
        return 0;
2450
    
2450
    
2451
    return axObjectCache()->getOrCreate(imageElement->renderer());
2451
    return axObjectCache()->getOrCreate(imageElement);
2452
}
2452
}
2453
    
2453
    
2454
void AccessibilityRenderObject::getDocumentLinks(AccessibilityChildrenVector& result)
2454
void AccessibilityRenderObject::getDocumentLinks(AccessibilityChildrenVector& result)
Lines 2634-2645 Element* AccessibilityRenderObject::root Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec9
2634
    return rootEditableElement;
2634
    return rootEditableElement;
2635
}
2635
}
2636
2636
2637
bool AccessibilityRenderObject::nodeIsTextControl(const Node* node) const
2637
bool AccessibilityRenderObject::nodeIsTextControl(Node* node) const
2638
{
2638
{
2639
    if (!node)
2639
    if (!node)
2640
        return false;
2640
        return false;
2641
2641
2642
    const AccessibilityObject* axObjectForNode = axObjectCache()->getOrCreate(node->renderer());
2642
    const AccessibilityObject* axObjectForNode = axObjectCache()->getOrCreate(node);
2643
    if (!axObjectForNode)
2643
    if (!axObjectForNode)
2644
        return false;
2644
        return false;
2645
2645
Lines 2979-2985 AccessibilityObject* AccessibilityRender Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec10
2979
    if (!target)
2979
    if (!target)
2980
        return 0;
2980
        return 0;
2981
    
2981
    
2982
    AccessibilityObject* obj = axObjectCache()->getOrCreate(target->renderer());
2982
    AccessibilityObject* obj = axObjectCache()->getOrCreate(target);
2983
    if (obj && obj->isAccessibilityRenderObject())
2983
    if (obj && obj->isAccessibilityRenderObject())
2984
    // an activedescendant is only useful if it has a renderer, because that's what's needed to post the notification
2984
    // an activedescendant is only useful if it has a renderer, because that's what's needed to post the notification
2985
        return obj;
2985
        return obj;
Lines 3044-3050 AccessibilityObject* AccessibilityRender Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec11
3044
    if (!correspondingControl)
3044
    if (!correspondingControl)
3045
        return 0;
3045
        return 0;
3046
    
3046
    
3047
    return axObjectCache()->getOrCreate(correspondingControl->renderer());     
3047
    return axObjectCache()->getOrCreate(correspondingControl);     
3048
}
3048
}
3049
3049
3050
AccessibilityObject* AccessibilityRenderObject::correspondingLabelForControlElement() const
3050
AccessibilityObject* AccessibilityRenderObject::correspondingLabelForControlElement() const
Lines 3056-3062 AccessibilityObject* AccessibilityRender Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec12
3056
    if (node && node->isHTMLElement()) {
3056
    if (node && node->isHTMLElement()) {
3057
        HTMLLabelElement* label = labelForElement(static_cast<Element*>(node));
3057
        HTMLLabelElement* label = labelForElement(static_cast<Element*>(node));
3058
        if (label)
3058
        if (label)
3059
            return axObjectCache()->getOrCreate(label->renderer());
3059
            return axObjectCache()->getOrCreate(label);
3060
    }
3060
    }
3061
3061
3062
    return 0;
3062
    return 0;
- Source/WebCore/accessibility/AccessibilityRenderObject.h -1 / +1 lines
Lines 280-286 private: Source/WebCore/accessibility/AccessibilityRenderObject.h_sec1
280
    String positionalDescriptionForMSAA() const;
280
    String positionalDescriptionForMSAA() const;
281
    PlainTextRange ariaSelectedTextRange() const;
281
    PlainTextRange ariaSelectedTextRange() const;
282
    Element* rootEditableElementForPosition(const Position&) const;
282
    Element* rootEditableElementForPosition(const Position&) const;
283
    bool nodeIsTextControl(const Node*) const;
283
    bool nodeIsTextControl(Node*) const;
284
    virtual void setNeedsToUpdateChildren() { m_childrenDirty = true; }
284
    virtual void setNeedsToUpdateChildren() { m_childrenDirty = true; }
285
285
286
    Element* menuElementForMenuButton() const;
286
    Element* menuElementForMenuButton() const;
- Source/WebCore/accessibility/AccessibilityScrollView.cpp -3 / +3 lines
Lines 160-166 AccessibilityObject* AccessibilityScroll Source/WebCore/accessibility/AccessibilityScrollView.cpp_sec1
160
    if (!doc || !doc->renderer())
160
    if (!doc || !doc->renderer())
161
        return 0;
161
        return 0;
162
162
163
    return axObjectCache()->getOrCreate(doc->renderer());
163
    return axObjectCache()->getOrCreate(doc);
164
}
164
}
165
165
166
AccessibilityObject* AccessibilityScrollView::accessibilityHitTest(const IntPoint& point) const
166
AccessibilityObject* AccessibilityScrollView::accessibilityHitTest(const IntPoint& point) const
Lines 197-203 AccessibilityObject* AccessibilityScroll Source/WebCore/accessibility/AccessibilityScrollView.cpp_sec2
197
    
197
    
198
    HTMLFrameOwnerElement* owner = static_cast<FrameView*>(m_scrollView.get())->frame()->ownerElement();
198
    HTMLFrameOwnerElement* owner = static_cast<FrameView*>(m_scrollView.get())->frame()->ownerElement();
199
    if (owner && owner->renderer())
199
    if (owner && owner->renderer())
200
        return axObjectCache()->getOrCreate(owner->renderer());
200
        return axObjectCache()->getOrCreate(owner);
201
201
202
    return 0;
202
    return 0;
203
}
203
}
Lines 209-215 AccessibilityObject* AccessibilityScroll Source/WebCore/accessibility/AccessibilityScrollView.cpp_sec3
209
    
209
    
210
    HTMLFrameOwnerElement* owner = static_cast<FrameView*>(m_scrollView.get())->frame()->ownerElement();
210
    HTMLFrameOwnerElement* owner = static_cast<FrameView*>(m_scrollView.get())->frame()->ownerElement();
211
    if (owner && owner->renderer())
211
    if (owner && owner->renderer())
212
        return axObjectCache()->get(owner->renderer());
212
        return axObjectCache()->get(owner);
213
    
213
    
214
    return 0;
214
    return 0;
215
}
215
}
- Source/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp -4 / +4 lines
Lines 80-86 void AXObjectCache::postPlatformNotifica Source/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp_sec1
80
80
81
        // Calling handleFocusedUIElementChanged will focus the new active
81
        // Calling handleFocusedUIElementChanged will focus the new active
82
        // descendant and send the AXFocusedUIElementChanged notification.
82
        // descendant and send the AXFocusedUIElementChanged notification.
83
        handleFocusedUIElementChanged(0, obj->document()->focusedNode()->renderer());
83
        handleFocusedUIElementChanged(0, obj->document()->focusedNode());
84
        break;
84
        break;
85
    case AXAutocorrectionOccured:
85
    case AXAutocorrectionOccured:
86
    case AXCheckedStateChanged:
86
    case AXCheckedStateChanged:
Lines 113-124 void AXObjectCache::frameLoadingEventPla Source/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp_sec2
113
{
113
{
114
}
114
}
115
115
116
void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject* newFocusedRenderer)
116
void AXObjectCache::handleFocusedUIElementChanged(Node*, Node* newFocusedNode)
117
{
117
{
118
    if (!newFocusedRenderer)
118
    if (!newFocusedNode)
119
        return;
119
        return;
120
120
121
    Page* page = newFocusedRenderer->document()->page();
121
    Page* page = newFocusedNode->document()->page();
122
    if (!page)
122
    if (!page)
123
        return;
123
        return;
124
124
- Source/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp -3 / +3 lines
Lines 217-230 void AXObjectCache::frameLoadingEventPla Source/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp_sec1
217
    }
217
    }
218
}
218
}
219
219
220
void AXObjectCache::handleFocusedUIElementChanged(RenderObject* oldFocusedRender, RenderObject* newFocusedRender)
220
void AXObjectCache::handleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFocusedNode)
221
{
221
{
222
    RefPtr<AccessibilityObject> oldObject = getOrCreate(oldFocusedRender);
222
    RefPtr<AccessibilityObject> oldObject = getOrCreate(oldFocusedNode);
223
    if (oldObject) {
223
    if (oldObject) {
224
        g_signal_emit_by_name(oldObject->wrapper(), "focus-event", false);
224
        g_signal_emit_by_name(oldObject->wrapper(), "focus-event", false);
225
        g_signal_emit_by_name(oldObject->wrapper(), "state-change", "focused", false);
225
        g_signal_emit_by_name(oldObject->wrapper(), "state-change", "focused", false);
226
    }
226
    }
227
    RefPtr<AccessibilityObject> newObject = getOrCreate(newFocusedRender);
227
    RefPtr<AccessibilityObject> newObject = getOrCreate(newFocusedNode);
228
    if (newObject) {
228
    if (newObject) {
229
        g_signal_emit_by_name(newObject->wrapper(), "focus-event", true);
229
        g_signal_emit_by_name(newObject->wrapper(), "focus-event", true);
230
        g_signal_emit_by_name(newObject->wrapper(), "state-change", "focused", true);
230
        g_signal_emit_by_name(newObject->wrapper(), "state-change", "focused", true);
- Source/WebCore/accessibility/mac/AXObjectCacheMac.mm -1 / +1 lines
Lines 139-145 void AXObjectCache::frameLoadingEventPla Source/WebCore/accessibility/mac/AXObjectCacheMac.mm_sec1
139
{
139
{
140
}
140
}
141
141
142
void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject*)
142
void AXObjectCache::handleFocusedUIElementChanged(Node*, Node*)
143
{
143
{
144
    wkAccessibilityHandleFocusChanged();
144
    wkAccessibilityHandleFocusChanged();
145
}
145
}
- Source/WebCore/accessibility/win/AXObjectCacheWin.cpp -3 / +3 lines
Lines 134-145 AXID AXObjectCache::platformGenerateAXID Source/WebCore/accessibility/win/AXObjectCacheWin.cpp_sec1
134
    return objID;
134
    return objID;
135
}
135
}
136
136
137
void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject* newFocusedRenderer)
137
void AXObjectCache::handleFocusedUIElementChanged(Node*, Node* newFocusedNode)
138
{
138
{
139
    if (!newFocusedRenderer)
139
    if (!newFocusedNode)
140
        return;
140
        return;
141
141
142
    Page* page = newFocusedRenderer->document()->page();
142
    Page* page = newFocusedNode->document()->page();
143
    if (!page || !page->chrome()->platformPageClient())
143
    if (!page || !page->chrome()->platformPageClient())
144
        return;
144
        return;
145
145
- Source/WebCore/bindings/cpp/WebDOMCustomVoidCallback.cpp -1 / +1 lines
Lines 45-48 void WebDOMCustomVoidCallback::handleEve Source/WebCore/bindings/cpp/WebDOMCustomVoidCallback.cpp_sec1
45
WebCore::VoidCallback* toWebCore(const WebDOMCustomVoidCallback& callback)
45
WebCore::VoidCallback* toWebCore(const WebDOMCustomVoidCallback& callback)
46
{
46
{
47
    return const_cast<WebCore::VoidCallback*>((WebCore::VoidCallback*)&callback);
47
    return const_cast<WebCore::VoidCallback*>((WebCore::VoidCallback*)&callback);
48
}
48
}
- Source/WebCore/dom/Document.cpp -11 / +2 lines
Lines 3842-3858 bool Document::setFocusedNode(PassRefPtr Source/WebCore/dom/Document.cpp_sec1
3842
    }
3842
    }
3843
3843
3844
#if PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM)
3844
#if PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM)
3845
    if (!focusChangeBlocked && m_focusedNode && AXObjectCache::accessibilityEnabled()) {
3845
    if (!focusChangeBlocked && m_focusedNode && AXObjectCache::accessibilityEnabled())
3846
        RenderObject* oldFocusedRenderer = 0;
3846
        axObjectCache()->handleFocusedUIElementChanged(oldFocusedNode.get(), newFocusedNode.get());
3847
        RenderObject* newFocusedRenderer = 0;
3848
3849
        if (oldFocusedNode)
3850
            oldFocusedRenderer = oldFocusedNode->renderer();
3851
        if (newFocusedNode)
3852
            newFocusedRenderer = newFocusedNode->renderer();
3853
3854
        axObjectCache()->handleFocusedUIElementChanged(oldFocusedRenderer, newFocusedRenderer);
3855
    }
3856
#endif
3847
#endif
3857
    if (!focusChangeBlocked)
3848
    if (!focusChangeBlocked)
3858
        page()->chrome()->focusedNodeChanged(m_focusedNode.get());
3849
        page()->chrome()->focusedNodeChanged(m_focusedNode.get());
- Source/WebCore/dom/Element.cpp -9 / +9 lines
Lines 713-738 void Element::attributeChanged(const Att Source/WebCore/dom/Element.cpp_sec1
713
    const QualifiedName& attrName = attribute.name();
713
    const QualifiedName& attrName = attribute.name();
714
    if (attrName == aria_activedescendantAttr) {
714
    if (attrName == aria_activedescendantAttr) {
715
        // any change to aria-activedescendant attribute triggers accessibility focus change, but document focus remains intact
715
        // any change to aria-activedescendant attribute triggers accessibility focus change, but document focus remains intact
716
        document()->axObjectCache()->handleActiveDescendantChanged(renderer());
716
        document()->axObjectCache()->handleActiveDescendantChanged(this);
717
    } else if (attrName == roleAttr) {
717
    } else if (attrName == roleAttr) {
718
        // the role attribute can change at any time, and the AccessibilityObject must pick up these changes
718
        // the role attribute can change at any time, and the AccessibilityObject must pick up these changes
719
        document()->axObjectCache()->handleAriaRoleChanged(renderer());
719
        document()->axObjectCache()->handleAriaRoleChanged(this);
720
    } else if (attrName == aria_valuenowAttr) {
720
    } else if (attrName == aria_valuenowAttr) {
721
        // If the valuenow attribute changes, AX clients need to be notified.
721
        // If the valuenow attribute changes, AX clients need to be notified.
722
        document()->axObjectCache()->postNotification(renderer(), AXObjectCache::AXValueChanged, true);
722
        document()->axObjectCache()->postNotification(this, AXObjectCache::AXValueChanged, true);
723
    } else if (attrName == aria_labelAttr || attrName == aria_labeledbyAttr || attrName == altAttr || attrName == titleAttr) {
723
    } else if (attrName == aria_labelAttr || attrName == aria_labeledbyAttr || attrName == altAttr || attrName == titleAttr) {
724
        // If the content of an element changes due to an attribute change, notify accessibility.
724
        // If the content of an element changes due to an attribute change, notify accessibility.
725
        document()->axObjectCache()->contentChanged(renderer());
725
        document()->axObjectCache()->contentChanged(this);
726
    } else if (attrName == aria_checkedAttr)
726
    } else if (attrName == aria_checkedAttr)
727
        document()->axObjectCache()->checkedStateChanged(renderer());
727
        document()->axObjectCache()->checkedStateChanged(this);
728
    else if (attrName == aria_selectedAttr)
728
    else if (attrName == aria_selectedAttr)
729
        document()->axObjectCache()->selectedChildrenChanged(renderer());
729
        document()->axObjectCache()->selectedChildrenChanged(this);
730
    else if (attrName == aria_expandedAttr)
730
    else if (attrName == aria_expandedAttr)
731
        document()->axObjectCache()->handleAriaExpandedChange(renderer());
731
        document()->axObjectCache()->handleAriaExpandedChange(this);
732
    else if (attrName == aria_hiddenAttr)
732
    else if (attrName == aria_hiddenAttr)
733
        document()->axObjectCache()->childrenChanged(renderer());
733
        document()->axObjectCache()->childrenChanged(this);
734
    else if (attrName == aria_invalidAttr)
734
    else if (attrName == aria_invalidAttr)
735
        document()->axObjectCache()->postNotification(renderer(), AXObjectCache::AXInvalidStatusChanged, true);
735
        document()->axObjectCache()->postNotification(this, AXObjectCache::AXInvalidStatusChanged, true);
736
}
736
}
737
737
738
// Returns true is the given attribute is an event handler.
738
// Returns true is the given attribute is an event handler.
- Source/WebCore/dom/Node.cpp -2 / +5 lines
Lines 408-414 Node::~Node() Source/WebCore/dom/Node.cpp_sec1
408
408
409
    Document* doc = m_document;
409
    Document* doc = m_document;
410
    if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists())
410
    if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists())
411
        doc->axObjectCache()->removeNodeForUse(this);
411
        doc->axObjectCache()->remove(this);
412
    
412
    
413
    if (m_previous)
413
    if (m_previous)
414
        m_previous->setNextSibling(0);
414
        m_previous->setNextSibling(0);
Lines 1295-1305 void Node::detach() Source/WebCore/dom/Node.cpp_sec2
1295
    detachingNode = this;
1295
    detachingNode = this;
1296
#endif
1296
#endif
1297
1297
1298
    Document* doc = document();
1299
    if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists())
1300
        doc->axObjectCache()->remove(this);
1301
1298
    if (renderer())
1302
    if (renderer())
1299
        renderer()->destroyAndCleanupAnonymousWrappers();
1303
        renderer()->destroyAndCleanupAnonymousWrappers();
1300
    setRenderer(0);
1304
    setRenderer(0);
1301
1305
1302
    Document* doc = document();
1303
    if (hovered())
1306
    if (hovered())
1304
        doc->hoveredNodeDetached(this);
1307
        doc->hoveredNodeDetached(this);
1305
    if (inActiveChain())
1308
    if (inActiveChain())
- Source/WebCore/editing/AppendNodeCommand.cpp -1 / +1 lines
Lines 51-57 static void sendAXTextChangedIgnoringLin Source/WebCore/editing/AppendNodeCommand.cpp_sec1
51
    if (nodeValue == "\n")
51
    if (nodeValue == "\n")
52
      return;
52
      return;
53
53
54
    node->document()->axObjectCache()->nodeTextChangeNotification(node->renderer(), textChange, 0, nodeValue);
54
    node->document()->axObjectCache()->nodeTextChangeNotification(node, textChange, 0, nodeValue);
55
}
55
}
56
56
57
void AppendNodeCommand::doApply()
57
void AppendNodeCommand::doApply()
- Source/WebCore/editing/DeleteFromTextNodeCommand.cpp -2 / +2 lines
Lines 57-63 void DeleteFromTextNodeCommand::doApply( Source/WebCore/editing/DeleteFromTextNodeCommand.cpp_sec1
57
    
57
    
58
    // Need to notify this before actually deleting the text
58
    // Need to notify this before actually deleting the text
59
    if (AXObjectCache::accessibilityEnabled())
59
    if (AXObjectCache::accessibilityEnabled())
60
        document()->axObjectCache()->nodeTextChangeNotification(m_node->renderer(), AXObjectCache::AXTextDeleted, m_offset, m_text);
60
        document()->axObjectCache()->nodeTextChangeNotification(m_node.get(), AXObjectCache::AXTextDeleted, m_offset, m_text);
61
61
62
    m_node->deleteData(m_offset, m_count, ec);
62
    m_node->deleteData(m_offset, m_count, ec);
63
}
63
}
Lines 73-79 void DeleteFromTextNodeCommand::doUnappl Source/WebCore/editing/DeleteFromTextNodeCommand.cpp_sec2
73
    m_node->insertData(m_offset, m_text, ec);
73
    m_node->insertData(m_offset, m_text, ec);
74
74
75
    if (AXObjectCache::accessibilityEnabled())
75
    if (AXObjectCache::accessibilityEnabled())
76
        document()->axObjectCache()->nodeTextChangeNotification(m_node->renderer(), AXObjectCache::AXTextInserted, m_offset, m_text);
76
        document()->axObjectCache()->nodeTextChangeNotification(m_node.get(), AXObjectCache::AXTextInserted, m_offset, m_text);
77
}
77
}
78
78
79
#ifndef NDEBUG
79
#ifndef NDEBUG
- Source/WebCore/editing/Editor.cpp -2 / +2 lines
Lines 494-500 void Editor::respondToChangedContents(co Source/WebCore/editing/Editor.cpp_sec1
494
    if (AXObjectCache::accessibilityEnabled()) {
494
    if (AXObjectCache::accessibilityEnabled()) {
495
        Node* node = endingSelection.start().deprecatedNode();
495
        Node* node = endingSelection.start().deprecatedNode();
496
        if (node)
496
        if (node)
497
            m_frame->document()->axObjectCache()->postNotification(node->renderer(), AXObjectCache::AXValueChanged, false);
497
            m_frame->document()->axObjectCache()->postNotification(node, AXObjectCache::AXValueChanged, false);
498
    }
498
    }
499
499
500
    updateMarkersForWordsAffectedByEditing(true);
500
    updateMarkersForWordsAffectedByEditing(true);
Lines 2128-2134 void Editor::markAndReplaceFor(PassRefPt Source/WebCore/editing/Editor.cpp_sec2
2128
                
2128
                
2129
                if (AXObjectCache::accessibilityEnabled()) {
2129
                if (AXObjectCache::accessibilityEnabled()) {
2130
                    if (Element* root = m_frame->selection()->selection().rootEditableElement())
2130
                    if (Element* root = m_frame->selection()->selection().rootEditableElement())
2131
                        m_frame->document()->axObjectCache()->postNotification(root->renderer(), AXObjectCache::AXAutocorrectionOccured, true);
2131
                        m_frame->document()->axObjectCache()->postNotification(root, AXObjectCache::AXAutocorrectionOccured, true);
2132
                }
2132
                }
2133
2133
2134
                selectionChanged = true;
2134
                selectionChanged = true;
- Source/WebCore/editing/InsertIntoTextNodeCommand.cpp -2 / +2 lines
Lines 60-66 void InsertIntoTextNodeCommand::doApply( Source/WebCore/editing/InsertIntoTextNodeCommand.cpp_sec1
60
    m_node->insertData(m_offset, m_text, ec);
60
    m_node->insertData(m_offset, m_text, ec);
61
61
62
    if (AXObjectCache::accessibilityEnabled())
62
    if (AXObjectCache::accessibilityEnabled())
63
        document()->axObjectCache()->nodeTextChangeNotification(m_node->renderer(), AXObjectCache::AXTextInserted, m_offset, m_text);
63
        document()->axObjectCache()->nodeTextChangeNotification(m_node.get(), AXObjectCache::AXTextInserted, m_offset, m_text);
64
}
64
}
65
65
66
void InsertIntoTextNodeCommand::doUnapply()
66
void InsertIntoTextNodeCommand::doUnapply()
Lines 70-76 void InsertIntoTextNodeCommand::doUnappl Source/WebCore/editing/InsertIntoTextNodeCommand.cpp_sec2
70
        
70
        
71
    // Need to notify this before actually deleting the text
71
    // Need to notify this before actually deleting the text
72
    if (AXObjectCache::accessibilityEnabled())
72
    if (AXObjectCache::accessibilityEnabled())
73
        document()->axObjectCache()->nodeTextChangeNotification(m_node->renderer(), AXObjectCache::AXTextDeleted, m_offset, m_text);
73
        document()->axObjectCache()->nodeTextChangeNotification(m_node.get(), AXObjectCache::AXTextDeleted, m_offset, m_text);
74
74
75
    ExceptionCode ec;
75
    ExceptionCode ec;
76
    m_node->deleteData(m_offset, m_text.length(), ec);
76
    m_node->deleteData(m_offset, m_text.length(), ec);
- Source/WebCore/editing/InsertNodeBeforeCommand.cpp -2 / +2 lines
Lines 55-61 void InsertNodeBeforeCommand::doApply() Source/WebCore/editing/InsertNodeBeforeCommand.cpp_sec1
55
    parent->insertBefore(m_insertChild.get(), m_refChild.get(), ec);
55
    parent->insertBefore(m_insertChild.get(), m_refChild.get(), ec);
56
56
57
    if (AXObjectCache::accessibilityEnabled())
57
    if (AXObjectCache::accessibilityEnabled())
58
        document()->axObjectCache()->nodeTextChangeNotification(m_insertChild->renderer(), AXObjectCache::AXTextInserted, 0, m_insertChild->nodeValue());
58
        document()->axObjectCache()->nodeTextChangeNotification(m_insertChild.get(), AXObjectCache::AXTextInserted, 0, m_insertChild->nodeValue());
59
}
59
}
60
60
61
void InsertNodeBeforeCommand::doUnapply()
61
void InsertNodeBeforeCommand::doUnapply()
Lines 65-71 void InsertNodeBeforeCommand::doUnapply( Source/WebCore/editing/InsertNodeBeforeCommand.cpp_sec2
65
        
65
        
66
    // Need to notify this before actually deleting the text
66
    // Need to notify this before actually deleting the text
67
    if (AXObjectCache::accessibilityEnabled())
67
    if (AXObjectCache::accessibilityEnabled())
68
        document()->axObjectCache()->nodeTextChangeNotification(m_insertChild->renderer(), AXObjectCache::AXTextDeleted, 0, m_insertChild->nodeValue());
68
        document()->axObjectCache()->nodeTextChangeNotification(m_insertChild.get(), AXObjectCache::AXTextDeleted, 0, m_insertChild->nodeValue());
69
69
70
    ExceptionCode ec;
70
    ExceptionCode ec;
71
    m_insertChild->remove(ec);
71
    m_insertChild->remove(ec);
- Source/WebCore/editing/chromium/FrameSelectionChromium.cpp -1 / +1 lines
Lines 42-48 void FrameSelection::notifyAccessibility Source/WebCore/editing/chromium/FrameSelectionChromium.cpp_sec1
42
    // FIXME: Support editable text in chromium.
42
    // FIXME: Support editable text in chromium.
43
    if (AXObjectCache::accessibilityEnabled() && m_selection.start().isNotNull() && m_selection.end().isNotNull()) {
43
    if (AXObjectCache::accessibilityEnabled() && m_selection.start().isNotNull() && m_selection.end().isNotNull()) {
44
        Document* document = m_frame->document();
44
        Document* document = m_frame->document();
45
        document->axObjectCache()->postNotification(m_selection.start().deprecatedNode()->renderer(), AXObjectCache::AXSelectedTextChanged, false);
45
        document->axObjectCache()->postNotification(m_selection.start().deprecatedNode(), AXObjectCache::AXSelectedTextChanged, false);
46
    }
46
    }
47
}
47
}
48
48
- Source/WebCore/html/HTMLInputElement.cpp -1 / +1 lines
Lines 853-859 void HTMLInputElement::setChecked(bool n Source/WebCore/html/HTMLInputElement.cpp_sec1
853
    // RenderTextView), but it's not possible to do it at the moment
853
    // RenderTextView), but it's not possible to do it at the moment
854
    // because of the way the code is structured.
854
    // because of the way the code is structured.
855
    if (renderer() && AXObjectCache::accessibilityEnabled())
855
    if (renderer() && AXObjectCache::accessibilityEnabled())
856
        renderer()->document()->axObjectCache()->checkedStateChanged(renderer());
856
        renderer()->document()->axObjectCache()->checkedStateChanged(this);
857
857
858
    // Only send a change event for items in the document (avoid firing during
858
    // Only send a change event for items in the document (avoid firing during
859
    // parsing) and don't send a change event for a radio button that's getting
859
    // parsing) and don't send a change event for a radio button that's getting
- Source/WebCore/html/HTMLSelectElement.cpp -2 / +2 lines
Lines 378-384 void HTMLSelectElement::childrenChanged( Source/WebCore/html/HTMLSelectElement.cpp_sec1
378
    HTMLFormControlElementWithState::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
378
    HTMLFormControlElementWithState::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
379
    
379
    
380
    if (AXObjectCache::accessibilityEnabled() && renderer())
380
    if (AXObjectCache::accessibilityEnabled() && renderer())
381
        renderer()->document()->axObjectCache()->childrenChanged(renderer());
381
        renderer()->document()->axObjectCache()->childrenChanged(this);
382
}
382
}
383
383
384
void HTMLSelectElement::optionElementChildrenChanged()
384
void HTMLSelectElement::optionElementChildrenChanged()
Lines 387-393 void HTMLSelectElement::optionElementChi Source/WebCore/html/HTMLSelectElement.cpp_sec2
387
    setNeedsValidityCheck();
387
    setNeedsValidityCheck();
388
388
389
    if (AXObjectCache::accessibilityEnabled() && renderer())
389
    if (AXObjectCache::accessibilityEnabled() && renderer())
390
        renderer()->document()->axObjectCache()->childrenChanged(renderer());
390
        renderer()->document()->axObjectCache()->childrenChanged(this);
391
}
391
}
392
392
393
void HTMLSelectElement::accessKeyAction(bool sendMouseEvents)
393
void HTMLSelectElement::accessKeyAction(bool sendMouseEvents)
- Source/WebCore/html/HTMLTextFormControlElement.cpp -1 / +1 lines
Lines 484-490 void HTMLTextFormControlElement::setInne Source/WebCore/html/HTMLTextFormControlElement.cpp_sec1
484
    bool textIsChanged = value != innerTextValue();
484
    bool textIsChanged = value != innerTextValue();
485
    if (textIsChanged || !innerTextElement()->hasChildNodes()) {
485
    if (textIsChanged || !innerTextElement()->hasChildNodes()) {
486
        if (textIsChanged && document() && renderer() && AXObjectCache::accessibilityEnabled())
486
        if (textIsChanged && document() && renderer() && AXObjectCache::accessibilityEnabled())
487
            document()->axObjectCache()->postNotification(renderer(), AXObjectCache::AXValueChanged, false);
487
            document()->axObjectCache()->postNotification(this, AXObjectCache::AXValueChanged, false);
488
488
489
        ExceptionCode ec = 0;
489
        ExceptionCode ec = 0;
490
        innerTextElement()->setInnerText(value, ec);
490
        innerTextElement()->setInnerText(value, ec);
- Source/WebCore/html/InputType.cpp -1 / +1 lines
Lines 957-963 void InputType::applyStep(int count, Any Source/WebCore/html/InputType.cpp_sec1
957
    setValueAsDecimal(newValue, eventBehavior, ec);
957
    setValueAsDecimal(newValue, eventBehavior, ec);
958
958
959
    if (AXObjectCache::accessibilityEnabled())
959
    if (AXObjectCache::accessibilityEnabled())
960
         element()->document()->axObjectCache()->postNotification(element()->renderer(), AXObjectCache::AXValueChanged, true);
960
         element()->document()->axObjectCache()->postNotification(element(), AXObjectCache::AXValueChanged, true);
961
}
961
}
962
962
963
bool InputType::getAllowedValueStep(Decimal* step) const
963
bool InputType::getAllowedValueStep(Decimal* step) const
- Source/WebCore/html/RangeInputType.cpp -1 / +1 lines
Lines 225-231 void RangeInputType::handleKeydownEvent( Source/WebCore/html/RangeInputType.cpp_sec1
225
        setValueAsDecimal(newValue, eventBehavior, ec);
225
        setValueAsDecimal(newValue, eventBehavior, ec);
226
226
227
        if (AXObjectCache::accessibilityEnabled())
227
        if (AXObjectCache::accessibilityEnabled())
228
            element()->document()->axObjectCache()->postNotification(element()->renderer(), AXObjectCache::AXValueChanged, true);
228
            element()->document()->axObjectCache()->postNotification(element(), AXObjectCache::AXValueChanged, true);
229
        element()->dispatchFormControlChangeEvent();
229
        element()->dispatchFormControlChangeEvent();
230
    }
230
    }
231
231
- Source/WebCore/page/FocusController.cpp -1 / +1 lines
Lines 285-291 bool FocusController::setInitialFocus(Fo Source/WebCore/page/FocusController.cpp_sec1
285
    // into the web area again, even if focus did not change within WebCore. PostNotification is called instead
285
    // into the web area again, even if focus did not change within WebCore. PostNotification is called instead
286
    // of handleFocusedUIElementChanged, because this will send the notification even if the element is the same.
286
    // of handleFocusedUIElementChanged, because this will send the notification even if the element is the same.
287
    if (AXObjectCache::accessibilityEnabled())
287
    if (AXObjectCache::accessibilityEnabled())
288
        focusedOrMainFrame()->document()->axObjectCache()->postNotification(focusedOrMainFrame()->document()->renderer(), AXObjectCache::AXFocusedUIElementChanged, true);
288
        focusedOrMainFrame()->document()->axObjectCache()->postNotification(focusedOrMainFrame()->document(), AXObjectCache::AXFocusedUIElementChanged, true);
289
289
290
    return didAdvanceFocus;
290
    return didAdvanceFocus;
291
}
291
}
- LayoutTests/ChangeLog +25 lines
Lines 1-3 LayoutTests/ChangeLog_sec1
1
2012-07-26  Dominic Mazzoni  <dmazzoni@google.com>
2
3
        AX: Calls to AXObjectCache should prefer Node over Renderer
4
        https://bugs.webkit.org/show_bug.cgi?id=91794
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        New tests:
9
        - canvas-fallback-content tests that objects in a canvas subtree can be
10
          focused and then you can retrieve the role of the accessible object.
11
        - accessibility-node-memory-management ensures that an AccessibilityNodeObject
12
          is detached when its node is destroyed.
13
        - accessibility-node-reparent ensures that if an AccessibilityNodeObject is
14
          created for a node without a renderer, but the node later gets a renderer,
15
          the AccessibilityNodeObject is detached and an AccessibilityRenderObject is
16
          created instead.
17
18
        * accessibility/accessibility-node-memory-management-expected.txt: Added.
19
        * accessibility/accessibility-node-memory-management.html: Added.
20
        * accessibility/accessibility-node-reparent-expected.txt: Added.
21
        * accessibility/accessibility-node-reparent.html: Added.
22
        * accessibility/canvas-fallback-content-expected.txt: Added.
23
        * accessibility/canvas-fallback-content.html: Added.
24
        * platform/gtk/TestExpectations:
25
1
2012-07-25  MORITA Hajime  <morrita@google.com>
26
2012-07-25  MORITA Hajime  <morrita@google.com>
2
27
3
        [Chromium][Win] <progress> animation on RTL direction is reverse
28
        [Chromium][Win] <progress> animation on RTL direction is reverse
- LayoutTests/accessibility/accessibility-node-memory-management-expected.txt +12 lines
Line 0 LayoutTests/accessibility/accessibility-node-memory-management-expected.txt_sec1
1
This test makes sure that AccessibilityNodeObjects are properly detached when the node they point to is deleted.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS expectedButtonRole != expectedDetachedRole is true
7
PASS canvasButtonRole is expectedButtonRole
8
PASS detachedCanvasButtonRole is expectedDetachedRole
9
PASS successfullyParsed is true
10
11
TEST COMPLETE
12
0
  + LF
13
  + LF
- LayoutTests/accessibility/accessibility-node-memory-management.html +60 lines
Line 0 LayoutTests/accessibility/accessibility-node-memory-management.html_sec1
1
<!DOCTYPE HTML>
2
<html>
3
<body>
4
<script src="../fast/js/resources/js-test-pre.js"></script>
5
6
<canvas id="canvas" tabindex="-1"></canvas>
7
8
<div id="console"></div>
9
<script>
10
description("This test makes sure that AccessibilityNodeObjects are properly detached when the node they point to is deleted.");
11
12
if (window.layoutTestController && window.accessibilityController) {
13
    window.layoutTestController.dumpAsText();
14
15
    // Create an ordinary button on the page, focus it and get its accessibility role.
16
    var button = document.createElement('button');
17
    document.body.appendChild(button);
18
    button.focus();
19
    window.axElement = accessibilityController.focusedElement;
20
    window.expectedButtonRole = axElement.role;
21
22
    // Now remove the node from the tree and get the role of the detached accessibility object.
23
    document.body.removeChild(button);
24
    window.expectedDetachedRole = axElement.role;
25
    shouldBeTrue("expectedButtonRole != expectedDetachedRole");
26
27
    // This time create a button that's a child of a canvas element. It will be focusable but not rendered.
28
    // In particular, this will create an AccessibilityNodeObject rather than an AccessibilityRenderObject.
29
    var canvas = document.getElementById('canvas');
30
    (function() {
31
        var button = document.createElement('button');
32
        canvas.appendChild(button);
33
34
        // Note: focusing the button and using that to get its accessibility object creates an extra
35
        // reference to the button and it won't get deleted when we want it to. So instead we focus the
36
        // canvas and get its first child.
37
        canvas.focus();
38
        window.axElement = accessibilityController.focusedElement.childAtIndex(0);
39
40
        window.canvasButtonRole = axElement.role;
41
        shouldBe("canvasButtonRole", "expectedButtonRole");
42
43
        // Now delete the node.
44
        canvas.removeChild(button);
45
    })();
46
47
    // Explicitly run garbage collection now; since there are no more references to the button,
48
    // the node will be destroyed.
49
    gc();
50
51
    // Ensure that the accessibility object is detached by checking its role.
52
    window.detachedCanvasButtonRole = axElement.role;
53
    shouldBe("detachedCanvasButtonRole", "expectedDetachedRole");
54
}
55
56
</script>
57
58
<script src="../fast/js/resources/js-test-post.js"></script>
59
</body>
60
</html>
0
  + text/html
61
  + text/html
1
  + LF
62
  + LF
- LayoutTests/accessibility/accessibility-node-reparent-expected.txt +14 lines
Line 0 LayoutTests/accessibility/accessibility-node-reparent-expected.txt_sec1
1
2
This test makes sure that AccessibilityNodeObjects are properly detached when the node they point to is reparented to a location that allows them to have a renderer.
3
4
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
5
6
7
PASS expectedButtonRole != expectedDetachedRole is true
8
PASS canvasButtonRole is expectedButtonRole
9
PASS detachedCanvasButtonRole is expectedDetachedRole
10
PASS reparentedButtonRole is expectedButtonRole
11
PASS successfullyParsed is true
12
13
TEST COMPLETE
14
0
  + LF
15
  + LF
- LayoutTests/accessibility/accessibility-node-reparent.html +65 lines
Line 0 LayoutTests/accessibility/accessibility-node-reparent.html_sec1
1
<!DOCTYPE HTML>
2
<html>
3
<body>
4
<script src="../fast/js/resources/js-test-pre.js"></script>
5
6
<div id="container" tabindex="-1"></div>
7
8
<canvas id="canvas" tabindex="-1"></canvas>
9
10
<div id="console"></div>
11
<script>
12
description("This test makes sure that AccessibilityNodeObjects are properly detached when the node they point to is reparented to a location that allows them to have a renderer.");
13
14
if (window.layoutTestController && window.accessibilityController) {
15
    window.layoutTestController.dumpAsText();
16
17
    // Create an ordinary button on the page, focus it and get its accessibility role.
18
    var button = document.createElement('button');
19
    document.body.appendChild(button);
20
    button.focus();
21
    window.axElement = accessibilityController.focusedElement;
22
    window.expectedButtonRole = axElement.role;
23
24
    // Now remove the node from the tree and get the role of the detached accessibility object.
25
    document.body.removeChild(button);
26
    window.expectedDetachedRole = axElement.role;
27
    shouldBeTrue("expectedButtonRole != expectedDetachedRole");
28
29
    // This time create a button that's a child of a canvas element. It will be focusable but not rendered.
30
    // In particular, this will create an AccessibilityNodeObject rather than an AccessibilityRenderObject.
31
    var canvas = document.getElementById('canvas');
32
    (function() {
33
        var button = document.createElement('button');
34
        canvas.appendChild(button);
35
36
        // Note: focusing the button and using that to get its accessibility object creates an extra
37
        // reference to the button and it won't get deleted when we want it to. So instead we focus the
38
        // canvas and get its first child.
39
        canvas.focus();
40
        window.axElement = accessibilityController.focusedElement.childAtIndex(0);
41
42
        window.canvasButtonRole = axElement.role;
43
        shouldBe("canvasButtonRole", "expectedButtonRole");
44
45
        // Now reparent the node to a container that's not a canvas.
46
        var container = document.getElementById('container');
47
        container.appendChild(button);
48
        container.focus();
49
        window.axReparentedElement = accessibilityController.focusedElement.childAtIndex(0);
50
    })();
51
52
    // Ensure that the old accessibility object is detached by checking its role.
53
    window.detachedCanvasButtonRole = axElement.role;
54
    shouldBe("detachedCanvasButtonRole", "expectedDetachedRole");
55
56
    // Ensure that the new accessibility object for the now-reparented node has the correct role.
57
    window.reparentedButtonRole = axReparentedElement.role;
58
    shouldBe("reparentedButtonRole", "expectedButtonRole");
59
}
60
61
</script>
62
63
<script src="../fast/js/resources/js-test-post.js"></script>
64
</body>
65
</html>
0
  + text/html
66
  + text/html
1
  + LF
67
  + LF
- LayoutTests/accessibility/canvas-fallback-content-expected.txt +101 lines
Line 0 LayoutTests/accessibility/canvas-fallback-content-expected.txt_sec1
1
Link  Button          
2
Focusable
3
ARIA button
4
ARIA link
5
This test makes sure that focusable elements in canvas fallback content are accessible.
6
7
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
8
9
10
link1
11
PASS document.activeElement == element is true
12
PASS axElement.role is "AXRole: AXLink"
13
14
button1
15
PASS document.activeElement == element is true
16
PASS axElement.role is "AXRole: AXButton"
17
18
text1
19
PASS document.activeElement == element is true
20
PASS axElement.role is "AXRole: AXTextField"
21
22
checkbox1
23
PASS document.activeElement == element is true
24
PASS axElement.role is "AXRole: AXCheckBox"
25
26
radio1
27
PASS document.activeElement == element is true
28
PASS axElement.role is "AXRole: AXRadioButton"
29
30
submit1
31
PASS document.activeElement == element is true
32
PASS axElement.role is "AXRole: AXButton"
33
34
combobox1
35
PASS document.activeElement == element is true
36
PASS axElement.role is "AXRole: AXPopUpButton"
37
38
focusable1
39
PASS document.activeElement == element is true
40
PASS axElement.role is "AXRole: AXGroup"
41
42
aria-button1
43
PASS document.activeElement == element is true
44
PASS axElement.role is "AXRole: AXButton"
45
46
aria-link1
47
PASS document.activeElement == element is true
48
PASS axElement.role is "AXRole: AXLink"
49
50
link2
51
PASS document.activeElement == element is true
52
PASS axElement.role is "AXRole: AXLink"
53
54
button2
55
PASS document.activeElement == element is true
56
PASS axElement.role is "AXRole: AXButton"
57
58
text2
59
PASS document.activeElement == element is true
60
PASS axElement.role is "AXRole: AXTextField"
61
62
checkbox2
63
PASS document.activeElement == element is true
64
PASS axElement.role is "AXRole: AXCheckBox"
65
66
radio2
67
PASS document.activeElement == element is true
68
PASS axElement.role is "AXRole: AXRadioButton"
69
70
submit2
71
PASS document.activeElement == element is true
72
PASS axElement.role is "AXRole: AXButton"
73
74
combobox2
75
PASS document.activeElement == element is true
76
PASS axElement.role is "AXRole: AXPopUpButton"
77
78
focusable2
79
PASS document.activeElement == element is true
80
PASS axElement.role is "AXRole: AXGroup"
81
82
aria-button2
83
PASS document.activeElement == element is true
84
PASS axElement.role is "AXRole: AXButton"
85
86
aria-link2
87
PASS document.activeElement == element is true
88
PASS axElement.role is "AXRole: AXLink"
89
90
focusable1
91
PASS document.activeElement == element is true
92
PASS axElement.role is "AXRole: AXButton"
93
94
focusable2
95
PASS document.activeElement == element is true
96
PASS axElement.role is "AXRole: AXButton"
97
98
PASS successfullyParsed is true
99
100
TEST COMPLETE
101
0
  + LF
102
  + LF
- LayoutTests/accessibility/canvas-fallback-content.html +84 lines
Line 0 LayoutTests/accessibility/canvas-fallback-content.html_sec1
1
<!DOCTYPE HTML>
2
<html>
3
<body>
4
<script src="../fast/js/resources/js-test-pre.js"></script>
5
6
<div>
7
  <a id="link1" href="#">Link</a>
8
  <button id="button1">Button</button>
9
  <input id="text1" type="text">
10
  <input id="checkbox1" type="checkbox">
11
  <input id="radio1" type="radio">
12
  <input id="submit1" type="submit">
13
  <select id="combobox1"><option>1<option>2</select>
14
  <div id="focusable1" tabindex="0">Focusable</div>
15
  <div id="aria-button1" tabindex="0" role="button">ARIA button</div>
16
  <div id="aria-link1" tabindex="0" role="link">ARIA link</div>
17
</div>
18
19
<canvas id="myCanvas" width="300" height="300">
20
  <a id="link2" href="#">Link</a>
21
  <button id="button2">Button</button>
22
  <input id="text2" type="text">
23
  <input id="checkbox2" type="checkbox">
24
  <input id="radio2" type="radio">
25
  <input id="submit2" type="submit">
26
  <select id="combobox2"><option>1<option>2</select>
27
  <div id="focusable2" tabindex="0">Focusable</div>
28
  <div id="aria-button2" tabindex="0" role="button">ARIA button</div>
29
  <div id="aria-link2" tabindex="0" role="link">ARIA link</div>
30
</canvas>
31
32
<div id="console"></div>
33
<script>
34
description("This test makes sure that focusable elements in canvas fallback content are accessible.");
35
36
if (window.layoutTestController && window.accessibilityController) {
37
    window.layoutTestController.dumpAsText();
38
39
    function check(id, expectedRole) {
40
        debug(id);
41
        window.element = document.getElementById(id);
42
        element.focus();
43
        shouldBe("document.activeElement == element", "true");
44
        window.axElement = accessibilityController.focusedElement;
45
        shouldBe("axElement.role", "\"" + expectedRole + "\"");
46
        debug("");
47
    }
48
49
    // Check rendered controls.
50
    check("link1", "AXRole: AXLink");
51
    check("button1", "AXRole: AXButton");
52
    check("text1", "AXRole: AXTextField");
53
    check("checkbox1", "AXRole: AXCheckBox");
54
    check("radio1", "AXRole: AXRadioButton");
55
    check("submit1", "AXRole: AXButton");
56
    check("combobox1", "AXRole: AXPopUpButton");
57
    check("focusable1", "AXRole: AXGroup");
58
    check("aria-button1", "AXRole: AXButton");
59
    check("aria-link1", "AXRole: AXLink");
60
61
    // Check unrendered controls inside a canvas.
62
    check("link2", "AXRole: AXLink");
63
    check("button2", "AXRole: AXButton");
64
    check("text2", "AXRole: AXTextField");
65
    check("checkbox2", "AXRole: AXCheckBox");
66
    check("radio2", "AXRole: AXRadioButton");
67
    check("submit2", "AXRole: AXButton");
68
    check("combobox2", "AXRole: AXPopUpButton");
69
    check("focusable2", "AXRole: AXGroup");
70
    check("aria-button2", "AXRole: AXButton");
71
    check("aria-link2", "AXRole: AXLink");
72
73
    // Check that the role is updated when the element changes.
74
    document.getElementById('focusable1').setAttribute('role', 'button');
75
    check("focusable1", "AXRole: AXButton");
76
    document.getElementById('focusable2').setAttribute('role', 'button');
77
    check("focusable2", "AXRole: AXButton");
78
}
79
80
</script>
81
82
<script src="../fast/js/resources/js-test-post.js"></script>
83
</body>
84
</html>
0
  + text/html
85
  + text/html
1
  + LF
86
  + LF
- LayoutTests/platform/gtk/TestExpectations +1 lines
Lines 580-585 BUGWKGTK : accessibility/aria-text-role. LayoutTests/platform/gtk/TestExpectations_sec1
580
BUGWKGTK : accessibility/aria-used-on-image-maps.html = TEXT
580
BUGWKGTK : accessibility/aria-used-on-image-maps.html = TEXT
581
BUGWKGTK : accessibility/button-press-action.html = TEXT
581
BUGWKGTK : accessibility/button-press-action.html = TEXT
582
BUGWKGTK : accessibility/canvas.html = TEXT
582
BUGWKGTK : accessibility/canvas.html = TEXT
583
BUGWKGTK : accessibility/canvas-fallback-content.html = TEXT
583
BUGWKGTK : accessibility/editable-webarea-context-menu-point.html = TEXT
584
BUGWKGTK : accessibility/editable-webarea-context-menu-point.html = TEXT
584
BUGWKGTK : accessibility/ellipsis-text.html = TEXT
585
BUGWKGTK : accessibility/ellipsis-text.html = TEXT
585
BUGWKGTK : accessibility/ignore-spacer-elements.html = TEXT
586
BUGWKGTK : accessibility/ignore-spacer-elements.html = TEXT

Return to Bug 91794