Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp

Issue 1477043003: Handle aria-owns and presentational children in AX name calc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@garaventa_visibility_hidden
Patch Set: Better solution to handle both aria-owns and role=presentation in name calc Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 m_cachedElementRectDirty = false; 1434 m_cachedElementRectDirty = false;
1435 } 1435 }
1436 1436
1437 void AXLayoutObject::markCachedElementRectDirty() const 1437 void AXLayoutObject::markCachedElementRectDirty() const
1438 { 1438 {
1439 if (m_cachedElementRectDirty) 1439 if (m_cachedElementRectDirty)
1440 return; 1440 return;
1441 1441
1442 // Marks children recursively, if this element changed. 1442 // Marks children recursively, if this element changed.
1443 m_cachedElementRectDirty = true; 1443 m_cachedElementRectDirty = true;
1444 for (AXObject* child = rawFirstChild(); child; child = child->rawFirstSiblin g()) 1444 for (AXObject* child = rawFirstChild(); child; child = child->rawNextSibling ())
1445 child->markCachedElementRectDirty(); 1445 child->markCachedElementRectDirty();
1446 } 1446 }
1447 1447
1448 IntPoint AXLayoutObject::clickPoint() 1448 IntPoint AXLayoutObject::clickPoint()
1449 { 1449 {
1450 // Headings are usually much wider than their textual content. If the mid po int is used, often it can be wrong. 1450 // Headings are usually much wider than their textual content. If the mid po int is used, often it can be wrong.
1451 if (isHeading() && children().size() == 1) 1451 if (isHeading() && children().size() == 1)
1452 return children()[0]->clickPoint(); 1452 return children()[0]->clickPoint();
1453 1453
1454 // use the default position unless this is an editable web area, in which ca se we use the selection bounds. 1454 // use the default position unless this is an editable web area, in which ca se we use the selection bounds.
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 return 0; 1586 return 0;
1587 1587
1588 LayoutObject* firstChild = firstChildConsideringContinuation(m_layoutObject) ; 1588 LayoutObject* firstChild = firstChildConsideringContinuation(m_layoutObject) ;
1589 1589
1590 if (!firstChild) 1590 if (!firstChild)
1591 return 0; 1591 return 0;
1592 1592
1593 return axObjectCache().getOrCreate(firstChild); 1593 return axObjectCache().getOrCreate(firstChild);
1594 } 1594 }
1595 1595
1596 AXObject* AXLayoutObject::rawFirstSibling() const 1596 AXObject* AXLayoutObject::rawNextSibling() const
1597 { 1597 {
1598 if (!m_layoutObject) 1598 if (!m_layoutObject)
1599 return 0; 1599 return 0;
1600 1600
1601 LayoutObject* nextSibling = 0; 1601 LayoutObject* nextSibling = 0;
1602 1602
1603 LayoutInline* inlineContinuation = m_layoutObject->isLayoutBlock() ? toLayou tBlock(m_layoutObject)->inlineElementContinuation() : 0; 1603 LayoutInline* inlineContinuation = m_layoutObject->isLayoutBlock() ? toLayou tBlock(m_layoutObject)->inlineElementContinuation() : 0;
1604 if (inlineContinuation) { 1604 if (inlineContinuation) {
1605 // Case 1: node is a block and has an inline continuation. Next sibling is the inline continuation's first child. 1605 // Case 1: node is a block and has an inline continuation. Next sibling is the inline continuation's first child.
1606 nextSibling = firstChildConsideringContinuation(inlineContinuation); 1606 nextSibling = firstChildConsideringContinuation(inlineContinuation);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 ASSERT(!m_haveChildren); 1645 ASSERT(!m_haveChildren);
1646 1646
1647 m_haveChildren = true; 1647 m_haveChildren = true;
1648 1648
1649 if (!canHaveChildren()) 1649 if (!canHaveChildren())
1650 return; 1650 return;
1651 1651
1652 HeapVector<Member<AXObject>> ownedChildren; 1652 HeapVector<Member<AXObject>> ownedChildren;
1653 computeAriaOwnsChildren(ownedChildren); 1653 computeAriaOwnsChildren(ownedChildren);
1654 1654
1655 for (AXObject* obj = rawFirstChild(); obj; obj = obj->rawFirstSibling()) { 1655 for (AXObject* obj = rawFirstChild(); obj; obj = obj->rawNextSibling()) {
1656 if (!axObjectCache().isAriaOwned(obj)) 1656 if (!axObjectCache().isAriaOwned(obj))
1657 addChild(obj); 1657 addChild(obj);
1658 } 1658 }
1659 1659
1660 addHiddenChildren(); 1660 addHiddenChildren();
1661 addAttachmentChildren(); 1661 addAttachmentChildren();
1662 addPopupChildren(); 1662 addPopupChildren();
1663 addImageMapChildren(); 1663 addImageMapChildren();
1664 addTextFieldChildren(); 1664 addTextFieldChildren();
1665 addCanvasChildren(); 1665 addCanvasChildren();
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
2553 if (label && label->layoutObject()) { 2553 if (label && label->layoutObject()) {
2554 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct(); 2554 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct();
2555 result.unite(labelRect); 2555 result.unite(labelRect);
2556 } 2556 }
2557 } 2557 }
2558 2558
2559 return result; 2559 return result;
2560 } 2560 }
2561 2561
2562 } // namespace blink 2562 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698