Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: Source/core/accessibility/AXObjectCache.cpp

Issue 495763005: Switch to using accessibilityEnabled and inlineTextBoxAccessibilityEnabled from settings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove cache->recomputeIsIgnored() calls from RenderBlockFlow; add TestExpectation for one failing … Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
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
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
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::getSettings()
915 {
916 if (m_settings)
917 return m_settings;
918 m_settings = m_document.settings();
919 return m_settings;
abarth-chromium 2014/08/29 18:32:07 Why store a pointer to m_settings? You can just g
aboxhall 2014/08/29 20:35:16 Done.
920 }
921
922 bool AXObjectCache::accessibilityEnabled()
923 {
924 Settings* settings = getSettings();
925 if (!settings)
926 return false;
927 return settings->accessibilityEnabled();
928 }
929
930 bool AXObjectCache::inlineTextBoxAccessibilityEnabled()
931 {
932 Settings* settings = getSettings();
933 if (!settings)
934 return false;
935 return settings->inlineTextBoxAccessibilityEnabled();
936 }
937
916 const Element* AXObjectCache::rootAXEditableElement(const Node* node) 938 const Element* AXObjectCache::rootAXEditableElement(const Node* node)
917 { 939 {
918 const Element* result = node->rootEditableElement(); 940 const Element* result = node->rootEditableElement();
919 const Element* element = node->isElementNode() ? toElement(node) : node->par entElement(); 941 const Element* element = node->isElementNode() ? toElement(node) : node->par entElement();
920 942
921 for (; element; element = element->parentElement()) { 943 for (; element; element = element->parentElement()) {
922 if (nodeIsTextControl(element)) 944 if (nodeIsTextControl(element))
923 result = element; 945 result = element;
924 } 946 }
925 947
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 void AXObjectCache::setCanvasObjectBounds(Element* element, const LayoutRect& re ct) 1043 void AXObjectCache::setCanvasObjectBounds(Element* element, const LayoutRect& re ct)
1022 { 1044 {
1023 AXObject* obj = getOrCreate(element); 1045 AXObject* obj = getOrCreate(element);
1024 if (!obj) 1046 if (!obj)
1025 return; 1047 return;
1026 1048
1027 obj->setElementRect(rect); 1049 obj->setElementRect(rect);
1028 } 1050 }
1029 1051
1030 } // namespace blink 1052 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698