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

Unified Diff: Source/modules/accessibility/AXObjectCacheImpl.cpp

Issue 742353004: Implement computedRole and computedName (behind a flag) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove fprintfs Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/accessibility/AXObjectCacheImpl.h ('k') | Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/accessibility/AXObjectCacheImpl.cpp
diff --git a/Source/modules/accessibility/AXObjectCacheImpl.cpp b/Source/modules/accessibility/AXObjectCacheImpl.cpp
index ab190e195d09f9c58ed60f5fc7aa43aeaeab8063..5abafb35ee99d89ab4dc117674a814523716031f 100644
--- a/Source/modules/accessibility/AXObjectCacheImpl.cpp
+++ b/Source/modules/accessibility/AXObjectCacheImpl.cpp
@@ -1074,6 +1074,50 @@ void AXObjectCacheImpl::handleScrollPositionChanged(RenderObject* renderObject)
postPlatformNotification(getOrCreate(renderObject), AXScrollPositionChanged);
}
+const AtomicString& AXObjectCacheImpl::computedRoleForNode(Node* node)
+{
+ AXObject* obj = getOrCreate(node);
+ if (!obj)
+ return AXObject::roleName(UnknownRole);
+ return AXObject::roleName(obj->roleValue());
+}
+
+String AXObjectCacheImpl::computedNameForNode(Node* node)
dmazzoni 2014/12/18 23:12:20 The logic for this looks fine, but instead of putt
aboxhall 2014/12/19 00:02:08 Ok, done.
+{
+ AXObject* obj = getOrCreate(node);
+ if (!obj)
+ return "";
+
+ String title = obj->title();
+
+ String titleUIText;
+ if (title.isEmpty()) {
+ AXObject* titleUIElement = obj->titleUIElement();
+ if (titleUIElement) {
+ titleUIText = titleUIElement->textUnderElement();
+ if (!titleUIText.isEmpty())
+ return titleUIText;
+ }
+ }
+
+ String description = obj->accessibilityDescription();
+ if (!description.isEmpty())
+ return description;
+
+ if (!title.isEmpty())
+ return title;
+
+ String placeholder;
dmazzoni 2014/12/18 23:12:20 The official accessible name calculation says that
aboxhall 2014/12/19 00:02:08 Yeah, it doesn't. I added a test case but I don't
+ if (isHTMLInputElement(node)) {
+ HTMLInputElement* element = toHTMLInputElement(node);
+ placeholder = element->strippedPlaceholder();
+ if (!placeholder.isEmpty())
+ return placeholder;
+ }
+
+ return String();
+}
+
void AXObjectCacheImpl::setCanvasObjectBounds(Element* element, const LayoutRect& rect)
{
AXObject* obj = getOrCreate(element);
« no previous file with comments | « Source/modules/accessibility/AXObjectCacheImpl.h ('k') | Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698