OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014, Google Inc. All rights reserved. | 2 * Copyright (C) 2014, 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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 Vector<AXID> child_axi_ds = aria_owner_to_children_mapping_.at(obj_id); | 567 Vector<AXID> child_axi_ds = aria_owner_to_children_mapping_.at(obj_id); |
568 for (size_t i = 0; i < child_axi_ds.size(); ++i) | 568 for (size_t i = 0; i < child_axi_ds.size(); ++i) |
569 aria_owned_child_to_owner_mapping_.erase(child_axi_ds[i]); | 569 aria_owned_child_to_owner_mapping_.erase(child_axi_ds[i]); |
570 aria_owner_to_children_mapping_.erase(obj_id); | 570 aria_owner_to_children_mapping_.erase(obj_id); |
571 } | 571 } |
572 aria_owned_child_to_owner_mapping_.erase(obj_id); | 572 aria_owned_child_to_owner_mapping_.erase(obj_id); |
573 aria_owned_child_to_real_parent_mapping_.erase(obj_id); | 573 aria_owned_child_to_real_parent_mapping_.erase(obj_id); |
574 aria_owner_to_ids_mapping_.erase(obj_id); | 574 aria_owner_to_ids_mapping_.erase(obj_id); |
575 } | 575 } |
576 | 576 |
577 void AXObjectCacheImpl::SelectionChanged(Node* node) { | 577 AXObjectImpl* AXObjectCacheImpl::NearestExistingAncestor(Node* node) { |
578 // Find the nearest ancestor that already has an accessibility object, since | 578 // Find the nearest ancestor that already has an accessibility object, since |
579 // we might be in the middle of a layout. | 579 // we might be in the middle of a layout. |
580 while (node) { | 580 while (node) { |
581 if (AXObjectImpl* obj = Get(node)) { | 581 if (AXObjectImpl* obj = Get(node)) |
582 obj->SelectionChanged(); | 582 return obj; |
583 return; | |
584 } | |
585 node = node->parentNode(); | 583 node = node->parentNode(); |
586 } | 584 } |
| 585 return nullptr; |
| 586 } |
| 587 |
| 588 void AXObjectCacheImpl::SelectionChanged(Node* node) { |
| 589 AXObjectImpl* nearestAncestor = NearestExistingAncestor(node); |
| 590 if (nearestAncestor) |
| 591 nearestAncestor->SelectionChanged(); |
587 } | 592 } |
588 | 593 |
589 void AXObjectCacheImpl::TextChanged(Node* node) { | 594 void AXObjectCacheImpl::TextChanged(Node* node) { |
590 TextChanged(GetOrCreate(node)); | 595 TextChanged(Get(node)); |
591 } | 596 } |
592 | 597 |
593 void AXObjectCacheImpl::TextChanged(LayoutObject* layout_object) { | 598 void AXObjectCacheImpl::TextChanged(LayoutObject* layout_object) { |
594 TextChanged(GetOrCreate(layout_object)); | 599 TextChanged(Get(layout_object)); |
595 } | 600 } |
596 | 601 |
597 void AXObjectCacheImpl::TextChanged(AXObjectImpl* obj) { | 602 void AXObjectCacheImpl::TextChanged(AXObjectImpl* obj) { |
598 if (!obj) | 603 if (!obj) |
599 return; | 604 return; |
600 | 605 |
601 obj->TextChanged(); | 606 obj->TextChanged(); |
602 PostNotification(obj, AXObjectCacheImpl::kAXTextChanged); | 607 PostNotification(obj, AXObjectCacheImpl::kAXTextChanged); |
603 } | 608 } |
604 | 609 |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 PostNotification(end_object, kAXChildrenChanged); | 1175 PostNotification(end_object, kAXChildrenChanged); |
1171 } | 1176 } |
1172 } | 1177 } |
1173 | 1178 |
1174 void AXObjectCacheImpl::HandleValueChanged(Node* node) { | 1179 void AXObjectCacheImpl::HandleValueChanged(Node* node) { |
1175 PostNotification(node, AXObjectCache::kAXValueChanged); | 1180 PostNotification(node, AXObjectCache::kAXValueChanged); |
1176 } | 1181 } |
1177 | 1182 |
1178 void AXObjectCacheImpl::HandleUpdateActiveMenuOption(LayoutMenuList* menu_list, | 1183 void AXObjectCacheImpl::HandleUpdateActiveMenuOption(LayoutMenuList* menu_list, |
1179 int option_index) { | 1184 int option_index) { |
1180 AXObjectImpl* obj = Get(menu_list); | 1185 AXObjectImpl* obj = GetOrCreate(menu_list); |
1181 if (!obj || !obj->IsMenuList()) | 1186 if (!obj || !obj->IsMenuList()) |
1182 return; | 1187 return; |
1183 | 1188 |
1184 ToAXMenuList(obj)->DidUpdateActiveOption(option_index); | 1189 ToAXMenuList(obj)->DidUpdateActiveOption(option_index); |
1185 } | 1190 } |
1186 | 1191 |
1187 void AXObjectCacheImpl::DidShowMenuListPopup(LayoutMenuList* menu_list) { | 1192 void AXObjectCacheImpl::DidShowMenuListPopup(LayoutMenuList* menu_list) { |
1188 AXObjectImpl* obj = Get(menu_list); | 1193 AXObjectImpl* obj = Get(menu_list); |
1189 if (!obj || !obj->IsMenuList()) | 1194 if (!obj || !obj->IsMenuList()) |
1190 return; | 1195 return; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 visitor->Trace(document_); | 1284 visitor->Trace(document_); |
1280 visitor->Trace(node_object_mapping_); | 1285 visitor->Trace(node_object_mapping_); |
1281 | 1286 |
1282 visitor->Trace(objects_); | 1287 visitor->Trace(objects_); |
1283 visitor->Trace(notifications_to_post_); | 1288 visitor->Trace(notifications_to_post_); |
1284 | 1289 |
1285 AXObjectCache::Trace(visitor); | 1290 AXObjectCache::Trace(visitor); |
1286 } | 1291 } |
1287 | 1292 |
1288 } // namespace blink | 1293 } // namespace blink |
OLD | NEW |