Changeset 132699 in webkit


Ignore:
Timestamp:
Oct 26, 2012 2:57:57 PM (11 years ago)
Author:
dmazzoni@google.com
Message:

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.
Location:
trunk
Files:
6 added
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r132696 r132699  
     12012-10-26  Dominic Mazzoni  <dmazzoni@google.com>
     2
     3        AX: Notification should be sent when accessibilityIsIgnored changes
     4        https://bugs.webkit.org/show_bug.cgi?id=99547
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Adds 3 new test to ensure:
     9        1. A "children changed" notification is fired on the parent object when an
     10           object that was previously ignored becomes unignored.
     11        2. A notification is sent when an element's text (incl. title or label) changes.
     12        3. A notification is sent when another ARIA attribute changes.
     13
     14        Modifies add-to-menu-list-crashes because it was too brittle; it was
     15            referencing a stale object rather than retrieving its latest handle.
     16        Modifies aria-checkbox-sends-notification to listen on the correct
     17            object on all platforms.
     18        Simplifies notification-listeners so it doesn't generate additional
     19            notifications that are inconsistent between platforms now.
     20
     21        * accessibility/aria-checkbox-sends-notification.html:
     22        * accessibility/notification-listeners.html:
     23        * platform/chromium/accessibility/add-to-menu-list-crashes-expected.txt:
     24        * platform/chromium/accessibility/add-to-menu-list-crashes.html:
     25        * platform/chromium/accessibility/is-ignored-change-sends-notification-expected.txt: Added.
     26        * platform/chromium/accessibility/is-ignored-change-sends-notification.html: Added.
     27        * platform/chromium/accessibility/other-aria-attribute-change-sends-notification-expected.txt: Added.
     28        * platform/chromium/accessibility/other-aria-attribute-change-sends-notification.html: Added.
     29        * platform/chromium/accessibility/text-change-notification-expected.txt: Added.
     30        * platform/chromium/accessibility/text-change-notification.html: Added.
     31
    1322012-10-26  Vincent Scheib  <scheib@chromium.org>
    233
  • trunk/LayoutTests/accessibility/aria-checkbox-sends-notification.html

    r132549 r132699  
    88
    99        description("This tests that checking of an aria checkbox sends a notification.");
    10         window.root = accessibilityController.rootElement;
    11         window.body = root.childAtIndex(0);
    1210
    13         var accessibleCheckbox = body.childAtIndex(0);
     11        var accessibleCheckbox = accessibilityController.accessibleElementById("checkbox1");
    1412        var notificationCount = 0;
    1513
    1614        function listener(notification) {
    17         if (notification == "CheckedStateChanged")
    18             notificationCount++;
     15            if (notification == "CheckedStateChanged")
     16                notificationCount++;
    1917
    2018            document.getElementById("console").innerText += "Got notification: " + notification + "\n";
  • trunk/LayoutTests/accessibility/notification-listeners.html

    r132549 r132699  
    88<p id="description"></p>
    99
    10 <select id="select" value="Select"><option>A<option>B</select>
     10<select id="select" value="Select"></select>
    1111
    1212<div id="slider" tabindex="0" role="slider" aria-valuenow="5">Slider</div>
  • trunk/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-ax-value-changed-notification-expected.txt

    r132549 r132699  
    88FocusedUIElementChanged AXHelp: Year=AXValueDescription: 2012
    99ValueChanged AXHelp: Day=AXValueDescription: 04
     10ValueChanged AXHelp: Day=AXValueDescription: 04
     11ValueChanged AXHelp: Year=AXValueDescription: 2013
    1012ValueChanged AXHelp: Year=AXValueDescription: 2013
    1113
  • trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-ax-value-changed-notification-expected.txt

    r132549 r132699  
    88ValueChanged AXHelp: Minutes=AXValueDescription: 05
    99ValueChanged AXHelp: Minutes=AXValueDescription: 05
     10ValueChanged AXHelp: Minutes=AXValueDescription: 05
     11ValueChanged AXHelp: Minutes=AXValueDescription: 05
    1012
    1113PASS successfullyParsed is true
  • trunk/LayoutTests/platform/chromium/accessibility/add-to-menu-list-crashes-expected.txt

    r132549 r132699  
    11This test makes sure that adding a selected option to a menu list via an unusual route (document.write from an external script) doesn't trigger a crash when didUpdateActiveOption is called before the children are updated.
    22
    3 PASS accessiblePopup.childrenCount is 1
    4 PASS accessiblePopup.childrenCount is 2
    5 PASS accessiblePopup.childrenCount is 1
     3PASS accessibleMenulist.childAtIndex(0).childrenCount is 1
     4PASS accessibleMenulist.childAtIndex(0).childrenCount is 2
     5PASS accessibleMenulist.childAtIndex(0).childrenCount is 1
    66PASS successfullyParsed is true
    77
  • trunk/LayoutTests/platform/chromium/accessibility/add-to-menu-list-crashes.html

    r132549 r132699  
    2020        if (window.testRunner && window.accessibilityController) {
    2121            window.accessibleMenulist = accessibilityController.focusedElement;
    22             window.accessiblePopup = accessibleMenulist.childAtIndex(0);
    23             shouldBe("accessiblePopup.childrenCount", "1");
     22            shouldBe("accessibleMenulist.childAtIndex(0).childrenCount", "1");
    2423        }
    2524    </script>
     
    2726    <script>
    2827        if (window.testRunner && window.accessibilityController)
    29             shouldBe("accessiblePopup.childrenCount", "2");
     28            shouldBe("accessibleMenulist.childAtIndex(0).childrenCount", "2");
    3029    </script>
    3130    <script>
    3231        menulist.removeChild(menulist.selectedOptions[0]);
    3332        if (window.testRunner && window.accessibilityController)
    34             shouldBe("accessiblePopup.childrenCount", "1");
     33            shouldBe("accessibleMenulist.childAtIndex(0).childrenCount", "1");
    3534    </script>
    3635</select>
  • trunk/Source/WebCore/ChangeLog

    r132698 r132699  
     12012-10-26  Dominic Mazzoni  <dmazzoni@google.com>
     2
     3        AX: Notification should be sent when accessibilityIsIgnored changes
     4        https://bugs.webkit.org/show_bug.cgi?id=99547
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Adds a new flag in AccessibilityObject that keeps track of the most recent
     9        value of accessibilityIsIgnored(). After certain events such as an ARIA
     10        attribute change or content change, checks the new value of
     11        accessibilityIsIgnored() and posts a "children changed" notification on the
     12        parent node if it changed, making sure the parent recomputes its vector of
     13        (unignored) children.
     14
     15        Also moves handling of attribute changes to AXObjectCache, and sends
     16        notifications for some attribute changes that were previously silent. On
     17        Chromium, all changes to an accessibility object's attributes should
     18        result in some notification.
     19
     20        Some tests would have broken because an AccessibilityScrollView was created
     21        and holding a reference to a ScrollView for an iframe after it was deleted,
     22        so this change switches AccessibilityScrollView to hold a weak reference
     23        to ScrollView instead.
     24
     25        Tests: platform/chromium/accessibility/is-ignored-change-sends-notification.html
     26               platform/chromium/accessibility/other-aria-attribute-change-sends-notification.html
     27               platform/chromium/accessibility/text-change-notification.html
     28
     29        * accessibility/AXObjectCache.cpp:
     30        (WebCore::AXObjectCache::focusedUIElementForPage):
     31        (WebCore::AXObjectCache::getOrCreate):
     32        (WebCore::AXObjectCache::textChanged):
     33        (WebCore):
     34        (WebCore::AXObjectCache::childrenChanged):
     35        (WebCore::AXObjectCache::handleAriaRoleChanged):
     36        (WebCore::AXObjectCache::handleAttributeChanged):
     37        (WebCore::AXObjectCache::labelChanged):
     38        (WebCore::AXObjectCache::recomputeIsIgnored):
     39        * accessibility/AXObjectCache.h:
     40        (AXObjectCache):
     41        (WebCore::AXObjectCache::childrenChanged):
     42        (WebCore::AXObjectCache::textChanged):
     43        (WebCore::AXObjectCache::handleAttributeChanged):
     44        (WebCore::AXObjectCache::recomputeIsIgnored):
     45        * accessibility/AccessibilityNodeObject.cpp:
     46        (WebCore::AccessibilityNodeObject::insertChild):
     47        * accessibility/AccessibilityObject.cpp:
     48        (WebCore::AccessibilityObject::AccessibilityObject):
     49        (WebCore::AccessibilityObject::cachedIsIgnoredValue):
     50        (WebCore):
     51        (WebCore::AccessibilityObject::setCachedIsIgnoredValue):
     52        (WebCore::AccessibilityObject::notifyIfIgnoredValueChanged):
     53        * accessibility/AccessibilityObject.h:
     54        (WebCore::AccessibilityObject::textChanged):
     55        (AccessibilityObject):
     56        * accessibility/AccessibilityRenderObject.cpp:
     57        (WebCore::AccessibilityRenderObject::accessibilityIsIgnored):
     58        (WebCore::AccessibilityRenderObject::correspondingControlForLabelElement):
     59        (WebCore::AccessibilityRenderObject::textChanged):
     60        (WebCore::AccessibilityRenderObject::addHiddenChildren):
     61        (WebCore::AccessibilityRenderObject::addChildren):
     62        * accessibility/AccessibilityRenderObject.h:
     63        (AccessibilityRenderObject):
     64        * accessibility/AccessibilityScrollView.cpp:
     65        (WebCore::AccessibilityScrollView::~AccessibilityScrollView):
     66        (WebCore):
     67        (WebCore::AccessibilityScrollView::detach):
     68        (WebCore::AccessibilityScrollView::isAttachment):
     69        (WebCore::AccessibilityScrollView::widgetForAttachmentView):
     70        (WebCore::AccessibilityScrollView::updateScrollbars):
     71        (WebCore::AccessibilityScrollView::webAreaObject):
     72        (WebCore::AccessibilityScrollView::elementRect):
     73        (WebCore::AccessibilityScrollView::documentFrameView):
     74        (WebCore::AccessibilityScrollView::parentObject):
     75        (WebCore::AccessibilityScrollView::parentObjectIfExists):
     76        (WebCore::AccessibilityScrollView::getScrollableAreaIfScrollable):
     77        (WebCore::AccessibilityScrollView::scrollTo):
     78        * accessibility/AccessibilityScrollView.h:
     79        (WebCore::AccessibilityScrollView::scrollView):
     80        (AccessibilityScrollView):
     81        * accessibility/AccessibilityTable.cpp:
     82        (WebCore::AccessibilityTable::isDataTable):
     83        * accessibility/chromium/AXObjectCacheChromium.cpp:
     84        (WebCore::AXObjectCache::postPlatformNotification):
     85        * dom/Element.cpp:
     86        (WebCore::Element::attributeChanged):
     87        * rendering/RenderBlock.cpp:
     88        (WebCore::RenderBlock::deleteLineBoxTree):
     89        (WebCore::RenderBlock::createAndAppendRootInlineBox):
     90        * rendering/RenderObject.cpp:
     91        (WebCore::RenderObject::styleWillChange):
     92        * rendering/RenderText.cpp:
     93        (WebCore::RenderText::setText):
     94
    1952012-10-26  Joshua Bell  <jsbell@chromium.org>
    296
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r132549 r132699  
    6161#include "HTMLImageElement.h"
    6262#include "HTMLInputElement.h"
     63#include "HTMLLabelElement.h"
    6364#include "HTMLNames.h"
    6465#if ENABLE(VIDEO)
     
    334335    m_objects.set(newObj->axObjectID(), newObj);
    335336    attachWrapper(newObj.get());
     337
     338    newObj->setCachedIsIgnoredValue(newObj->accessibilityIsIgnored());
     339
    336340    return newObj.get();
    337341}
     
    352356    m_objects.set(newObj->axObjectID(), newObj);
    353357    attachWrapper(newObj.get());
     358
     359    newObj->setCachedIsIgnoredValue(newObj->accessibilityIsIgnored());
     360
    354361    return newObj.get();
    355362}
     
    528535}
    529536
    530 void AXObjectCache::contentChanged(Node* node)
    531 {
    532     if (AccessibilityObject* object = getOrCreate(node))
    533         object->contentChanged();
    534 }
    535 
    536 void AXObjectCache::contentChanged(RenderObject* renderer)
    537 {
    538     if (AccessibilityObject* object = getOrCreate(renderer))
    539         object->contentChanged();
     537void AXObjectCache::textChanged(Node* node)
     538{
     539    textChanged(getOrCreate(node));
     540}
     541
     542void AXObjectCache::textChanged(RenderObject* renderer)
     543{
     544    textChanged(getOrCreate(renderer));
     545}
     546
     547void AXObjectCache::textChanged(AccessibilityObject* obj)
     548{
     549    if (!obj)
     550        return;
     551
     552    bool parentAlreadyExists = obj->parentObjectIfExists();
     553    obj->textChanged();
     554    postNotification(obj, obj->document(), AXObjectCache::AXTextChanged, true);
     555    if (parentAlreadyExists)
     556        obj->notifyIfIgnoredValueChanged();
    540557}
    541558
     
    549566void AXObjectCache::childrenChanged(Node* node)
    550567{
    551     if (AccessibilityObject* obj = get(node))
    552         obj->childrenChanged();
     568    childrenChanged(get(node));
    553569}
    554570
    555571void AXObjectCache::childrenChanged(RenderObject* renderer)
    556572{
    557     if (AccessibilityObject* obj = get(renderer))
    558         obj->childrenChanged();
     573    childrenChanged(get(renderer));
     574}
     575
     576void AXObjectCache::childrenChanged(AccessibilityObject* obj)
     577{
     578    if (!obj)
     579        return;
     580
     581    obj->childrenChanged();
     582
     583    if (obj->parentObjectIfExists() && obj->cachedIsIgnoredValue() != obj->accessibilityIsIgnored())
     584        childrenChanged(obj->parentObject());
    559585}
    560586   
     
    707733void AXObjectCache::handleAriaRoleChanged(Node* node)
    708734{
    709     if (AccessibilityObject* obj = getOrCreate(node))
     735    if (AccessibilityObject* obj = getOrCreate(node)) {
    710736        obj->updateAccessibilityRole();
     737        obj->notifyIfIgnoredValueChanged();
     738    }
     739}
     740
     741void AXObjectCache::handleAttributeChanged(const QualifiedName& attrName, Element* element)
     742{
     743    if (attrName == roleAttr)
     744        handleAriaRoleChanged(element);
     745    else if (attrName == altAttr || attrName == titleAttr)
     746        textChanged(element);
     747    else if (attrName == forAttr && element->hasTagName(labelTag))
     748        labelChanged(element);
     749
     750    if (!attrName.localName().string().startsWith("aria-"))
     751        return;
     752
     753    if (attrName == aria_activedescendantAttr)
     754        handleActiveDescendantChanged(element);
     755    else if (attrName == aria_valuenowAttr || attrName == aria_valuetextAttr)
     756        postNotification(element, AXObjectCache::AXValueChanged, true);
     757    else if (attrName == aria_labelAttr || attrName == aria_labeledbyAttr || attrName == aria_labelledbyAttr)
     758        textChanged(element);
     759    else if (attrName == aria_checkedAttr)
     760        checkedStateChanged(element);
     761    else if (attrName == aria_selectedAttr)
     762        selectedChildrenChanged(element);
     763    else if (attrName == aria_expandedAttr)
     764        handleAriaExpandedChange(element);
     765    else if (attrName == aria_hiddenAttr)
     766        childrenChanged(element->parentNode());
     767    else if (attrName == aria_invalidAttr)
     768        postNotification(element, AXObjectCache::AXInvalidStatusChanged, true);
     769    else
     770        postNotification(element, AXObjectCache::AXAriaAttributeChanged, true);
     771}
     772
     773void AXObjectCache::labelChanged(Element* element)
     774{
     775    ASSERT(element->hasTagName(labelTag));
     776    HTMLElement* correspondingControl = static_cast<HTMLLabelElement*>(element)->control();
     777    textChanged(correspondingControl);
     778}
     779
     780void AXObjectCache::recomputeIsIgnored(RenderObject* renderer)
     781{
     782    if (AccessibilityObject* obj = get(renderer))
     783        obj->notifyIfIgnoredValueChanged();
    711784}
    712785
  • trunk/Source/WebCore/accessibility/AXObjectCache.h

    r132549 r132699  
    9090    void childrenChanged(Node*);
    9191    void childrenChanged(RenderObject*);
     92    void childrenChanged(AccessibilityObject*);
    9293    void checkedStateChanged(Node*);
    9394    void selectedChildrenChanged(Node*);
    9495    void selectedChildrenChanged(RenderObject*);
    9596    // Called by a node when text or a text equivalent (e.g. alt) attribute is changed.
    96     void contentChanged(Node*);
    97     void contentChanged(RenderObject*);
     97    void textChanged(Node*);
     98    void textChanged(RenderObject*);
    9899    // Called when a node has just been attached, so we can make sure we have the right subclass of AccessibilityObject.
    99100    void updateCacheAfterNodeIsAttached(Node*);
     
    105106    void handleAriaExpandedChange(Node*);
    106107    void handleScrollbarUpdate(ScrollView*);
     108
     109    void handleAttributeChanged(const QualifiedName& attrName, Element*);
     110    void recomputeIsIgnored(RenderObject* renderer);
    107111
    108112#if HAVE(ACCESSIBILITY)
     
    153157        AXRowExpanded,
    154158        AXInvalidStatusChanged,
     159        AXTextChanged,
     160        AXAriaAttributeChanged
    155161    };
    156162
     
    181187    void nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned offset, const String&);
    182188    void frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent);
     189    void textChanged(AccessibilityObject*);
     190    void labelChanged(Element*);
    183191
    184192    // This is a weak reference cache for knowing if Nodes used by TextMarkers are valid.
     
    233241inline void AXObjectCache::childrenChanged(RenderObject*) { }
    234242inline void AXObjectCache::childrenChanged(Node*) { }
    235 inline void AXObjectCache::contentChanged(RenderObject*) { }
    236 inline void AXObjectCache::contentChanged(Node*) { }
     243inline void AXObjectCache::childrenChanged(AccessibilityObject*) { }
     244inline void AXObjectCache::textChanged(RenderObject*) { }
     245inline void AXObjectCache::textChanged(Node*) { }
     246inline void AXObjectCache::textChanged(AccessibilityObject*) { }
    237247inline void AXObjectCache::updateCacheAfterNodeIsAttached(Node*) { }
    238248inline void AXObjectCache::detachWrapper(AccessibilityObject*) { }
     
    244254inline void AXObjectCache::handleFocusedUIElementChanged(Node*, Node*) { }
    245255inline void AXObjectCache::handleScrollbarUpdate(ScrollView*) { }
     256inline void AXObjectCache::handleAttributeChanged(const QualifiedName&, Element*) { }
     257inline void AXObjectCache::recomputeIsIgnored(RenderObject*) { }
    246258inline void AXObjectCache::handleScrolledToAnchor(const Node*) { }
    247259inline void AXObjectCache::nodeTextChangeNotification(Node*, AXTextChange, unsigned, const String&) { }
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r132549 r132699  
    7373    , m_haveChildren(false)
    7474    , m_role(UnknownRole)
     75    , m_cachedIsIgnoredValue(DefaultBehavior)
    7576#if PLATFORM(GTK)
    7677    , m_wrapper(0)
     
    17711772}
    17721773
     1774bool AccessibilityObject::cachedIsIgnoredValue()
     1775{
     1776    if (m_cachedIsIgnoredValue == DefaultBehavior)
     1777        m_cachedIsIgnoredValue = accessibilityIsIgnored() ? IgnoreObject : IncludeObject;
     1778
     1779    return m_cachedIsIgnoredValue == IgnoreObject;
     1780}
     1781
     1782void AccessibilityObject::setCachedIsIgnoredValue(bool isIgnored)
     1783{
     1784    m_cachedIsIgnoredValue = isIgnored ? IgnoreObject : IncludeObject;
     1785}
     1786
     1787void AccessibilityObject::notifyIfIgnoredValueChanged()
     1788{
     1789    bool isIgnored = accessibilityIsIgnored();
     1790    if (cachedIsIgnoredValue() != isIgnored) {
     1791        axObjectCache()->childrenChanged(parentObject());
     1792        setCachedIsIgnoredValue(isIgnored);
     1793    }
     1794}
     1795
    17731796bool AccessibilityObject::ariaPressedIsPresent() const
    17741797{
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r132549 r132699  
    611611
    612612    virtual void childrenChanged() { }
    613     virtual void contentChanged() { }
     613    virtual void textChanged() { }
    614614    virtual void updateAccessibilityRole() { }
    615615    const AccessibilityChildrenVector& children();
     
    730730    virtual void scrollToGlobalPoint(const IntPoint&) const;
    731731
     732    bool cachedIsIgnoredValue();
     733    void setCachedIsIgnoredValue(bool);
     734
     735    // Fires a children changed notification on the parent if the isIgnored value changed.
     736    void notifyIfIgnoredValueChanged();
     737
    732738#if HAVE(ACCESSIBILITY)
    733739#if PLATFORM(GTK)
     
    768774    mutable bool m_haveChildren;
    769775    AccessibilityRole m_role;
     776    AccessibilityObjectInclusion m_cachedIsIgnoredValue;
    770777   
    771778    // If this object itself scrolls, return its ScrollableArea.
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r132549 r132699  
    10951095    if (m_renderer->isText()) {
    10961096        // static text beneath MenuItems and MenuButtons are just reported along with the menu item, so it's ignored on an individual level
    1097         if (parentObjectUnignored()->ariaRoleAttribute() == MenuItemRole
    1098             || parentObjectUnignored()->ariaRoleAttribute() == MenuButtonRole)
     1097        AccessibilityObject* parent = parentObjectUnignored();
     1098        if (parent && (parent->ariaRoleAttribute() == MenuItemRole || parent->ariaRoleAttribute() == MenuButtonRole))
    10991099            return true;
    11001100        RenderText* renderText = toRenderText(m_renderer);
     
    22132213    if (!correspondingControl)
    22142214        return 0;
     2215
     2216    // Make sure the corresponding control isn't a descendant of this label that's in the middle of being destroyed.
     2217    if (correspondingControl->renderer() && !correspondingControl->renderer()->parent())
     2218        return 0;
    22152219   
    22162220    return axObjectCache()->getOrCreate(correspondingControl);     
     
    25292533}
    25302534
    2531 void AccessibilityRenderObject::contentChanged()
     2535void AccessibilityRenderObject::textChanged()
    25322536{
    25332537    // If this element supports ARIA live regions, or is part of a region with an ARIA editable role,
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h

    r132549 r132699  
    166166   
    167167    virtual void detach();
    168     virtual void contentChanged();
     168    virtual void textChanged();
    169169    virtual void addChildren();
    170170    virtual bool canHaveChildren() const;
  • trunk/Source/WebCore/accessibility/AccessibilityScrollView.cpp

    r132549 r132699  
    4444}
    4545
     46AccessibilityScrollView::~AccessibilityScrollView()
     47{
     48    ASSERT(isDetached());
     49}
     50
     51void AccessibilityScrollView::detach()
     52{
     53    AccessibilityObject::detach();
     54    m_scrollView = 0;
     55}
     56
    4657PassRefPtr<AccessibilityScrollView> AccessibilityScrollView::create(ScrollView* view)
    4758{
     
    6879bool AccessibilityScrollView::isAttachment() const
    6980{
    70     return m_scrollView->platformWidget();
     81    return m_scrollView && m_scrollView->platformWidget();
    7182}
    7283
    7384Widget* AccessibilityScrollView::widgetForAttachmentView() const
    7485{
    75     return m_scrollView.get();
     86    return m_scrollView;
    7687}
    7788   
     
    89100void AccessibilityScrollView::updateScrollbars()
    90101{
     102    if (!m_scrollView)
     103        return;
     104
    91105    if (m_scrollView->horizontalScrollbar() && !m_horizontalScrollbar)
    92106        m_horizontalScrollbar = addChildScrollbar(m_scrollView->horizontalScrollbar());
     
    154168AccessibilityObject* AccessibilityScrollView::webAreaObject() const
    155169{
    156     if (!m_scrollView->isFrameView())
    157         return 0;
    158    
    159     Document* doc = static_cast<FrameView*>(m_scrollView.get())->frame()->document();
     170    if (!m_scrollView || !m_scrollView->isFrameView())
     171        return 0;
     172   
     173    Document* doc = static_cast<FrameView*>(m_scrollView)->frame()->document();
    160174    if (!doc || !doc->renderer())
    161175        return 0;
     
    180194LayoutRect AccessibilityScrollView::elementRect() const
    181195{
     196    if (!m_scrollView)
     197        return LayoutRect();
     198
    182199    return m_scrollView->frameRect();
    183200}
     
    185202FrameView* AccessibilityScrollView::documentFrameView() const
    186203{
    187     if (!m_scrollView->isFrameView())
    188         return 0;
    189    
    190     return static_cast<FrameView*>(m_scrollView.get());
     204    if (!m_scrollView || !m_scrollView->isFrameView())
     205        return 0;
     206   
     207    return static_cast<FrameView*>(m_scrollView);
    191208}   
    192209
    193210AccessibilityObject* AccessibilityScrollView::parentObject() const
    194211{
    195     if (!m_scrollView->isFrameView())
    196         return 0;
    197    
    198     HTMLFrameOwnerElement* owner = static_cast<FrameView*>(m_scrollView.get())->frame()->ownerElement();
     212    if (!m_scrollView || !m_scrollView->isFrameView())
     213        return 0;
     214   
     215    HTMLFrameOwnerElement* owner = static_cast<FrameView*>(m_scrollView)->frame()->ownerElement();
    199216    if (owner && owner->renderer())
    200217        return axObjectCache()->getOrCreate(owner);
     
    205222AccessibilityObject* AccessibilityScrollView::parentObjectIfExists() const
    206223{
    207     if (!m_scrollView->isFrameView())
    208         return 0;
    209    
    210     HTMLFrameOwnerElement* owner = static_cast<FrameView*>(m_scrollView.get())->frame()->ownerElement();
     224    if (!m_scrollView || !m_scrollView->isFrameView())
     225        return 0;
     226   
     227    HTMLFrameOwnerElement* owner = static_cast<FrameView*>(m_scrollView)->frame()->ownerElement();
    211228    if (owner && owner->renderer())
    212229        return axObjectCache()->get(owner);
     
    217234ScrollableArea* AccessibilityScrollView::getScrollableAreaIfScrollable() const
    218235{
    219     return m_scrollView.get();
     236    return m_scrollView;
    220237}
    221238
    222239void AccessibilityScrollView::scrollTo(const IntPoint& point) const
    223240{
    224     m_scrollView->setScrollPosition(point);
     241    if (m_scrollView)
     242        m_scrollView->setScrollPosition(point);
    225243}
    226244
  • trunk/Source/WebCore/accessibility/AccessibilityScrollView.h

    r132549 r132699  
    3939    static PassRefPtr<AccessibilityScrollView> create(ScrollView*);   
    4040    virtual AccessibilityRole roleValue() const { return ScrollAreaRole; }
    41     ScrollView* scrollView() const { return m_scrollView.get(); }
     41    ScrollView* scrollView() const { return m_scrollView; }
     42
     43    virtual ~AccessibilityScrollView();
     44    virtual void detach();
    4245
    4346protected:
     
    7376    void removeChildScrollbar(AccessibilityObject*);
    7477   
    75     RefPtr<ScrollView> m_scrollView;
     78    ScrollView* m_scrollView;
    7679    RefPtr<AccessibilityObject> m_horizontalScrollbar;
    7780    RefPtr<AccessibilityObject> m_verticalScrollbar;
  • trunk/Source/WebCore/accessibility/AccessibilityTable.cpp

    r132549 r132699  
    131131    // go through the cell's and check for tell-tale signs of "data" table status
    132132    // cells have borders, or use attributes like headers, abbr, scope or axis
     133    table->recalcSectionsIfNeeded();
    133134    RenderTableSection* firstBody = table->firstBody();
    134135    if (!firstBody)
  • trunk/Source/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp

    r132549 r132699  
    8383        handleFocusedUIElementChanged(0, obj->document()->focusedNode());
    8484        break;
     85    case AXAriaAttributeChanged:
    8586    case AXAutocorrectionOccured:
    8687    case AXCheckedStateChanged:
    8788    case AXChildrenChanged:
    8889    case AXFocusedUIElementChanged:
     90    case AXInvalidStatusChanged:
    8991    case AXLayoutComplete:
    9092    case AXLiveRegionChanged:
     
    98100    case AXSelectedChildrenChanged:
    99101    case AXSelectedTextChanged:
     102    case AXTextChanged:
    100103    case AXValueChanged:
    101     case AXInvalidStatusChanged:
    102104        break;
    103105    }
  • trunk/Source/WebCore/dom/Element.cpp

    r132684 r132699  
    729729    invalidateNodeListCachesInAncestors(&name, this);
    730730
    731     if (!AXObjectCache::accessibilityEnabled())
    732         return;
    733 
    734     if (name == aria_activedescendantAttr) {
    735         // any change to aria-activedescendant attribute triggers accessibility focus change, but document focus remains intact
    736         document()->axObjectCache()->handleActiveDescendantChanged(this);
    737     } else if (name == roleAttr) {
    738         // the role attribute can change at any time, and the AccessibilityObject must pick up these changes
    739         document()->axObjectCache()->handleAriaRoleChanged(this);
    740     } else if (name == aria_valuenowAttr) {
    741         // If the valuenow attribute changes, AX clients need to be notified.
    742         document()->axObjectCache()->postNotification(this, AXObjectCache::AXValueChanged, true);
    743     } else if (name == aria_labelAttr || name == aria_labeledbyAttr || name == altAttr || name == titleAttr) {
    744         // If the content of an element changes due to an attribute change, notify accessibility.
    745         document()->axObjectCache()->contentChanged(this);
    746     } else if (name == aria_checkedAttr)
    747         document()->axObjectCache()->checkedStateChanged(this);
    748     else if (name == aria_selectedAttr)
    749         document()->axObjectCache()->selectedChildrenChanged(this);
    750     else if (name == aria_expandedAttr)
    751         document()->axObjectCache()->handleAriaExpandedChange(this);
    752     else if (name == aria_hiddenAttr)
    753         document()->axObjectCache()->childrenChanged(this);
    754     else if (name == aria_invalidAttr)
    755         document()->axObjectCache()->postNotification(this, AXObjectCache::AXInvalidStatusChanged, true);
     731    if (AXObjectCache::accessibilityEnabled())
     732        document()->axObjectCache()->handleAttributeChanged(name, this);
    756733}
    757734
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r132696 r132699  
    2525#include "RenderBlock.h"
    2626
     27#include "AXObjectCache.h"
    2728#include "ColumnInfo.h"
    2829#include "Document.h"
     
    10121013    }
    10131014    m_lineBoxes.deleteLineBoxTree(renderArena());
     1015    if (UNLIKELY(AXObjectCache::accessibilityEnabled()))
     1016        document()->axObjectCache()->recomputeIsIgnored(this);
    10141017}
    10151018
     
    10231026    RootInlineBox* rootBox = createRootInlineBox();
    10241027    m_lineBoxes.appendLineBox(rootBox);
     1028
     1029    if (UNLIKELY(AXObjectCache::accessibilityEnabled()) && m_lineBoxes.firstLineBox() == rootBox)
     1030        document()->axObjectCache()->recomputeIsIgnored(this);
     1031
    10251032    return rootBox;
    10261033}
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r132591 r132699  
    18301830#endif
    18311831            if (visibilityChanged && AXObjectCache::accessibilityEnabled())
    1832                 document()->axObjectCache()->childrenChanged(this);
     1832                document()->axObjectCache()->childrenChanged(parent());
    18331833
    18341834            // Keep layer hierarchy visibility bits up to date if visibility changes.
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r132549 r132699  
    14671467    AXObjectCache* axObjectCache = document()->axObjectCache();
    14681468    if (axObjectCache->accessibilityEnabled())
    1469         axObjectCache->contentChanged(this);
     1469        axObjectCache->textChanged(this);
    14701470}
    14711471
  • trunk/Source/WebKit/chromium/ChangeLog

    r132600 r132699  
     12012-10-26  Dominic Mazzoni  <dmazzoni@google.com>
     2
     3        AX: Notification should be sent when accessibilityIsIgnored changes
     4        https://bugs.webkit.org/show_bug.cgi?id=99547
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Adds new accessibility notifications.
     9
     10        * public/WebAccessibilityNotification.h:
     11        * src/AssertMatchingEnums.cpp:
     12
    1132012-10-26  Thiago Marcos P. Santos  <thiago.santos@intel.com>
    214
  • trunk/Source/WebKit/chromium/public/WebAccessibilityNotification.h

    r132549 r132699  
    5555    WebAccessibilityNotificationRowExpanded,
    5656    WebAccessibilityNotificationInvalidStatusChanged,
    57 
    58     // FIXME: now that we're using AssertMatchingEnums, we don't need a
    59     // catch-all "invalid" notification enum. Remove this once it's been
    60     // removed from Chromium.
    61     WebAccessibilityNotificationInvalid,
     57    WebAccessibilityNotificationTextChanged,
     58    WebAccessibilityNotificationAriaAttributeChanged
    6259};
    6360
  • trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp

    r132549 r132699  
    154154COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityNotificationRowExpanded, AXObjectCache::AXRowExpanded);
    155155COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityNotificationInvalidStatusChanged, AXObjectCache::AXInvalidStatusChanged);
     156COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityNotificationTextChanged, AXObjectCache::AXTextChanged);
     157COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityNotificationAriaAttributeChanged, AXObjectCache::AXAriaAttributeChanged);
    156158
    157159COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleUnknown, UnknownRole);
  • trunk/Tools/ChangeLog

    r132690 r132699  
     12012-10-26  Dominic Mazzoni  <dmazzoni@google.com>
     2
     3        AX: Notification should be sent when accessibilityIsIgnored changes
     4        https://bugs.webkit.org/show_bug.cgi?id=99547
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Add additional accessibility notifications.
     9
     10        * DumpRenderTree/chromium/WebViewHost.cpp:
     11        (WebViewHost::postAccessibilityNotification):
     12
    1132012-10-25  Roger Fong  <roger_fong@apple.com>
    214
  • trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp

    r132597 r132699  
    697697        notificationName = "InvalidStatusChanged";
    698698        break;
     699    case WebAccessibilityNotificationTextChanged:
     700        notificationName = "TextChanged";
     701        break;
     702    case WebAccessibilityNotificationAriaAttributeChanged:
     703        notificationName = "AriaAttributeChanged";
     704        break;
    699705    default:
    700706        notificationName = "UnknownNotification";
Note: See TracChangeset for help on using the changeset viewer.