Chromium Code Reviews| 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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 526 | 526 |
| 527 bool AXObject::computeIsInertOrAriaHidden( | 527 bool AXObject::computeIsInertOrAriaHidden( |
| 528 IgnoredReasons* ignoredReasons) const { | 528 IgnoredReasons* ignoredReasons) const { |
| 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->append( |
|
esprehn
2017/02/07 23:50:59
Why rename this back?
aboxhall
2017/02/08 05:26:02
bad merge :(
| |
| 537 IgnoredReason(AXActiveModalDialog, dialogObject)); | 537 IgnoredReason(AXActiveModalDialog, dialogObject)); |
| 538 else | 538 else |
| 539 ignoredReasons->push_back(IgnoredReason(AXInert)); | 539 ignoredReasons->append(IgnoredReason(AXInertElement)); |
| 540 } else { | 540 } else { |
| 541 // TODO(aboxhall): handle inert attribute if it eventuates | 541 const AXObject* inertRootEl = inertRoot(); |
| 542 ignoredReasons->push_back(IgnoredReason(AXInert)); | 542 if (inertRootEl == this) |
| 543 ignoredReasons->append(IgnoredReason(AXInertElement)); | |
| 544 else | |
| 545 ignoredReasons->append(IgnoredReason(AXInertSubtree, inertRootEl)); | |
| 543 } | 546 } |
| 544 } | 547 } |
| 545 return true; | 548 return true; |
| 546 } | 549 } |
| 547 } else { | 550 } else { |
| 548 AXObject* parent = parentObject(); | 551 AXObject* parent = parentObject(); |
| 549 if (parent && parent->isInertOrAriaHidden()) { | 552 if (parent && parent->isInertOrAriaHidden()) { |
| 550 if (ignoredReasons) | 553 if (ignoredReasons) |
| 551 parent->computeIsInertOrAriaHidden(ignoredReasons); | 554 parent->computeIsInertOrAriaHidden(ignoredReasons); |
| 552 return true; | 555 return true; |
| 553 } | 556 } |
| 554 } | 557 } |
| 555 | 558 |
| 556 const AXObject* hiddenRoot = ariaHiddenRoot(); | 559 const AXObject* hiddenRoot = ariaHiddenRoot(); |
| 557 if (hiddenRoot) { | 560 if (hiddenRoot) { |
| 558 if (ignoredReasons) { | 561 if (ignoredReasons) { |
| 559 if (hiddenRoot == this) | 562 if (hiddenRoot == this) { |
| 560 ignoredReasons->push_back(IgnoredReason(AXAriaHidden)); | 563 ignoredReasons->push_back(IgnoredReason(AXAriaHiddenElement)); |
| 561 else | 564 } else { |
| 562 ignoredReasons->push_back(IgnoredReason(AXAriaHiddenRoot, hiddenRoot)); | 565 ignoredReasons->push_back( |
| 566 IgnoredReason(AXAriaHiddenSubtree, hiddenRoot)); | |
| 567 } | |
| 563 } | 568 } |
| 564 return true; | 569 return true; |
| 565 } | 570 } |
| 566 | 571 |
| 567 return false; | 572 return false; |
| 568 } | 573 } |
| 569 | 574 |
| 570 bool AXObject::isDescendantOfLeafNode() const { | 575 bool AXObject::isDescendantOfLeafNode() const { |
| 571 updateCachedAttributeValuesIfNeeded(); | 576 updateCachedAttributeValuesIfNeeded(); |
| 572 return m_cachedIsDescendantOfLeafNode; | 577 return m_cachedIsDescendantOfLeafNode; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 585 | 590 |
| 586 const AXObject* AXObject::ariaHiddenRoot() const { | 591 const AXObject* AXObject::ariaHiddenRoot() const { |
| 587 for (const AXObject* object = this; object; object = object->parentObject()) { | 592 for (const AXObject* object = this; object; object = object->parentObject()) { |
| 588 if (equalIgnoringCase(object->getAttribute(aria_hiddenAttr), "true")) | 593 if (equalIgnoringCase(object->getAttribute(aria_hiddenAttr), "true")) |
| 589 return object; | 594 return object; |
| 590 } | 595 } |
| 591 | 596 |
| 592 return 0; | 597 return 0; |
| 593 } | 598 } |
| 594 | 599 |
| 600 const AXObject* AXObject::inertRoot() const { | |
| 601 const AXObject* object = this; | |
| 602 if (!RuntimeEnabledFeatures::inertAttributeEnabled()) | |
| 603 return 0; | |
| 604 | |
| 605 while (object && !object->isAXNodeObject()) | |
| 606 object = object->parentObject(); | |
| 607 for (Node* node = object->getNode(); node; | |
|
esprehn
2017/02/07 23:50:59
ditto, this wants the composed/flat tree.
aboxhall
2017/02/08 05:26:01
Done.
| |
| 608 node = node->parentOrShadowHostElement()) { | |
| 609 if (!node->isElementNode()) | |
| 610 continue; | |
| 611 if (toElement(node)->hasAttribute(inertAttr)) | |
| 612 return axObjectCache().getOrCreate(node); | |
| 613 } | |
| 614 | |
| 615 return 0; | |
| 616 } | |
| 617 | |
| 595 bool AXObject::isDescendantOfDisabledNode() const { | 618 bool AXObject::isDescendantOfDisabledNode() const { |
| 596 updateCachedAttributeValuesIfNeeded(); | 619 updateCachedAttributeValuesIfNeeded(); |
| 597 return m_cachedIsDescendantOfDisabledNode; | 620 return m_cachedIsDescendantOfDisabledNode; |
| 598 } | 621 } |
| 599 | 622 |
| 600 const AXObject* AXObject::disabledAncestor() const { | 623 const AXObject* AXObject::disabledAncestor() const { |
| 601 const AtomicString& disabled = getAttribute(aria_disabledAttr); | 624 const AtomicString& disabled = getAttribute(aria_disabledAttr); |
| 602 if (equalIgnoringCase(disabled, "true")) | 625 if (equalIgnoringCase(disabled, "true")) |
| 603 return this; | 626 return this; |
| 604 if (equalIgnoringCase(disabled, "false")) | 627 if (equalIgnoringCase(disabled, "false")) |
| (...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1746 } | 1769 } |
| 1747 | 1770 |
| 1748 DEFINE_TRACE(AXObject) { | 1771 DEFINE_TRACE(AXObject) { |
| 1749 visitor->trace(m_children); | 1772 visitor->trace(m_children); |
| 1750 visitor->trace(m_parent); | 1773 visitor->trace(m_parent); |
| 1751 visitor->trace(m_cachedLiveRegionRoot); | 1774 visitor->trace(m_cachedLiveRegionRoot); |
| 1752 visitor->trace(m_axObjectCache); | 1775 visitor->trace(m_axObjectCache); |
| 1753 } | 1776 } |
| 1754 | 1777 |
| 1755 } // namespace blink | 1778 } // namespace blink |
| OLD | NEW |