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

Unified Diff: third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp

Issue 1525793002: Fall back to title element text for SVG root text alternatives (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: + AXSVGRoot override Created 5 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
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 96bdd2579a833fc65c58ac72478832d680bde08a..ad039772217754bf79bbeb494460b4faa95a20f4 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp
@@ -55,6 +55,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"
@@ -2369,6 +2370,34 @@ String AXNodeObject::nativeTextAlternative(AXObjectSet& visited, AXNameFrom& nam
return textAlternative;
}
+ // Per SVG AAM 1.0's modifications to 2D of this algorithm.
+ if (node()->isSVGElement()) {
+ Element* title = nullptr;
aboxhall 2015/12/15 19:56:03 Before this line, add: nameFrom = AXNameFromRelat
+ for (Element& element : ElementTraversal::descendantsOf(*(node()))) {
+ if (element.hasTagName(SVGNames::titleTag)) {
+ title = &element;
+ break;
+ }
+ }
+
+ if (title) {
+ String text = title->innerText();
+ textAlternative = text;
+ if (nameSources) {
+ NameSource& source = nameSources->last();
+ source.type = AXNameFromTitle;
+ source.attributeValue = AtomicString(text);
+ source.text = textAlternative;
+ source.nativeSource = AXTextFromNativeHTMLTitleElement;
+ *foundTextAlternative = true;
+ } else {
+ return textAlternative;
+ }
+ }
+
+ return textAlternative;
+ }
+
// Fieldset / legend.
if (isHTMLFieldSetElement(node())) {
nameFrom = AXNameFromRelatedElement;

Powered by Google App Engine
This is Rietveld 408576698