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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014, Google Inc. All rights reserved. 2 * Copyright (C) 2014, Google 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 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 if (targetAXObject && !targetAXObject->children().isEmpty()) 1067 if (targetAXObject && !targetAXObject->children().isEmpty())
1068 targetAXObject = targetAXObject->children()[0].get(); 1068 targetAXObject = targetAXObject->children()[0].get();
1069 postPlatformNotification(targetAXObject, AXScrollPositionChanged); 1069 postPlatformNotification(targetAXObject, AXScrollPositionChanged);
1070 } 1070 }
1071 1071
1072 void AXObjectCacheImpl::handleScrollPositionChanged(RenderObject* renderObject) 1072 void AXObjectCacheImpl::handleScrollPositionChanged(RenderObject* renderObject)
1073 { 1073 {
1074 postPlatformNotification(getOrCreate(renderObject), AXScrollPositionChanged) ; 1074 postPlatformNotification(getOrCreate(renderObject), AXScrollPositionChanged) ;
1075 } 1075 }
1076 1076
1077 const AtomicString& AXObjectCacheImpl::computedRoleForNode(Node* node)
1078 {
1079 AXObject* obj = getOrCreate(node);
1080 if (!obj)
1081 return AXObject::roleName(UnknownRole);
1082 return AXObject::roleName(obj->roleValue());
1083 }
1084
1085 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.
1086 {
1087 AXObject* obj = getOrCreate(node);
1088 if (!obj)
1089 return "";
1090
1091 String title = obj->title();
1092
1093 String titleUIText;
1094 if (title.isEmpty()) {
1095 AXObject* titleUIElement = obj->titleUIElement();
1096 if (titleUIElement) {
1097 titleUIText = titleUIElement->textUnderElement();
1098 if (!titleUIText.isEmpty())
1099 return titleUIText;
1100 }
1101 }
1102
1103 String description = obj->accessibilityDescription();
1104 if (!description.isEmpty())
1105 return description;
1106
1107 if (!title.isEmpty())
1108 return title;
1109
1110 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
1111 if (isHTMLInputElement(node)) {
1112 HTMLInputElement* element = toHTMLInputElement(node);
1113 placeholder = element->strippedPlaceholder();
1114 if (!placeholder.isEmpty())
1115 return placeholder;
1116 }
1117
1118 return String();
1119 }
1120
1077 void AXObjectCacheImpl::setCanvasObjectBounds(Element* element, const LayoutRect & rect) 1121 void AXObjectCacheImpl::setCanvasObjectBounds(Element* element, const LayoutRect & rect)
1078 { 1122 {
1079 AXObject* obj = getOrCreate(element); 1123 AXObject* obj = getOrCreate(element);
1080 if (!obj) 1124 if (!obj)
1081 return; 1125 return;
1082 1126
1083 obj->setElementRect(rect); 1127 obj->setElementRect(rect);
1084 } 1128 }
1085 1129
1086 } // namespace blink 1130 } // namespace blink
OLDNEW
« 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