Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple 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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 889 } | 889 } |
| 890 | 890 |
| 891 String AXRenderObject::stringValue() const | 891 String AXRenderObject::stringValue() const |
| 892 { | 892 { |
| 893 if (!m_renderer) | 893 if (!m_renderer) |
| 894 return String(); | 894 return String(); |
| 895 | 895 |
| 896 if (isPasswordFieldAndShouldHideValue()) | 896 if (isPasswordFieldAndShouldHideValue()) |
| 897 return String(); | 897 return String(); |
| 898 | 898 |
| 899 RenderBoxModelObject* cssBox = renderBoxModelObject(); | |
| 900 | 899 |
| 901 if (ariaRoleAttribute() == StaticTextRole) { | 900 if (ariaRoleAttribute() == StaticTextRole) { |
| 902 String staticText = text(); | 901 String staticText = text(); |
| 903 if (!staticText.length()) | 902 if (!staticText.length()) |
| 904 staticText = textUnderElement(); | 903 staticText = textUnderElement(); |
| 905 return staticText; | 904 return staticText; |
| 906 } | 905 } |
| 907 | 906 |
| 908 if (m_renderer->isText()) | 907 if (m_renderer->isText()) |
| 909 return textUnderElement(); | 908 return textUnderElement(); |
| 910 | 909 |
| 911 if (cssBox && cssBox->isMenuList()) { | 910 if (isHTMLSelectElement(m_renderer->node())) { |
|
dmazzoni
2015/02/18 19:01:38
As I commented before, I don't think we should be
| |
| 912 // RenderMenuList will go straight to the text() of its selected item. | 911 // RenderMenuList will go straight to the text() of its selected item. |
| 913 // This has to be overridden in the case where the selected item has an ARIA label. | 912 // This has to be overridden in the case where the selected item has an ARIA label. |
| 914 HTMLSelectElement* selectElement = toHTMLSelectElement(m_renderer->node( )); | 913 HTMLSelectElement* selectElement = toHTMLSelectElement(m_renderer->node( )); |
| 915 int selectedIndex = selectElement->selectedIndex(); | 914 int selectedIndex = selectElement->selectedIndex(); |
| 916 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems = sel ectElement->listItems(); | 915 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems = sel ectElement->listItems(); |
| 917 if (selectedIndex >= 0 && static_cast<size_t>(selectedIndex) < listItems .size()) { | 916 if (selectedIndex >= 0 && static_cast<size_t>(selectedIndex) < listItems .size()) { |
| 918 const AtomicString& overriddenDescription = listItems[selectedIndex] ->fastGetAttribute(aria_labelAttr); | 917 const AtomicString& overriddenDescription = listItems[selectedIndex] ->fastGetAttribute(aria_labelAttr); |
| 919 if (!overriddenDescription.isNull()) | 918 if (!overriddenDescription.isNull()) |
| 920 return overriddenDescription; | 919 return overriddenDescription; |
| 921 } | 920 } |
| 922 return toRenderMenuList(m_renderer)->text(); | 921 return selectElement->value(); |
| 923 } | 922 } |
| 924 | 923 |
| 925 if (m_renderer->isListMarker()) | 924 if (m_renderer->isListMarker()) |
| 926 return toRenderListMarker(m_renderer)->text(); | 925 return toRenderListMarker(m_renderer)->text(); |
| 927 | 926 |
| 928 if (isWebArea()) { | 927 if (isWebArea()) { |
| 929 // FIXME: Why would a renderer exist when the Document isn't attached to a frame? | 928 // FIXME: Why would a renderer exist when the Document isn't attached to a frame? |
| 930 if (m_renderer->frame()) | 929 if (m_renderer->frame()) |
| 931 return String(); | 930 return String(); |
| 932 | 931 |
| (...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2420 if (label && label->renderer()) { | 2419 if (label && label->renderer()) { |
| 2421 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); | 2420 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); |
| 2422 result.unite(labelRect); | 2421 result.unite(labelRect); |
| 2423 } | 2422 } |
| 2424 } | 2423 } |
| 2425 | 2424 |
| 2426 return result; | 2425 return result; |
| 2427 } | 2426 } |
| 2428 | 2427 |
| 2429 } // namespace blink | 2428 } // namespace blink |
| OLD | NEW |