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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp

Issue 1809573003: Fix support for accessible action verbs and performing the default action. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix two tests Created 4 years, 9 months 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
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 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 if (result && result->roleValue() == StaticTextRole && result->children().si ze()) 1046 if (result && result->roleValue() == StaticTextRole && result->children().si ze())
1047 result = result->children()[result->children().size() - 1].get(); 1047 result = result->children()[result->children().size() - 1].get();
1048 1048
1049 return result; 1049 return result;
1050 } 1050 }
1051 1051
1052 // 1052 //
1053 // Properties of interactive elements. 1053 // Properties of interactive elements.
1054 // 1054 //
1055 1055
1056 static String queryString(WebLocalizedString::Name name)
1057 {
1058 return Locale::defaultLocale().queryString(name);
1059 }
1060
1061 String AXLayoutObject::actionVerb() const
1062 {
1063 switch (roleValue()) {
1064 case ButtonRole:
1065 case ToggleButtonRole:
1066 return queryString(WebLocalizedString::AXButtonActionVerb);
1067 case TextFieldRole:
1068 return queryString(WebLocalizedString::AXTextFieldActionVerb);
1069 case RadioButtonRole:
1070 return queryString(WebLocalizedString::AXRadioButtonActionVerb);
1071 case CheckBoxRole:
1072 case SwitchRole:
1073 return queryString(isChecked() ? WebLocalizedString::AXCheckedCheckBoxAc tionVerb : WebLocalizedString::AXUncheckedCheckBoxActionVerb);
1074 case LinkRole:
1075 return queryString(WebLocalizedString::AXLinkActionVerb);
1076 default:
1077 return emptyString();
1078 }
1079 }
1080
1081 String AXLayoutObject::stringValue() const 1056 String AXLayoutObject::stringValue() const
1082 { 1057 {
1083 if (!m_layoutObject) 1058 if (!m_layoutObject)
1084 return String(); 1059 return String();
1085 1060
1086 LayoutBoxModelObject* cssBox = layoutBoxModelObject(); 1061 LayoutBoxModelObject* cssBox = layoutBoxModelObject();
1087 1062
1088 if (cssBox && cssBox->isMenuList()) { 1063 if (cssBox && cssBox->isMenuList()) {
1089 // LayoutMenuList will go straight to the text() of its selected item. 1064 // LayoutMenuList will go straight to the text() of its selected item.
1090 // This has to be overridden in the case where the selected item has an ARIA label. 1065 // This has to be overridden in the case where the selected item has an ARIA label.
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after
2546 if (label && label->layoutObject()) { 2521 if (label && label->layoutObject()) {
2547 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct(); 2522 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct();
2548 result.unite(labelRect); 2523 result.unite(labelRect);
2549 } 2524 }
2550 } 2525 }
2551 2526
2552 return result; 2527 return result;
2553 } 2528 }
2554 2529
2555 } // namespace blink 2530 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698