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

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

Issue 1773813007: blink: Rename modules/ method to prefix with get when they collide. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clash-modules: rebase-fixes 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 return ListBoxOptionRole; 67 return ListBoxOptionRole;
68 } 68 }
69 69
70 bool AXListBoxOption::isParentPresentationalRole() const 70 bool AXListBoxOption::isParentPresentationalRole() const
71 { 71 {
72 AXObject* parent = parentObject(); 72 AXObject* parent = parentObject();
73 if (!parent) 73 if (!parent)
74 return false; 74 return false;
75 75
76 LayoutObject* layoutObject = parent->layoutObject(); 76 LayoutObject* layoutObject = parent->getLayoutObject();
77 if (!layoutObject) 77 if (!layoutObject)
78 return false; 78 return false;
79 79
80 if (layoutObject->isListBox() && parent->hasInheritedPresentationalRole()) 80 if (layoutObject->isListBox() && parent->hasInheritedPresentationalRole())
81 return true; 81 return true;
82 82
83 return false; 83 return false;
84 } 84 }
85 85
86 bool AXListBoxOption::isEnabled() const 86 bool AXListBoxOption::isEnabled() const
87 { 87 {
88 if (!node()) 88 if (!getNode())
89 return false; 89 return false;
90 90
91 if (equalIgnoringCase(getAttribute(aria_disabledAttr), "true")) 91 if (equalIgnoringCase(getAttribute(aria_disabledAttr), "true"))
92 return false; 92 return false;
93 93
94 if (toElement(node())->hasAttribute(disabledAttr)) 94 if (toElement(getNode())->hasAttribute(disabledAttr))
95 return false; 95 return false;
96 96
97 return true; 97 return true;
98 } 98 }
99 99
100 bool AXListBoxOption::isSelected() const 100 bool AXListBoxOption::isSelected() const
101 { 101 {
102 return isHTMLOptionElement(node()) && toHTMLOptionElement(node())->selected( ); 102 return isHTMLOptionElement(getNode()) && toHTMLOptionElement(getNode())->sel ected();
103 } 103 }
104 104
105 bool AXListBoxOption::isSelectedOptionActive() const 105 bool AXListBoxOption::isSelectedOptionActive() const
106 { 106 {
107 HTMLSelectElement* listBoxParentNode = listBoxOptionParentNode(); 107 HTMLSelectElement* listBoxParentNode = listBoxOptionParentNode();
108 if (!listBoxParentNode) 108 if (!listBoxParentNode)
109 return false; 109 return false;
110 110
111 return listBoxParentNode->activeSelectionEndListIndex() == listBoxOptionInde x(); 111 return listBoxParentNode->activeSelectionEndListIndex() == listBoxOptionInde x();
112 } 112 }
113 113
114 bool AXListBoxOption::computeAccessibilityIsIgnored(IgnoredReasons* ignoredReaso ns) const 114 bool AXListBoxOption::computeAccessibilityIsIgnored(IgnoredReasons* ignoredReaso ns) const
115 { 115 {
116 if (!node()) 116 if (!getNode())
117 return true; 117 return true;
118 118
119 if (accessibilityIsIgnoredByDefault(ignoredReasons)) 119 if (accessibilityIsIgnoredByDefault(ignoredReasons))
120 return true; 120 return true;
121 121
122 return false; 122 return false;
123 } 123 }
124 124
125 bool AXListBoxOption::canSetSelectedAttribute() const 125 bool AXListBoxOption::canSetSelectedAttribute() const
126 { 126 {
127 if (!isHTMLOptionElement(node())) 127 if (!isHTMLOptionElement(getNode()))
128 return false; 128 return false;
129 129
130 if (toHTMLOptionElement(node())->isDisabledFormControl()) 130 if (toHTMLOptionElement(getNode())->isDisabledFormControl())
131 return false; 131 return false;
132 132
133 HTMLSelectElement* selectElement = listBoxOptionParentNode(); 133 HTMLSelectElement* selectElement = listBoxOptionParentNode();
134 if (selectElement && selectElement->isDisabledFormControl()) 134 if (selectElement && selectElement->isDisabledFormControl())
135 return false; 135 return false;
136 136
137 return true; 137 return true;
138 } 138 }
139 139
140 String AXListBoxOption::textAlternative(bool recursive, bool inAriaLabelledByTra versal, AXObjectSet& visited, AXNameFrom& nameFrom, AXRelatedObjectVector* relat edObjects, NameSources* nameSources) const 140 String AXListBoxOption::textAlternative(bool recursive, bool inAriaLabelledByTra versal, AXObjectSet& visited, AXNameFrom& nameFrom, AXRelatedObjectVector* relat edObjects, NameSources* nameSources) const
141 { 141 {
142 // If nameSources is non-null, relatedObjects is used in filling it in, so i t must be non-null as well. 142 // If nameSources is non-null, relatedObjects is used in filling it in, so i t must be non-null as well.
143 if (nameSources) 143 if (nameSources)
144 ASSERT(relatedObjects); 144 ASSERT(relatedObjects);
145 145
146 if (!node()) 146 if (!getNode())
147 return String(); 147 return String();
148 148
149 bool foundTextAlternative = false; 149 bool foundTextAlternative = false;
150 String textAlternative = ariaTextAlternative(recursive, inAriaLabelledByTrav ersal, visited, nameFrom, relatedObjects, nameSources, &foundTextAlternative); 150 String textAlternative = ariaTextAlternative(recursive, inAriaLabelledByTrav ersal, visited, nameFrom, relatedObjects, nameSources, &foundTextAlternative);
151 if (foundTextAlternative && !nameSources) 151 if (foundTextAlternative && !nameSources)
152 return textAlternative; 152 return textAlternative;
153 153
154 nameFrom = AXNameFromContents; 154 nameFrom = AXNameFromContents;
155 textAlternative = toHTMLOptionElement(node())->displayLabel(); 155 textAlternative = toHTMLOptionElement(getNode())->displayLabel();
156 if (nameSources) { 156 if (nameSources) {
157 nameSources->append(NameSource(foundTextAlternative)); 157 nameSources->append(NameSource(foundTextAlternative));
158 nameSources->last().type = nameFrom; 158 nameSources->last().type = nameFrom;
159 nameSources->last().text = textAlternative; 159 nameSources->last().text = textAlternative;
160 foundTextAlternative = true; 160 foundTextAlternative = true;
161 } 161 }
162 162
163 return textAlternative; 163 return textAlternative;
164 } 164 }
165 165
(...skipping 10 matching lines...) Expand all
176 if ((isOptionSelected && selected) || (!isOptionSelected && !selected)) 176 if ((isOptionSelected && selected) || (!isOptionSelected && !selected))
177 return; 177 return;
178 178
179 // Convert from the entire list index to the option index. 179 // Convert from the entire list index to the option index.
180 int optionIndex = selectElement->listToOptionIndex(listBoxOptionIndex()); 180 int optionIndex = selectElement->listToOptionIndex(listBoxOptionIndex());
181 selectElement->accessKeySetSelectedIndex(optionIndex); 181 selectElement->accessKeySetSelectedIndex(optionIndex);
182 } 182 }
183 183
184 HTMLSelectElement* AXListBoxOption::listBoxOptionParentNode() const 184 HTMLSelectElement* AXListBoxOption::listBoxOptionParentNode() const
185 { 185 {
186 if (!node()) 186 if (!getNode())
187 return 0; 187 return 0;
188 188
189 if (isHTMLOptionElement(node())) 189 if (isHTMLOptionElement(getNode()))
190 return toHTMLOptionElement(node())->ownerSelectElement(); 190 return toHTMLOptionElement(getNode())->ownerSelectElement();
191 191
192 return 0; 192 return 0;
193 } 193 }
194 194
195 int AXListBoxOption::listBoxOptionIndex() const 195 int AXListBoxOption::listBoxOptionIndex() const
196 { 196 {
197 HTMLSelectElement* selectElement = listBoxOptionParentNode(); 197 HTMLSelectElement* selectElement = listBoxOptionParentNode();
198 if (!selectElement) 198 if (!selectElement)
199 return -1; 199 return -1;
200 200
201 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems = selectE lement->listItems(); 201 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems = selectE lement->listItems();
202 unsigned length = listItems.size(); 202 unsigned length = listItems.size();
203 for (unsigned i = 0; i < length; i++) { 203 for (unsigned i = 0; i < length; i++) {
204 if (listItems[i] == node()) 204 if (listItems[i] == getNode())
205 return i; 205 return i;
206 } 206 }
207 207
208 return -1; 208 return -1;
209 } 209 }
210 210
211 } // namespace blink 211 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698