| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, Google 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 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 WillBeHeapVector<RefPtrWillBeMember<HTMLFormControlElement>> | 1295 WillBeHeapVector<RefPtrWillBeMember<HTMLFormControlElement>> |
| 1296 invalidControls; | 1296 invalidControls; |
| 1297 bool isInvalid = !element->checkValidity( | 1297 bool isInvalid = !element->checkValidity( |
| 1298 &invalidControls, CheckValidityDispatchNoEvent); | 1298 &invalidControls, CheckValidityDispatchNoEvent); |
| 1299 return isInvalid ? InvalidStateTrue : InvalidStateFalse; | 1299 return isInvalid ? InvalidStateTrue : InvalidStateFalse; |
| 1300 } | 1300 } |
| 1301 | 1301 |
| 1302 return InvalidStateUndefined; | 1302 return InvalidStateUndefined; |
| 1303 } | 1303 } |
| 1304 | 1304 |
| 1305 int AXNodeObject::positionInRadioGroup() const |
| 1306 { |
| 1307 if (!isHTMLInputElement(node())) |
| 1308 return 0; |
| 1309 |
| 1310 HTMLInputElement& input = toHTMLInputElement(*node()); |
| 1311 const AtomicString& type = input.type(); |
| 1312 if (type != InputTypeNames::radio) |
| 1313 return 0; |
| 1314 |
| 1315 int pos = input.positionInRadioGroup(); |
| 1316 // If it has no pos in Group, it means that there is only itself. |
| 1317 if (!pos) |
| 1318 return 1; |
| 1319 return pos; |
| 1320 |
| 1321 } |
| 1322 |
| 1323 int AXNodeObject::sizeOfRadioGroup() const |
| 1324 { |
| 1325 if (!isHTMLInputElement(node())) |
| 1326 return 0; |
| 1327 |
| 1328 HTMLInputElement& input = toHTMLInputElement(*node()); |
| 1329 const AtomicString& type = input.type(); |
| 1330 if (type != InputTypeNames::radio) |
| 1331 return 0; |
| 1332 |
| 1333 int size = input.sizeOfRadioGroup(); |
| 1334 // If it has no size in Group, it means that there is only itself. |
| 1335 if (!size) |
| 1336 return 1; |
| 1337 return size; |
| 1338 |
| 1339 } |
| 1340 |
| 1305 int AXNodeObject::posInSet() const | 1341 int AXNodeObject::posInSet() const |
| 1306 { | 1342 { |
| 1307 if (supportsSetSizeAndPosInSet()) { | 1343 if (supportsSetSizeAndPosInSet()) { |
| 1308 if (hasAttribute(aria_posinsetAttr)) | 1344 if (hasAttribute(aria_posinsetAttr)) |
| 1309 return getAttribute(aria_posinsetAttr).toInt(); | 1345 return getAttribute(aria_posinsetAttr).toInt(); |
| 1346 |
| 1347 if (int position = positionInRadioGroup()) |
| 1348 return position; |
| 1349 |
| 1310 return AXObject::indexInParent() + 1; | 1350 return AXObject::indexInParent() + 1; |
| 1311 } | 1351 } |
| 1312 | 1352 |
| 1313 return 0; | 1353 return 0; |
| 1314 } | 1354 } |
| 1315 | 1355 |
| 1316 int AXNodeObject::setSize() const | 1356 int AXNodeObject::setSize() const |
| 1317 { | 1357 { |
| 1318 if (supportsSetSizeAndPosInSet()) { | 1358 if (supportsSetSizeAndPosInSet()) { |
| 1319 if (hasAttribute(aria_setsizeAttr)) | 1359 if (hasAttribute(aria_setsizeAttr)) |
| 1320 return getAttribute(aria_setsizeAttr).toInt(); | 1360 return getAttribute(aria_setsizeAttr).toInt(); |
| 1321 | 1361 |
| 1362 if (int size = sizeOfRadioGroup()) |
| 1363 return size; |
| 1364 |
| 1322 if (parentObject()) { | 1365 if (parentObject()) { |
| 1323 const auto& siblings = parentObject()->children(); | 1366 const auto& siblings = parentObject()->children(); |
| 1324 return siblings.size(); | 1367 return siblings.size(); |
| 1325 } | 1368 } |
| 1326 } | 1369 } |
| 1327 | 1370 |
| 1328 return 0; | 1371 return 0; |
| 1329 } | 1372 } |
| 1330 | 1373 |
| 1331 String AXNodeObject::ariaInvalidValue() const | 1374 String AXNodeObject::ariaInvalidValue() const |
| (...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2751 return placeholder; | 2794 return placeholder; |
| 2752 } | 2795 } |
| 2753 | 2796 |
| 2754 DEFINE_TRACE(AXNodeObject) | 2797 DEFINE_TRACE(AXNodeObject) |
| 2755 { | 2798 { |
| 2756 visitor->trace(m_node); | 2799 visitor->trace(m_node); |
| 2757 AXObject::trace(visitor); | 2800 AXObject::trace(visitor); |
| 2758 } | 2801 } |
| 2759 | 2802 |
| 2760 } // namespace blink | 2803 } // namespace blink |
| OLD | NEW |