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

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

Issue 2902133002: Revert of "Implement the inert attribute" (Closed)
Patch Set: Created 3 years, 7 months 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, 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
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() { 601 bool AXObjectImpl::AccessibilityIsIgnored() const {
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
621 UpdateCachedAttributeValuesIfNeeded(); 602 UpdateCachedAttributeValuesIfNeeded();
622 return cached_is_ignored_; 603 return cached_is_ignored_;
623 } 604 }
624 605
625 void AXObjectImpl::UpdateCachedAttributeValuesIfNeeded() const { 606 void AXObjectImpl::UpdateCachedAttributeValuesIfNeeded() const {
626 if (IsDetached()) 607 if (IsDetached())
627 return; 608 return;
628 609
629 AXObjectCacheImpl& cache = AxObjectCache(); 610 AXObjectCacheImpl& cache = AxObjectCache();
630 611
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 if (GetNode()) { 673 if (GetNode()) {
693 if (GetNode()->IsInert()) { 674 if (GetNode()->IsInert()) {
694 if (ignored_reasons) { 675 if (ignored_reasons) {
695 HTMLDialogElement* dialog = GetActiveDialogElement(GetNode()); 676 HTMLDialogElement* dialog = GetActiveDialogElement(GetNode());
696 if (dialog) { 677 if (dialog) {
697 AXObjectImpl* dialog_object = AxObjectCache().GetOrCreate(dialog); 678 AXObjectImpl* dialog_object = AxObjectCache().GetOrCreate(dialog);
698 if (dialog_object) { 679 if (dialog_object) {
699 ignored_reasons->push_back( 680 ignored_reasons->push_back(
700 IgnoredReason(kAXActiveModalDialog, dialog_object)); 681 IgnoredReason(kAXActiveModalDialog, dialog_object));
701 } else { 682 } else {
702 ignored_reasons->push_back(IgnoredReason(kAXInertElement)); 683 ignored_reasons->push_back(IgnoredReason(kAXInert));
703 } 684 }
704 } else { 685 } else {
705 const AXObjectImpl* inert_root_el = InertRoot(); 686 // TODO(aboxhall): handle inert attribute if it eventuates
706 if (inert_root_el == this) { 687 ignored_reasons->push_back(IgnoredReason(kAXInert));
707 ignored_reasons->push_back(IgnoredReason(kAXInertElement));
708 } else {
709 ignored_reasons->push_back(
710 IgnoredReason(kAXInertSubtree, inert_root_el));
711 }
712 } 688 }
713 } 689 }
714 return true; 690 return true;
715 } 691 }
716 } else { 692 } else {
717 AXObjectImpl* parent = ParentObject(); 693 AXObjectImpl* parent = ParentObject();
718 if (parent && parent->IsInertOrAriaHidden()) { 694 if (parent && parent->IsInertOrAriaHidden()) {
719 if (ignored_reasons) 695 if (ignored_reasons)
720 parent->ComputeIsInertOrAriaHidden(ignored_reasons); 696 parent->ComputeIsInertOrAriaHidden(ignored_reasons);
721 return true; 697 return true;
722 } 698 }
723 } 699 }
724 700
725 const AXObjectImpl* hidden_root = AriaHiddenRoot(); 701 const AXObjectImpl* hidden_root = AriaHiddenRoot();
726 if (hidden_root) { 702 if (hidden_root) {
727 if (ignored_reasons) { 703 if (ignored_reasons) {
728 if (hidden_root == this) { 704 if (hidden_root == this) {
729 ignored_reasons->push_back(IgnoredReason(kAXAriaHiddenElement)); 705 ignored_reasons->push_back(IgnoredReason(kAXAriaHidden));
730 } else { 706 } else {
731 ignored_reasons->push_back( 707 ignored_reasons->push_back(
732 IgnoredReason(kAXAriaHiddenSubtree, hidden_root)); 708 IgnoredReason(kAXAriaHiddenRoot, hidden_root));
733 } 709 }
734 } 710 }
735 return true; 711 return true;
736 } 712 }
737 713
738 return false; 714 return false;
739 } 715 }
740 716
741 bool AXObjectImpl::IsDescendantOfLeafNode() const { 717 bool AXObjectImpl::IsDescendantOfLeafNode() const {
742 UpdateCachedAttributeValuesIfNeeded(); 718 UpdateCachedAttributeValuesIfNeeded();
(...skipping 14 matching lines...) Expand all
757 const AXObjectImpl* AXObjectImpl::AriaHiddenRoot() const { 733 const AXObjectImpl* AXObjectImpl::AriaHiddenRoot() const {
758 for (const AXObjectImpl* object = this; object; 734 for (const AXObjectImpl* object = this; object;
759 object = object->ParentObject()) { 735 object = object->ParentObject()) {
760 if (object->AOMPropertyOrARIAAttributeIsTrue(AOMBooleanProperty::kHidden)) 736 if (object->AOMPropertyOrARIAAttributeIsTrue(AOMBooleanProperty::kHidden))
761 return object; 737 return object;
762 } 738 }
763 739
764 return 0; 740 return 0;
765 } 741 }
766 742
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
787 bool AXObjectImpl::IsDescendantOfDisabledNode() const { 743 bool AXObjectImpl::IsDescendantOfDisabledNode() const {
788 UpdateCachedAttributeValuesIfNeeded(); 744 UpdateCachedAttributeValuesIfNeeded();
789 return cached_is_descendant_of_disabled_node_; 745 return cached_is_descendant_of_disabled_node_;
790 } 746 }
791 747
792 const AXObjectImpl* AXObjectImpl::DisabledAncestor() const { 748 const AXObjectImpl* AXObjectImpl::DisabledAncestor() const {
793 bool disabled = false; 749 bool disabled = false;
794 if (HasAOMPropertyOrARIAAttribute(AOMBooleanProperty::kDisabled, disabled)) { 750 if (HasAOMPropertyOrARIAAttribute(AOMBooleanProperty::kDisabled, disabled)) {
795 if (disabled) 751 if (disabled)
796 return this; 752 return this;
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
2102 } 2058 }
2103 2059
2104 DEFINE_TRACE(AXObjectImpl) { 2060 DEFINE_TRACE(AXObjectImpl) {
2105 visitor->Trace(children_); 2061 visitor->Trace(children_);
2106 visitor->Trace(parent_); 2062 visitor->Trace(parent_);
2107 visitor->Trace(cached_live_region_root_); 2063 visitor->Trace(cached_live_region_root_);
2108 visitor->Trace(ax_object_cache_); 2064 visitor->Trace(ax_object_cache_);
2109 } 2065 }
2110 2066
2111 } // namespace blink 2067 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698