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 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1855 return String::Number(ValueForRange()); | 1855 return String::Number(ValueForRange()); |
1856 } | 1856 } |
1857 | 1857 |
1858 return StringValue(); | 1858 return StringValue(); |
1859 } | 1859 } |
1860 | 1860 |
1861 // Step 2D from: http://www.w3.org/TR/accname-aam-1.1 | 1861 // Step 2D from: http://www.w3.org/TR/accname-aam-1.1 |
1862 text_alternative = | 1862 text_alternative = |
1863 NativeTextAlternative(visited, name_from, related_objects, name_sources, | 1863 NativeTextAlternative(visited, name_from, related_objects, name_sources, |
1864 &found_text_alternative); | 1864 &found_text_alternative); |
1865 if (!text_alternative.IsEmpty() && !name_sources) | 1865 const bool has_text_alternative = |
| 1866 !text_alternative.IsEmpty() || |
| 1867 name_from == kAXNameFromExplicitlyEmptyAttribute; |
| 1868 if (has_text_alternative && !name_sources) |
1866 return text_alternative; | 1869 return text_alternative; |
1867 | 1870 |
1868 // Step 2F / 2G from: http://www.w3.org/TR/accname-aam-1.1 | 1871 // Step 2F / 2G from: http://www.w3.org/TR/accname-aam-1.1 |
1869 if (recursive || NameFromContents()) { | 1872 if (recursive || NameFromContents()) { |
1870 name_from = kAXNameFromContents; | 1873 name_from = kAXNameFromContents; |
1871 if (name_sources) { | 1874 if (name_sources) { |
1872 name_sources->push_back(NameSource(found_text_alternative)); | 1875 name_sources->push_back(NameSource(found_text_alternative)); |
1873 name_sources->back().type = name_from; | 1876 name_sources->back().type = name_from; |
1874 } | 1877 } |
1875 | 1878 |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2624 } | 2627 } |
2625 } | 2628 } |
2626 } | 2629 } |
2627 return text_alternative; | 2630 return text_alternative; |
2628 } | 2631 } |
2629 | 2632 |
2630 // 5.3 input type="image" | 2633 // 5.3 input type="image" |
2631 if (input_element && | 2634 if (input_element && |
2632 input_element->getAttribute(typeAttr) == InputTypeNames::image) { | 2635 input_element->getAttribute(typeAttr) == InputTypeNames::image) { |
2633 // alt attr | 2636 // alt attr |
2634 name_from = kAXNameFromAttribute; | 2637 const AtomicString& alt = input_element->getAttribute(altAttr); |
| 2638 const bool isEmpty = alt.IsEmpty() && !alt.IsNull(); |
| 2639 name_from = |
| 2640 isEmpty ? kAXNameFromExplicitlyEmptyAttribute : kAXNameFromAttribute; |
2635 if (name_sources) { | 2641 if (name_sources) { |
2636 name_sources->push_back(NameSource(*found_text_alternative, altAttr)); | 2642 name_sources->push_back(NameSource(*found_text_alternative, altAttr)); |
2637 name_sources->back().type = name_from; | 2643 name_sources->back().type = name_from; |
2638 } | 2644 } |
2639 const AtomicString& alt = input_element->getAttribute(altAttr); | |
2640 if (!alt.IsNull()) { | 2645 if (!alt.IsNull()) { |
2641 text_alternative = alt; | 2646 text_alternative = alt; |
2642 if (name_sources) { | 2647 if (name_sources) { |
2643 NameSource& source = name_sources->back(); | 2648 NameSource& source = name_sources->back(); |
2644 source.attribute_value = alt; | 2649 source.attribute_value = alt; |
2645 source.text = text_alternative; | 2650 source.text = text_alternative; |
2646 *found_text_alternative = true; | 2651 *found_text_alternative = true; |
2647 } else { | 2652 } else { |
2648 return text_alternative; | 2653 return text_alternative; |
2649 } | 2654 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2771 } | 2776 } |
2772 } | 2777 } |
2773 } | 2778 } |
2774 return text_alternative; | 2779 return text_alternative; |
2775 } | 2780 } |
2776 | 2781 |
2777 // 5.8 img or area Element | 2782 // 5.8 img or area Element |
2778 if (isHTMLImageElement(GetNode()) || isHTMLAreaElement(GetNode()) || | 2783 if (isHTMLImageElement(GetNode()) || isHTMLAreaElement(GetNode()) || |
2779 (GetLayoutObject() && GetLayoutObject()->IsSVGImage())) { | 2784 (GetLayoutObject() && GetLayoutObject()->IsSVGImage())) { |
2780 // alt | 2785 // alt |
2781 name_from = kAXNameFromAttribute; | 2786 const AtomicString& alt = GetAttribute(altAttr); |
| 2787 const bool isEmpty = alt.IsEmpty() && !alt.IsNull(); |
| 2788 name_from = |
| 2789 isEmpty ? kAXNameFromExplicitlyEmptyAttribute : kAXNameFromAttribute; |
2782 if (name_sources) { | 2790 if (name_sources) { |
2783 name_sources->push_back(NameSource(*found_text_alternative, altAttr)); | 2791 name_sources->push_back(NameSource(*found_text_alternative, altAttr)); |
2784 name_sources->back().type = name_from; | 2792 name_sources->back().type = name_from; |
2785 } | 2793 } |
2786 const AtomicString& alt = GetAttribute(altAttr); | |
2787 if (!alt.IsNull()) { | 2794 if (!alt.IsNull()) { |
2788 text_alternative = alt; | 2795 text_alternative = alt; |
2789 if (name_sources) { | 2796 if (name_sources) { |
2790 NameSource& source = name_sources->back(); | 2797 NameSource& source = name_sources->back(); |
2791 source.attribute_value = alt; | 2798 source.attribute_value = alt; |
2792 source.text = text_alternative; | 2799 source.text = text_alternative; |
2793 *found_text_alternative = true; | 2800 *found_text_alternative = true; |
2794 } else { | 2801 } else { |
2795 return text_alternative; | 2802 return text_alternative; |
2796 } | 2803 } |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3217 return String(); | 3224 return String(); |
3218 return ToTextControlElement(node)->StrippedPlaceholder(); | 3225 return ToTextControlElement(node)->StrippedPlaceholder(); |
3219 } | 3226 } |
3220 | 3227 |
3221 DEFINE_TRACE(AXNodeObject) { | 3228 DEFINE_TRACE(AXNodeObject) { |
3222 visitor->Trace(node_); | 3229 visitor->Trace(node_); |
3223 AXObject::Trace(visitor); | 3230 AXObject::Trace(visitor); |
3224 } | 3231 } |
3225 | 3232 |
3226 } // namespace blink | 3233 } // namespace blink |
OLD | NEW |