⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 100057 in webkit


Ignore:
Timestamp:
Nov 11, 2011, 6:23:09 PM (15 years ago)
Author:
dmazzoni@google.com
Message:

New iframe content may not be reflected in the ax tree.
https://bugs.webkit.org/show_bug.cgi?id=72100

Reviewed by Chris Fleizach.

Source/WebCore:

The core issue was that when childrenChanged was called on a
web area from an iframe that was just detached, it wasn't calling
childrenChanged on its parent scroll area, or that scroll area's
parent iframe element. To fix this, now AccessibilityScrollView
implements setNeedsToUpdateChildren and parentObjectIfExists,
and childrenChanged calls setNeedsToUpdateChildren on every object
in the parent chain, not just AccessibilityRenderObjects.

Test: accessibility/loading-iframe-updates-axtree.html

  • accessibility/AXObjectCache.h:
  • accessibility/AccessibilityObject.h:

(WebCore::AccessibilityObject::setNeedsToUpdateChildren):

  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::parentObjectIfExists):
(WebCore::AccessibilityRenderObject::childrenChanged):

  • accessibility/AccessibilityRenderObject.h:

(WebCore::AccessibilityRenderObject::setNeedsToUpdateChildren):

  • accessibility/AccessibilityScrollView.cpp:

(WebCore::AccessibilityScrollView::AccessibilityScrollView):
(WebCore::AccessibilityScrollView::updateChildrenIfNecessary):
(WebCore::AccessibilityScrollView::parentObject):
(WebCore::AccessibilityScrollView::parentObjectIfExists):

  • accessibility/AccessibilityScrollView.h:

(WebCore::AccessibilityScrollView::setNeedsToUpdateChildren):

LayoutTests:

Add new test that makes sure that if you explore the accessibility
tree of an iframe and that iframe subsequently loads new content,
the iframe AccessibilityObject's descendants are updated to point
to the new content, not the old content.

  • accessibility/loading-iframe-updates-axtree-expected.txt: Added.
  • accessibility/loading-iframe-updates-axtree.html: Added.
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r100051 r100057  
     12011-11-11  Dominic Mazzoni  <dmazzoni@google.com>
     2
     3        New iframe content may not be reflected in the ax tree.
     4        https://bugs.webkit.org/show_bug.cgi?id=72100
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Add new test that makes sure that if you explore the accessibility
     9        tree of an iframe and that iframe subsequently loads new content,
     10        the iframe AccessibilityObject's descendants are updated to point
     11        to the new content, not the old content.
     12
     13        * accessibility/loading-iframe-updates-axtree-expected.txt: Added.
     14        * accessibility/loading-iframe-updates-axtree.html: Added.
     15
    1162011-11-11  Julien Chaffraix  <jchaffraix@webkit.org>
    217
  • trunk/Source/WebCore/ChangeLog

    r100055 r100057  
     12011-11-11  Dominic Mazzoni  <dmazzoni@google.com>
     2
     3        New iframe content may not be reflected in the ax tree.
     4        https://bugs.webkit.org/show_bug.cgi?id=72100
     5
     6        Reviewed by Chris Fleizach.
     7
     8        The core issue was that when childrenChanged was called on a
     9        web area from an iframe that was just detached, it wasn't calling
     10        childrenChanged on its parent scroll area, or that scroll area's
     11        parent iframe element. To fix this, now AccessibilityScrollView
     12        implements setNeedsToUpdateChildren and parentObjectIfExists,
     13        and childrenChanged calls setNeedsToUpdateChildren on every object
     14        in the parent chain, not just AccessibilityRenderObjects.
     15
     16        Test: accessibility/loading-iframe-updates-axtree.html
     17
     18        * accessibility/AXObjectCache.h:
     19        * accessibility/AccessibilityObject.h:
     20        (WebCore::AccessibilityObject::setNeedsToUpdateChildren):
     21        * accessibility/AccessibilityRenderObject.cpp:
     22        (WebCore::AccessibilityRenderObject::parentObjectIfExists):
     23        (WebCore::AccessibilityRenderObject::childrenChanged):
     24        * accessibility/AccessibilityRenderObject.h:
     25        (WebCore::AccessibilityRenderObject::setNeedsToUpdateChildren):
     26        * accessibility/AccessibilityScrollView.cpp:
     27        (WebCore::AccessibilityScrollView::AccessibilityScrollView):
     28        (WebCore::AccessibilityScrollView::updateChildrenIfNecessary):
     29        (WebCore::AccessibilityScrollView::parentObject):
     30        (WebCore::AccessibilityScrollView::parentObjectIfExists):
     31        * accessibility/AccessibilityScrollView.h:
     32        (WebCore::AccessibilityScrollView::setNeedsToUpdateChildren):
     33
    1342011-11-11  Iain Merrick  <husky@google.com>
    235
  • trunk/Source/WebCore/accessibility/AXObjectCache.h

    r96343 r100057  
    7777    // will only return the AccessibilityObject if it already exists
    7878    AccessibilityObject* get(RenderObject*);
     79    AccessibilityObject* get(Widget*);
    7980   
    8081    void remove(RenderObject*);
     
    172173   
    173174    AXID getAXID(AccessibilityObject*);
    174     AccessibilityObject* get(Widget*);
    175175};
    176176
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r97755 r100057  
    565565    virtual bool hasChildren() const { return m_haveChildren; }
    566566    virtual void updateChildrenIfNecessary();
     567    virtual void setNeedsToUpdateChildren() { }
    567568    virtual void clearChildren();
    568569    virtual void detachFromParent() { }
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r99740 r100057  
    436436AccessibilityObject* AccessibilityRenderObject::parentObjectIfExists() const
    437437{
     438    // WebArea's parent should be the scroll view containing it.
     439    if (isWebArea())
     440        return axObjectCache()->get(m_renderer->frame()->view());
     441
    438442    return axObjectCache()->get(renderParentObject());
    439443}
     
    34033407        return;
    34043408
    3405     bool sentChildrenChanged = false;
    3406    
     3409    axObjectCache()->postNotification(this, document(), AXObjectCache::AXChildrenChanged, true);
     3410
    34073411    // Go up the accessibility parent chain, but only if the element already exists. This method is
    34083412    // called during render layouts, minimal work should be done.
     
    34103414    // At the same time, process ARIA live region changes.
    34113415    for (AccessibilityObject* parent = this; parent; parent = parent->parentObjectIfExists()) {
    3412         if (!parent->isAccessibilityRenderObject())
    3413             continue;
    3414        
    3415         AccessibilityRenderObject* axParent = toAccessibilityRenderObject(parent);
    3416        
    3417         // Send the children changed notification on the first accessibility render object ancestor.
    3418         if (!sentChildrenChanged) {
    3419             axObjectCache()->postNotification(axParent->renderer(), AXObjectCache::AXChildrenChanged, true);
    3420             sentChildrenChanged = true;
    3421         }
    3422        
    3423         axParent->setNeedsToUpdateChildren();
    3424        
     3416        parent->setNeedsToUpdateChildren();
     3417
    34253418        // These notifications always need to be sent because screenreaders are reliant on them to perform.
    34263419        // In other words, they need to be sent even when the screen reader has not accessed this live region since the last update.
    34273420
    34283421        // If this element supports ARIA live regions, then notify the AT of changes.
    3429         if (axParent->supportsARIALiveRegion())
    3430             axObjectCache()->postNotification(axParent->renderer(), AXObjectCache::AXLiveRegionChanged, true);
     3422        if (parent->supportsARIALiveRegion())
     3423            axObjectCache()->postNotification(parent, parent->document(), AXObjectCache::AXLiveRegionChanged, true);
    34313424       
    34323425        // If this element is an ARIA text control, notify the AT of changes.
    3433         if (axParent->isARIATextControl() && !axParent->isNativeTextControl() && !axParent->node()->isContentEditable())
    3434             axObjectCache()->postNotification(axParent->renderer(), AXObjectCache::AXValueChanged, true);
     3426        if (parent->isARIATextControl() && !parent->isNativeTextControl() && !parent->node()->isContentEditable())
     3427            axObjectCache()->postNotification(parent, parent->document(), AXObjectCache::AXValueChanged, true);
    34353428    }
    34363429}
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h

    r97769 r100057  
    262262    RenderObject* m_renderer;
    263263    AccessibilityRole m_ariaRole;
    264     mutable bool m_childrenDirty;
     264    bool m_childrenDirty;
    265265   
    266266    void setRenderObject(RenderObject* renderer) { m_renderer = renderer; }
     
    281281    Element* rootEditableElementForPosition(const Position&) const;
    282282    bool nodeIsTextControl(const Node*) const;
     283    virtual void setNeedsToUpdateChildren() { m_childrenDirty = true; }
    283284
    284285    Element* menuElementForMenuButton() const;
     
    321322   
    322323    bool inheritsPresentationalRole() const;
    323     void setNeedsToUpdateChildren() const { m_childrenDirty = true; }
    324324   
    325325    mutable AccessibilityRole m_roleForMSAA;
  • trunk/Source/WebCore/accessibility/AccessibilityScrollView.cpp

    r97629 r100057  
    4040AccessibilityScrollView::AccessibilityScrollView(ScrollView* view)
    4141    : m_scrollView(view)
     42    , m_childrenDirty(false)
    4243{
    4344}
     
    7576void AccessibilityScrollView::updateChildrenIfNecessary()
    7677{
     78    if (m_childrenDirty)
     79        clearChildren();
     80
    7781    if (!m_haveChildren)
    7882        addChildren();
     
    175179   
    176180    HTMLFrameOwnerElement* owner = static_cast<FrameView*>(m_scrollView.get())->frame()->ownerElement();
    177     if (owner && owner->renderPart())
    178         return axObjectCache()->getOrCreate(owner->renderPart()->parent());
     181    if (owner && owner->renderer())
     182        return axObjectCache()->getOrCreate(owner->renderer());
     183
     184    return 0;
     185}
     186   
     187AccessibilityObject* AccessibilityScrollView::parentObjectIfExists() const
     188{
     189    if (!m_scrollView->isFrameView())
     190        return 0;
     191   
     192    HTMLFrameOwnerElement* owner = static_cast<FrameView*>(m_scrollView.get())->frame()->ownerElement();
     193    if (owner && owner->renderer())
     194        return axObjectCache()->get(owner->renderer());
    179195   
    180196    return 0;
    181197}
    182    
     198
    183199} // namespace WebCore   
  • trunk/Source/WebCore/accessibility/AccessibilityScrollView.h

    r97629 r100057  
    5555    virtual AccessibilityObject* accessibilityHitTest(const LayoutPoint&) const;
    5656    virtual void updateChildrenIfNecessary();
     57    virtual void setNeedsToUpdateChildren() { m_childrenDirty = true; }
    5758    void updateScrollbars();
    5859   
     
    6061    virtual LayoutRect elementRect() const;
    6162    virtual AccessibilityObject* parentObject() const;
     63    virtual AccessibilityObject* parentObjectIfExists() const;
    6264   
    6365    AccessibilityObject* webAreaObject() const;
     
    6971    RefPtr<AccessibilityObject> m_horizontalScrollbar;
    7072    RefPtr<AccessibilityObject> m_verticalScrollbar;
     73    bool m_childrenDirty;
    7174};
    7275
Note: See TracChangeset for help on using the changeset viewer.