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 ASSERT(node()->isContainerNode()); |
| 2390 Element* title = ElementTraversal::firstChild( |
| 2391 toContainerNode(*(node())), |
| 2392 HasTagName(SVGNames::titleTag)); |
| 2393 |
| 2394 if (title) { |
| 2395 AXObject* titleAXObject = axObjectCache().getOrCreate(title); |
| 2396 if (titleAXObject && !visited.contains(titleAXObject)) { |
| 2397 textAlternative = recursiveTextAlternative(*titleAXObject, false
, visited); |
| 2398 if (relatedObjects) { |
| 2399 localRelatedObjects.append(new NameSourceRelatedObject( |
| 2400 titleAXObject, textAlternative)); |
| 2401 *relatedObjects = localRelatedObjects; |
| 2402 localRelatedObjects.clear(); |
| 2403 } |
| 2404 } |
| 2405 if (nameSources) { |
| 2406 NameSource& source = nameSources->last(); |
| 2407 source.text = textAlternative; |
| 2408 source.relatedObjects = *relatedObjects; |
| 2409 *foundTextAlternative = true; |
| 2410 } else { |
| 2411 return textAlternative; |
| 2412 } |
| 2413 } |
| 2414 } |
| 2415 |
2380 // Fieldset / legend. | 2416 // Fieldset / legend. |
2381 if (isHTMLFieldSetElement(node())) { | 2417 if (isHTMLFieldSetElement(node())) { |
2382 nameFrom = AXNameFromRelatedElement; | 2418 nameFrom = AXNameFromRelatedElement; |
2383 if (nameSources) { | 2419 if (nameSources) { |
2384 nameSources->append(NameSource(*foundTextAlternative)); | 2420 nameSources->append(NameSource(*foundTextAlternative)); |
2385 nameSources->last().type = nameFrom; | 2421 nameSources->last().type = nameFrom; |
2386 nameSources->last().nativeSource = AXTextFromNativeHTMLLegend; | 2422 nameSources->last().nativeSource = AXTextFromNativeHTMLLegend; |
2387 } | 2423 } |
2388 HTMLElement* legend = toHTMLFieldSetElement(node())->legend(); | 2424 HTMLElement* legend = toHTMLFieldSetElement(node())->legend(); |
2389 if (legend) { | 2425 if (legend) { |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2702 return placeholder; | 2738 return placeholder; |
2703 } | 2739 } |
2704 | 2740 |
2705 DEFINE_TRACE(AXNodeObject) | 2741 DEFINE_TRACE(AXNodeObject) |
2706 { | 2742 { |
2707 visitor->trace(m_node); | 2743 visitor->trace(m_node); |
2708 AXObject::trace(visitor); | 2744 AXObject::trace(visitor); |
2709 } | 2745 } |
2710 | 2746 |
2711 } // namespace blin | 2747 } // namespace blin |
OLD | NEW |