OLD | NEW |
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 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 if (ariaRoleAttribute() == MenuRole) { | 1528 if (ariaRoleAttribute() == MenuRole) { |
1529 AXObject* parent = menuButtonForMenu(); | 1529 AXObject* parent = menuButtonForMenu(); |
1530 if (parent) | 1530 if (parent) |
1531 return parent; | 1531 return parent; |
1532 } | 1532 } |
1533 | 1533 |
1534 LayoutObject* parentObj = layoutParentObject(); | 1534 LayoutObject* parentObj = layoutParentObject(); |
1535 if (parentObj) | 1535 if (parentObj) |
1536 return axObjectCache().getOrCreate(parentObj); | 1536 return axObjectCache().getOrCreate(parentObj); |
1537 | 1537 |
1538 // A WebArea's parent should be the containing frame (if local) or page popu
p owner. | 1538 // A WebArea's parent should be the page popup owner, if any, otherwise null
. |
1539 if (isWebArea()) { | 1539 if (isWebArea()) { |
1540 LocalFrame* frame = m_layoutObject->frame(); | 1540 LocalFrame* frame = m_layoutObject->frame(); |
1541 if (frame->owner() && frame->owner()->isLocal()) { | |
1542 HTMLFrameOwnerElement* owner = toHTMLFrameOwnerElement(frame->owner(
)); | |
1543 if (owner && owner->layoutObject()) | |
1544 return axObjectCache().getOrCreate(owner->layoutObject()); | |
1545 } | |
1546 return axObjectCache().getOrCreate(frame->pagePopupOwner()); | 1541 return axObjectCache().getOrCreate(frame->pagePopupOwner()); |
1547 } | 1542 } |
1548 | 1543 |
1549 return 0; | 1544 return 0; |
1550 } | 1545 } |
1551 | 1546 |
1552 AXObject* AXLayoutObject::computeParentIfExists() const | 1547 AXObject* AXLayoutObject::computeParentIfExists() const |
1553 { | 1548 { |
1554 if (!m_layoutObject) | 1549 if (!m_layoutObject) |
1555 return 0; | 1550 return 0; |
1556 | 1551 |
1557 if (ariaRoleAttribute() == MenuBarRole) | 1552 if (ariaRoleAttribute() == MenuBarRole) |
1558 return axObjectCache().get(m_layoutObject->parent()); | 1553 return axObjectCache().get(m_layoutObject->parent()); |
1559 | 1554 |
1560 // menuButton and its corresponding menu are DOM siblings, but Accessibility
needs them to be parent/child | 1555 // menuButton and its corresponding menu are DOM siblings, but Accessibility
needs them to be parent/child |
1561 if (ariaRoleAttribute() == MenuRole) { | 1556 if (ariaRoleAttribute() == MenuRole) { |
1562 AXObject* parent = menuButtonForMenu(); | 1557 AXObject* parent = menuButtonForMenu(); |
1563 if (parent) | 1558 if (parent) |
1564 return parent; | 1559 return parent; |
1565 } | 1560 } |
1566 | 1561 |
1567 LayoutObject* parentObj = layoutParentObject(); | 1562 LayoutObject* parentObj = layoutParentObject(); |
1568 if (parentObj) | 1563 if (parentObj) |
1569 return axObjectCache().get(parentObj); | 1564 return axObjectCache().get(parentObj); |
1570 | 1565 |
1571 // A WebArea's parent should be the containing frame (if local) or page popu
p owner. | 1566 // A WebArea's parent should be the page popup owner, if any, otherwise null
. |
1572 if (isWebArea()) { | 1567 if (isWebArea()) { |
1573 LocalFrame* frame = m_layoutObject->frame(); | 1568 LocalFrame* frame = m_layoutObject->frame(); |
1574 if (frame->owner() && frame->owner()->isLocal()) { | |
1575 HTMLFrameOwnerElement* owner = toHTMLFrameOwnerElement(frame->owner(
)); | |
1576 if (owner && owner->layoutObject()) | |
1577 return axObjectCache().get(owner->layoutObject()); | |
1578 } | |
1579 return axObjectCache().get(frame->pagePopupOwner()); | 1569 return axObjectCache().get(frame->pagePopupOwner()); |
1580 } | 1570 } |
1581 | 1571 |
1582 return 0; | 1572 return 0; |
1583 } | 1573 } |
1584 | 1574 |
1585 // | 1575 // |
1586 // Low-level accessibility tree exploration, only for use within the accessibili
ty module. | 1576 // Low-level accessibility tree exploration, only for use within the accessibili
ty module. |
1587 // | 1577 // |
1588 | 1578 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 computeAriaOwnsChildren(ownedChildren); | 1649 computeAriaOwnsChildren(ownedChildren); |
1660 | 1650 |
1661 for (AXObject* obj = rawFirstChild(); obj; obj = obj->rawNextSibling()) { | 1651 for (AXObject* obj = rawFirstChild(); obj; obj = obj->rawNextSibling()) { |
1662 if (!axObjectCache().isAriaOwned(obj)) { | 1652 if (!axObjectCache().isAriaOwned(obj)) { |
1663 obj->setParent(this); | 1653 obj->setParent(this); |
1664 addChild(obj); | 1654 addChild(obj); |
1665 } | 1655 } |
1666 } | 1656 } |
1667 | 1657 |
1668 addHiddenChildren(); | 1658 addHiddenChildren(); |
1669 addFrameChildren(); | |
1670 addPopupChildren(); | 1659 addPopupChildren(); |
1671 addImageMapChildren(); | 1660 addImageMapChildren(); |
1672 addTextFieldChildren(); | 1661 addTextFieldChildren(); |
1673 addCanvasChildren(); | 1662 addCanvasChildren(); |
1674 addRemoteSVGChildren(); | 1663 addRemoteSVGChildren(); |
1675 addInlineTextBoxChildren(false); | 1664 addInlineTextBoxChildren(false); |
1676 | 1665 |
1677 for (const auto& child : m_children) { | 1666 for (const auto& child : m_children) { |
1678 if (!child->cachedParentObject()) | 1667 if (!child->cachedParentObject()) |
1679 child->setParent(this); | 1668 child->setParent(this); |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2448 if (!isHTMLCanvasElement(getNode())) | 2437 if (!isHTMLCanvasElement(getNode())) |
2449 return; | 2438 return; |
2450 | 2439 |
2451 // If it's a canvas, it won't have laid out children, but it might have acce
ssible fallback content. | 2440 // If it's a canvas, it won't have laid out children, but it might have acce
ssible fallback content. |
2452 // Clear m_haveChildren because AXNodeObject::addChildren will expect it to
be false. | 2441 // Clear m_haveChildren because AXNodeObject::addChildren will expect it to
be false. |
2453 ASSERT(!m_children.size()); | 2442 ASSERT(!m_children.size()); |
2454 m_haveChildren = false; | 2443 m_haveChildren = false; |
2455 AXNodeObject::addChildren(); | 2444 AXNodeObject::addChildren(); |
2456 } | 2445 } |
2457 | 2446 |
2458 void AXLayoutObject::addFrameChildren() | |
2459 { | |
2460 if (!m_layoutObject || !m_layoutObject->isLayoutPart()) | |
2461 return; | |
2462 | |
2463 Widget* widget = toLayoutPart(m_layoutObject)->widget(); | |
2464 if (!widget || !widget->isFrameView()) | |
2465 return; | |
2466 | |
2467 Document* doc = toFrameView(widget)->frame().document(); | |
2468 if (!doc || !doc->layoutView()) | |
2469 return; | |
2470 | |
2471 AXObject* axChildFrame = axObjectCache().getOrCreate(doc); | |
2472 if (!axChildFrame->accessibilityIsIgnored()) | |
2473 m_children.append(axChildFrame); | |
2474 } | |
2475 | |
2476 void AXLayoutObject::addPopupChildren() | 2447 void AXLayoutObject::addPopupChildren() |
2477 { | 2448 { |
2478 if (!isHTMLInputElement(getNode())) | 2449 if (!isHTMLInputElement(getNode())) |
2479 return; | 2450 return; |
2480 if (AXObject* axPopup = toHTMLInputElement(getNode())->popupRootAXObject()) | 2451 if (AXObject* axPopup = toHTMLInputElement(getNode())->popupRootAXObject()) |
2481 m_children.append(axPopup); | 2452 m_children.append(axPopup); |
2482 } | 2453 } |
2483 | 2454 |
2484 void AXLayoutObject::addRemoteSVGChildren() | 2455 void AXLayoutObject::addRemoteSVGChildren() |
2485 { | 2456 { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2549 if (label && label->layoutObject()) { | 2520 if (label && label->layoutObject()) { |
2550 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); | 2521 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); |
2551 result.unite(labelRect); | 2522 result.unite(labelRect); |
2552 } | 2523 } |
2553 } | 2524 } |
2554 | 2525 |
2555 return result; | 2526 return result; |
2556 } | 2527 } |
2557 | 2528 |
2558 } // namespace blink | 2529 } // namespace blink |
OLD | NEW |