| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, Google 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 #include "wtf/text/StringBuilder.h" | 67 #include "wtf/text/StringBuilder.h" |
| 68 | 68 |
| 69 namespace blink { | 69 namespace blink { |
| 70 | 70 |
| 71 using namespace HTMLNames; | 71 using namespace HTMLNames; |
| 72 | 72 |
| 73 AXNodeObject::AXNodeObject(Node* node, AXObjectCacheImpl& axObjectCache) | 73 AXNodeObject::AXNodeObject(Node* node, AXObjectCacheImpl& axObjectCache) |
| 74 : AXObject(axObjectCache), | 74 : AXObject(axObjectCache), |
| 75 m_ariaRole(UnknownRole), | 75 m_ariaRole(UnknownRole), |
| 76 m_childrenDirty(false), | 76 m_childrenDirty(false), |
| 77 #if ENABLE(ASSERT) | |
| 78 m_initialized(false), | |
| 79 #endif | |
| 80 m_node(node) { | 77 m_node(node) { |
| 81 } | 78 } |
| 82 | 79 |
| 83 AXNodeObject* AXNodeObject::create(Node* node, | 80 AXNodeObject* AXNodeObject::create(Node* node, |
| 84 AXObjectCacheImpl& axObjectCache) { | 81 AXObjectCacheImpl& axObjectCache) { |
| 85 return new AXNodeObject(node, axObjectCache); | 82 return new AXNodeObject(node, axObjectCache); |
| 86 } | 83 } |
| 87 | 84 |
| 88 AXNodeObject::~AXNodeObject() { | 85 AXNodeObject::~AXNodeObject() { |
| 89 ASSERT(!m_node); | 86 ASSERT(!m_node); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 117 element->treeScope().getElementById(activeDescendantAttr); | 114 element->treeScope().getElementById(activeDescendantAttr); |
| 118 if (!descendant) | 115 if (!descendant) |
| 119 return nullptr; | 116 return nullptr; |
| 120 | 117 |
| 121 AXObject* axDescendant = axObjectCache().getOrCreate(descendant); | 118 AXObject* axDescendant = axObjectCache().getOrCreate(descendant); |
| 122 return axDescendant; | 119 return axDescendant; |
| 123 } | 120 } |
| 124 | 121 |
| 125 bool AXNodeObject::computeAccessibilityIsIgnored( | 122 bool AXNodeObject::computeAccessibilityIsIgnored( |
| 126 IgnoredReasons* ignoredReasons) const { | 123 IgnoredReasons* ignoredReasons) const { |
| 127 #if ENABLE(ASSERT) | 124 #if DCHECK_IS_ON() |
| 128 // Double-check that an AXObject is never accessed before | 125 // Double-check that an AXObject is never accessed before |
| 129 // it's been initialized. | 126 // it's been initialized. |
| 130 ASSERT(m_initialized); | 127 ASSERT(m_initialized); |
| 131 #endif | 128 #endif |
| 132 | 129 |
| 133 // If this element is within a parent that cannot have children, it should not | 130 // If this element is within a parent that cannot have children, it should not |
| 134 // be exposed. | 131 // be exposed. |
| 135 if (isDescendantOfLeafNode()) { | 132 if (isDescendantOfLeafNode()) { |
| 136 if (ignoredReasons) | 133 if (ignoredReasons) |
| 137 ignoredReasons->push_back( | 134 ignoredReasons->push_back( |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 // If the parent had a different role, then we don't need to continue | 731 // If the parent had a different role, then we don't need to continue |
| 735 // searching up the chain. | 732 // searching up the chain. |
| 736 if (parentAriaRole) | 733 if (parentAriaRole) |
| 737 break; | 734 break; |
| 738 } | 735 } |
| 739 | 736 |
| 740 return role; | 737 return role; |
| 741 } | 738 } |
| 742 | 739 |
| 743 void AXNodeObject::init() { | 740 void AXNodeObject::init() { |
| 744 #if ENABLE(ASSERT) | 741 #if DCHECK_IS_ON() |
| 745 ASSERT(!m_initialized); | 742 ASSERT(!m_initialized); |
| 746 m_initialized = true; | 743 m_initialized = true; |
| 747 #endif | 744 #endif |
| 748 m_role = determineAccessibilityRole(); | 745 m_role = determineAccessibilityRole(); |
| 749 } | 746 } |
| 750 | 747 |
| 751 void AXNodeObject::detach() { | 748 void AXNodeObject::detach() { |
| 752 AXObject::detach(); | 749 AXObject::detach(); |
| 753 m_node = nullptr; | 750 m_node = nullptr; |
| 754 } | 751 } |
| (...skipping 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2895 return String(); | 2892 return String(); |
| 2896 return toTextControlElement(node)->strippedPlaceholder(); | 2893 return toTextControlElement(node)->strippedPlaceholder(); |
| 2897 } | 2894 } |
| 2898 | 2895 |
| 2899 DEFINE_TRACE(AXNodeObject) { | 2896 DEFINE_TRACE(AXNodeObject) { |
| 2900 visitor->trace(m_node); | 2897 visitor->trace(m_node); |
| 2901 AXObject::trace(visitor); | 2898 AXObject::trace(visitor); |
| 2902 } | 2899 } |
| 2903 | 2900 |
| 2904 } // namespace blink | 2901 } // namespace blink |
| OLD | NEW |