OLD | NEW |
---|---|
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 #include "core/html/HTMLTableCaptionElement.h" | 47 #include "core/html/HTMLTableCaptionElement.h" |
48 #include "core/html/HTMLTableCellElement.h" | 48 #include "core/html/HTMLTableCellElement.h" |
49 #include "core/html/HTMLTableElement.h" | 49 #include "core/html/HTMLTableElement.h" |
50 #include "core/html/HTMLTableRowElement.h" | 50 #include "core/html/HTMLTableRowElement.h" |
51 #include "core/html/HTMLTableSectionElement.h" | 51 #include "core/html/HTMLTableSectionElement.h" |
52 #include "core/html/HTMLTextAreaElement.h" | 52 #include "core/html/HTMLTextAreaElement.h" |
53 #include "core/html/parser/HTMLParserIdioms.h" | 53 #include "core/html/parser/HTMLParserIdioms.h" |
54 #include "core/html/shadow/MediaControlElements.h" | 54 #include "core/html/shadow/MediaControlElements.h" |
55 #include "core/layout/LayoutBlockFlow.h" | 55 #include "core/layout/LayoutBlockFlow.h" |
56 #include "core/layout/LayoutObject.h" | 56 #include "core/layout/LayoutObject.h" |
57 #include "core/svg/SVGElement.h" | |
57 #include "modules/accessibility/AXObjectCacheImpl.h" | 58 #include "modules/accessibility/AXObjectCacheImpl.h" |
58 #include "platform/UserGestureIndicator.h" | 59 #include "platform/UserGestureIndicator.h" |
59 #include "platform/text/PlatformLocale.h" | 60 #include "platform/text/PlatformLocale.h" |
60 #include "wtf/text/StringBuilder.h" | 61 #include "wtf/text/StringBuilder.h" |
61 | 62 |
62 | 63 |
63 namespace blink { | 64 namespace blink { |
64 | 65 |
65 using namespace HTMLNames; | 66 using namespace HTMLNames; |
66 | 67 |
(...skipping 2303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2370 source.text = textAlternative; | 2371 source.text = textAlternative; |
2371 *foundTextAlternative = true; | 2372 *foundTextAlternative = true; |
2372 } else { | 2373 } else { |
2373 return textAlternative; | 2374 return textAlternative; |
2374 } | 2375 } |
2375 } | 2376 } |
2376 | 2377 |
2377 return textAlternative; | 2378 return textAlternative; |
2378 } | 2379 } |
2379 | 2380 |
2381 // Per SVG AAM 1.0's modifications to 2D of this algorithm. | |
2382 if (node()->isSVGElement()) { | |
2383 nameFrom = AXNameFromRelatedElement; | |
2384 if (nameSources) { | |
2385 nameSources->append(NameSource(*foundTextAlternative)); | |
2386 nameSources->last().type = nameFrom; | |
2387 nameSources->last().nativeSource = AXTextFromNativeHTMLTitleElement; | |
2388 } | |
2389 Element* title = nullptr; | |
2390 for (Element& element : ElementTraversal::descendantsOf(*(node()))) { | |
aboxhall
2016/01/06 17:04:07
Could this be simplified to
Element* title = Eleme
Elly Fong-Jones
2016/01/07 18:46:00
Oooh, TIL! Thanks :D
Elly Fong-Jones
2016/01/07 18:46:01
Done.
| |
2391 if (element.hasTagName(SVGNames::titleTag)) { | |
2392 title = &element; | |
2393 break; | |
2394 } | |
2395 } | |
2396 | |
2397 if (title) { | |
2398 String text = title->innerText(); | |
aboxhall
2016/01/06 17:04:07
This should follow the same pattern used by fields
Elly Fong-Jones
2016/01/07 18:46:00
Done.
| |
2399 textAlternative = text; | |
2400 if (nameSources) { | |
2401 NameSource& source = nameSources->last(); | |
2402 source.text = textAlternative; | |
2403 *foundTextAlternative = true; | |
2404 } else { | |
2405 return textAlternative; | |
2406 } | |
2407 } | |
2408 | |
2409 return textAlternative; | |
2410 } | |
2411 | |
2380 // Fieldset / legend. | 2412 // Fieldset / legend. |
2381 if (isHTMLFieldSetElement(node())) { | 2413 if (isHTMLFieldSetElement(node())) { |
2382 nameFrom = AXNameFromRelatedElement; | 2414 nameFrom = AXNameFromRelatedElement; |
2383 if (nameSources) { | 2415 if (nameSources) { |
2384 nameSources->append(NameSource(*foundTextAlternative)); | 2416 nameSources->append(NameSource(*foundTextAlternative)); |
2385 nameSources->last().type = nameFrom; | 2417 nameSources->last().type = nameFrom; |
2386 nameSources->last().nativeSource = AXTextFromNativeHTMLLegend; | 2418 nameSources->last().nativeSource = AXTextFromNativeHTMLLegend; |
2387 } | 2419 } |
2388 HTMLElement* legend = toHTMLFieldSetElement(node())->legend(); | 2420 HTMLElement* legend = toHTMLFieldSetElement(node())->legend(); |
2389 if (legend) { | 2421 if (legend) { |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2702 return placeholder; | 2734 return placeholder; |
2703 } | 2735 } |
2704 | 2736 |
2705 DEFINE_TRACE(AXNodeObject) | 2737 DEFINE_TRACE(AXNodeObject) |
2706 { | 2738 { |
2707 visitor->trace(m_node); | 2739 visitor->trace(m_node); |
2708 AXObject::trace(visitor); | 2740 AXObject::trace(visitor); |
2709 } | 2741 } |
2710 | 2742 |
2711 } // namespace blin | 2743 } // namespace blin |
OLD | NEW |