| 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 (!m_document.settings() || !m_document.settings()->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 (!m_document.settings() || !m_document.settings()->inlineTextBoxAccessibi
lityEnabled()) |
| 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 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 void AXObjectCache::setCanvasObjectBounds(Element* element, const LayoutRect& re
ct) | 1019 void AXObjectCache::setCanvasObjectBounds(Element* element, const LayoutRect& re
ct) |
| 1022 { | 1020 { |
| 1023 AXObject* obj = getOrCreate(element); | 1021 AXObject* obj = getOrCreate(element); |
| 1024 if (!obj) | 1022 if (!obj) |
| 1025 return; | 1023 return; |
| 1026 | 1024 |
| 1027 obj->setElementRect(rect); | 1025 obj->setElementRect(rect); |
| 1028 } | 1026 } |
| 1029 | 1027 |
| 1030 } // namespace blink | 1028 } // namespace blink |
| OLD | NEW |