AX: Notification should be sent when accessibilityIsIgnored changes
https://bugs.webkit.org/show_bug.cgi?id=99547
Reviewed by Chris Fleizach.
Source/WebCore:
Adds a new flag in AccessibilityObject that keeps track of the most recent
value of accessibilityIsIgnored(). After certain events such as an ARIA
attribute change or content change, checks the new value of
accessibilityIsIgnored() and posts a "children changed" notification on the
parent node if it changed, making sure the parent recomputes its vector of
(unignored) children.
Also moves handling of attribute changes to AXObjectCache, and sends
notifications for some attribute changes that were previously silent. On
Chromium, all changes to an accessibility object's attributes should
result in some notification.
Some tests would have broken because an AccessibilityScrollView was created
and holding a reference to a ScrollView for an iframe after it was deleted,
so this change switches AccessibilityScrollView to hold a weak reference
to ScrollView instead.
Tests: platform/chromium/accessibility/is-ignored-change-sends-notification.html
platform/chromium/accessibility/other-aria-attribute-change-sends-notification.html
platform/chromium/accessibility/text-change-notification.html
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::focusedUIElementForPage):
(WebCore::AXObjectCache::getOrCreate):
(WebCore::AXObjectCache::textChanged):
(WebCore):
(WebCore::AXObjectCache::childrenChanged):
(WebCore::AXObjectCache::handleAriaRoleChanged):
(WebCore::AXObjectCache::handleAttributeChanged):
(WebCore::AXObjectCache::labelChanged):
(WebCore::AXObjectCache::recomputeIsIgnored):
* accessibility/AXObjectCache.h:
(AXObjectCache):
(WebCore::AXObjectCache::childrenChanged):
(WebCore::AXObjectCache::textChanged):
(WebCore::AXObjectCache::handleAttributeChanged):
(WebCore::AXObjectCache::recomputeIsIgnored):
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::insertChild):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::AccessibilityObject):
(WebCore::AccessibilityObject::cachedIsIgnoredValue):
(WebCore):
(WebCore::AccessibilityObject::setCachedIsIgnoredValue):
(WebCore::AccessibilityObject::notifyIfIgnoredValueChanged):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::textChanged):
(AccessibilityObject):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::accessibilityIsIgnored):
(WebCore::AccessibilityRenderObject::correspondingControlForLabelElement):
(WebCore::AccessibilityRenderObject::textChanged):
(WebCore::AccessibilityRenderObject::addHiddenChildren):
(WebCore::AccessibilityRenderObject::addChildren):
* accessibility/AccessibilityRenderObject.h:
(AccessibilityRenderObject):
* accessibility/AccessibilityScrollView.cpp:
(WebCore::AccessibilityScrollView::~AccessibilityScrollView):
(WebCore):
(WebCore::AccessibilityScrollView::detach):
(WebCore::AccessibilityScrollView::isAttachment):
(WebCore::AccessibilityScrollView::widgetForAttachmentView):
(WebCore::AccessibilityScrollView::updateScrollbars):
(WebCore::AccessibilityScrollView::webAreaObject):
(WebCore::AccessibilityScrollView::elementRect):
(WebCore::AccessibilityScrollView::documentFrameView):
(WebCore::AccessibilityScrollView::parentObject):
(WebCore::AccessibilityScrollView::parentObjectIfExists):
(WebCore::AccessibilityScrollView::getScrollableAreaIfScrollable):
(WebCore::AccessibilityScrollView::scrollTo):
* accessibility/AccessibilityScrollView.h:
(WebCore::AccessibilityScrollView::scrollView):
(AccessibilityScrollView):
* accessibility/AccessibilityTable.cpp:
(WebCore::AccessibilityTable::isDataTable):
* accessibility/chromium/AXObjectCacheChromium.cpp:
(WebCore::AXObjectCache::postPlatformNotification):
* dom/Element.cpp:
(WebCore::Element::attributeChanged):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::deleteLineBoxTree):
(WebCore::RenderBlock::createAndAppendRootInlineBox):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::styleWillChange):
* rendering/RenderText.cpp:
(WebCore::RenderText::setText):
Source/WebKit/chromium:
Adds new accessibility notifications.
* public/WebAccessibilityNotification.h:
* src/AssertMatchingEnums.cpp:
Tools:
Add additional accessibility notifications.
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::postAccessibilityNotification):
LayoutTests:
Adds 3 new test to ensure:
1. A "children changed" notification is fired on the parent object when an
object that was previously ignored becomes unignored.
2. A notification is sent when an element's text (incl. title or label) changes.
3. A notification is sent when another ARIA attribute changes.
Modifies add-to-menu-list-crashes because it was too brittle; it was
referencing a stale object rather than retrieving its latest handle.
Modifies aria-checkbox-sends-notification to listen on the correct
object on all platforms.
Simplifies notification-listeners so it doesn't generate additional
notifications that are inconsistent between platforms now.
* accessibility/aria-checkbox-sends-notification.html:
* accessibility/notification-listeners.html:
* platform/chromium/accessibility/add-to-menu-list-crashes-expected.txt:
* platform/chromium/accessibility/add-to-menu-list-crashes.html:
* platform/chromium/accessibility/is-ignored-change-sends-notification-expected.txt: Added.
* platform/chromium/accessibility/is-ignored-change-sends-notification.html: Added.
* platform/chromium/accessibility/other-aria-attribute-change-sends-notification-expected.txt: Added.
* platform/chromium/accessibility/other-aria-attribute-change-sends-notification.html: Added.
* platform/chromium/accessibility/text-change-notification-expected.txt: Added.
* platform/chromium/accessibility/text-change-notification.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/accessibility/AccessibilityScrollView.h b/Source/WebCore/accessibility/AccessibilityScrollView.h
index 9953164..4ff8a22 100644
--- a/Source/WebCore/accessibility/AccessibilityScrollView.h
+++ b/Source/WebCore/accessibility/AccessibilityScrollView.h
@@ -38,7 +38,10 @@
public:
static PassRefPtr<AccessibilityScrollView> create(ScrollView*);
virtual AccessibilityRole roleValue() const { return ScrollAreaRole; }
- ScrollView* scrollView() const { return m_scrollView.get(); }
+ ScrollView* scrollView() const { return m_scrollView; }
+
+ virtual ~AccessibilityScrollView();
+ virtual void detach();
protected:
virtual ScrollableArea* getScrollableAreaIfScrollable() const;
@@ -72,7 +75,7 @@
AccessibilityScrollbar* addChildScrollbar(Scrollbar*);
void removeChildScrollbar(AccessibilityObject*);
- RefPtr<ScrollView> m_scrollView;
+ ScrollView* m_scrollView;
RefPtr<AccessibilityObject> m_horizontalScrollbar;
RefPtr<AccessibilityObject> m_verticalScrollbar;
bool m_childrenDirty;