| Differences between
and this patch
- Source/WebCore/ChangeLog +124 lines
Lines 1-3 Source/WebCore/ChangeLog_sec1
1
2012-08-13  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::get):
23
        (WebCore::AXObjectCache::getOrCreate):
24
        (WebCore::AXObjectCache::contentChanged):
25
        (WebCore):
26
        (WebCore::AXObjectCache::attached):
27
        (WebCore::AXObjectCache::childrenChanged):
28
        (WebCore::AXObjectCache::postNotification):
29
        (WebCore::AXObjectCache::checkedStateChanged):
30
        (WebCore::AXObjectCache::selectedChildrenChanged):
31
        (WebCore::AXObjectCache::nodeTextChangeNotification):
32
        (WebCore::AXObjectCache::handleAriaExpandedChange):
33
        (WebCore::AXObjectCache::handleActiveDescendantChanged):
34
        (WebCore::AXObjectCache::handleAriaRoleChanged):
35
        (WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
36
        (WebCore::AXObjectCache::rootAXEditableElement):
37
        (WebCore::AXObjectCache::nodeIsTextControl):
38
        * accessibility/AXObjectCache.h:
39
        (AXObjectCache):
40
        (WebCore::AXObjectCache::setNodeInUse):
41
        (WebCore::AXObjectCache::removeNodeForUse):
42
        (WebCore::AXObjectCache::isNodeInUse):
43
        (WebCore::AXObjectCache::checkedStateChanged):
44
        (WebCore::AXObjectCache::childrenChanged):
45
        (WebCore::AXObjectCache::contentChanged):
46
        (WebCore::AXObjectCache::attached):
47
        (WebCore::AXObjectCache::handleActiveDescendantChanged):
48
        (WebCore::AXObjectCache::handleAriaExpandedChange):
49
        (WebCore::AXObjectCache::handleAriaRoleChanged):
50
        (WebCore::AXObjectCache::handleFocusedUIElementChanged):
51
        (WebCore::AXObjectCache::nodeTextChangeNotification):
52
        (WebCore::AXObjectCache::postNotification):
53
        (WebCore::AXObjectCache::selectedChildrenChanged):
54
        * accessibility/AccessibilityListBoxOption.cpp:
55
        (WebCore::AccessibilityListBoxOption::parentObject):
56
        * accessibility/AccessibilityObject.cpp:
57
        (WebCore::appendAccessibilityObject):
58
        (WebCore::replacedNodeNeedsCharacter):
59
        * accessibility/AccessibilityRenderObject.cpp:
60
        (WebCore::AccessibilityRenderObject::menuForMenuButton):
61
        (WebCore::AccessibilityRenderObject::menuButtonForMenu):
62
        (WebCore::AccessibilityRenderObject::checkboxOrRadioRect):
63
        (WebCore::AccessibilityRenderObject::addRadioButtonGroupMembers):
64
        (WebCore::AccessibilityRenderObject::titleUIElement):
65
        (WebCore::AccessibilityRenderObject::isTabItemSelected):
66
        (WebCore::AccessibilityRenderObject::accessibilityParentForImageMap):
67
        (WebCore::AccessibilityRenderObject::nodeIsTextControl):
68
        (WebCore::AccessibilityRenderObject::activeDescendant):
69
        (WebCore::AccessibilityRenderObject::correspondingControlForLabelElement):
70
        (WebCore::AccessibilityRenderObject::correspondingLabelForControlElement):
71
        * accessibility/AccessibilityRenderObject.h:
72
        (AccessibilityRenderObject):
73
        * accessibility/AccessibilityScrollView.cpp:
74
        (WebCore::AccessibilityScrollView::webAreaObject):
75
        (WebCore::AccessibilityScrollView::parentObject):
76
        (WebCore::AccessibilityScrollView::parentObjectIfExists):
77
        * accessibility/chromium/AXObjectCacheChromium.cpp:
78
        (WebCore::AXObjectCache::postPlatformNotification):
79
        (WebCore::AXObjectCache::handleFocusedUIElementChanged):
80
        * accessibility/gtk/AXObjectCacheAtk.cpp:
81
        (WebCore::AXObjectCache::handleFocusedUIElementChanged):
82
        * accessibility/mac/AXObjectCacheMac.mm:
83
        (WebCore::AXObjectCache::handleFocusedUIElementChanged):
84
        * accessibility/win/AXObjectCacheWin.cpp:
85
        (WebCore::AXObjectCache::handleFocusedUIElementChanged):
86
        * bindings/cpp/WebDOMCustomVoidCallback.cpp:
87
        (toWebCore):
88
        * dom/Document.cpp:
89
        (WebCore::Document::setFocusedNode):
90
        * dom/Element.cpp:
91
        (WebCore::Element::attributeChanged):
92
        * dom/Node.cpp:
93
        (WebCore::Node::~Node):
94
        (WebCore::Node::attach):
95
        * editing/AppendNodeCommand.cpp:
96
        (WebCore::sendAXTextChangedIgnoringLineBreaks):
97
        * editing/DeleteFromTextNodeCommand.cpp:
98
        (WebCore::DeleteFromTextNodeCommand::doApply):
99
        (WebCore::DeleteFromTextNodeCommand::doUnapply):
100
        * editing/Editor.cpp:
101
        (WebCore::Editor::respondToChangedContents):
102
        (WebCore::Editor::markAndReplaceFor):
103
        * editing/InsertIntoTextNodeCommand.cpp:
104
        (WebCore::InsertIntoTextNodeCommand::doApply):
105
        (WebCore::InsertIntoTextNodeCommand::doUnapply):
106
        * editing/InsertNodeBeforeCommand.cpp:
107
        (WebCore::InsertNodeBeforeCommand::doApply):
108
        (WebCore::InsertNodeBeforeCommand::doUnapply):
109
        * editing/chromium/FrameSelectionChromium.cpp:
110
        (WebCore::FrameSelection::notifyAccessibilityForSelectionChange):
111
        * html/HTMLInputElement.cpp:
112
        (WebCore::HTMLInputElement::setChecked):
113
        * html/HTMLSelectElement.cpp:
114
        (WebCore::HTMLSelectElement::childrenChanged):
115
        (WebCore::HTMLSelectElement::optionElementChildrenChanged):
116
        * html/HTMLTextFormControlElement.cpp:
117
        (WebCore::HTMLTextFormControlElement::setInnerTextValue):
118
        * html/InputType.cpp:
119
        (WebCore::InputType::applyStep):
120
        * html/RangeInputType.cpp:
121
        (WebCore::RangeInputType::handleKeydownEvent):
122
        * page/FocusController.cpp:
123
        (WebCore::FocusController::setInitialFocus):
124
1
2012-08-10  Arko Saha  <arko@motorola.com>
125
2012-08-10  Arko Saha  <arko@motorola.com>
2
126
3
        REGRESSION(r125159): ASSERTION FAILED: m_listsInvalidatedAtDocument.contains(list) in Document::unregisterNodeListCache.
127
        REGRESSION(r125159): ASSERTION FAILED: m_listsInvalidatedAtDocument.contains(list) in Document::unregisterNodeListCache.
- Source/WebCore/accessibility/AXObjectCache.cpp -56 / +85 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-155 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)
148
    if (!obj)
149
        return 0;
149
        return 0;
150
150
151
    AccessibilityObject* obj = focusedNodeRenderer->document()->axObjectCache()->getOrCreate(focusedNodeRenderer);
152
153
    if (obj->shouldFocusActiveDescendant()) {
151
    if (obj->shouldFocusActiveDescendant()) {
154
        if (AccessibilityObject* descendant = obj->activeDescendant())
152
        if (AccessibilityObject* descendant = obj->activeDescendant())
155
            obj = descendant;
153
            obj = descendant;
Lines 193-208 AccessibilityObject* AXObjectCache::get( Source/WebCore/accessibility/AXObjectCache.cpp_sec3
193
    if (!node)
191
    if (!node)
194
        return 0;
192
        return 0;
195
193
196
    // Always prefer building the AccessibilityObject from the renderer if there is one.
194
    AXID renderID = node->renderer() ? m_renderObjectMapping.get(node->renderer()) : 0;
197
    if (node->renderer())
195
    ASSERT(!HashTraits<AXID>::isDeletedValue(renderID));
198
        return get(node->renderer());
199
196
200
    AXID axID = m_nodeObjectMapping.get(node);
197
    AXID nodeID = m_nodeObjectMapping.get(node);
201
    ASSERT(!HashTraits<AXID>::isDeletedValue(axID));
198
    ASSERT(!HashTraits<AXID>::isDeletedValue(nodeID));
202
    if (!axID)
199
200
    if (node->renderer() && nodeID && !renderID) {
201
        // This can happen if an AccessibilityNodeObject is created for a node that's not
202
        // rendered, but later something changes and it gets a renderer (like if it's
203
        // reparented).
204
        remove(nodeID);
205
        return 0;
206
    }
207
208
    if (renderID)
209
        return m_objects.get(renderID).get();
210
211
    if (!nodeID)
203
        return 0;
212
        return 0;
204
213
205
    return m_objects.get(axID).get();
214
    return m_objects.get(nodeID).get();
206
}
215
}
207
216
208
// FIXME: This probably belongs on Node.
217
// FIXME: This probably belongs on Node.
Lines 512-535 void AXObjectCache::removeAXID(Accessibi Source/WebCore/accessibility/AXObjectCache.cpp_sec4
512
    m_idsInUse.remove(objID);
521
    m_idsInUse.remove(objID);
513
}
522
}
514
523
524
void AXObjectCache::contentChanged(Node* node)
525
{
526
    if (AccessibilityObject* object = getOrCreate(node))
527
        object->contentChanged(); 
528
}
529
515
void AXObjectCache::contentChanged(RenderObject* renderer)
530
void AXObjectCache::contentChanged(RenderObject* renderer)
516
{
531
{
517
    AccessibilityObject* object = getOrCreate(renderer);
532
    if (AccessibilityObject* object = getOrCreate(renderer))
518
    if (object)
519
        object->contentChanged(); 
533
        object->contentChanged(); 
520
}
534
}
521
535
536
void AXObjectCache::attach(Node* node)
537
{
538
    // Calling get() will update the AX object if we had an AccessibilityNodeObject but now we need
539
    // an AccessibilityRenderObject, because it was reparented to a location outside of a canvas.
540
    get(node);
541
}
542
543
void AXObjectCache::childrenChanged(Node* node)
544
{
545
    if (AccessibilityObject* obj = get(node))
546
        obj->childrenChanged();
547
}
548
522
void AXObjectCache::childrenChanged(RenderObject* renderer)
549
void AXObjectCache::childrenChanged(RenderObject* renderer)
523
{
550
{
524
    if (!renderer)
551
    if (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)
533
        obj->childrenChanged();
552
        obj->childrenChanged();
534
}
553
}
535
    
554
    
Lines 559-566 void AXObjectCache::notificationPostTime Source/WebCore/accessibility/AXObjectCache.cpp_sec5
559
    
578
    
560
void AXObjectCache::postNotification(RenderObject* renderer, AXNotification notification, bool postToElement, PostType postType)
579
void AXObjectCache::postNotification(RenderObject* renderer, AXNotification notification, bool postToElement, PostType postType)
561
{
580
{
562
    // Notifications for text input objects are sent to that object.
563
    // All others are sent to the top WebArea.
564
    if (!renderer)
581
    if (!renderer)
565
        return;
582
        return;
566
    
583
    
Lines 578-583 void AXObjectCache::postNotification(Ren Source/WebCore/accessibility/AXObjectCache.cpp_sec6
578
    postNotification(object.get(), renderer->document(), notification, postToElement, postType);
595
    postNotification(object.get(), renderer->document(), notification, postToElement, postType);
579
}
596
}
580
597
598
void AXObjectCache::postNotification(Node* node, AXNotification notification, bool postToElement, PostType postType)
599
{
600
    if (!node)
601
        return;
602
    
603
    // Get an accessibility object that already exists. One should not be created here
604
    // because a render update may be in progress and creating an AX object can re-trigger a layout
605
    RefPtr<AccessibilityObject> object = get(node);
606
    while (!object && node) {
607
        node = node->parentNode();
608
        object = get(node);
609
    }
610
    
611
    if (!node)
612
        return;
613
    
614
    postNotification(object.get(), node->document(), notification, postToElement, postType);
615
}
616
581
void AXObjectCache::postNotification(AccessibilityObject* object, Document* document, AXNotification notification, bool postToElement, PostType postType)
617
void AXObjectCache::postNotification(AccessibilityObject* object, Document* document, AXNotification notification, bool postToElement, PostType postType)
582
{
618
{
583
    if (object && !postToElement)
619
    if (object && !postToElement)
Lines 597-605 void AXObjectCache::postNotification(Acc Source/WebCore/accessibility/AXObjectCache.cpp_sec7
597
        postPlatformNotification(object, notification);
633
        postPlatformNotification(object, notification);
598
}
634
}
599
635
600
void AXObjectCache::checkedStateChanged(RenderObject* renderer)
636
void AXObjectCache::checkedStateChanged(Node* node)
601
{
637
{
602
    postNotification(renderer, AXObjectCache::AXCheckedStateChanged, true);
638
    postNotification(node, AXObjectCache::AXCheckedStateChanged, true);
639
}
640
641
void AXObjectCache::selectedChildrenChanged(Node* node)
642
{
643
    // postToElement is false so that you can pass in any child of an element and it will go up the parent tree
644
    // to find the container which should send out the notification.
645
    postNotification(node, AXSelectedChildrenChanged, false);
603
}
646
}
604
647
605
void AXObjectCache::selectedChildrenChanged(RenderObject* renderer)
648
void AXObjectCache::selectedChildrenChanged(RenderObject* renderer)
Lines 609-621 void AXObjectCache::selectedChildrenChan Source/WebCore/accessibility/AXObjectCache.cpp_sec8
609
    postNotification(renderer, AXSelectedChildrenChanged, false);
652
    postNotification(renderer, AXSelectedChildrenChanged, false);
610
}
653
}
611
654
612
void AXObjectCache::nodeTextChangeNotification(RenderObject* renderer, AXTextChange textChange, unsigned offset, const String& text)
655
void AXObjectCache::nodeTextChangeNotification(Node* node, AXTextChange textChange, unsigned offset, const String& text)
613
{
656
{
614
    if (!renderer)
657
    if (!node)
615
        return;
658
        return;
616
659
617
    // Delegate on the right platform
660
    // Delegate on the right platform
618
    AccessibilityObject* obj = getOrCreate(renderer);
661
    AccessibilityObject* obj = getOrCreate(node);
619
    nodeTextChangePlatformNotification(obj, textChange, offset, text);
662
    nodeTextChangePlatformNotification(obj, textChange, offset, text);
620
}
663
}
621
664
Lines 639-674 void AXObjectCache::handleScrollbarUpdat Source/WebCore/accessibility/AXObjectCache.cpp_sec9
639
        return;
682
        return;
640
    
683
    
641
    // We don't want to create a scroll view from this method, only update an existing one.
684
    // We don't want to create a scroll view from this method, only update an existing one.
642
    AccessibilityObject* scrollViewObject = get(view);
685
    if (AccessibilityObject* scrollViewObject = get(view))
643
    if (scrollViewObject)
644
        scrollViewObject->updateChildrenIfNecessary();
686
        scrollViewObject->updateChildrenIfNecessary();
645
}
687
}
646
    
688
    
647
void AXObjectCache::handleAriaExpandedChange(RenderObject *renderer)
689
void AXObjectCache::handleAriaExpandedChange(Node* node)
648
{
690
{
649
    if (!renderer)
691
    if (AccessibilityObject* obj = getOrCreate(node))
650
        return;
651
    AccessibilityObject* obj = getOrCreate(renderer);
652
    if (obj)
653
        obj->handleAriaExpandedChanged();
692
        obj->handleAriaExpandedChanged();
654
}
693
}
655
    
694
    
656
void AXObjectCache::handleActiveDescendantChanged(RenderObject* renderer)
695
void AXObjectCache::handleActiveDescendantChanged(Node* node)
657
{
696
{
658
    if (!renderer)
697
    if (AccessibilityObject* obj = getOrCreate(node))
659
        return;
660
    AccessibilityObject* obj = getOrCreate(renderer);
661
    if (obj)
662
        obj->handleActiveDescendantChanged();
698
        obj->handleActiveDescendantChanged();
663
}
699
}
664
700
665
void AXObjectCache::handleAriaRoleChanged(RenderObject* renderer)
701
void AXObjectCache::handleAriaRoleChanged(Node* node)
666
{
702
{
667
    if (!renderer)
703
    if (AccessibilityObject* obj = getOrCreate(node))
668
        return;
704
        obj->updateAccessibilityRole();
669
    AccessibilityObject* obj = getOrCreate(renderer);
670
    if (obj && obj->isAccessibilityRenderObject())
671
        static_cast<AccessibilityRenderObject*>(obj)->updateAccessibilityRole();
672
}
705
}
673
706
674
VisiblePosition AXObjectCache::visiblePositionForTextMarkerData(TextMarkerData& textMarkerData)
707
VisiblePosition AXObjectCache::visiblePositionForTextMarkerData(TextMarkerData& textMarkerData)
Lines 717-729 void AXObjectCache::textMarkerDataForVis Source/WebCore/accessibility/AXObjectCache.cpp_sec10
717
            return;
750
            return;
718
    }
751
    }
719
    
752
    
720
    // locate the renderer, which must exist for a visible dom node
753
    // find or create an accessibility object for this node
721
    RenderObject* renderer = domNode->renderer();
754
    AXObjectCache* cache = domNode->document()->axObjectCache();
722
    ASSERT(renderer);
755
    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
    
756
    
728
    textMarkerData.axID = obj.get()->axObjectID();
757
    textMarkerData.axID = obj.get()->axObjectID();
729
    textMarkerData.node = domNode;
758
    textMarkerData.node = domNode;
Lines 751-757 bool AXObjectCache::nodeIsTextControl(co Source/WebCore/accessibility/AXObjectCache.cpp_sec11
751
    if (!node)
780
    if (!node)
752
        return false;
781
        return false;
753
782
754
    const AccessibilityObject* axObject = getOrCreate(node->renderer());
783
    const AccessibilityObject* axObject = getOrCreate(const_cast<Node*>(node));
755
    return axObject && axObject->isTextControl();
784
    return axObject && axObject->isTextControl();
756
}
785
}
757
786
- Source/WebCore/accessibility/AXObjectCache.h -18 / +29 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
    // Called when a node is attached, so we can make sure we have the right subclass of AccessibilityObject.
96
    void handleActiveDescendantChanged(RenderObject*);
99
    void attach(Node*);
97
    void handleAriaRoleChanged(RenderObject*);
100
98
    void handleFocusedUIElementChanged(RenderObject* oldFocusedRenderer, RenderObject* newFocusedRenderer);
101
    void handleActiveDescendantChanged(Node*);
102
    void handleAriaRoleChanged(Node*);
103
    void handleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFocusedNode);
99
    void handleScrolledToAnchor(const Node* anchorNode);
104
    void handleScrolledToAnchor(const Node* anchorNode);
100
    void handleAriaExpandedChange(RenderObject*);
105
    void handleAriaExpandedChange(Node*);
101
    void handleScrollbarUpdate(ScrollView*);
106
    void handleScrollbarUpdate(ScrollView*);
102
107
103
#if HAVE(ACCESSIBILITY)
108
#if HAVE(ACCESSIBILITY)
Lines 124-134 public: Source/WebCore/accessibility/AXObjectCache.h_sec2
124
    AXID platformGenerateAXID() const;
129
    AXID platformGenerateAXID() const;
125
    AccessibilityObject* objectFromAXID(AXID id) const { return m_objects.get(id).get(); }
130
    AccessibilityObject* objectFromAXID(AXID id) const { return m_objects.get(id).get(); }
126
131
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.
132
    // Text marker utilities.
133
    void textMarkerDataForVisiblePosition(TextMarkerData&, const VisiblePosition&);
133
    void textMarkerDataForVisiblePosition(TextMarkerData&, const VisiblePosition&);
134
    VisiblePosition visiblePositionForTextMarkerData(TextMarkerData&);
134
    VisiblePosition visiblePositionForTextMarkerData(TextMarkerData&);
Lines 155-160 public: Source/WebCore/accessibility/AXObjectCache.h_sec3
155
    };
155
    };
156
156
157
    void postNotification(RenderObject*, AXNotification, bool postToElement, PostType = PostAsynchronously);
157
    void postNotification(RenderObject*, AXNotification, bool postToElement, PostType = PostAsynchronously);
158
    void postNotification(Node*, AXNotification, bool postToElement, PostType = PostAsynchronously);
158
    void postNotification(AccessibilityObject*, Document*, AXNotification, bool postToElement, PostType = PostAsynchronously);
159
    void postNotification(AccessibilityObject*, Document*, AXNotification, bool postToElement, PostType = PostAsynchronously);
159
160
160
    enum AXTextChange {
161
    enum AXTextChange {
Lines 162-168 public: Source/WebCore/accessibility/AXObjectCache.h_sec4
162
        AXTextDeleted,
163
        AXTextDeleted,
163
    };
164
    };
164
165
165
    void nodeTextChangeNotification(RenderObject*, AXTextChange, unsigned offset, const String&);
166
    void nodeTextChangeNotification(Node*, AXTextChange, unsigned offset, const String&);
166
167
167
    enum AXLoadingEvent {
168
    enum AXLoadingEvent {
168
        AXLoadingStarted,
169
        AXLoadingStarted,
Lines 180-185 protected: Source/WebCore/accessibility/AXObjectCache.h_sec5
180
    void nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned offset, const String&);
181
    void nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned offset, const String&);
181
    void frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent);
182
    void frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent);
182
183
184
    // This is a weak reference cache for knowing if Nodes used by TextMarkers are valid.
185
    void setNodeInUse(Node* n) { m_textMarkerNodes.add(n); }
186
    void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); }
187
    bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); }
188
183
private:
189
private:
184
    Document* m_document;
190
    Document* m_document;
185
    HashMap<AXID, RefPtr<AccessibilityObject> > m_objects;
191
    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; }
226
inline bool nodeHasRole(Node*, const String&) { return false; }
221
inline const Element* AXObjectCache::rootAXEditableElement(const Node*) { return 0; }
227
inline const Element* AXObjectCache::rootAXEditableElement(const Node*) { return 0; }
222
inline void AXObjectCache::attachWrapper(AccessibilityObject*) { }
228
inline void AXObjectCache::attachWrapper(AccessibilityObject*) { }
223
inline void AXObjectCache::checkedStateChanged(RenderObject*) { }
229
inline void AXObjectCache::checkedStateChanged(Node*) { }
224
inline void AXObjectCache::childrenChanged(RenderObject*) { }
230
inline void AXObjectCache::childrenChanged(RenderObject*) { }
231
inline void AXObjectCache::childrenChanged(Node*) { }
225
inline void AXObjectCache::contentChanged(RenderObject*) { }
232
inline void AXObjectCache::contentChanged(RenderObject*) { }
233
inline void AXObjectCache::contentChanged(Node*) { }
234
inline void AXObjectCache::attach(Node*) { }
226
inline void AXObjectCache::detachWrapper(AccessibilityObject*) { }
235
inline void AXObjectCache::detachWrapper(AccessibilityObject*) { }
227
inline void AXObjectCache::frameLoadingEventNotification(Frame*, AXLoadingEvent) { }
236
inline void AXObjectCache::frameLoadingEventNotification(Frame*, AXLoadingEvent) { }
228
inline void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent) { }
237
inline void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent) { }
229
inline void AXObjectCache::handleActiveDescendantChanged(RenderObject*) { }
238
inline void AXObjectCache::handleActiveDescendantChanged(Node*) { }
230
inline void AXObjectCache::handleAriaExpandedChange(RenderObject*) { }
239
inline void AXObjectCache::handleAriaExpandedChange(Node*) { }
231
inline void AXObjectCache::handleAriaRoleChanged(RenderObject*) { }
240
inline void AXObjectCache::handleAriaRoleChanged(Node*) { }
232
inline void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject*) { }
241
inline void AXObjectCache::handleFocusedUIElementChanged(Node*, Node*) { }
233
inline void AXObjectCache::handleScrollbarUpdate(ScrollView*) { }
242
inline void AXObjectCache::handleScrollbarUpdate(ScrollView*) { }
234
inline void AXObjectCache::handleScrolledToAnchor(const Node*) { }
243
inline void AXObjectCache::handleScrolledToAnchor(const Node*) { }
235
inline void AXObjectCache::nodeTextChangeNotification(RenderObject*, AXTextChange, unsigned, const String&) { }
244
inline void AXObjectCache::nodeTextChangeNotification(Node*, AXTextChange, unsigned, const String&) { }
236
inline void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, const String&) { }
245
inline void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, const String&) { }
237
inline void AXObjectCache::postNotification(AccessibilityObject*, Document*, AXNotification, bool postToElement, PostType) { }
246
inline void AXObjectCache::postNotification(AccessibilityObject*, Document*, AXNotification, bool postToElement, PostType) { }
238
inline void AXObjectCache::postNotification(RenderObject*, AXNotification, bool postToElement, PostType) { }
247
inline void AXObjectCache::postNotification(RenderObject*, AXNotification, bool postToElement, PostType) { }
248
inline void AXObjectCache::postNotification(Node*, AXNotification, bool postToElement, PostType) { }
239
inline void AXObjectCache::postPlatformNotification(AccessibilityObject*, AXNotification) { }
249
inline void AXObjectCache::postPlatformNotification(AccessibilityObject*, AXNotification) { }
240
inline void AXObjectCache::remove(AXID) { }
250
inline void AXObjectCache::remove(AXID) { }
241
inline void AXObjectCache::remove(RenderObject*) { }
251
inline void AXObjectCache::remove(RenderObject*) { }
242
inline void AXObjectCache::remove(Node*) { }
252
inline void AXObjectCache::remove(Node*) { }
243
inline void AXObjectCache::remove(Widget*) { }
253
inline void AXObjectCache::remove(Widget*) { }
244
inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { }
254
inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { }
255
inline void AXObjectCache::selectedChildrenChanged(Node*) { }
245
#endif
256
#endif
246
257
247
}
258
}
- 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/AccessibilityNodeObject.h -1 / +1 lines
Lines 81-87 public: Source/WebCore/accessibility/AccessibilityNodeObject.h_sec1
81
81
82
    virtual void detach();
82
    virtual void detach();
83
    virtual void childrenChanged();
83
    virtual void childrenChanged();
84
    void updateAccessibilityRole();
84
    virtual void updateAccessibilityRole();
85
85
86
    virtual LayoutRect elementRect() const;
86
    virtual LayoutRect elementRect() const;
87
87
- 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/AccessibilityObject.h +1 lines
Lines 557-562 public: Source/WebCore/accessibility/AccessibilityObject.h_sec1
557
557
558
    virtual void childrenChanged() { }
558
    virtual void childrenChanged() { }
559
    virtual void contentChanged() { }
559
    virtual void contentChanged() { }
560
    virtual void updateAccessibilityRole() { }
560
    const AccessibilityChildrenVector& children();
561
    const AccessibilityChildrenVector& children();
561
    virtual void addChildren() { }
562
    virtual void addChildren() { }
562
    virtual bool canHaveChildren() const { return true; }
563
    virtual bool canHaveChildren() const { return true; }
- 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 1552-1558 LayoutRect AccessibilityRenderObject::ch Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec3
1552
    if (!label || !label->renderer())
1552
    if (!label || !label->renderer())
1553
        return boundingBoxRect();
1553
        return boundingBoxRect();
1554
    
1554
    
1555
    LayoutRect labelRect = axObjectCache()->getOrCreate(label->renderer())->elementRect();
1555
    LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementRect();
1556
    labelRect.unite(boundingBoxRect());
1556
    labelRect.unite(boundingBoxRect());
1557
    return labelRect;
1557
    return labelRect;
1558
}
1558
}
Lines 1640-1646 void AccessibilityRenderObject::addRadio Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec4
1640
        unsigned len = formElements.size();
1640
        unsigned len = formElements.size();
1641
        for (unsigned i = 0; i < len; ++i) {
1641
        for (unsigned i = 0; i < len; ++i) {
1642
            Node* associateElement = formElements[i].get();
1642
            Node* associateElement = formElements[i].get();
1643
            if (AccessibilityObject* object = axObjectCache()->getOrCreate(associateElement->renderer()))
1643
            if (AccessibilityObject* object = axObjectCache()->getOrCreate(associateElement))
1644
                linkedUIElements.append(object);        
1644
                linkedUIElements.append(object);        
1645
        } 
1645
        } 
1646
    } else {
1646
    } else {
Lines 1650-1656 void AccessibilityRenderObject::addRadio Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec5
1650
            if (list->item(i)->hasTagName(inputTag)) {
1650
            if (list->item(i)->hasTagName(inputTag)) {
1651
                HTMLInputElement* associateElement = static_cast<HTMLInputElement*>(list->item(i));
1651
                HTMLInputElement* associateElement = static_cast<HTMLInputElement*>(list->item(i));
1652
                if (associateElement->isRadioButton() && associateElement->name() == input->name()) {
1652
                if (associateElement->isRadioButton() && associateElement->name() == input->name()) {
1653
                    if (AccessibilityObject* object = axObjectCache()->getOrCreate(associateElement->renderer()))
1653
                    if (AccessibilityObject* object = axObjectCache()->getOrCreate(associateElement))
1654
                        linkedUIElements.append(object);
1654
                        linkedUIElements.append(object);
1655
                }
1655
                }
1656
            }
1656
            }
Lines 1703-1709 void AccessibilityRenderObject::ariaFlow Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec6
1703
    unsigned count = elements.size();
1703
    unsigned count = elements.size();
1704
    for (unsigned k = 0; k < count; ++k) {
1704
    for (unsigned k = 0; k < count; ++k) {
1705
        Element* element = elements[k];
1705
        Element* element = elements[k];
1706
        AccessibilityObject* flowToElement = cache->getOrCreate(element->renderer());
1706
        AccessibilityObject* flowToElement = cache->getOrCreate(element);
1707
        if (flowToElement)
1707
        if (flowToElement)
1708
            flowTo.append(flowToElement);
1708
            flowTo.append(flowToElement);
1709
    }
1709
    }
Lines 1777-1783 AccessibilityObject* AccessibilityRender Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec7
1777
        return 0;
1777
        return 0;
1778
    HTMLLabelElement* label = labelForElement(static_cast<Element*>(element));
1778
    HTMLLabelElement* label = labelForElement(static_cast<Element*>(element));
1779
    if (label && label->renderer())
1779
    if (label && label->renderer())
1780
        return axObjectCache()->getOrCreate(label->renderer());
1780
        return axObjectCache()->getOrCreate(label);
1781
1781
1782
    return 0;   
1782
    return 0;   
1783
}
1783
}
Lines 2271-2277 bool AccessibilityRenderObject::isTabIte Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec8
2271
    unsigned count = elements.size();
2271
    unsigned count = elements.size();
2272
    for (unsigned k = 0; k < count; ++k) {
2272
    for (unsigned k = 0; k < count; ++k) {
2273
        Element* element = elements[k];
2273
        Element* element = elements[k];
2274
        AccessibilityObject* tabPanel = axObjectCache()->getOrCreate(element->renderer());
2274
        AccessibilityObject* tabPanel = axObjectCache()->getOrCreate(element);
2275
2275
2276
        // A tab item should only control tab panels.
2276
        // A tab item should only control tab panels.
2277
        if (!tabPanel || tabPanel->roleValue() != TabPanelRole)
2277
        if (!tabPanel || tabPanel->roleValue() != TabPanelRole)
Lines 2470-2476 AccessibilityObject* AccessibilityRender Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec9
2470
    if (!imageElement)
2470
    if (!imageElement)
2471
        return 0;
2471
        return 0;
2472
    
2472
    
2473
    return axObjectCache()->getOrCreate(imageElement->renderer());
2473
    return axObjectCache()->getOrCreate(imageElement);
2474
}
2474
}
2475
    
2475
    
2476
void AccessibilityRenderObject::getDocumentLinks(AccessibilityChildrenVector& result)
2476
void AccessibilityRenderObject::getDocumentLinks(AccessibilityChildrenVector& result)
Lines 2661-2667 bool AccessibilityRenderObject::nodeIsTe Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec10
2661
    if (!node)
2661
    if (!node)
2662
        return false;
2662
        return false;
2663
2663
2664
    const AccessibilityObject* axObjectForNode = axObjectCache()->getOrCreate(node->renderer());
2664
    const AccessibilityObject* axObjectForNode = axObjectCache()->getOrCreate(const_cast<Node*>(node));
2665
    if (!axObjectForNode)
2665
    if (!axObjectForNode)
2666
        return false;
2666
        return false;
2667
2667
Lines 2998-3004 AccessibilityObject* AccessibilityRender Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec11
2998
    if (!target)
2998
    if (!target)
2999
        return 0;
2999
        return 0;
3000
    
3000
    
3001
    AccessibilityObject* obj = axObjectCache()->getOrCreate(target->renderer());
3001
    AccessibilityObject* obj = axObjectCache()->getOrCreate(target);
3002
    if (obj && obj->isAccessibilityRenderObject())
3002
    if (obj && obj->isAccessibilityRenderObject())
3003
    // an activedescendant is only useful if it has a renderer, because that's what's needed to post the notification
3003
    // an activedescendant is only useful if it has a renderer, because that's what's needed to post the notification
3004
        return obj;
3004
        return obj;
Lines 3063-3069 AccessibilityObject* AccessibilityRender Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec12
3063
    if (!correspondingControl)
3063
    if (!correspondingControl)
3064
        return 0;
3064
        return 0;
3065
    
3065
    
3066
    return axObjectCache()->getOrCreate(correspondingControl->renderer());     
3066
    return axObjectCache()->getOrCreate(correspondingControl);     
3067
}
3067
}
3068
3068
3069
AccessibilityObject* AccessibilityRenderObject::correspondingLabelForControlElement() const
3069
AccessibilityObject* AccessibilityRenderObject::correspondingLabelForControlElement() const
Lines 3075-3081 AccessibilityObject* AccessibilityRender Source/WebCore/accessibility/AccessibilityRenderObject.cpp_sec13
3075
    if (node && node->isHTMLElement()) {
3075
    if (node && node->isHTMLElement()) {
3076
        HTMLLabelElement* label = labelForElement(static_cast<Element*>(node));
3076
        HTMLLabelElement* label = labelForElement(static_cast<Element*>(node));
3077
        if (label)
3077
        if (label)
3078
            return axObjectCache()->getOrCreate(label->renderer());
3078
            return axObjectCache()->getOrCreate(label);
3079
    }
3079
    }
3080
3080
3081
    return 0;
3081
    return 0;
- 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 238-251 void AXObjectCache::frameLoadingEventPla Source/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp_sec1
238
    }
238
    }
239
}
239
}
240
240
241
void AXObjectCache::handleFocusedUIElementChanged(RenderObject* oldFocusedRender, RenderObject* newFocusedRender)
241
void AXObjectCache::handleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFocusedNode)
242
{
242
{
243
    RefPtr<AccessibilityObject> oldObject = getOrCreate(oldFocusedRender);
243
    RefPtr<AccessibilityObject> oldObject = getOrCreate(oldFocusedNode);
244
    if (oldObject) {
244
    if (oldObject) {
245
        g_signal_emit_by_name(oldObject->wrapper(), "focus-event", false);
245
        g_signal_emit_by_name(oldObject->wrapper(), "focus-event", false);
246
        g_signal_emit_by_name(oldObject->wrapper(), "state-change", "focused", false);
246
        g_signal_emit_by_name(oldObject->wrapper(), "state-change", "focused", false);
247
    }
247
    }
248
    RefPtr<AccessibilityObject> newObject = getOrCreate(newFocusedRender);
248
    RefPtr<AccessibilityObject> newObject = getOrCreate(newFocusedNode);
249
    if (newObject) {
249
    if (newObject) {
250
        g_signal_emit_by_name(newObject->wrapper(), "focus-event", true);
250
        g_signal_emit_by_name(newObject->wrapper(), "focus-event", true);
251
        g_signal_emit_by_name(newObject->wrapper(), "state-change", "focused", true);
251
        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/dom/Document.cpp -11 / +2 lines
Lines 3854-3870 bool Document::setFocusedNode(PassRefPtr Source/WebCore/dom/Document.cpp_sec1
3854
    }
3854
    }
3855
3855
3856
#if PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM)
3856
#if PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM)
3857
    if (!focusChangeBlocked && m_focusedNode && AXObjectCache::accessibilityEnabled()) {
3857
    if (!focusChangeBlocked && m_focusedNode && AXObjectCache::accessibilityEnabled())
3858
        RenderObject* oldFocusedRenderer = 0;
3858
        axObjectCache()->handleFocusedUIElementChanged(oldFocusedNode.get(), newFocusedNode.get());
3859
        RenderObject* newFocusedRenderer = 0;
3860
3861
        if (oldFocusedNode)
3862
            oldFocusedRenderer = oldFocusedNode->renderer();
3863
        if (newFocusedNode)
3864
            newFocusedRenderer = newFocusedNode->renderer();
3865
3866
        axObjectCache()->handleFocusedUIElementChanged(oldFocusedRenderer, newFocusedRenderer);
3867
    }
3868
#endif
3859
#endif
3869
    if (!focusChangeBlocked)
3860
    if (!focusChangeBlocked)
3870
        page()->chrome()->focusedNodeChanged(m_focusedNode.get());
3861
        page()->chrome()->focusedNodeChanged(m_focusedNode.get());
- Source/WebCore/dom/Element.cpp -9 / +9 lines
Lines 724-749 void Element::attributeChanged(const Att Source/WebCore/dom/Element.cpp_sec1
724
    const QualifiedName& attrName = attribute.name();
724
    const QualifiedName& attrName = attribute.name();
725
    if (attrName == aria_activedescendantAttr) {
725
    if (attrName == aria_activedescendantAttr) {
726
        // any change to aria-activedescendant attribute triggers accessibility focus change, but document focus remains intact
726
        // any change to aria-activedescendant attribute triggers accessibility focus change, but document focus remains intact
727
        document()->axObjectCache()->handleActiveDescendantChanged(renderer());
727
        document()->axObjectCache()->handleActiveDescendantChanged(this);
728
    } else if (attrName == roleAttr) {
728
    } else if (attrName == roleAttr) {
729
        // the role attribute can change at any time, and the AccessibilityObject must pick up these changes
729
        // the role attribute can change at any time, and the AccessibilityObject must pick up these changes
730
        document()->axObjectCache()->handleAriaRoleChanged(renderer());
730
        document()->axObjectCache()->handleAriaRoleChanged(this);
731
    } else if (attrName == aria_valuenowAttr) {
731
    } else if (attrName == aria_valuenowAttr) {
732
        // If the valuenow attribute changes, AX clients need to be notified.
732
        // If the valuenow attribute changes, AX clients need to be notified.
733
        document()->axObjectCache()->postNotification(renderer(), AXObjectCache::AXValueChanged, true);
733
        document()->axObjectCache()->postNotification(this, AXObjectCache::AXValueChanged, true);
734
    } else if (attrName == aria_labelAttr || attrName == aria_labeledbyAttr || attrName == altAttr || attrName == titleAttr) {
734
    } else if (attrName == aria_labelAttr || attrName == aria_labeledbyAttr || attrName == altAttr || attrName == titleAttr) {
735
        // If the content of an element changes due to an attribute change, notify accessibility.
735
        // If the content of an element changes due to an attribute change, notify accessibility.
736
        document()->axObjectCache()->contentChanged(renderer());
736
        document()->axObjectCache()->contentChanged(this);
737
    } else if (attrName == aria_checkedAttr)
737
    } else if (attrName == aria_checkedAttr)
738
        document()->axObjectCache()->checkedStateChanged(renderer());
738
        document()->axObjectCache()->checkedStateChanged(this);
739
    else if (attrName == aria_selectedAttr)
739
    else if (attrName == aria_selectedAttr)
740
        document()->axObjectCache()->selectedChildrenChanged(renderer());
740
        document()->axObjectCache()->selectedChildrenChanged(this);
741
    else if (attrName == aria_expandedAttr)
741
    else if (attrName == aria_expandedAttr)
742
        document()->axObjectCache()->handleAriaExpandedChange(renderer());
742
        document()->axObjectCache()->handleAriaExpandedChange(this);
743
    else if (attrName == aria_hiddenAttr)
743
    else if (attrName == aria_hiddenAttr)
744
        document()->axObjectCache()->childrenChanged(renderer());
744
        document()->axObjectCache()->childrenChanged(this);
745
    else if (attrName == aria_invalidAttr)
745
    else if (attrName == aria_invalidAttr)
746
        document()->axObjectCache()->postNotification(renderer(), AXObjectCache::AXInvalidStatusChanged, true);
746
        document()->axObjectCache()->postNotification(this, AXObjectCache::AXInvalidStatusChanged, true);
747
}
747
}
748
748
749
// Returns true is the given attribute is an event handler.
749
// Returns true is the given attribute is an event handler.
- Source/WebCore/dom/Node.cpp -1 / +5 lines
Lines 414-420 Node::~Node() Source/WebCore/dom/Node.cpp_sec1
414
414
415
    Document* doc = m_document;
415
    Document* doc = m_document;
416
    if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists())
416
    if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists())
417
        doc->axObjectCache()->removeNodeForUse(this);
417
        doc->axObjectCache()->remove(this);
418
    
418
    
419
    if (m_previous)
419
    if (m_previous)
420
        m_previous->setNextSibling(0);
420
        m_previous->setNextSibling(0);
Lines 1283-1288 void Node::attach() Source/WebCore/dom/Node.cpp_sec2
1283
1283
1284
    setAttached();
1284
    setAttached();
1285
    clearNeedsStyleRecalc();
1285
    clearNeedsStyleRecalc();
1286
    
1287
    Document* doc = m_document;
1288
    if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists())
1289
        doc->axObjectCache()->attach(this);
1286
}
1290
}
1287
1291
1288
#ifndef NDEBUG
1292
#ifndef NDEBUG
- 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 2130-2136 void Editor::markAndReplaceFor(PassRefPt Source/WebCore/editing/Editor.cpp_sec2
2130
                
2130
                
2131
                if (AXObjectCache::accessibilityEnabled()) {
2131
                if (AXObjectCache::accessibilityEnabled()) {
2132
                    if (Element* root = m_frame->selection()->selection().rootEditableElement())
2132
                    if (Element* root = m_frame->selection()->selection().rootEditableElement())
2133
                        m_frame->document()->axObjectCache()->postNotification(root->renderer(), AXObjectCache::AXAutocorrectionOccured, true);
2133
                        m_frame->document()->axObjectCache()->postNotification(root, AXObjectCache::AXAutocorrectionOccured, true);
2134
                }
2134
                }
2135
2135
2136
                selectionChanged = true;
2136
                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 850-856 void HTMLInputElement::setChecked(bool n Source/WebCore/html/HTMLInputElement.cpp_sec1
850
    // RenderTextView), but it's not possible to do it at the moment
850
    // RenderTextView), but it's not possible to do it at the moment
851
    // because of the way the code is structured.
851
    // because of the way the code is structured.
852
    if (renderer() && AXObjectCache::accessibilityEnabled())
852
    if (renderer() && AXObjectCache::accessibilityEnabled())
853
        renderer()->document()->axObjectCache()->checkedStateChanged(renderer());
853
        renderer()->document()->axObjectCache()->checkedStateChanged(this);
854
854
855
    // Only send a change event for items in the document (avoid firing during
855
    // Only send a change event for items in the document (avoid firing during
856
    // parsing) and don't send a change event for a radio button that's getting
856
    // 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 972-978 void InputType::applyStep(int count, Any Source/WebCore/html/InputType.cpp_sec1
972
    setValueAsDecimal(newValue, eventBehavior, ec);
972
    setValueAsDecimal(newValue, eventBehavior, ec);
973
973
974
    if (AXObjectCache::accessibilityEnabled())
974
    if (AXObjectCache::accessibilityEnabled())
975
         element()->document()->axObjectCache()->postNotification(element()->renderer(), AXObjectCache::AXValueChanged, true);
975
         element()->document()->axObjectCache()->postNotification(element(), AXObjectCache::AXValueChanged, true);
976
}
976
}
977
977
978
bool InputType::getAllowedValueStep(Decimal* step) const
978
bool InputType::getAllowedValueStep(Decimal* step) const
- Source/WebCore/html/RangeInputType.cpp -1 / +1 lines
Lines 239-245 void RangeInputType::handleKeydownEvent( Source/WebCore/html/RangeInputType.cpp_sec1
239
        setValueAsDecimal(newValue, eventBehavior, ec);
239
        setValueAsDecimal(newValue, eventBehavior, ec);
240
240
241
        if (AXObjectCache::accessibilityEnabled())
241
        if (AXObjectCache::accessibilityEnabled())
242
            element()->document()->axObjectCache()->postNotification(element()->renderer(), AXObjectCache::AXValueChanged, true);
242
            element()->document()->axObjectCache()->postNotification(element(), AXObjectCache::AXValueChanged, true);
243
        element()->dispatchFormControlChangeEvent();
243
        element()->dispatchFormControlChangeEvent();
244
    }
244
    }
245
245
- 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-08-13  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-08-10  Arko Saha  <arko@motorola.com>
26
2012-08-10  Arko Saha  <arko@motorola.com>
2
27
3
        REGRESSION(r125159): ASSERTION FAILED: m_listsInvalidatedAtDocument.contains(list) in Document::unregisterNodeListCache.
28
        REGRESSION(r125159): ASSERTION FAILED: m_listsInvalidatedAtDocument.contains(list) in Document::unregisterNodeListCache.
- 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.testRunner && window.accessibilityController) {
13
    window.testRunner.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.testRunner && window.accessibilityController) {
15
    window.testRunner.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.testRunner && window.accessibilityController) {
37
    window.testRunner.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 598-603 BUGWKGTK : accessibility/aria-text-role. LayoutTests/platform/gtk/TestExpectations_sec1
598
BUGWKGTK : accessibility/aria-used-on-image-maps.html = TEXT
598
BUGWKGTK : accessibility/aria-used-on-image-maps.html = TEXT
599
BUGWKGTK : accessibility/button-press-action.html = TEXT
599
BUGWKGTK : accessibility/button-press-action.html = TEXT
600
BUGWKGTK : accessibility/canvas.html = TEXT
600
BUGWKGTK : accessibility/canvas.html = TEXT
601
BUGWKGTK : accessibility/canvas-fallback-content.html = TEXT
601
BUGWKGTK : accessibility/editable-webarea-context-menu-point.html = TEXT
602
BUGWKGTK : accessibility/editable-webarea-context-menu-point.html = TEXT
602
BUGWKGTK : accessibility/ellipsis-text.html = TEXT
603
BUGWKGTK : accessibility/ellipsis-text.html = TEXT
603
BUGWKGTK : accessibility/ignore-spacer-elements.html = TEXT
604
BUGWKGTK : accessibility/ignore-spacer-elements.html = TEXT

Return to Bug 91794