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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 "scrollbar", | 323 "scrollbar", |
| 324 "slider", | 324 "slider", |
| 325 "spinbutton", | 325 "spinbutton", |
| 326 "status", | 326 "status", |
| 327 "tab", | 327 "tab", |
| 328 "tabpanel", | 328 "tabpanel", |
| 329 "textbox", | 329 "textbox", |
| 330 "timer", | 330 "timer", |
| 331 "tooltip", | 331 "tooltip", |
| 332 "treeitem", | 332 "treeitem", |
| 333 // Composite user interface widgets. This list is also from w3.org site ref rerenced above. | 333 // Composite user interface widgets. |
| 334 // This list is also from the w3.org site referenced above. | |
| 334 "combobox", | 335 "combobox", |
| 335 "grid", | 336 "grid", |
| 336 "listbox", | 337 "listbox", |
| 337 "menu", | 338 "menu", |
| 338 "menubar", | 339 "menubar", |
| 339 "radiogroup", | 340 "radiogroup", |
| 340 "tablist", | 341 "tablist", |
| 341 "tree", | 342 "tree", |
| 342 "treegrid" | 343 "treegrid" |
| 343 }; | 344 }; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 381 , m_role(UnknownRole) | 382 , m_role(UnknownRole) |
| 382 , m_lastKnownIsIgnoredValue(DefaultBehavior) | 383 , m_lastKnownIsIgnoredValue(DefaultBehavior) |
| 383 , m_parent(nullptr) | 384 , m_parent(nullptr) |
| 384 , m_lastModificationCount(-1) | 385 , m_lastModificationCount(-1) |
| 385 , m_cachedIsIgnored(false) | 386 , m_cachedIsIgnored(false) |
| 386 , m_cachedIsInertOrAriaHidden(false) | 387 , m_cachedIsInertOrAriaHidden(false) |
| 387 , m_cachedIsDescendantOfLeafNode(false) | 388 , m_cachedIsDescendantOfLeafNode(false) |
| 388 , m_cachedIsDescendantOfDisabledNode(false) | 389 , m_cachedIsDescendantOfDisabledNode(false) |
| 389 , m_cachedHasInheritedPresentationalRole(false) | 390 , m_cachedHasInheritedPresentationalRole(false) |
| 390 , m_cachedIsPresentationalChild(false) | 391 , m_cachedIsPresentationalChild(false) |
| 392 , m_cachedAncestorExposesActiveDescendant(false) | |
| 391 , m_cachedLiveRegionRoot(nullptr) | 393 , m_cachedLiveRegionRoot(nullptr) |
| 392 , m_axObjectCache(&axObjectCache) | 394 , m_axObjectCache(&axObjectCache) |
| 393 { | 395 { |
| 394 ++s_numberOfLiveAXObjects; | 396 ++s_numberOfLiveAXObjects; |
| 395 } | 397 } |
| 396 | 398 |
| 397 AXObject::~AXObject() | 399 AXObject::~AXObject() |
| 398 { | 400 { |
| 399 ASSERT(isDetached()); | 401 ASSERT(isDetached()); |
| 400 --s_numberOfLiveAXObjects; | 402 --s_numberOfLiveAXObjects; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 514 m_lastModificationCount = cache.modificationCount(); | 516 m_lastModificationCount = cache.modificationCount(); |
| 515 m_cachedIsInertOrAriaHidden = computeIsInertOrAriaHidden(); | 517 m_cachedIsInertOrAriaHidden = computeIsInertOrAriaHidden(); |
| 516 m_cachedIsDescendantOfLeafNode = (leafNodeAncestor() != 0); | 518 m_cachedIsDescendantOfLeafNode = (leafNodeAncestor() != 0); |
| 517 m_cachedIsDescendantOfDisabledNode = (disabledAncestor() != 0); | 519 m_cachedIsDescendantOfDisabledNode = (disabledAncestor() != 0); |
| 518 m_cachedHasInheritedPresentationalRole = (inheritsPresentationalRoleFrom() ! = 0); | 520 m_cachedHasInheritedPresentationalRole = (inheritsPresentationalRoleFrom() ! = 0); |
| 519 m_cachedIsPresentationalChild = (ancestorForWhichThisIsAPresentationalChild( ) != 0); | 521 m_cachedIsPresentationalChild = (ancestorForWhichThisIsAPresentationalChild( ) != 0); |
| 520 m_cachedIsIgnored = computeAccessibilityIsIgnored(); | 522 m_cachedIsIgnored = computeAccessibilityIsIgnored(); |
| 521 m_cachedLiveRegionRoot = isLiveRegion() ? | 523 m_cachedLiveRegionRoot = isLiveRegion() ? |
| 522 this : | 524 this : |
| 523 (parentObjectIfExists() ? parentObjectIfExists()->liveRegionRoot() : 0); | 525 (parentObjectIfExists() ? parentObjectIfExists()->liveRegionRoot() : 0); |
| 526 m_cachedAncestorExposesActiveDescendant = computeAncestorExposesActiveDescen dant(); | |
| 524 } | 527 } |
| 525 | 528 |
| 526 bool AXObject::accessibilityIsIgnoredByDefault(IgnoredReasons* ignoredReasons) c onst | 529 bool AXObject::accessibilityIsIgnoredByDefault(IgnoredReasons* ignoredReasons) c onst |
| 527 { | 530 { |
| 528 return defaultObjectInclusion(ignoredReasons) == IgnoreObject; | 531 return defaultObjectInclusion(ignoredReasons) == IgnoreObject; |
| 529 } | 532 } |
| 530 | 533 |
| 531 AXObjectInclusion AXObject::accessibilityPlatformIncludesObject() const | 534 AXObjectInclusion AXObject::accessibilityPlatformIncludesObject() const |
| 532 { | 535 { |
| 533 if (isMenuListPopup() || isMenuListOption()) | 536 if (isMenuListPopup() || isMenuListOption()) |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 669 updateCachedAttributeValuesIfNeeded(); | 672 updateCachedAttributeValuesIfNeeded(); |
| 670 return m_cachedHasInheritedPresentationalRole; | 673 return m_cachedHasInheritedPresentationalRole; |
| 671 } | 674 } |
| 672 | 675 |
| 673 bool AXObject::isPresentationalChild() const | 676 bool AXObject::isPresentationalChild() const |
| 674 { | 677 { |
| 675 updateCachedAttributeValuesIfNeeded(); | 678 updateCachedAttributeValuesIfNeeded(); |
| 676 return m_cachedIsPresentationalChild; | 679 return m_cachedIsPresentationalChild; |
| 677 } | 680 } |
| 678 | 681 |
| 682 bool AXObject::ancestorExposesActiveDescendant() const | |
| 683 { | |
| 684 updateCachedAttributeValuesIfNeeded(); | |
| 685 return m_cachedAncestorExposesActiveDescendant; | |
| 686 } | |
| 687 | |
| 688 bool AXObject::computeAncestorExposesActiveDescendant() const | |
| 689 { | |
| 690 for (const AXObject* object = this; object; object = object->parentObjectUni gnored()) { | |
|
dmazzoni
2016/04/06 15:51:12
Should this return true for itself or only for an
| |
| 691 if (object->supportsActiveDescendant() | |
| 692 && !object->getAttribute(aria_activedescendantAttr).isEmpty()) { | |
| 693 return true; | |
| 694 } | |
| 695 } | |
| 696 | |
| 697 return false; | |
| 698 } | |
| 699 | |
| 679 // Simplify whitespace, but preserve a single leading and trailing whitespace ch aracter if it's present. | 700 // Simplify whitespace, but preserve a single leading and trailing whitespace ch aracter if it's present. |
| 680 // static | 701 // static |
| 681 String AXObject::collapseWhitespace(const String& str) | 702 String AXObject::collapseWhitespace(const String& str) |
| 682 { | 703 { |
| 683 StringBuilder result; | 704 StringBuilder result; |
| 684 if (!str.isEmpty() && isHTMLSpace<UChar>(str[0])) | 705 if (!str.isEmpty() && isHTMLSpace<UChar>(str[0])) |
| 685 result.append(' '); | 706 result.append(' '); |
| 686 result.append(str.simplifyWhiteSpace(isHTMLSpace<UChar>)); | 707 result.append(str.simplifyWhiteSpace(isHTMLSpace<UChar>)); |
| 687 if (!str.isEmpty() && isHTMLSpace<UChar>(str[str.length() - 1])) | 708 if (!str.isEmpty() && isHTMLSpace<UChar>(str[str.length() - 1])) |
| 688 result.append(' '); | 709 result.append(' '); |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 972 return false; | 993 return false; |
| 973 | 994 |
| 974 return equalIgnoringCase(getAttribute(aria_multilineAttr), "true"); | 995 return equalIgnoringCase(getAttribute(aria_multilineAttr), "true"); |
| 975 } | 996 } |
| 976 | 997 |
| 977 bool AXObject::ariaPressedIsPresent() const | 998 bool AXObject::ariaPressedIsPresent() const |
| 978 { | 999 { |
| 979 return !getAttribute(aria_pressedAttr).isEmpty(); | 1000 return !getAttribute(aria_pressedAttr).isEmpty(); |
| 980 } | 1001 } |
| 981 | 1002 |
| 1003 bool AXObject::supportsActiveDescendant() const | |
| 1004 { | |
| 1005 // According to the ARIA Spec, all ARIA composite widgets, ARIA text boxes | |
| 1006 // and ARIA groups should be able to expose an active descendant. | |
| 1007 // Implicitly, <input> and <textarea> elements should also have this ability . | |
| 1008 switch (ariaRoleAttribute()) { | |
| 1009 case ComboBoxRole: | |
| 1010 case GridRole: | |
| 1011 case GroupRole: | |
| 1012 case ListBoxRole: | |
| 1013 case MenuRole: | |
| 1014 case MenuBarRole: | |
| 1015 case RadioGroupRole: | |
| 1016 case RowRole: | |
| 1017 case SearchBoxRole: | |
| 1018 case TabListRole: | |
| 1019 case TextFieldRole: | |
| 1020 case ToolbarRole: | |
| 1021 case TreeRole: | |
| 1022 case TreeGridRole: | |
| 1023 return true; | |
| 1024 default: | |
| 1025 return false; | |
| 1026 } | |
| 1027 } | |
| 1028 | |
| 982 bool AXObject::supportsARIAAttributes() const | 1029 bool AXObject::supportsARIAAttributes() const |
| 983 { | 1030 { |
| 984 return isLiveRegion() | 1031 return isLiveRegion() |
| 985 || supportsARIADragging() | 1032 || supportsARIADragging() |
| 986 || supportsARIADropping() | 1033 || supportsARIADropping() |
| 987 || supportsARIAFlowTo() | 1034 || supportsARIAFlowTo() |
| 988 || supportsARIAOwns() | 1035 || supportsARIAOwns() |
| 989 || hasAttribute(aria_labelAttr); | 1036 || hasAttribute(aria_labelAttr); |
| 990 } | 1037 } |
| 991 | 1038 |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1685 | 1732 |
| 1686 DEFINE_TRACE(AXObject) | 1733 DEFINE_TRACE(AXObject) |
| 1687 { | 1734 { |
| 1688 visitor->trace(m_children); | 1735 visitor->trace(m_children); |
| 1689 visitor->trace(m_parent); | 1736 visitor->trace(m_parent); |
| 1690 visitor->trace(m_cachedLiveRegionRoot); | 1737 visitor->trace(m_cachedLiveRegionRoot); |
| 1691 visitor->trace(m_axObjectCache); | 1738 visitor->trace(m_axObjectCache); |
| 1692 } | 1739 } |
| 1693 | 1740 |
| 1694 } // namespace blink | 1741 } // namespace blink |
| OLD | NEW |