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

Side by Side Diff: Source/core/accessibility/AXListBoxOption.cpp

Issue 192413002: Use new is*Element() helper functions in accessibility code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 PassRefPtr<AXListBoxOption> AXListBoxOption::create() 53 PassRefPtr<AXListBoxOption> AXListBoxOption::create()
54 { 54 {
55 return adoptRef(new AXListBoxOption()); 55 return adoptRef(new AXListBoxOption());
56 } 56 }
57 57
58 bool AXListBoxOption::isEnabled() const 58 bool AXListBoxOption::isEnabled() const
59 { 59 {
60 if (!m_optionElement) 60 if (!m_optionElement)
61 return false; 61 return false;
62 62
63 if (m_optionElement->hasTagName(optgroupTag)) 63 if (isHTMLOptGroupElement(*m_optionElement))
64 return false; 64 return false;
65 65
66 if (equalIgnoringCase(getAttribute(aria_disabledAttr), "true")) 66 if (equalIgnoringCase(getAttribute(aria_disabledAttr), "true"))
67 return false; 67 return false;
68 68
69 if (m_optionElement->hasAttribute(disabledAttr)) 69 if (m_optionElement->hasAttribute(disabledAttr))
70 return false; 70 return false;
71 71
72 return true; 72 return true;
73 } 73 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 return true; 117 return true;
118 118
119 if (accessibilityIsIgnoredByDefault()) 119 if (accessibilityIsIgnoredByDefault())
120 return true; 120 return true;
121 121
122 return parentObject()->accessibilityIsIgnored(); 122 return parentObject()->accessibilityIsIgnored();
123 } 123 }
124 124
125 bool AXListBoxOption::canSetSelectedAttribute() const 125 bool AXListBoxOption::canSetSelectedAttribute() const
126 { 126 {
127 if (!m_optionElement) 127 if (!isHTMLOptionElement(m_optionElement))
128 return false;
129
130 if (!m_optionElement->hasTagName(optionTag))
131 return false; 128 return false;
132 129
133 if (m_optionElement->isDisabledFormControl()) 130 if (m_optionElement->isDisabledFormControl())
134 return false; 131 return false;
135 132
136 HTMLSelectElement* selectElement = listBoxOptionParentNode(); 133 HTMLSelectElement* selectElement = listBoxOptionParentNode();
137 if (selectElement && selectElement->isDisabledFormControl()) 134 if (selectElement && selectElement->isDisabledFormControl())
138 return false; 135 return false;
139 136
140 return true; 137 return true;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 unsigned length = listItems.size(); 214 unsigned length = listItems.size();
218 for (unsigned i = 0; i < length; i++) { 215 for (unsigned i = 0; i < length; i++) {
219 if (listItems[i] == m_optionElement) 216 if (listItems[i] == m_optionElement)
220 return i; 217 return i;
221 } 218 }
222 219
223 return -1; 220 return -1;
224 } 221 }
225 222
226 } // namespace WebCore 223 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698