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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/ElementAccessibleNode.cpp

Issue 2750533006: Initial skeleton of Accessibility Object Model Phase 1 (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "modules/accessibility/ElementAccessibleNode.h"
6
7 #include "core/dom/Document.h"
8 #include "core/frame/Settings.h"
9 #include "modules/accessibility/AXObject.h"
10 #include "modules/accessibility/AXObjectCacheImpl.h"
11 #include "modules/accessibility/AccessibleNode.h"
12 #include "platform/RuntimeEnabledFeatures.h"
13
14 namespace blink {
15
16 AccessibleNode* ElementAccessibleNode::accessibleNode(Element& node) {
17 if (!RuntimeEnabledFeatures::accessibilityObjectModelEnabled())
18 return nullptr;
19
20 Settings* settings = node.document().settings();
21 if (settings && !settings->getAccessibilityEnabled())
aboxhall 2017/03/16 05:49:34 Wait, why do we need to do this? Can we decouple c
dmazzoni 2017/03/16 20:43:16 Hmmm, good point. Right now the AXObject for the
22 settings->setAccessibilityEnabled(true);
23
24 // Creates an AXObjectCache if needed.
25 AXObjectCacheImpl* cache =
26 static_cast<AXObjectCacheImpl*>(node.document().axObjectCache());
27 if (!cache)
28 return nullptr;
29
30 DCHECK(cache);
31 AXObject* obj = cache->getOrCreate(&node);
32 if (!obj)
33 return nullptr;
34
35 if (!obj->getAccessibleNode())
36 obj->setAccessibleNode(new AccessibleNode(obj));
37 return obj->getAccessibleNode();
38 }
39
40 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698