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 12 matching lines...) Expand all Loading... |
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #include "config.h" | 29 #include "config.h" |
30 #include "core/accessibility/AXRenderObject.h" | 30 #include "core/accessibility/AXRenderObject.h" |
31 | 31 |
32 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 32 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 33 #include "core/InputTypeNames.h" |
33 #include "core/accessibility/AXImageMapLink.h" | 34 #include "core/accessibility/AXImageMapLink.h" |
34 #include "core/accessibility/AXInlineTextBox.h" | 35 #include "core/accessibility/AXInlineTextBox.h" |
35 #include "core/accessibility/AXObjectCache.h" | 36 #include "core/accessibility/AXObjectCache.h" |
36 #include "core/accessibility/AXSVGRoot.h" | 37 #include "core/accessibility/AXSVGRoot.h" |
37 #include "core/accessibility/AXSpinButton.h" | 38 #include "core/accessibility/AXSpinButton.h" |
38 #include "core/accessibility/AXTable.h" | 39 #include "core/accessibility/AXTable.h" |
39 #include "core/dom/ElementTraversal.h" | 40 #include "core/dom/ElementTraversal.h" |
40 #include "core/dom/shadow/ShadowRoot.h" | 41 #include "core/dom/shadow/ShadowRoot.h" |
41 #include "core/editing/FrameSelection.h" | 42 #include "core/editing/FrameSelection.h" |
42 #include "core/editing/RenderedPosition.h" | 43 #include "core/editing/RenderedPosition.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 return WebAreaRole; | 298 return WebAreaRole; |
298 | 299 |
299 if (cssBox && cssBox->isTextField()) | 300 if (cssBox && cssBox->isTextField()) |
300 return TextFieldRole; | 301 return TextFieldRole; |
301 | 302 |
302 if (cssBox && cssBox->isTextArea()) | 303 if (cssBox && cssBox->isTextArea()) |
303 return TextAreaRole; | 304 return TextAreaRole; |
304 | 305 |
305 if (isHTMLInputElement(node)) { | 306 if (isHTMLInputElement(node)) { |
306 HTMLInputElement& input = toHTMLInputElement(*node); | 307 HTMLInputElement& input = toHTMLInputElement(*node); |
307 if (input.isCheckbox()) | 308 const AtomicString& type = input.type(); |
| 309 if (type == InputTypeNames::checkbox) |
308 return CheckBoxRole; | 310 return CheckBoxRole; |
309 if (input.isRadioButton()) | 311 if (type == InputTypeNames::radio) |
310 return RadioButtonRole; | 312 return RadioButtonRole; |
311 if (input.isTextButton()) | 313 if (input.isTextButton()) |
312 return buttonRoleType(); | 314 return buttonRoleType(); |
313 | 315 if (type == InputTypeNames::color) |
314 const AtomicString& type = input.getAttribute(typeAttr); | |
315 if (equalIgnoringCase(type, "color")) | |
316 return ColorWellRole; | 316 return ColorWellRole; |
317 } | 317 } |
318 | 318 |
319 if (isFileUploadButton()) | 319 if (isFileUploadButton()) |
320 return ButtonRole; | 320 return ButtonRole; |
321 | 321 |
322 if (cssBox && cssBox->isMenuList()) | 322 if (cssBox && cssBox->isMenuList()) |
323 return PopUpButtonRole; | 323 return PopUpButtonRole; |
324 | 324 |
325 if (headingLevel()) | 325 if (headingLevel()) |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 if (!renderer) | 443 if (!renderer) |
444 return false; | 444 return false; |
445 // Widgets are the replaced elements that we represent to AX as attachments | 445 // Widgets are the replaced elements that we represent to AX as attachments |
446 bool isWidget = renderer->isWidget(); | 446 bool isWidget = renderer->isWidget(); |
447 ASSERT(!isWidget || (renderer->isReplaced() && !isImage())); | 447 ASSERT(!isWidget || (renderer->isReplaced() && !isImage())); |
448 return isWidget; | 448 return isWidget; |
449 } | 449 } |
450 | 450 |
451 bool AXRenderObject::isFileUploadButton() const | 451 bool AXRenderObject::isFileUploadButton() const |
452 { | 452 { |
453 if (m_renderer && isHTMLInputElement(m_renderer->node())) { | 453 return m_renderer && isHTMLInputElement(m_renderer->node()) && toHTMLInputEl
ement(*m_renderer->node()).type() == InputTypeNames::file; |
454 HTMLInputElement& input = toHTMLInputElement(*m_renderer->node()); | |
455 return input.isFileUpload(); | |
456 } | |
457 | |
458 return false; | |
459 } | 454 } |
460 | 455 |
461 static bool isLinkable(const AXObject& object) | 456 static bool isLinkable(const AXObject& object) |
462 { | 457 { |
463 if (!object.renderer()) | 458 if (!object.renderer()) |
464 return false; | 459 return false; |
465 | 460 |
466 // See https://wiki.mozilla.org/Accessibility/AT-Windows-API for the element
s | 461 // See https://wiki.mozilla.org/Accessibility/AT-Windows-API for the element
s |
467 // Mozilla considers linkable. | 462 // Mozilla considers linkable. |
468 return object.isLink() || object.isImage() || object.renderer()->isText(); | 463 return object.isLink() || object.isImage() || object.renderer()->isText(); |
(...skipping 1875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2344 if (label && label->renderer()) { | 2339 if (label && label->renderer()) { |
2345 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); | 2340 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); |
2346 result.unite(labelRect); | 2341 result.unite(labelRect); |
2347 } | 2342 } |
2348 } | 2343 } |
2349 | 2344 |
2350 return result; | 2345 return result; |
2351 } | 2346 } |
2352 | 2347 |
2353 } // namespace blink | 2348 } // namespace blink |
OLD | NEW |