OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2011 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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 if (getNode()) { | 529 if (getNode()) { |
530 if (getNode()->isInert()) { | 530 if (getNode()->isInert()) { |
531 if (ignoredReasons) { | 531 if (ignoredReasons) { |
532 HTMLDialogElement* dialog = getActiveDialogElement(getNode()); | 532 HTMLDialogElement* dialog = getActiveDialogElement(getNode()); |
533 if (dialog) { | 533 if (dialog) { |
534 AXObject* dialogObject = axObjectCache().getOrCreate(dialog); | 534 AXObject* dialogObject = axObjectCache().getOrCreate(dialog); |
535 if (dialogObject) | 535 if (dialogObject) |
536 ignoredReasons->push_back( | 536 ignoredReasons->push_back( |
537 IgnoredReason(AXActiveModalDialog, dialogObject)); | 537 IgnoredReason(AXActiveModalDialog, dialogObject)); |
538 else | 538 else |
539 ignoredReasons->push_back(IgnoredReason(AXInert)); | 539 ignoredReasons->push_back(IgnoredReason(AXInertElement)); |
540 } else { | 540 } else { |
541 // TODO(aboxhall): handle inert attribute if it eventuates | 541 const AXObject* inertRoot = this->inertRoot(); |
542 ignoredReasons->push_back(IgnoredReason(AXInert)); | 542 if (inertRoot == this) { |
| 543 ignoredReasons->push_back(IgnoredReason(AXInertElement)); |
| 544 } else { |
| 545 ignoredReasons->push_back(IgnoredReason(AXInertSubtree, inertRoot)); |
| 546 } |
543 } | 547 } |
544 } | 548 } |
545 return true; | 549 return true; |
546 } | 550 } |
547 } else { | 551 } else { |
548 AXObject* parent = parentObject(); | 552 AXObject* parent = parentObject(); |
549 if (parent && parent->isInertOrAriaHidden()) { | 553 if (parent && parent->isInertOrAriaHidden()) { |
550 if (ignoredReasons) | 554 if (ignoredReasons) |
551 parent->computeIsInertOrAriaHidden(ignoredReasons); | 555 parent->computeIsInertOrAriaHidden(ignoredReasons); |
552 return true; | 556 return true; |
553 } | 557 } |
554 } | 558 } |
555 | 559 |
556 const AXObject* hiddenRoot = ariaHiddenRoot(); | 560 const AXObject* hiddenRoot = ariaHiddenRoot(); |
557 if (hiddenRoot) { | 561 if (hiddenRoot) { |
558 if (ignoredReasons) { | 562 if (ignoredReasons) { |
559 if (hiddenRoot == this) | 563 if (hiddenRoot == this) { |
560 ignoredReasons->push_back(IgnoredReason(AXAriaHidden)); | 564 ignoredReasons->push_back(IgnoredReason(AXAriaHiddenElement)); |
561 else | 565 } else { |
562 ignoredReasons->push_back(IgnoredReason(AXAriaHiddenRoot, hiddenRoot)); | 566 ignoredReasons->push_back( |
| 567 IgnoredReason(AXAriaHiddenSubtree, hiddenRoot)); |
| 568 } |
563 } | 569 } |
564 return true; | 570 return true; |
565 } | 571 } |
566 | 572 |
567 return false; | 573 return false; |
568 } | 574 } |
569 | 575 |
570 bool AXObject::isDescendantOfLeafNode() const { | 576 bool AXObject::isDescendantOfLeafNode() const { |
571 updateCachedAttributeValuesIfNeeded(); | 577 updateCachedAttributeValuesIfNeeded(); |
572 return m_cachedIsDescendantOfLeafNode; | 578 return m_cachedIsDescendantOfLeafNode; |
(...skipping 12 matching lines...) Expand all Loading... |
585 | 591 |
586 const AXObject* AXObject::ariaHiddenRoot() const { | 592 const AXObject* AXObject::ariaHiddenRoot() const { |
587 for (const AXObject* object = this; object; object = object->parentObject()) { | 593 for (const AXObject* object = this; object; object = object->parentObject()) { |
588 if (equalIgnoringCase(object->getAttribute(aria_hiddenAttr), "true")) | 594 if (equalIgnoringCase(object->getAttribute(aria_hiddenAttr), "true")) |
589 return object; | 595 return object; |
590 } | 596 } |
591 | 597 |
592 return 0; | 598 return 0; |
593 } | 599 } |
594 | 600 |
| 601 const AXObject* AXObject::inertRoot() const { |
| 602 const AXObject* object = this; |
| 603 if (!RuntimeEnabledFeatures::inertAttributeEnabled()) |
| 604 return nullptr; |
| 605 |
| 606 while (object && !object->isAXNodeObject()) |
| 607 object = object->parentObject(); |
| 608 for (Node* node = object->getNode(); node; |
| 609 node = FlatTreeTraversal::parentElement(*node)) { |
| 610 if (!node->isElementNode()) |
| 611 continue; |
| 612 if (toElement(node)->hasAttribute(inertAttr)) |
| 613 return axObjectCache().getOrCreate(node); |
| 614 } |
| 615 |
| 616 return nullptr; |
| 617 } |
| 618 |
595 bool AXObject::isDescendantOfDisabledNode() const { | 619 bool AXObject::isDescendantOfDisabledNode() const { |
596 updateCachedAttributeValuesIfNeeded(); | 620 updateCachedAttributeValuesIfNeeded(); |
597 return m_cachedIsDescendantOfDisabledNode; | 621 return m_cachedIsDescendantOfDisabledNode; |
598 } | 622 } |
599 | 623 |
600 const AXObject* AXObject::disabledAncestor() const { | 624 const AXObject* AXObject::disabledAncestor() const { |
601 const AtomicString& disabled = getAttribute(aria_disabledAttr); | 625 const AtomicString& disabled = getAttribute(aria_disabledAttr); |
602 if (equalIgnoringCase(disabled, "true")) | 626 if (equalIgnoringCase(disabled, "true")) |
603 return this; | 627 return this; |
604 if (equalIgnoringCase(disabled, "false")) | 628 if (equalIgnoringCase(disabled, "false")) |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 } | 1783 } |
1760 | 1784 |
1761 DEFINE_TRACE(AXObject) { | 1785 DEFINE_TRACE(AXObject) { |
1762 visitor->trace(m_children); | 1786 visitor->trace(m_children); |
1763 visitor->trace(m_parent); | 1787 visitor->trace(m_parent); |
1764 visitor->trace(m_cachedLiveRegionRoot); | 1788 visitor->trace(m_cachedLiveRegionRoot); |
1765 visitor->trace(m_axObjectCache); | 1789 visitor->trace(m_axObjectCache); |
1766 } | 1790 } |
1767 | 1791 |
1768 } // namespace blink | 1792 } // namespace blink |
OLD | NEW |