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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 Vector<AXID> child_axi_ds = aria_owner_to_children_mapping_.at(obj_id); | 561 Vector<AXID> child_axi_ds = aria_owner_to_children_mapping_.at(obj_id); |
562 for (size_t i = 0; i < child_axi_ds.size(); ++i) | 562 for (size_t i = 0; i < child_axi_ds.size(); ++i) |
563 aria_owned_child_to_owner_mapping_.erase(child_axi_ds[i]); | 563 aria_owned_child_to_owner_mapping_.erase(child_axi_ds[i]); |
564 aria_owner_to_children_mapping_.erase(obj_id); | 564 aria_owner_to_children_mapping_.erase(obj_id); |
565 } | 565 } |
566 aria_owned_child_to_owner_mapping_.erase(obj_id); | 566 aria_owned_child_to_owner_mapping_.erase(obj_id); |
567 aria_owned_child_to_real_parent_mapping_.erase(obj_id); | 567 aria_owned_child_to_real_parent_mapping_.erase(obj_id); |
568 aria_owner_to_ids_mapping_.erase(obj_id); | 568 aria_owner_to_ids_mapping_.erase(obj_id); |
569 } | 569 } |
570 | 570 |
571 void AXObjectCacheImpl::SelectionChanged(Node* node) { | 571 AXObjectImpl* AXObjectCacheImpl::NearestExistingAncestor(Node* node) { |
572 // Find the nearest ancestor that already has an accessibility object, since | 572 // Find the nearest ancestor that already has an accessibility object, since |
573 // we might be in the middle of a layout. | 573 // we might be in the middle of a layout. |
574 while (node) { | 574 while (node) { |
575 if (AXObjectImpl* obj = Get(node)) { | 575 if (AXObjectImpl* obj = Get(node)) |
576 obj->SelectionChanged(); | 576 return obj; |
577 return; | |
578 } | |
579 node = node->parentNode(); | 577 node = node->parentNode(); |
580 } | 578 } |
| 579 return nullptr; |
| 580 } |
| 581 |
| 582 void AXObjectCacheImpl::SelectionChanged(Node* node) { |
| 583 AXObjectImpl* nearestAncestor = NearestExistingAncestor(node); |
| 584 if (nearestAncestor) |
| 585 nearestAncestor->SelectionChanged(); |
581 } | 586 } |
582 | 587 |
583 void AXObjectCacheImpl::TextChanged(Node* node) { | 588 void AXObjectCacheImpl::TextChanged(Node* node) { |
584 TextChanged(GetOrCreate(node)); | 589 TextChanged(Get(node)); |
585 } | 590 } |
586 | 591 |
587 void AXObjectCacheImpl::TextChanged(LayoutObject* layout_object) { | 592 void AXObjectCacheImpl::TextChanged(LayoutObject* layout_object) { |
588 TextChanged(GetOrCreate(layout_object)); | 593 TextChanged(Get(layout_object)); |
589 } | 594 } |
590 | 595 |
591 void AXObjectCacheImpl::TextChanged(AXObjectImpl* obj) { | 596 void AXObjectCacheImpl::TextChanged(AXObjectImpl* obj) { |
592 if (!obj) | 597 if (!obj) |
593 return; | 598 return; |
594 | 599 |
595 obj->TextChanged(); | 600 obj->TextChanged(); |
596 PostNotification(obj, AXObjectCacheImpl::kAXTextChanged); | 601 PostNotification(obj, AXObjectCacheImpl::kAXTextChanged); |
597 } | 602 } |
598 | 603 |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 void AXObjectCacheImpl::HandleTextFormControlChanged(Node* node) { | 1153 void AXObjectCacheImpl::HandleTextFormControlChanged(Node* node) { |
1149 HandleEditableTextContentChanged(node); | 1154 HandleEditableTextContentChanged(node); |
1150 } | 1155 } |
1151 | 1156 |
1152 void AXObjectCacheImpl::HandleValueChanged(Node* node) { | 1157 void AXObjectCacheImpl::HandleValueChanged(Node* node) { |
1153 PostNotification(node, AXObjectCache::kAXValueChanged); | 1158 PostNotification(node, AXObjectCache::kAXValueChanged); |
1154 } | 1159 } |
1155 | 1160 |
1156 void AXObjectCacheImpl::HandleUpdateActiveMenuOption(LayoutMenuList* menu_list, | 1161 void AXObjectCacheImpl::HandleUpdateActiveMenuOption(LayoutMenuList* menu_list, |
1157 int option_index) { | 1162 int option_index) { |
1158 AXObjectImpl* obj = Get(menu_list); | 1163 AXObjectImpl* obj = GetOrCreate(menu_list); |
1159 if (!obj || !obj->IsMenuList()) | 1164 if (!obj || !obj->IsMenuList()) |
1160 return; | 1165 return; |
1161 | 1166 |
1162 ToAXMenuList(obj)->DidUpdateActiveOption(option_index); | 1167 ToAXMenuList(obj)->DidUpdateActiveOption(option_index); |
1163 } | 1168 } |
1164 | 1169 |
1165 void AXObjectCacheImpl::DidShowMenuListPopup(LayoutMenuList* menu_list) { | 1170 void AXObjectCacheImpl::DidShowMenuListPopup(LayoutMenuList* menu_list) { |
1166 AXObjectImpl* obj = Get(menu_list); | 1171 AXObjectImpl* obj = Get(menu_list); |
1167 if (!obj || !obj->IsMenuList()) | 1172 if (!obj || !obj->IsMenuList()) |
1168 return; | 1173 return; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 visitor->Trace(document_); | 1260 visitor->Trace(document_); |
1256 visitor->Trace(node_object_mapping_); | 1261 visitor->Trace(node_object_mapping_); |
1257 | 1262 |
1258 visitor->Trace(objects_); | 1263 visitor->Trace(objects_); |
1259 visitor->Trace(notifications_to_post_); | 1264 visitor->Trace(notifications_to_post_); |
1260 | 1265 |
1261 AXObjectCache::Trace(visitor); | 1266 AXObjectCache::Trace(visitor); |
1262 } | 1267 } |
1263 | 1268 |
1264 } // namespace blink | 1269 } // namespace blink |
OLD | NEW |