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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "core/html/HTMLTableCaptionElement.h" 48 #include "core/html/HTMLTableCaptionElement.h"
49 #include "core/html/HTMLTableCellElement.h" 49 #include "core/html/HTMLTableCellElement.h"
50 #include "core/html/HTMLTableElement.h" 50 #include "core/html/HTMLTableElement.h"
51 #include "core/html/HTMLTableRowElement.h" 51 #include "core/html/HTMLTableRowElement.h"
52 #include "core/html/HTMLTableSectionElement.h" 52 #include "core/html/HTMLTableSectionElement.h"
53 #include "core/html/HTMLTextAreaElement.h" 53 #include "core/html/HTMLTextAreaElement.h"
54 #include "core/html/parser/HTMLParserIdioms.h" 54 #include "core/html/parser/HTMLParserIdioms.h"
55 #include "core/html/shadow/MediaControlElements.h" 55 #include "core/html/shadow/MediaControlElements.h"
56 #include "core/layout/LayoutBlockFlow.h" 56 #include "core/layout/LayoutBlockFlow.h"
57 #include "core/layout/LayoutObject.h" 57 #include "core/layout/LayoutObject.h"
58 #include "core/svg/SVGElement.h"
58 #include "modules/accessibility/AXObjectCacheImpl.h" 59 #include "modules/accessibility/AXObjectCacheImpl.h"
59 #include "platform/UserGestureIndicator.h" 60 #include "platform/UserGestureIndicator.h"
60 #include "platform/text/PlatformLocale.h" 61 #include "platform/text/PlatformLocale.h"
61 #include "wtf/text/StringBuilder.h" 62 #include "wtf/text/StringBuilder.h"
62 63
63 64
64 namespace blink { 65 namespace blink {
65 66
66 using namespace HTMLNames; 67 using namespace HTMLNames;
67 68
(...skipping 2294 matching lines...) Expand 10 before | Expand all | Expand 10 after
2362 source.text = textAlternative; 2363 source.text = textAlternative;
2363 *foundTextAlternative = true; 2364 *foundTextAlternative = true;
2364 } else { 2365 } else {
2365 return textAlternative; 2366 return textAlternative;
2366 } 2367 }
2367 } 2368 }
2368 2369
2369 return textAlternative; 2370 return textAlternative;
2370 } 2371 }
2371 2372
2373 // Per SVG AAM 1.0's modifications to 2D of this algorithm.
2374 if (node()->isSVGElement()) {
2375 Element* title = nullptr;
aboxhall 2015/12/15 19:56:03 Before this line, add: nameFrom = AXNameFromRelat
2376 for (Element& element : ElementTraversal::descendantsOf(*(node()))) {
2377 if (element.hasTagName(SVGNames::titleTag)) {
2378 title = &element;
2379 break;
2380 }
2381 }
2382
2383 if (title) {
2384 String text = title->innerText();
2385 textAlternative = text;
2386 if (nameSources) {
2387 NameSource& source = nameSources->last();
2388 source.type = AXNameFromTitle;
2389 source.attributeValue = AtomicString(text);
2390 source.text = textAlternative;
2391 source.nativeSource = AXTextFromNativeHTMLTitleElement;
2392 *foundTextAlternative = true;
2393 } else {
2394 return textAlternative;
2395 }
2396 }
2397
2398 return textAlternative;
2399 }
2400
2372 // Fieldset / legend. 2401 // Fieldset / legend.
2373 if (isHTMLFieldSetElement(node())) { 2402 if (isHTMLFieldSetElement(node())) {
2374 nameFrom = AXNameFromRelatedElement; 2403 nameFrom = AXNameFromRelatedElement;
2375 if (nameSources) { 2404 if (nameSources) {
2376 nameSources->append(NameSource(*foundTextAlternative)); 2405 nameSources->append(NameSource(*foundTextAlternative));
2377 nameSources->last().type = nameFrom; 2406 nameSources->last().type = nameFrom;
2378 nameSources->last().nativeSource = AXTextFromNativeHTMLLegend; 2407 nameSources->last().nativeSource = AXTextFromNativeHTMLLegend;
2379 } 2408 }
2380 HTMLElement* legend = toHTMLFieldSetElement(node())->legend(); 2409 HTMLElement* legend = toHTMLFieldSetElement(node())->legend();
2381 if (legend) { 2410 if (legend) {
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
2694 return placeholder; 2723 return placeholder;
2695 } 2724 }
2696 2725
2697 DEFINE_TRACE(AXNodeObject) 2726 DEFINE_TRACE(AXNodeObject)
2698 { 2727 {
2699 visitor->trace(m_node); 2728 visitor->trace(m_node);
2700 AXObject::trace(visitor); 2729 AXObject::trace(visitor);
2701 } 2730 }
2702 2731
2703 } // namespace blin 2732 } // namespace blin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698