OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "core/accessibility/AXScrollbar.h" | 50 #include "core/accessibility/AXScrollbar.h" |
51 #include "core/accessibility/AXSlider.h" | 51 #include "core/accessibility/AXSlider.h" |
52 #include "core/accessibility/AXSpinButton.h" | 52 #include "core/accessibility/AXSpinButton.h" |
53 #include "core/accessibility/AXTable.h" | 53 #include "core/accessibility/AXTable.h" |
54 #include "core/accessibility/AXTableCell.h" | 54 #include "core/accessibility/AXTableCell.h" |
55 #include "core/accessibility/AXTableColumn.h" | 55 #include "core/accessibility/AXTableColumn.h" |
56 #include "core/accessibility/AXTableHeaderContainer.h" | 56 #include "core/accessibility/AXTableHeaderContainer.h" |
57 #include "core/accessibility/AXTableRow.h" | 57 #include "core/accessibility/AXTableRow.h" |
58 #include "core/dom/Document.h" | 58 #include "core/dom/Document.h" |
59 #include "core/frame/LocalFrame.h" | 59 #include "core/frame/LocalFrame.h" |
| 60 #include "core/frame/Settings.h" |
60 #include "core/html/HTMLAreaElement.h" | 61 #include "core/html/HTMLAreaElement.h" |
61 #include "core/html/HTMLImageElement.h" | 62 #include "core/html/HTMLImageElement.h" |
62 #include "core/html/HTMLInputElement.h" | 63 #include "core/html/HTMLInputElement.h" |
63 #include "core/html/HTMLLabelElement.h" | 64 #include "core/html/HTMLLabelElement.h" |
64 #include "core/page/Chrome.h" | 65 #include "core/page/Chrome.h" |
65 #include "core/page/ChromeClient.h" | 66 #include "core/page/ChromeClient.h" |
66 #include "core/page/FocusController.h" | 67 #include "core/page/FocusController.h" |
67 #include "core/page/Page.h" | 68 #include "core/page/Page.h" |
68 #include "core/rendering/AbstractInlineTextBox.h" | 69 #include "core/rendering/AbstractInlineTextBox.h" |
69 #include "core/rendering/RenderListBox.h" | 70 #include "core/rendering/RenderListBox.h" |
(...skipping 27 matching lines...) Expand all Loading... |
97 attributes.ignored = inclusion; | 98 attributes.ignored = inclusion; |
98 m_idMapping.set(id, attributes); | 99 m_idMapping.set(id, attributes); |
99 } | 100 } |
100 } | 101 } |
101 | 102 |
102 void AXComputedObjectAttributeCache::clear() | 103 void AXComputedObjectAttributeCache::clear() |
103 { | 104 { |
104 m_idMapping.clear(); | 105 m_idMapping.clear(); |
105 } | 106 } |
106 | 107 |
107 bool AXObjectCache::gAccessibilityEnabled = false; | |
108 bool AXObjectCache::gInlineTextBoxAccessibility = false; | |
109 | |
110 AXObjectCache::AXObjectCache(Document& document) | 108 AXObjectCache::AXObjectCache(Document& document) |
111 : m_document(document) | 109 : m_document(document) |
112 , m_notificationPostTimer(this, &AXObjectCache::notificationPostTimerFired) | 110 , m_notificationPostTimer(this, &AXObjectCache::notificationPostTimerFired) |
113 { | 111 { |
114 m_computedObjectAttributeCache = AXComputedObjectAttributeCache::create(); | 112 m_computedObjectAttributeCache = AXComputedObjectAttributeCache::create(); |
115 } | 113 } |
116 | 114 |
117 AXObjectCache::~AXObjectCache() | 115 AXObjectCache::~AXObjectCache() |
118 { | 116 { |
119 m_notificationPostTimer.stop(); | 117 m_notificationPostTimer.stop(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 149 |
152 if (toAXImageMapLink(child)->areaElement() == areaElement) | 150 if (toAXImageMapLink(child)->areaElement() == areaElement) |
153 return child; | 151 return child; |
154 } | 152 } |
155 | 153 |
156 return 0; | 154 return 0; |
157 } | 155 } |
158 | 156 |
159 AXObject* AXObjectCache::focusedUIElementForPage(const Page* page) | 157 AXObject* AXObjectCache::focusedUIElementForPage(const Page* page) |
160 { | 158 { |
161 if (!gAccessibilityEnabled) | 159 if (!page->settings().accessibilityEnabled()) |
162 return 0; | 160 return 0; |
163 | 161 |
164 // Cross-process accessibility is not yet implemented. | 162 // Cross-process accessibility is not yet implemented. |
165 if (!page->focusController().focusedOrMainFrame()->isLocalFrame()) | 163 if (!page->focusController().focusedOrMainFrame()->isLocalFrame()) |
166 return 0; | 164 return 0; |
167 | 165 |
168 // get the focused node in the page | 166 // get the focused node in the page |
169 Document* focusedDocument = toLocalFrame(page->focusController().focusedOrMa
inFrame())->document(); | 167 Document* focusedDocument = toLocalFrame(page->focusController().focusedOrMa
inFrame())->document(); |
170 Node* focusedNode = focusedDocument->focusedElement(); | 168 Node* focusedNode = focusedDocument->focusedElement(); |
171 if (!focusedNode) | 169 if (!focusedNode) |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 m_objects.set(newObj->axObjectID(), newObj); | 442 m_objects.set(newObj->axObjectID(), newObj); |
445 newObj->init(); | 443 newObj->init(); |
446 attachWrapper(newObj.get()); | 444 attachWrapper(newObj.get()); |
447 newObj->setLastKnownIsIgnoredValue(newObj->accessibilityIsIgnored()); | 445 newObj->setLastKnownIsIgnoredValue(newObj->accessibilityIsIgnored()); |
448 | 446 |
449 return newObj.get(); | 447 return newObj.get(); |
450 } | 448 } |
451 | 449 |
452 AXObject* AXObjectCache::rootObject() | 450 AXObject* AXObjectCache::rootObject() |
453 { | 451 { |
454 if (!gAccessibilityEnabled) | 452 if (!accessibilityEnabled()) |
455 return 0; | 453 return 0; |
456 | 454 |
457 return getOrCreate(m_document.view()); | 455 return getOrCreate(m_document.view()); |
458 } | 456 } |
459 | 457 |
460 AXObject* AXObjectCache::getOrCreate(AccessibilityRole role) | 458 AXObject* AXObjectCache::getOrCreate(AccessibilityRole role) |
461 { | 459 { |
462 RefPtr<AXObject> obj = nullptr; | 460 RefPtr<AXObject> obj = nullptr; |
463 | 461 |
464 // will be filled in... | 462 // will be filled in... |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 } | 891 } |
894 | 892 |
895 void AXObjectCache::recomputeIsIgnored(RenderObject* renderer) | 893 void AXObjectCache::recomputeIsIgnored(RenderObject* renderer) |
896 { | 894 { |
897 if (AXObject* obj = get(renderer)) | 895 if (AXObject* obj = get(renderer)) |
898 obj->notifyIfIgnoredValueChanged(); | 896 obj->notifyIfIgnoredValueChanged(); |
899 } | 897 } |
900 | 898 |
901 void AXObjectCache::inlineTextBoxesUpdated(RenderObject* renderer) | 899 void AXObjectCache::inlineTextBoxesUpdated(RenderObject* renderer) |
902 { | 900 { |
903 if (!gInlineTextBoxAccessibility) | 901 if (!inlineTextBoxAccessibilityEnabled()) |
904 return; | 902 return; |
905 | 903 |
906 // Only update if the accessibility object already exists and it's | 904 // Only update if the accessibility object already exists and it's |
907 // not already marked as dirty. | 905 // not already marked as dirty. |
908 if (AXObject* obj = get(renderer)) { | 906 if (AXObject* obj = get(renderer)) { |
909 if (!obj->needsToUpdateChildren()) { | 907 if (!obj->needsToUpdateChildren()) { |
910 obj->setNeedsToUpdateChildren(); | 908 obj->setNeedsToUpdateChildren(); |
911 postNotification(renderer, AXChildrenChanged, true); | 909 postNotification(renderer, AXChildrenChanged, true); |
912 } | 910 } |
913 } | 911 } |
914 } | 912 } |
915 | 913 |
| 914 Settings* AXObjectCache::settings() |
| 915 { |
| 916 return m_document.settings(); |
| 917 } |
| 918 |
| 919 bool AXObjectCache::accessibilityEnabled() |
| 920 { |
| 921 Settings* settings = this->settings(); |
| 922 if (!settings) |
| 923 return false; |
| 924 return settings->accessibilityEnabled(); |
| 925 } |
| 926 |
| 927 bool AXObjectCache::inlineTextBoxAccessibilityEnabled() |
| 928 { |
| 929 Settings* settings = this->settings(); |
| 930 if (!settings) |
| 931 return false; |
| 932 return settings->inlineTextBoxAccessibilityEnabled(); |
| 933 } |
| 934 |
916 const Element* AXObjectCache::rootAXEditableElement(const Node* node) | 935 const Element* AXObjectCache::rootAXEditableElement(const Node* node) |
917 { | 936 { |
918 const Element* result = node->rootEditableElement(); | 937 const Element* result = node->rootEditableElement(); |
919 const Element* element = node->isElementNode() ? toElement(node) : node->par
entElement(); | 938 const Element* element = node->isElementNode() ? toElement(node) : node->par
entElement(); |
920 | 939 |
921 for (; element; element = element->parentElement()) { | 940 for (; element; element = element->parentElement()) { |
922 if (nodeIsTextControl(element)) | 941 if (nodeIsTextControl(element)) |
923 result = element; | 942 result = element; |
924 } | 943 } |
925 | 944 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 void AXObjectCache::setCanvasObjectBounds(Element* element, const LayoutRect& re
ct) | 1040 void AXObjectCache::setCanvasObjectBounds(Element* element, const LayoutRect& re
ct) |
1022 { | 1041 { |
1023 AXObject* obj = getOrCreate(element); | 1042 AXObject* obj = getOrCreate(element); |
1024 if (!obj) | 1043 if (!obj) |
1025 return; | 1044 return; |
1026 | 1045 |
1027 obj->setElementRect(rect); | 1046 obj->setElementRect(rect); |
1028 } | 1047 } |
1029 | 1048 |
1030 } // namespace blink | 1049 } // namespace blink |
OLD | NEW |