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

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

Issue 2088453002: Implement the inert attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 3 years, 10 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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
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* inertRootEl = inertRoot();
esprehn 2017/02/15 01:40:47 don't abbreviate, intertRoot = this->inertRoot()
aboxhall 2017/02/15 02:06:16 Done.
542 ignoredReasons->push_back(IgnoredReason(AXInert)); 542 if (inertRootEl == this) {
543 ignoredReasons->push_back(IgnoredReason(AXInertElement));
544 } else {
545 ignoredReasons->push_back(
546 IgnoredReason(AXInertSubtree, inertRootEl));
547 }
543 } 548 }
544 } 549 }
545 return true; 550 return true;
546 } 551 }
547 } else { 552 } else {
548 AXObject* parent = parentObject(); 553 AXObject* parent = parentObject();
549 if (parent && parent->isInertOrAriaHidden()) { 554 if (parent && parent->isInertOrAriaHidden()) {
550 if (ignoredReasons) 555 if (ignoredReasons)
551 parent->computeIsInertOrAriaHidden(ignoredReasons); 556 parent->computeIsInertOrAriaHidden(ignoredReasons);
552 return true; 557 return true;
553 } 558 }
554 } 559 }
555 560
556 const AXObject* hiddenRoot = ariaHiddenRoot(); 561 const AXObject* hiddenRoot = ariaHiddenRoot();
557 if (hiddenRoot) { 562 if (hiddenRoot) {
558 if (ignoredReasons) { 563 if (ignoredReasons) {
559 if (hiddenRoot == this) 564 if (hiddenRoot == this) {
560 ignoredReasons->push_back(IgnoredReason(AXAriaHidden)); 565 ignoredReasons->push_back(IgnoredReason(AXAriaHiddenElement));
561 else 566 } else {
562 ignoredReasons->push_back(IgnoredReason(AXAriaHiddenRoot, hiddenRoot)); 567 ignoredReasons->push_back(
568 IgnoredReason(AXAriaHiddenSubtree, hiddenRoot));
569 }
563 } 570 }
564 return true; 571 return true;
565 } 572 }
566 573
567 return false; 574 return false;
568 } 575 }
569 576
570 bool AXObject::isDescendantOfLeafNode() const { 577 bool AXObject::isDescendantOfLeafNode() const {
571 updateCachedAttributeValuesIfNeeded(); 578 updateCachedAttributeValuesIfNeeded();
572 return m_cachedIsDescendantOfLeafNode; 579 return m_cachedIsDescendantOfLeafNode;
(...skipping 12 matching lines...) Expand all
585 592
586 const AXObject* AXObject::ariaHiddenRoot() const { 593 const AXObject* AXObject::ariaHiddenRoot() const {
587 for (const AXObject* object = this; object; object = object->parentObject()) { 594 for (const AXObject* object = this; object; object = object->parentObject()) {
588 if (equalIgnoringCase(object->getAttribute(aria_hiddenAttr), "true")) 595 if (equalIgnoringCase(object->getAttribute(aria_hiddenAttr), "true"))
589 return object; 596 return object;
590 } 597 }
591 598
592 return 0; 599 return 0;
593 } 600 }
594 601
602 const AXObject* AXObject::inertRoot() const {
603 const AXObject* object = this;
604 if (!RuntimeEnabledFeatures::inertAttributeEnabled())
605 return 0;
esprehn 2017/02/15 01:40:47 nullptr
aboxhall 2017/02/15 02:06:16 Done.
606
607 while (object && !object->isAXNodeObject())
608 object = object->parentObject();
609 for (Node* node = object->getNode(); node;
610 node = FlatTreeTraversal::parentElement(*node)) {
611 if (!node->isElementNode())
esprehn 2017/02/15 01:40:47 This is definitely weird since it's doing parentEl
aboxhall 2017/02/15 02:06:16 Acknowledged.
612 continue;
613 if (toElement(node)->hasAttribute(inertAttr))
614 return axObjectCache().getOrCreate(node);
615 }
616
617 return 0;
esprehn 2017/02/15 01:40:47 ditto
aboxhall 2017/02/15 02:06:16 Done.
618 }
619
595 bool AXObject::isDescendantOfDisabledNode() const { 620 bool AXObject::isDescendantOfDisabledNode() const {
596 updateCachedAttributeValuesIfNeeded(); 621 updateCachedAttributeValuesIfNeeded();
597 return m_cachedIsDescendantOfDisabledNode; 622 return m_cachedIsDescendantOfDisabledNode;
598 } 623 }
599 624
600 const AXObject* AXObject::disabledAncestor() const { 625 const AXObject* AXObject::disabledAncestor() const {
601 const AtomicString& disabled = getAttribute(aria_disabledAttr); 626 const AtomicString& disabled = getAttribute(aria_disabledAttr);
602 if (equalIgnoringCase(disabled, "true")) 627 if (equalIgnoringCase(disabled, "true"))
603 return this; 628 return this;
604 if (equalIgnoringCase(disabled, "false")) 629 if (equalIgnoringCase(disabled, "false"))
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 } 1784 }
1760 1785
1761 DEFINE_TRACE(AXObject) { 1786 DEFINE_TRACE(AXObject) {
1762 visitor->trace(m_children); 1787 visitor->trace(m_children);
1763 visitor->trace(m_parent); 1788 visitor->trace(m_parent);
1764 visitor->trace(m_cachedLiveRegionRoot); 1789 visitor->trace(m_cachedLiveRegionRoot);
1765 visitor->trace(m_axObjectCache); 1790 visitor->trace(m_axObjectCache);
1766 } 1791 }
1767 1792
1768 } // namespace blink 1793 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698