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

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

Issue 806823002: Ignore text elements for menu item related roles. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Make sure parent object is always a valid object Created 6 years 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 | « LayoutTests/accessibility/ignore-text-elements-for-menu-item-related-roles-expected.txt ('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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 580
581 // find out if this element is inside of a label element. 581 // find out if this element is inside of a label element.
582 // if so, it may be ignored because it's the label for a checkbox or radio b utton 582 // if so, it may be ignored because it's the label for a checkbox or radio b utton
583 AXObject* controlObject = correspondingControlForLabelElement(); 583 AXObject* controlObject = correspondingControlForLabelElement();
584 if (controlObject && !controlObject->exposesTitleUIElement() && controlObjec t->isCheckboxOrRadio()) 584 if (controlObject && !controlObject->exposesTitleUIElement() && controlObjec t->isCheckboxOrRadio())
585 return true; 585 return true;
586 586
587 // NOTE: BRs always have text boxes now, so the text box check here can be r emoved 587 // NOTE: BRs always have text boxes now, so the text box check here can be r emoved
588 if (m_renderer->isText()) { 588 if (m_renderer->isText()) {
589 // static text beneath MenuItems and MenuButtons are just reported along with the menu item, so it's ignored on an individual level 589 // static text beneath MenuItems and MenuButtons are just reported along with the menu item, so it's ignored on an individual level
590 AXObject* parent = parentObjectUnignored(); 590 if (AXObject* parent = parentObjectUnignored()) {
591 if (parent && (parent->ariaRoleAttribute() == MenuItemRole || parent->ar iaRoleAttribute() == MenuButtonRole)) 591 AccessibilityRole role = parent->ariaRoleAttribute();
592 return true; 592 if (role == MenuItemRole || role == MenuItemRadioRole || role == Men uItemCheckBoxRole || role == MenuButtonRole)
593 return true;
594 }
593 RenderText* renderText = toRenderText(m_renderer); 595 RenderText* renderText = toRenderText(m_renderer);
594 if (m_renderer->isBR() || !renderText->firstTextBox()) 596 if (m_renderer->isBR() || !renderText->firstTextBox())
595 return true; 597 return true;
596 598
597 // Don't ignore static text in editable text controls. 599 // Don't ignore static text in editable text controls.
598 for (AXObject* parent = parentObject(); parent; parent = parent->parentO bject()) { 600 for (AXObject* parent = parentObject(); parent; parent = parent->parentO bject()) {
599 if (parent->roleValue() == TextFieldRole || parent->roleValue() == T extAreaRole) 601 if (parent->roleValue() == TextFieldRole || parent->roleValue() == T extAreaRole)
600 return false; 602 return false;
601 } 603 }
602 604
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after
2408 if (label && label->renderer()) { 2410 if (label && label->renderer()) {
2409 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); 2411 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect();
2410 result.unite(labelRect); 2412 result.unite(labelRect);
2411 } 2413 }
2412 } 2414 }
2413 2415
2414 return result; 2416 return result;
2415 } 2417 }
2416 2418
2417 } // namespace blink 2419 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/accessibility/ignore-text-elements-for-menu-item-related-roles-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698