Changeset 131947 in webkit


Ignore:
Timestamp:
Oct 19, 2012 2:59:04 PM (12 years ago)
Author:
Csaba Osztrogonác
Message:

Unreviewed, rolling out r131915.
http://trac.webkit.org/changeset/131915
https://bugs.webkit.org/show_bug.cgi?id=98787

It broke the build on platforms with \!HAVE(ACCESSIBILITY)

Source/WebCore:

  • accessibility/AXObjectCache.cpp:

(WebCore::AXObjectCache::getOrCreate):
(WebCore::AXObjectCache::nodeIsTextControl):

  • accessibility/AXObjectCache.h:

(WebCore):

  • accessibility/AccessibilityARIAGrid.cpp:

(WebCore::AccessibilityARIAGrid::addChild):
(WebCore::AccessibilityARIAGrid::addChildren):

  • accessibility/AccessibilityARIAGrid.h:

(AccessibilityARIAGrid):

  • accessibility/AccessibilityNodeObject.cpp:

(WebCore::AccessibilityNodeObject::elementRect):
(WebCore::AccessibilityNodeObject::addChildren):
(WebCore::AccessibilityNodeObject::textUnderElement):

  • accessibility/AccessibilityNodeObject.h:

(AccessibilityNodeObject):

  • accessibility/AccessibilityObject.cpp:
  • accessibility/AccessibilityObject.h:

(AccessibilityObject):

  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::textIteratorBehaviorForTextRange):
(WebCore):
(WebCore::AccessibilityRenderObject::accessibilityIsIgnoredBase):
(WebCore::AccessibilityRenderObject::addChildren):

  • accessibility/AccessibilityRenderObject.h:

(AccessibilityRenderObject):

LayoutTests:

  • accessibility/aria-hidden-negates-no-visibility.html: Removed.
  • platform/chromium/TestExpectations:
  • platform/mac/accessibility/aria-hidden-negates-no-visibility-expected.txt: Removed.
Location:
trunk
Files:
2 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r131943 r131947  
     12012-10-19  Csaba Osztrogonác  <ossy@webkit.org>
     2
     3        Unreviewed, rolling out r131915.
     4        http://trac.webkit.org/changeset/131915
     5        https://bugs.webkit.org/show_bug.cgi?id=98787
     6
     7        It broke the build on platforms with \!HAVE(ACCESSIBILITY)
     8
     9        * accessibility/aria-hidden-negates-no-visibility.html: Removed.
     10        * platform/chromium/TestExpectations:
     11        * platform/mac/accessibility/aria-hidden-negates-no-visibility-expected.txt: Removed.
     12
    1132012-10-19  Emil A Eklund  <eae@chromium.org>
    214
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r131933 r131947  
    14231423
    14241424webkit.org/b/73912 accessibility/aria-checkbox-sends-notification.html [ Failure Pass ]
    1425 webkit.org/b/98787 accessibility/aria-hidden-negates-no-visibility.html [ Skip ]
    14261425
    14271426# -----------------------------------------------------------------
  • trunk/Source/WebCore/ChangeLog

    r131946 r131947  
     12012-10-19  Csaba Osztrogonác  <ossy@webkit.org>
     2
     3        Unreviewed, rolling out r131915.
     4        http://trac.webkit.org/changeset/131915
     5        https://bugs.webkit.org/show_bug.cgi?id=98787
     6
     7        It broke the build on platforms with \!HAVE(ACCESSIBILITY)
     8
     9        * accessibility/AXObjectCache.cpp:
     10        (WebCore::AXObjectCache::getOrCreate):
     11        (WebCore::AXObjectCache::nodeIsTextControl):
     12        * accessibility/AXObjectCache.h:
     13        (WebCore):
     14        * accessibility/AccessibilityARIAGrid.cpp:
     15        (WebCore::AccessibilityARIAGrid::addChild):
     16        (WebCore::AccessibilityARIAGrid::addChildren):
     17        * accessibility/AccessibilityARIAGrid.h:
     18        (AccessibilityARIAGrid):
     19        * accessibility/AccessibilityNodeObject.cpp:
     20        (WebCore::AccessibilityNodeObject::elementRect):
     21        (WebCore::AccessibilityNodeObject::addChildren):
     22        (WebCore::AccessibilityNodeObject::textUnderElement):
     23        * accessibility/AccessibilityNodeObject.h:
     24        (AccessibilityNodeObject):
     25        * accessibility/AccessibilityObject.cpp:
     26        * accessibility/AccessibilityObject.h:
     27        (AccessibilityObject):
     28        * accessibility/AccessibilityRenderObject.cpp:
     29        (WebCore::textIteratorBehaviorForTextRange):
     30        (WebCore):
     31        (WebCore::AccessibilityRenderObject::accessibilityIsIgnoredBase):
     32        (WebCore::AccessibilityRenderObject::addChildren):
     33        * accessibility/AccessibilityRenderObject.h:
     34        (AccessibilityRenderObject):
     35
    1362012-10-19  Tony Chang  <tony@chromium.org>
    237
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r131915 r131947  
    317317        return getOrCreate(node->renderer());
    318318
    319     if (!node->parentElement())
    320         return 0;
    321    
    322319    // It's only allowed to create an AccessibilityObject from a Node if it's in a canvas subtree.
    323     // Or if it's a hidden element, but we still want to expose it because of other ARIA attributes.
    324     bool inCanvasSubtree = node->parentElement()->isInCanvasSubtree();
    325     bool isHidden = !node->renderer() && isNodeAriaVisible(node);
    326     if (!inCanvasSubtree && !isHidden)
     320    if (!node->parentElement() || !node->parentElement()->isInCanvasSubtree())
    327321        return 0;
    328322
     
    790784    return axObject && axObject->isTextControl();
    791785}
    792    
    793 bool isNodeAriaVisible(Node* node)
    794 {
    795     if (!node)
    796         return false;
    797    
    798     if (!node->isElementNode())
    799         return false;
    800    
    801     return equalIgnoringCase(toElement(node)->getAttribute(aria_hiddenAttr), "false");
    802 }
    803786
    804787} // namespace WebCore
  • trunk/Source/WebCore/accessibility/AXObjectCache.h

    r131915 r131947  
    209209
    210210bool nodeHasRole(Node*, const String& role);
    211 // This will let you know if aria-hidden was explicitly set to false.
    212 bool isNodeAriaVisible(Node*);
    213    
     211
    214212#if !HAVE(ACCESSIBILITY)
    215213inline AXObjectCache::AXObjectCache(const Document* doc) : m_document(const_cast<Document*>(doc)), m_notificationPostTimer(this, 0) { }
  • trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp

    r131915 r131947  
    6767}
    6868
    69 bool AccessibilityARIAGrid::addTableCellChild(AccessibilityObject* child, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount)
     69bool AccessibilityARIAGrid::addChild(AccessibilityObject* child, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount)
    7070{
    7171    if (!child || !child->isTableRow() || child->ariaRoleAttribute() != RowRole)
     
    115115    for (RefPtr<AccessibilityObject> child = firstChild(); child; child = child->nextSibling()) {
    116116
    117         if (!addTableCellChild(child.get(), appendedRows, columnCount)) {
     117        if (!addChild(child.get(), appendedRows, columnCount)) {
    118118           
    119119            // in case the render tree doesn't match the expected ARIA hierarchy, look at the children
     
    126126            size_t length = children.size();
    127127            for (size_t i = 0; i < length; ++i)
    128                 addTableCellChild(children[i].get(), appendedRows, columnCount);
     128                addChild(children[i].get(), appendedRows, columnCount);
    129129        }
    130130    }
  • trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.h

    r131915 r131947  
    5959    virtual bool isMultiSelectable() const { return true; }
    6060   
    61     bool addTableCellChild(AccessibilityObject*, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount);
     61    bool addChild(AccessibilityObject*, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount);
    6262};
    6363
  • trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp

    r131915 r131947  
    223223    return boundingBoxRect();
    224224}
    225    
    226 LayoutRect AccessibilityNodeObject::boundingBoxRect() const
    227 {
    228     // AccessibilityNodeObjects have no mechanism yet to return a size or position.
    229     // For now, let's return the position of the ancestor that does have a position,
    230     // and make it the width of that parent, and about the height of a line of text, so that it's clear the object is a child of the parent.
    231    
    232     LayoutRect boundingBox;
    233    
    234     for (AccessibilityObject* positionProvider = parentObject(); positionProvider; positionProvider = positionProvider->parentObject()) {
    235         if (positionProvider->isAccessibilityRenderObject()) {
    236             LayoutRect parentRect = positionProvider->elementRect();
    237             boundingBox.setSize(LayoutSize(parentRect.width(), FractionalLayoutUnit(std::min(10.0f, parentRect.height().toFloat()))));
    238             boundingBox.setLocation(parentRect.location());
    239             break;
    240         }
    241     }
    242    
    243     return boundingBox;
    244 }
    245225
    246226void AccessibilityNodeObject::setNode(Node* node)
     
    305285}
    306286
    307 void AccessibilityNodeObject::insertChild(AccessibilityObject* child, unsigned index)
    308 {
    309     if (!child)
    310         return;
    311    
    312     // If the parent is asking for this child's children, then either it's the first time (and clearing is a no-op),
    313     // or its visibility has changed. In the latter case, this child may have a stale child cached.
    314     // This can prevent aria-hidden changes from working correctly. Hence, whenever a parent is getting children, ensure data is not stale.
    315     child->clearChildren();
    316    
    317     if (child->accessibilityIsIgnored()) {
    318         AccessibilityChildrenVector children = child->children();
    319         size_t length = children.size();
    320         for (size_t i = 0; i < length; ++i)
    321             m_children.insert(index + i, children[i]);
    322     } else {
    323         ASSERT(child->parentObject() == this);
    324         m_children.insert(index, child);
    325     }
    326 }
    327 
    328 void AccessibilityNodeObject::addChild(AccessibilityObject* child)
    329 {
    330     insertChild(child, m_children.size());
    331 }
    332 
    333287void AccessibilityNodeObject::addChildren()
    334288{
     
    346300        return;
    347301   
    348     for (Node* child = m_node->firstChild(); child; child = child->nextSibling())
    349         addChild(axObjectCache()->getOrCreate(child));
     302    for (Node* child = m_node->firstChild(); child; child = child->nextSibling()) {
     303        RefPtr<AccessibilityObject> obj = axObjectCache()->getOrCreate(child);
     304        obj->clearChildren();
     305        if (obj->accessibilityIsIgnored()) {
     306            AccessibilityChildrenVector children = obj->children();
     307            size_t length = children.size();
     308            for (size_t i = 0; i < length; ++i)
     309                m_children.append(children[i]);
     310        } else {
     311            ASSERT(obj->parentObject() == this);
     312            m_children.append(obj);
     313        }
     314    }
    350315}
    351316
     
    14361401    if (node->isElementNode())
    14371402        return toElement(node)->innerText();
    1438     else if (node->isTextNode())
    1439         return toText(node)->wholeText();
    1440    
     1403
    14411404    return String();
    14421405}
  • trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h

    r131915 r131947  
    159159    virtual AccessibilityRole determineAccessibilityRole();
    160160    virtual void addChildren();
    161     virtual void addChild(AccessibilityObject*);
    162     virtual void insertChild(AccessibilityObject*, unsigned index);
    163 
    164161    virtual bool canHaveChildren() const;
    165162    virtual bool accessibilityIsIgnored() const;
     
    178175    String accessibilityDescriptionForElements(Vector<Element*> &elements) const;
    179176    void elementsFromAttribute(Vector<Element*>& elements, const QualifiedName&) const;
    180     virtual LayoutRect boundingBoxRect() const;
    181177    String ariaDescribedByAttribute() const;
    182178   
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r131915 r131947  
    17771777}
    17781778
    1779 TextIteratorBehavior AccessibilityObject::textIteratorBehaviorForTextRange() const
    1780 {
    1781     TextIteratorBehavior behavior = TextIteratorIgnoresStyleVisibility;
    1782    
    1783 #if PLATFORM(GTK)
    1784     // We need to emit replaced elements for GTK, and present
    1785     // them with the 'object replacement character' (0xFFFC).
    1786     behavior = static_cast<TextIteratorBehavior>(behavior | TextIteratorEmitsObjectReplacementCharacters);
    1787 #endif
    1788    
    1789     return behavior;
    1790 }
    1791    
    17921779AccessibilityRole AccessibilityObject::buttonRoleType() const
    17931780{
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r131915 r131947  
    3434#include "FractionalLayoutRect.h"
    3535#include "LayoutTypes.h"
    36 #include "TextIterator.h"
    3736#include "VisiblePosition.h"
    3837#include "VisibleSelection.h"
     
    575574    static IntRect boundingBoxForQuads(RenderObject*, const Vector<FloatQuad>&);
    576575   
    577     TextIteratorBehavior textIteratorBehaviorForTextRange() const;
    578576    virtual PlainTextRange selectedTextRange() const { return PlainTextRange(); }
    579577    unsigned selectionStart() const { return selectedTextRange().start; }
     
    615613    const AccessibilityChildrenVector& children();
    616614    virtual void addChildren() { }
    617     virtual void addChild(AccessibilityObject*) { }
    618     virtual void insertChild(AccessibilityObject*, unsigned) { }
    619    
    620615    virtual bool canHaveChildren() const { return true; }
    621616    virtual bool hasChildren() const { return m_haveChildren; }
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r131915 r131947  
    8080#include "Text.h"
    8181#include "TextControlInnerElements.h"
     82#include "TextIterator.h"
    8283#include "htmlediting.h"
    8384#include "visible_units.h"
     
    597598   
    598599    return String();
     600}
     601
     602static TextIteratorBehavior textIteratorBehaviorForTextRange()
     603{
     604    TextIteratorBehavior behavior = TextIteratorIgnoresStyleVisibility;
     605
     606#if PLATFORM(GTK)
     607    // We need to emit replaced elements for GTK, and present
     608    // them with the 'object replacement character' (0xFFFC).
     609    behavior = static_cast<TextIteratorBehavior>(behavior | TextIteratorEmitsObjectReplacementCharacters);
     610#endif
     611
     612    return behavior;
    599613}
    600614
     
    10221036    // The following cases can apply to any element that's a subclass of AccessibilityRenderObject.
    10231037   
    1024     if (!m_renderer)
     1038    // Ignore invisible elements.
     1039    if (!m_renderer || m_renderer->style()->visibility() != VISIBLE)
    10251040        return IgnoreObject;
    10261041
    1027     if (m_renderer->style()->visibility() != VISIBLE) {
    1028         // aria-hidden is meant to override visibility as the determinant in AX hierarchy inclusion.
    1029         if (equalIgnoringCase(getAttribute(aria_hiddenAttr), "false"))
    1030             return DefaultBehavior;
    1031        
    1032         return IgnoreObject;
    1033     }
    1034    
    10351042    // Anything marked as aria-hidden or a child of something aria-hidden must be hidden.
    10361043    if (ariaIsHidden())
     
    26452652#endif
    26462653
    2647 // Hidden children are those that are not rendered or visible, but are specifically marked as aria-hidden=false,
    2648 // meaning that they should be exposed to the AX hierarchy.
    2649 void AccessibilityRenderObject::addHiddenChildren()
    2650 {
    2651     Node* node = this->node();
    2652     if (!node)
    2653         return;
    2654    
    2655     // First do a quick run through to determine if we have any hidden nodes (most often we will not).
    2656     // If we do have hidden nodes, we need to determine where to insert them so they match DOM order as close as possible.
    2657     bool shouldInsertHiddenNodes = false;
    2658     for (Node* child = node->firstChild(); child; child = child->nextSibling()) {
    2659         if (!child->renderer() && isNodeAriaVisible(child)) {
    2660             shouldInsertHiddenNodes = true;
    2661             break;
    2662         }
    2663     }
    2664    
    2665     if (!shouldInsertHiddenNodes)
    2666         return;
    2667    
    2668     // Iterate through all of the children, including those that may have already been added, and
    2669     // try to insert hidden nodes in the correct place in the DOM order.
    2670     unsigned insertionIndex = 0;
    2671     for (Node* child = node->firstChild(); child; child = child->nextSibling()) {
    2672         if (child->renderer()) {
    2673             // Find out where the last render sibling is located within m_children.
    2674             AccessibilityObject* childObject = axObjectCache()->get(child->renderer());
    2675             if (childObject && childObject->accessibilityIsIgnored()) {
    2676                 AccessibilityChildrenVector children = childObject->children();
    2677                 if (children.size())
    2678                     childObject = children.last().get();
    2679                 else
    2680                     childObject = 0;
    2681             }
    2682 
    2683             if (childObject)
    2684                 insertionIndex = m_children.find(childObject) + 1;
    2685             continue;
    2686         }
    2687 
    2688         if (!isNodeAriaVisible(child))
    2689             continue;
    2690        
    2691         unsigned previousSize = m_children.size();
    2692         if (insertionIndex > previousSize)
    2693             insertionIndex = previousSize;
    2694        
    2695         insertChild(axObjectCache()->getOrCreate(child), insertionIndex);
    2696         insertionIndex += (m_children.size() - previousSize);
    2697     }
    2698 }
    2699    
    27002654void AccessibilityRenderObject::addChildren()
    27012655{
     
    27092663        return;
    27102664   
    2711     for (RefPtr<AccessibilityObject> obj = firstChild(); obj; obj = obj->nextSibling())
    2712         addChild(obj.get());
    2713    
    2714     addHiddenChildren();
     2665    // add all unignored acc children
     2666    for (RefPtr<AccessibilityObject> obj = firstChild(); obj; obj = obj->nextSibling()) {
     2667        // If the parent is asking for this child's children, then either it's the first time (and clearing is a no-op),
     2668        // or its visibility has changed. In the latter case, this child may have a stale child cached.
     2669        // This can prevent aria-hidden changes from working correctly. Hence, whenever a parent is getting children, ensure data is not stale.
     2670        obj->clearChildren();
     2671
     2672        if (obj->accessibilityIsIgnored()) {
     2673            AccessibilityChildrenVector children = obj->children();
     2674            unsigned length = children.size();
     2675            for (unsigned i = 0; i < length; ++i)
     2676                m_children.append(children[i]);
     2677        } else {
     2678            ASSERT(obj->parentObject() == this);
     2679            m_children.append(obj);
     2680        }
     2681    }
     2682   
    27152683    addAttachmentChildren();
    27162684    addImageMapChildren();
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h

    r131915 r131947  
    247247    // This returns true if it's focusable but it's not content editable and it's not a control or ARIA control.
    248248
    249     void addHiddenChildren();
    250249    void addTextFieldChildren();
    251250    void addImageMapChildren();
Note: See TracChangeset for help on using the changeset viewer.