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 12 matching lines...) Expand all Loading... |
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #include "modules/accessibility/AXObjectCacheImpl.h" | 29 #include "modules/accessibility/AXObjectCacheImpl.h" |
30 | 30 |
31 #include "core/HTMLNames.h" | 31 #include "core/HTMLNames.h" |
32 #include "core/InputTypeNames.h" | 32 #include "core/InputTypeNames.h" |
| 33 #include "core/dom/AccessibleNode.h" |
33 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
34 #include "core/dom/TaskRunnerHelper.h" | 35 #include "core/dom/TaskRunnerHelper.h" |
35 #include "core/editing/EditingUtilities.h" | 36 #include "core/editing/EditingUtilities.h" |
36 #include "core/frame/FrameView.h" | 37 #include "core/frame/FrameView.h" |
37 #include "core/frame/LocalFrame.h" | 38 #include "core/frame/LocalFrame.h" |
38 #include "core/frame/Settings.h" | 39 #include "core/frame/Settings.h" |
39 #include "core/html/HTMLAreaElement.h" | 40 #include "core/html/HTMLAreaElement.h" |
40 #include "core/html/HTMLCanvasElement.h" | 41 #include "core/html/HTMLCanvasElement.h" |
41 #include "core/html/HTMLImageElement.h" | 42 #include "core/html/HTMLImageElement.h" |
42 #include "core/html/HTMLInputElement.h" | 43 #include "core/html/HTMLInputElement.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 AXObjectCacheImpl::AXObjectCacheImpl(Document& document) | 95 AXObjectCacheImpl::AXObjectCacheImpl(Document& document) |
95 : document_(document), | 96 : document_(document), |
96 modification_count_(0), | 97 modification_count_(0), |
97 notification_post_timer_( | 98 notification_post_timer_( |
98 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &document), | 99 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &document), |
99 this, | 100 this, |
100 &AXObjectCacheImpl::NotificationPostTimerFired) {} | 101 &AXObjectCacheImpl::NotificationPostTimerFired) {} |
101 | 102 |
102 AXObjectCacheImpl::~AXObjectCacheImpl() { | 103 AXObjectCacheImpl::~AXObjectCacheImpl() { |
103 #if DCHECK_IS_ON() | 104 #if DCHECK_IS_ON() |
104 DCHECK(has_been_disposed_); | 105 DCHECK(m_hasBeenDisposed); |
105 #endif | 106 #endif |
106 } | 107 } |
107 | 108 |
108 void AXObjectCacheImpl::Dispose() { | 109 void AXObjectCacheImpl::Dispose() { |
109 notification_post_timer_.Stop(); | 110 notification_post_timer_.Stop(); |
110 | 111 |
111 for (auto& entry : objects_) { | 112 for (auto& entry : objects_) { |
112 AXObject* obj = entry.value; | 113 AXObject* obj = entry.value; |
113 obj->Detach(); | 114 obj->Detach(); |
114 RemoveAXID(obj); | 115 RemoveAXID(obj); |
115 } | 116 } |
116 | 117 |
117 #if DCHECK_IS_ON() | 118 #if DCHECK_IS_ON() |
118 has_been_disposed_ = true; | 119 m_hasBeenDisposed = true; |
119 #endif | 120 #endif |
120 } | 121 } |
121 | 122 |
122 AXObject* AXObjectCacheImpl::Root() { | 123 AXObject* AXObjectCacheImpl::Root() { |
123 return GetOrCreate(document_); | 124 return GetOrCreate(document_); |
124 } | 125 } |
125 | 126 |
126 AXObject* AXObjectCacheImpl::FocusedImageMapUIElement( | 127 AXObject* AXObjectCacheImpl::FocusedImageMapUIElement( |
127 HTMLAreaElement* area_element) { | 128 HTMLAreaElement* area_element) { |
128 // Find the corresponding accessibility object for the HTMLAreaElement. This | 129 // Find the corresponding accessibility object for the HTMLAreaElement. This |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 | 629 |
629 if (!obj->AxObjectID()) | 630 if (!obj->AxObjectID()) |
630 continue; | 631 continue; |
631 | 632 |
632 if (obj->IsDetached()) | 633 if (obj->IsDetached()) |
633 continue; | 634 continue; |
634 | 635 |
635 #if DCHECK_IS_ON() | 636 #if DCHECK_IS_ON() |
636 // Make sure none of the layout views are in the process of being layed out. | 637 // Make sure none of the layout views are in the process of being layed out. |
637 // Notifications should only be sent after the layoutObject has finished | 638 // Notifications should only be sent after the layoutObject has finished |
638 if (obj->IsAXLayoutObject()) { | 639 if (obj->isAXLayoutObject()) { |
639 AXLayoutObject* layout_obj = ToAXLayoutObject(obj); | 640 AXLayoutObject* layoutObj = toAXLayoutObject(obj); |
640 LayoutObject* layout_object = layout_obj->GetLayoutObject(); | 641 LayoutObject* layoutObject = layoutObj->getLayoutObject(); |
641 if (layout_object && layout_object->View()) | 642 if (layoutObject && layoutObject->view()) |
642 DCHECK(!layout_object->View()->GetLayoutState()); | 643 DCHECK(!layoutObject->view()->layoutState()); |
643 } | 644 } |
644 #endif | 645 #endif |
645 | 646 |
646 AXNotification notification = notifications_to_post_[i].second; | 647 AXNotification notification = notifications_to_post_[i].second; |
647 PostPlatformNotification(obj, notification); | 648 PostPlatformNotification(obj, notification); |
648 | 649 |
649 if (notification == kAXChildrenChanged && obj->ParentObjectIfExists() && | 650 if (notification == kAXChildrenChanged && obj->ParentObjectIfExists() && |
650 obj->LastKnownIsIgnoredValue() != obj->AccessibilityIsIgnored()) | 651 obj->LastKnownIsIgnoredValue() != obj->AccessibilityIsIgnored()) |
651 ChildrenChanged(obj->ParentObject()); | 652 ChildrenChanged(obj->ParentObject()); |
652 } | 653 } |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 return ax_object && ax_object->IsTextControl(); | 1088 return ax_object && ax_object->IsTextControl(); |
1088 } | 1089 } |
1089 | 1090 |
1090 bool IsNodeAriaVisible(Node* node) { | 1091 bool IsNodeAriaVisible(Node* node) { |
1091 if (!node) | 1092 if (!node) |
1092 return false; | 1093 return false; |
1093 | 1094 |
1094 if (!node->IsElementNode()) | 1095 if (!node->IsElementNode()) |
1095 return false; | 1096 return false; |
1096 | 1097 |
1097 return EqualIgnoringASCIICase(ToElement(node)->getAttribute(aria_hiddenAttr), | 1098 bool is_null = true; |
1098 "false"); | 1099 bool hidden = AccessibleNode::GetProperty( |
| 1100 ToElement(node), AOMBooleanProperty::kHidden, is_null); |
| 1101 return !is_null && !hidden; |
1099 } | 1102 } |
1100 | 1103 |
1101 void AXObjectCacheImpl::PostPlatformNotification(AXObject* obj, | 1104 void AXObjectCacheImpl::PostPlatformNotification(AXObject* obj, |
1102 AXNotification notification) { | 1105 AXNotification notification) { |
1103 if (!obj || !obj->GetDocument() || !obj->DocumentFrameView() || | 1106 if (!obj || !obj->GetDocument() || !obj->DocumentFrameView() || |
1104 !obj->DocumentFrameView()->GetFrame().GetPage()) | 1107 !obj->DocumentFrameView()->GetFrame().GetPage()) |
1105 return; | 1108 return; |
1106 | 1109 |
1107 ChromeClient& client = | 1110 ChromeClient& client = |
1108 obj->GetDocument()->AxObjectCacheOwner().GetPage()->GetChromeClient(); | 1111 obj->GetDocument()->AxObjectCacheOwner().GetPage()->GetChromeClient(); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 visitor->Trace(document_); | 1252 visitor->Trace(document_); |
1250 visitor->Trace(node_object_mapping_); | 1253 visitor->Trace(node_object_mapping_); |
1251 | 1254 |
1252 visitor->Trace(objects_); | 1255 visitor->Trace(objects_); |
1253 visitor->Trace(notifications_to_post_); | 1256 visitor->Trace(notifications_to_post_); |
1254 | 1257 |
1255 AXObjectCache::Trace(visitor); | 1258 AXObjectCache::Trace(visitor); |
1256 } | 1259 } |
1257 | 1260 |
1258 } // namespace blink | 1261 } // namespace blink |
OLD | NEW |