| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 roleMap->set(roles[i].ariaRole, roles[i].webcoreRole); | 127 roleMap->set(roles[i].ariaRole, roles[i].webcoreRole); |
| 128 return roleMap; | 128 return roleMap; |
| 129 } | 129 } |
| 130 | 130 |
| 131 AXObject::AXObject() | 131 AXObject::AXObject() |
| 132 : m_id(0) | 132 : m_id(0) |
| 133 , m_haveChildren(false) | 133 , m_haveChildren(false) |
| 134 , m_role(UnknownRole) | 134 , m_role(UnknownRole) |
| 135 , m_lastKnownIsIgnoredValue(DefaultBehavior) | 135 , m_lastKnownIsIgnoredValue(DefaultBehavior) |
| 136 , m_detached(false) | 136 , m_detached(false) |
| 137 , m_lastModificationCount(-1) |
| 138 , m_cachedIsIgnored(false) |
| 137 { | 139 { |
| 138 } | 140 } |
| 139 | 141 |
| 140 AXObject::~AXObject() | 142 AXObject::~AXObject() |
| 141 { | 143 { |
| 142 ASSERT(isDetached()); | 144 ASSERT(isDetached()); |
| 143 } | 145 } |
| 144 | 146 |
| 145 void AXObject::detach() | 147 void AXObject::detach() |
| 146 { | 148 { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 case TextFieldRole: | 243 case TextFieldRole: |
| 242 case ToggleButtonRole: | 244 case ToggleButtonRole: |
| 243 return true; | 245 return true; |
| 244 default: | 246 default: |
| 245 return false; | 247 return false; |
| 246 } | 248 } |
| 247 } | 249 } |
| 248 | 250 |
| 249 bool AXObject::accessibilityIsIgnored() const | 251 bool AXObject::accessibilityIsIgnored() const |
| 250 { | 252 { |
| 253 updateCachedAttributeValuesIfNeeded(); |
| 254 return m_cachedIsIgnored; |
| 255 } |
| 256 |
| 257 void AXObject::updateCachedAttributeValuesIfNeeded() const |
| 258 { |
| 251 AXObjectCacheImpl* cache = axObjectCache(); | 259 AXObjectCacheImpl* cache = axObjectCache(); |
| 252 if (!cache) | 260 if (!cache) |
| 253 return true; | 261 return; |
| 254 | 262 |
| 255 AXComputedObjectAttributeCache* attributeCache = cache->computedObjectAttrib
uteCache(); | 263 if (cache->modificationCount() == m_lastModificationCount) |
| 256 if (attributeCache) { | 264 return; |
| 257 AXObjectInclusion ignored = attributeCache->getIgnored(axObjectID()); | |
| 258 switch (ignored) { | |
| 259 case IgnoreObject: | |
| 260 return true; | |
| 261 case IncludeObject: | |
| 262 return false; | |
| 263 case DefaultBehavior: | |
| 264 break; | |
| 265 } | |
| 266 } | |
| 267 | 265 |
| 268 bool result = computeAccessibilityIsIgnored(); | 266 m_cachedIsIgnored = computeAccessibilityIsIgnored(); |
| 269 | 267 m_lastModificationCount = cache->modificationCount(); |
| 270 if (attributeCache) | |
| 271 attributeCache->setIgnored(axObjectID(), result ? IgnoreObject : Include
Object); | |
| 272 | |
| 273 return result; | |
| 274 } | 268 } |
| 275 | 269 |
| 276 bool AXObject::accessibilityIsIgnoredByDefault() const | 270 bool AXObject::accessibilityIsIgnoredByDefault() const |
| 277 { | 271 { |
| 278 return defaultObjectInclusion() == IgnoreObject; | 272 return defaultObjectInclusion() == IgnoreObject; |
| 279 } | 273 } |
| 280 | 274 |
| 281 AXObjectInclusion AXObject::accessibilityPlatformIncludesObject() const | 275 AXObjectInclusion AXObject::accessibilityPlatformIncludesObject() const |
| 282 { | 276 { |
| 283 if (isMenuListPopup() || isMenuListOption()) | 277 if (isMenuListPopup() || isMenuListOption()) |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 return ToggleButtonRole; | 910 return ToggleButtonRole; |
| 917 if (ariaHasPopup()) | 911 if (ariaHasPopup()) |
| 918 return PopUpButtonRole; | 912 return PopUpButtonRole; |
| 919 // We don't contemplate RadioButtonRole, as it depends on the input | 913 // We don't contemplate RadioButtonRole, as it depends on the input |
| 920 // type. | 914 // type. |
| 921 | 915 |
| 922 return ButtonRole; | 916 return ButtonRole; |
| 923 } | 917 } |
| 924 | 918 |
| 925 } // namespace blink | 919 } // namespace blink |
| OLD | NEW |