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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole) | 273 if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole) |
| 274 return m_ariaRole; | 274 return m_ariaRole; |
| 275 | 275 |
| 276 Node* node = m_renderer->node(); | 276 Node* node = m_renderer->node(); |
| 277 RenderBoxModelObject* cssBox = renderBoxModelObject(); | 277 RenderBoxModelObject* cssBox = renderBoxModelObject(); |
| 278 | 278 |
| 279 if ((cssBox && cssBox->isListItem()) || isHTMLLIElement(node)) | 279 if ((cssBox && cssBox->isListItem()) || isHTMLLIElement(node)) |
| 280 return ListItemRole; | 280 return ListItemRole; |
| 281 if (m_renderer->isListMarker()) | 281 if (m_renderer->isListMarker()) |
| 282 return ListMarkerRole; | 282 return ListMarkerRole; |
| 283 if (isHTMLSelectElement(node)) { | |
| 284 HTMLSelectElement& selectElement = toHTMLSelectElement(*node); | |
| 285 return (selectElement.multiple() || selectElement.size() > 1 ) ? ListBox Role : PopUpButtonRole; | |
|
dmazzoni
2015/01/29 16:28:29
I don't think this will return the correct result
m.lapinski
2015/01/30 10:46:21
According to standard (working draft) http://www.w
dmazzoni
2015/02/02 19:49:25
Yeah, I think we need to fix the layout test so th
| |
| 286 } | |
| 283 if (m_renderer->isBR()) | 287 if (m_renderer->isBR()) |
| 284 return LineBreakRole; | 288 return LineBreakRole; |
| 285 if (isHTMLLegendElement(node)) | 289 if (isHTMLLegendElement(node)) |
| 286 return LegendRole; | 290 return LegendRole; |
| 287 if (m_renderer->isText()) | 291 if (m_renderer->isText()) |
| 288 return StaticTextRole; | 292 return StaticTextRole; |
| 289 if (cssBox && isImageOrAltText(cssBox, node)) { | 293 if (cssBox && isImageOrAltText(cssBox, node)) { |
| 290 if (node && node->isLink()) | 294 if (node && node->isLink()) |
| 291 return ImageMapRole; | 295 return ImageMapRole; |
| 292 if (isHTMLInputElement(node)) | 296 if (isHTMLInputElement(node)) |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 889 } | 893 } |
| 890 | 894 |
| 891 String AXRenderObject::stringValue() const | 895 String AXRenderObject::stringValue() const |
| 892 { | 896 { |
| 893 if (!m_renderer) | 897 if (!m_renderer) |
| 894 return String(); | 898 return String(); |
| 895 | 899 |
| 896 if (isPasswordFieldAndShouldHideValue()) | 900 if (isPasswordFieldAndShouldHideValue()) |
| 897 return String(); | 901 return String(); |
| 898 | 902 |
| 899 RenderBoxModelObject* cssBox = renderBoxModelObject(); | |
| 900 | |
| 901 if (ariaRoleAttribute() == StaticTextRole) { | 903 if (ariaRoleAttribute() == StaticTextRole) { |
| 902 String staticText = text(); | 904 String staticText = text(); |
| 903 if (!staticText.length()) | 905 if (!staticText.length()) |
| 904 staticText = textUnderElement(); | 906 staticText = textUnderElement(); |
| 905 return staticText; | 907 return staticText; |
| 906 } | 908 } |
| 907 | 909 |
| 908 if (m_renderer->isText()) | 910 if (m_renderer->isText()) |
| 909 return textUnderElement(); | 911 return textUnderElement(); |
| 910 | 912 |
| 911 if (cssBox && cssBox->isMenuList()) { | 913 if (isHTMLSelectElement(m_renderer->node())) { |
| 912 // RenderMenuList will go straight to the text() of its selected item. | 914 // 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. | 915 // This has to be overridden in the case where the selected item has an ARIA label. |
| 914 HTMLSelectElement* selectElement = toHTMLSelectElement(m_renderer->node( )); | 916 HTMLSelectElement* selectElement = toHTMLSelectElement(m_renderer->node( )); |
| 915 int selectedIndex = selectElement->selectedIndex(); | 917 int selectedIndex = selectElement->selectedIndex(); |
| 916 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems = sel ectElement->listItems(); | 918 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems = sel ectElement->listItems(); |
| 917 if (selectedIndex >= 0 && static_cast<size_t>(selectedIndex) < listItems .size()) { | 919 if (selectedIndex >= 0 && static_cast<size_t>(selectedIndex) < listItems .size()) { |
| 918 const AtomicString& overriddenDescription = listItems[selectedIndex] ->fastGetAttribute(aria_labelAttr); | 920 const AtomicString& overriddenDescription = listItems[selectedIndex] ->fastGetAttribute(aria_labelAttr); |
| 919 if (!overriddenDescription.isNull()) | 921 if (!overriddenDescription.isNull()) |
| 920 return overriddenDescription; | 922 return overriddenDescription; |
| 921 } | 923 } |
| 922 return toRenderMenuList(m_renderer)->text(); | 924 return selectElement->value(); |
| 923 } | 925 } |
| 924 | 926 |
| 925 if (m_renderer->isListMarker()) | 927 if (m_renderer->isListMarker()) |
| 926 return toRenderListMarker(m_renderer)->text(); | 928 return toRenderListMarker(m_renderer)->text(); |
| 927 | 929 |
| 928 if (isWebArea()) { | 930 if (isWebArea()) { |
| 929 // FIXME: Why would a renderer exist when the Document isn't attached to a frame? | 931 // FIXME: Why would a renderer exist when the Document isn't attached to a frame? |
| 930 if (m_renderer->frame()) | 932 if (m_renderer->frame()) |
| 931 return String(); | 933 return String(); |
| 932 | 934 |
| (...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2420 if (label && label->renderer()) { | 2422 if (label && label->renderer()) { |
| 2421 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); | 2423 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); |
| 2422 result.unite(labelRect); | 2424 result.unite(labelRect); |
| 2423 } | 2425 } |
| 2424 } | 2426 } |
| 2425 | 2427 |
| 2426 return result; | 2428 return result; |
| 2427 } | 2429 } |
| 2428 | 2430 |
| 2429 } // namespace blink | 2431 } // namespace blink |
| OLD | NEW |