Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: Source/modules/accessibility/AXRenderObject.cpp

Issue 753663003: Input type file should return ButtonRole. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/modules/accessibility/AXRenderObject.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 if (type == InputTypeNames::datetime 325 if (type == InputTypeNames::datetime
326 || type == InputTypeNames::datetime_local 326 || type == InputTypeNames::datetime_local
327 || type == InputTypeNames::month 327 || type == InputTypeNames::month
328 || type == InputTypeNames::week) 328 || type == InputTypeNames::week)
329 return DateTimeRole; 329 return DateTimeRole;
330 if (type == InputTypeNames::radio) { 330 if (type == InputTypeNames::radio) {
331 if ((node->parentNode() && isHTMLMenuElement(node->parentNode())) || (parentObject() && parentObject()->roleValue() == MenuRole)) 331 if ((node->parentNode() && isHTMLMenuElement(node->parentNode())) || (parentObject() && parentObject()->roleValue() == MenuRole))
332 return MenuItemRadioRole; 332 return MenuItemRadioRole;
333 return RadioButtonRole; 333 return RadioButtonRole;
334 } 334 }
335 if (type == InputTypeNames::file)
336 return ButtonRole;
335 if (type == InputTypeNames::number) 337 if (type == InputTypeNames::number)
336 return SpinButtonRole; 338 return SpinButtonRole;
337 if (input.isTextButton()) 339 if (input.isTextButton())
338 return buttonRoleType(); 340 return buttonRoleType();
339 if (type == InputTypeNames::color) 341 if (type == InputTypeNames::color)
340 return ColorWellRole; 342 return ColorWellRole;
341 if (type == InputTypeNames::time) 343 if (type == InputTypeNames::time)
342 return TimeRole; 344 return TimeRole;
343 return TextFieldRole; 345 return TextFieldRole;
344 } 346 }
345 347
346 if (isFileUploadButton())
347 return ButtonRole;
348
349 if (cssBox && cssBox->isMenuList()) 348 if (cssBox && cssBox->isMenuList())
350 return PopUpButtonRole; 349 return PopUpButtonRole;
351 350
352 if (headingLevel()) 351 if (headingLevel())
353 return HeadingRole; 352 return HeadingRole;
354 353
355 if (m_renderer->isSVGImage()) 354 if (m_renderer->isSVGImage())
356 return ImageRole; 355 return ImageRole;
357 if (m_renderer->isSVGRoot()) 356 if (m_renderer->isSVGRoot())
358 return SVGRootRole; 357 return SVGRootRole;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 { 488 {
490 RenderBoxModelObject* renderer = renderBoxModelObject(); 489 RenderBoxModelObject* renderer = renderBoxModelObject();
491 if (!renderer) 490 if (!renderer)
492 return false; 491 return false;
493 // Widgets are the replaced elements that we represent to AX as attachments 492 // Widgets are the replaced elements that we represent to AX as attachments
494 bool isRenderPart = renderer->isRenderPart(); 493 bool isRenderPart = renderer->isRenderPart();
495 ASSERT(!isRenderPart || (renderer->isReplaced() && !isImage())); 494 ASSERT(!isRenderPart || (renderer->isReplaced() && !isImage()));
496 return isRenderPart; 495 return isRenderPart;
497 } 496 }
498 497
499 bool AXRenderObject::isFileUploadButton() const
500 {
501 return m_renderer && isHTMLInputElement(m_renderer->node()) && toHTMLInputEl ement(*m_renderer->node()).type() == InputTypeNames::file;
502 }
503
504 static bool isLinkable(const AXObject& object) 498 static bool isLinkable(const AXObject& object)
505 { 499 {
506 if (!object.renderer()) 500 if (!object.renderer())
507 return false; 501 return false;
508 502
509 // See https://wiki.mozilla.org/Accessibility/AT-Windows-API for the element s 503 // See https://wiki.mozilla.org/Accessibility/AT-Windows-API for the element s
510 // Mozilla considers linkable. 504 // Mozilla considers linkable.
511 return object.isLink() || object.isImage() || object.renderer()->isText(); 505 return object.isLink() || object.isImage() || object.renderer()->isText();
512 } 506 }
513 507
(...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after
2453 if (label && label->renderer()) { 2447 if (label && label->renderer()) {
2454 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); 2448 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect();
2455 result.unite(labelRect); 2449 result.unite(labelRect);
2456 } 2450 }
2457 } 2451 }
2458 2452
2459 return result; 2453 return result;
2460 } 2454 }
2461 2455
2462 } // namespace blink 2456 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXRenderObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698