Chromium Code Reviews| Index: third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp |
| diff --git a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp |
| index 4779e922a80661d2542d87ed64984e55a858fd2c..7756baee5dc1c8e00bf4915cf6d461c50c94aaa1 100644 |
| --- a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp |
| +++ b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp |
| @@ -54,6 +54,7 @@ |
| #include "core/html/shadow/MediaControlElements.h" |
| #include "core/layout/LayoutBlockFlow.h" |
| #include "core/layout/LayoutObject.h" |
| +#include "core/svg/SVGElement.h" |
| #include "modules/accessibility/AXObjectCacheImpl.h" |
| #include "platform/UserGestureIndicator.h" |
| #include "platform/text/PlatformLocale.h" |
| @@ -2377,6 +2378,40 @@ String AXNodeObject::nativeTextAlternative(AXObjectSet& visited, AXNameFrom& nam |
| return textAlternative; |
| } |
| + // Per SVG AAM 1.0's modifications to 2D of this algorithm. |
| + if (node()->isSVGElement()) { |
| + nameFrom = AXNameFromRelatedElement; |
| + if (nameSources) { |
| + nameSources->append(NameSource(*foundTextAlternative)); |
| + nameSources->last().type = nameFrom; |
| + nameSources->last().nativeSource = AXTextFromNativeHTMLTitleElement; |
| + } |
| + DCHECK(node()->isContainerNode()); |
| + Element* title = ElementTraversal::firstChild( |
|
aboxhall
2016/01/07 18:55:26
I just now thought to look at how SVGElement does
Elly Fong-Jones
2016/01/08 14:13:16
To do this I have to turn the Node into an SVGElem
|
| + toContainerNode(*(node())), |
| + HasTagName(SVGNames::titleTag)); |
| + |
| + if (title) { |
| + AXObject* titleAXObject = axObjectCache().getOrCreate(title); |
| + if (titleAXObject && !visited.contains(titleAXObject)) { |
| + textAlternative = recursiveTextAlternative(*titleAXObject, false, visited); |
| + if (relatedObjects) { |
| + localRelatedObjects.append(new NameSourceRelatedObject( |
| + titleAXObject, textAlternative)); |
| + *relatedObjects = localRelatedObjects; |
| + localRelatedObjects.clear(); |
| + } |
| + } |
| + if (nameSources) { |
| + NameSource& source = nameSources->last(); |
| + source.text = textAlternative; |
|
aboxhall
2016/01/07 18:55:26
need to set source.relatedObjects here.
...yeah,
Elly Fong-Jones
2016/01/08 14:13:16
Done!
|
| + *foundTextAlternative = true; |
| + } else { |
| + return textAlternative; |
| + } |
| + } |
| + } |
| + |
| // Fieldset / legend. |
| if (isHTMLFieldSetElement(node())) { |
| nameFrom = AXNameFromRelatedElement; |