Changeset 131947 in webkit
- Timestamp:
- Oct 19, 2012 2:59:04 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r131943 r131947 1 2012-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 1 13 2012-10-19 Emil A Eklund <eae@chromium.org> 2 14 -
trunk/LayoutTests/platform/chromium/TestExpectations
r131933 r131947 1423 1423 1424 1424 webkit.org/b/73912 accessibility/aria-checkbox-sends-notification.html [ Failure Pass ] 1425 webkit.org/b/98787 accessibility/aria-hidden-negates-no-visibility.html [ Skip ]1426 1425 1427 1426 # ----------------------------------------------------------------- -
trunk/Source/WebCore/ChangeLog
r131946 r131947 1 2012-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 1 36 2012-10-19 Tony Chang <tony@chromium.org> 2 37 -
trunk/Source/WebCore/accessibility/AXObjectCache.cpp
r131915 r131947 317 317 return getOrCreate(node->renderer()); 318 318 319 if (!node->parentElement())320 return 0;321 322 319 // 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()) 327 321 return 0; 328 322 … … 790 784 return axObject && axObject->isTextControl(); 791 785 } 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 }803 786 804 787 } // namespace WebCore -
trunk/Source/WebCore/accessibility/AXObjectCache.h
r131915 r131947 209 209 210 210 bool 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 214 212 #if !HAVE(ACCESSIBILITY) 215 213 inline AXObjectCache::AXObjectCache(const Document* doc) : m_document(const_cast<Document*>(doc)), m_notificationPostTimer(this, 0) { } -
trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp
r131915 r131947 67 67 } 68 68 69 bool AccessibilityARIAGrid::add TableCellChild(AccessibilityObject* child, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount)69 bool AccessibilityARIAGrid::addChild(AccessibilityObject* child, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount) 70 70 { 71 71 if (!child || !child->isTableRow() || child->ariaRoleAttribute() != RowRole) … … 115 115 for (RefPtr<AccessibilityObject> child = firstChild(); child; child = child->nextSibling()) { 116 116 117 if (!add TableCellChild(child.get(), appendedRows, columnCount)) {117 if (!addChild(child.get(), appendedRows, columnCount)) { 118 118 119 119 // in case the render tree doesn't match the expected ARIA hierarchy, look at the children … … 126 126 size_t length = children.size(); 127 127 for (size_t i = 0; i < length; ++i) 128 add TableCellChild(children[i].get(), appendedRows, columnCount);128 addChild(children[i].get(), appendedRows, columnCount); 129 129 } 130 130 } -
trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.h
r131915 r131947 59 59 virtual bool isMultiSelectable() const { return true; } 60 60 61 bool add TableCellChild(AccessibilityObject*, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount);61 bool addChild(AccessibilityObject*, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount); 62 62 }; 63 63 -
trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp
r131915 r131947 223 223 return boundingBoxRect(); 224 224 } 225 226 LayoutRect AccessibilityNodeObject::boundingBoxRect() const227 {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 }245 225 246 226 void AccessibilityNodeObject::setNode(Node* node) … … 305 285 } 306 286 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 333 287 void AccessibilityNodeObject::addChildren() 334 288 { … … 346 300 return; 347 301 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 } 350 315 } 351 316 … … 1436 1401 if (node->isElementNode()) 1437 1402 return toElement(node)->innerText(); 1438 else if (node->isTextNode()) 1439 return toText(node)->wholeText(); 1440 1403 1441 1404 return String(); 1442 1405 } -
trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h
r131915 r131947 159 159 virtual AccessibilityRole determineAccessibilityRole(); 160 160 virtual void addChildren(); 161 virtual void addChild(AccessibilityObject*);162 virtual void insertChild(AccessibilityObject*, unsigned index);163 164 161 virtual bool canHaveChildren() const; 165 162 virtual bool accessibilityIsIgnored() const; … … 178 175 String accessibilityDescriptionForElements(Vector<Element*> &elements) const; 179 176 void elementsFromAttribute(Vector<Element*>& elements, const QualifiedName&) const; 180 virtual LayoutRect boundingBoxRect() const;181 177 String ariaDescribedByAttribute() const; 182 178 -
trunk/Source/WebCore/accessibility/AccessibilityObject.cpp
r131915 r131947 1777 1777 } 1778 1778 1779 TextIteratorBehavior AccessibilityObject::textIteratorBehaviorForTextRange() const1780 {1781 TextIteratorBehavior behavior = TextIteratorIgnoresStyleVisibility;1782 1783 #if PLATFORM(GTK)1784 // We need to emit replaced elements for GTK, and present1785 // them with the 'object replacement character' (0xFFFC).1786 behavior = static_cast<TextIteratorBehavior>(behavior | TextIteratorEmitsObjectReplacementCharacters);1787 #endif1788 1789 return behavior;1790 }1791 1792 1779 AccessibilityRole AccessibilityObject::buttonRoleType() const 1793 1780 { -
trunk/Source/WebCore/accessibility/AccessibilityObject.h
r131915 r131947 34 34 #include "FractionalLayoutRect.h" 35 35 #include "LayoutTypes.h" 36 #include "TextIterator.h"37 36 #include "VisiblePosition.h" 38 37 #include "VisibleSelection.h" … … 575 574 static IntRect boundingBoxForQuads(RenderObject*, const Vector<FloatQuad>&); 576 575 577 TextIteratorBehavior textIteratorBehaviorForTextRange() const;578 576 virtual PlainTextRange selectedTextRange() const { return PlainTextRange(); } 579 577 unsigned selectionStart() const { return selectedTextRange().start; } … … 615 613 const AccessibilityChildrenVector& children(); 616 614 virtual void addChildren() { } 617 virtual void addChild(AccessibilityObject*) { }618 virtual void insertChild(AccessibilityObject*, unsigned) { }619 620 615 virtual bool canHaveChildren() const { return true; } 621 616 virtual bool hasChildren() const { return m_haveChildren; } -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r131915 r131947 80 80 #include "Text.h" 81 81 #include "TextControlInnerElements.h" 82 #include "TextIterator.h" 82 83 #include "htmlediting.h" 83 84 #include "visible_units.h" … … 597 598 598 599 return String(); 600 } 601 602 static 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; 599 613 } 600 614 … … 1022 1036 // The following cases can apply to any element that's a subclass of AccessibilityRenderObject. 1023 1037 1024 if (!m_renderer) 1038 // Ignore invisible elements. 1039 if (!m_renderer || m_renderer->style()->visibility() != VISIBLE) 1025 1040 return IgnoreObject; 1026 1041 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 1035 1042 // Anything marked as aria-hidden or a child of something aria-hidden must be hidden. 1036 1043 if (ariaIsHidden()) … … 2645 2652 #endif 2646 2653 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, and2669 // 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 else2680 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 2700 2654 void AccessibilityRenderObject::addChildren() 2701 2655 { … … 2709 2663 return; 2710 2664 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 2715 2683 addAttachmentChildren(); 2716 2684 addImageMapChildren(); -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h
r131915 r131947 247 247 // This returns true if it's focusable but it's not content editable and it's not a control or ARIA control. 248 248 249 void addHiddenChildren();250 249 void addTextFieldChildren(); 251 250 void addImageMapChildren();
Note: See TracChangeset
for help on using the changeset viewer.