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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 case kSpinButtonRole: | 591 case kSpinButtonRole: |
592 case kTabRole: | 592 case kTabRole: |
593 case kTextFieldRole: | 593 case kTextFieldRole: |
594 case kToggleButtonRole: | 594 case kToggleButtonRole: |
595 return true; | 595 return true; |
596 default: | 596 default: |
597 return false; | 597 return false; |
598 } | 598 } |
599 } | 599 } |
600 | 600 |
601 bool AXObjectImpl::AccessibilityIsIgnored() const { | 601 bool AXObjectImpl::AccessibilityIsIgnored() { |
| 602 Node* node = GetNode(); |
| 603 if (!node) { |
| 604 AXObjectImpl* parent = this->ParentObject(); |
| 605 while (!node && parent) { |
| 606 node = parent->GetNode(); |
| 607 parent = parent->ParentObject(); |
| 608 } |
| 609 } |
| 610 |
| 611 if (node) |
| 612 node->UpdateDistribution(); |
| 613 |
| 614 // TODO(aboxhall): Instead of this, propagate inert down through frames |
| 615 Document* document = GetDocument(); |
| 616 while (document && document->LocalOwner()) { |
| 617 document->LocalOwner()->UpdateDistribution(); |
| 618 document = document->LocalOwner()->ownerDocument(); |
| 619 } |
| 620 |
602 UpdateCachedAttributeValuesIfNeeded(); | 621 UpdateCachedAttributeValuesIfNeeded(); |
603 return cached_is_ignored_; | 622 return cached_is_ignored_; |
604 } | 623 } |
605 | 624 |
606 void AXObjectImpl::UpdateCachedAttributeValuesIfNeeded() const { | 625 void AXObjectImpl::UpdateCachedAttributeValuesIfNeeded() const { |
607 if (IsDetached()) | 626 if (IsDetached()) |
608 return; | 627 return; |
609 | 628 |
610 AXObjectCacheImpl& cache = AxObjectCache(); | 629 AXObjectCacheImpl& cache = AxObjectCache(); |
611 | 630 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 if (GetNode()) { | 692 if (GetNode()) { |
674 if (GetNode()->IsInert()) { | 693 if (GetNode()->IsInert()) { |
675 if (ignored_reasons) { | 694 if (ignored_reasons) { |
676 HTMLDialogElement* dialog = GetActiveDialogElement(GetNode()); | 695 HTMLDialogElement* dialog = GetActiveDialogElement(GetNode()); |
677 if (dialog) { | 696 if (dialog) { |
678 AXObjectImpl* dialog_object = AxObjectCache().GetOrCreate(dialog); | 697 AXObjectImpl* dialog_object = AxObjectCache().GetOrCreate(dialog); |
679 if (dialog_object) { | 698 if (dialog_object) { |
680 ignored_reasons->push_back( | 699 ignored_reasons->push_back( |
681 IgnoredReason(kAXActiveModalDialog, dialog_object)); | 700 IgnoredReason(kAXActiveModalDialog, dialog_object)); |
682 } else { | 701 } else { |
683 ignored_reasons->push_back(IgnoredReason(kAXInert)); | 702 ignored_reasons->push_back(IgnoredReason(kAXInertElement)); |
684 } | 703 } |
685 } else { | 704 } else { |
686 // TODO(aboxhall): handle inert attribute if it eventuates | 705 const AXObjectImpl* inert_root_el = InertRoot(); |
687 ignored_reasons->push_back(IgnoredReason(kAXInert)); | 706 if (inert_root_el == this) { |
| 707 ignored_reasons->push_back(IgnoredReason(kAXInertElement)); |
| 708 } else { |
| 709 ignored_reasons->push_back( |
| 710 IgnoredReason(kAXInertSubtree, inert_root_el)); |
| 711 } |
688 } | 712 } |
689 } | 713 } |
690 return true; | 714 return true; |
691 } | 715 } |
692 } else { | 716 } else { |
693 AXObjectImpl* parent = ParentObject(); | 717 AXObjectImpl* parent = ParentObject(); |
694 if (parent && parent->IsInertOrAriaHidden()) { | 718 if (parent && parent->IsInertOrAriaHidden()) { |
695 if (ignored_reasons) | 719 if (ignored_reasons) |
696 parent->ComputeIsInertOrAriaHidden(ignored_reasons); | 720 parent->ComputeIsInertOrAriaHidden(ignored_reasons); |
697 return true; | 721 return true; |
698 } | 722 } |
699 } | 723 } |
700 | 724 |
701 const AXObjectImpl* hidden_root = AriaHiddenRoot(); | 725 const AXObjectImpl* hidden_root = AriaHiddenRoot(); |
702 if (hidden_root) { | 726 if (hidden_root) { |
703 if (ignored_reasons) { | 727 if (ignored_reasons) { |
704 if (hidden_root == this) { | 728 if (hidden_root == this) { |
705 ignored_reasons->push_back(IgnoredReason(kAXAriaHidden)); | 729 ignored_reasons->push_back(IgnoredReason(kAXAriaHiddenElement)); |
706 } else { | 730 } else { |
707 ignored_reasons->push_back( | 731 ignored_reasons->push_back( |
708 IgnoredReason(kAXAriaHiddenRoot, hidden_root)); | 732 IgnoredReason(kAXAriaHiddenSubtree, hidden_root)); |
709 } | 733 } |
710 } | 734 } |
711 return true; | 735 return true; |
712 } | 736 } |
713 | 737 |
714 return false; | 738 return false; |
715 } | 739 } |
716 | 740 |
717 bool AXObjectImpl::IsDescendantOfLeafNode() const { | 741 bool AXObjectImpl::IsDescendantOfLeafNode() const { |
718 UpdateCachedAttributeValuesIfNeeded(); | 742 UpdateCachedAttributeValuesIfNeeded(); |
(...skipping 14 matching lines...) Expand all Loading... |
733 const AXObjectImpl* AXObjectImpl::AriaHiddenRoot() const { | 757 const AXObjectImpl* AXObjectImpl::AriaHiddenRoot() const { |
734 for (const AXObjectImpl* object = this; object; | 758 for (const AXObjectImpl* object = this; object; |
735 object = object->ParentObject()) { | 759 object = object->ParentObject()) { |
736 if (object->AOMPropertyOrARIAAttributeIsTrue(AOMBooleanProperty::kHidden)) | 760 if (object->AOMPropertyOrARIAAttributeIsTrue(AOMBooleanProperty::kHidden)) |
737 return object; | 761 return object; |
738 } | 762 } |
739 | 763 |
740 return 0; | 764 return 0; |
741 } | 765 } |
742 | 766 |
| 767 const AXObjectImpl* AXObjectImpl::InertRoot() const { |
| 768 const AXObjectImpl* object = this; |
| 769 if (!RuntimeEnabledFeatures::inertAttributeEnabled()) |
| 770 return 0; |
| 771 |
| 772 while (object && !object->IsAXNodeObject()) |
| 773 object = object->ParentObject(); |
| 774 Node* node = object->GetNode(); |
| 775 Element* element = node->IsElementNode() |
| 776 ? ToElement(node) |
| 777 : FlatTreeTraversal::ParentElement(*node); |
| 778 while (element) { |
| 779 if (element->hasAttribute(inertAttr)) |
| 780 return AxObjectCache().GetOrCreate(element); |
| 781 element = FlatTreeTraversal::ParentElement(*element); |
| 782 } |
| 783 |
| 784 return 0; |
| 785 } |
| 786 |
743 bool AXObjectImpl::IsDescendantOfDisabledNode() const { | 787 bool AXObjectImpl::IsDescendantOfDisabledNode() const { |
744 UpdateCachedAttributeValuesIfNeeded(); | 788 UpdateCachedAttributeValuesIfNeeded(); |
745 return cached_is_descendant_of_disabled_node_; | 789 return cached_is_descendant_of_disabled_node_; |
746 } | 790 } |
747 | 791 |
748 const AXObjectImpl* AXObjectImpl::DisabledAncestor() const { | 792 const AXObjectImpl* AXObjectImpl::DisabledAncestor() const { |
749 bool disabled = false; | 793 bool disabled = false; |
750 if (HasAOMPropertyOrARIAAttribute(AOMBooleanProperty::kDisabled, disabled)) { | 794 if (HasAOMPropertyOrARIAAttribute(AOMBooleanProperty::kDisabled, disabled)) { |
751 if (disabled) | 795 if (disabled) |
752 return this; | 796 return this; |
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2091 } | 2135 } |
2092 | 2136 |
2093 DEFINE_TRACE(AXObjectImpl) { | 2137 DEFINE_TRACE(AXObjectImpl) { |
2094 visitor->Trace(children_); | 2138 visitor->Trace(children_); |
2095 visitor->Trace(parent_); | 2139 visitor->Trace(parent_); |
2096 visitor->Trace(cached_live_region_root_); | 2140 visitor->Trace(cached_live_region_root_); |
2097 visitor->Trace(ax_object_cache_); | 2141 visitor->Trace(ax_object_cache_); |
2098 } | 2142 } |
2099 | 2143 |
2100 } // namespace blink | 2144 } // namespace blink |
OLD | NEW |