| 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 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1288 WillBeHeapVector<RefPtrWillBeMember<HTMLFormControlElement>> | 1288 WillBeHeapVector<RefPtrWillBeMember<HTMLFormControlElement>> |
| 1289 invalidControls; | 1289 invalidControls; |
| 1290 bool isInvalid = !element->checkValidity( | 1290 bool isInvalid = !element->checkValidity( |
| 1291 &invalidControls, CheckValidityDispatchNoEvent); | 1291 &invalidControls, CheckValidityDispatchNoEvent); |
| 1292 return isInvalid ? InvalidStateTrue : InvalidStateFalse; | 1292 return isInvalid ? InvalidStateTrue : InvalidStateFalse; |
| 1293 } | 1293 } |
| 1294 | 1294 |
| 1295 return InvalidStateUndefined; | 1295 return InvalidStateUndefined; |
| 1296 } | 1296 } |
| 1297 | 1297 |
| 1298 int AXNodeObject::positionInRadioGroup() const |
| 1299 { |
| 1300 if (!isHTMLInputElement(node())) |
| 1301 return 0; |
| 1302 |
| 1303 HTMLInputElement& input = toHTMLInputElement(*node()); |
| 1304 const AtomicString& type = input.type(); |
| 1305 if (type != InputTypeNames::radio) |
| 1306 return 0; |
| 1307 |
| 1308 int pos = input.posInRadioGroup(); |
| 1309 // If it has no pos in Group, it means that there is only itself. |
| 1310 if (!pos) |
| 1311 return 1; |
| 1312 return pos; |
| 1313 |
| 1314 } |
| 1315 |
| 1316 int AXNodeObject::sizeOfRadioGroup() const |
| 1317 { |
| 1318 if (!isHTMLInputElement(node())) |
| 1319 return 0; |
| 1320 |
| 1321 HTMLInputElement& input = toHTMLInputElement(*node()); |
| 1322 const AtomicString& type = input.type(); |
| 1323 if (type != InputTypeNames::radio) |
| 1324 return 0; |
| 1325 |
| 1326 int size = input.sizeOfRadioGroup(); |
| 1327 // If it has no size in Group, it means that there is only itself. |
| 1328 if (!size) |
| 1329 return 1; |
| 1330 return size; |
| 1331 |
| 1332 } |
| 1333 |
| 1298 int AXNodeObject::posInSet() const | 1334 int AXNodeObject::posInSet() const |
| 1299 { | 1335 { |
| 1300 if (supportsSetSizeAndPosInSet()) { | 1336 if (supportsSetSizeAndPosInSet()) { |
| 1301 if (hasAttribute(aria_posinsetAttr)) | 1337 if (hasAttribute(aria_posinsetAttr)) |
| 1302 return getAttribute(aria_posinsetAttr).toInt(); | 1338 return getAttribute(aria_posinsetAttr).toInt(); |
| 1339 |
| 1340 if (int position = positionInRadioGroup()) |
| 1341 return position; |
| 1342 |
| 1303 return AXObject::indexInParent() + 1; | 1343 return AXObject::indexInParent() + 1; |
| 1304 } | 1344 } |
| 1305 | 1345 |
| 1306 return 0; | 1346 return 0; |
| 1307 } | 1347 } |
| 1308 | 1348 |
| 1309 int AXNodeObject::setSize() const | 1349 int AXNodeObject::setSize() const |
| 1310 { | 1350 { |
| 1311 if (supportsSetSizeAndPosInSet()) { | 1351 if (supportsSetSizeAndPosInSet()) { |
| 1312 if (hasAttribute(aria_setsizeAttr)) | 1352 if (hasAttribute(aria_setsizeAttr)) |
| 1313 return getAttribute(aria_setsizeAttr).toInt(); | 1353 return getAttribute(aria_setsizeAttr).toInt(); |
| 1314 | 1354 |
| 1355 if (int size = sizeOfRadioGroup()) |
| 1356 return size; |
| 1357 |
| 1315 if (parentObject()) { | 1358 if (parentObject()) { |
| 1316 const auto& siblings = parentObject()->children(); | 1359 const auto& siblings = parentObject()->children(); |
| 1317 return siblings.size(); | 1360 return siblings.size(); |
| 1318 } | 1361 } |
| 1319 } | 1362 } |
| 1320 | 1363 |
| 1321 return 0; | 1364 return 0; |
| 1322 } | 1365 } |
| 1323 | 1366 |
| 1324 String AXNodeObject::ariaInvalidValue() const | 1367 String AXNodeObject::ariaInvalidValue() const |
| (...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2741 return placeholder; | 2784 return placeholder; |
| 2742 } | 2785 } |
| 2743 | 2786 |
| 2744 DEFINE_TRACE(AXNodeObject) | 2787 DEFINE_TRACE(AXNodeObject) |
| 2745 { | 2788 { |
| 2746 visitor->trace(m_node); | 2789 visitor->trace(m_node); |
| 2747 AXObject::trace(visitor); | 2790 AXObject::trace(visitor); |
| 2748 } | 2791 } |
| 2749 | 2792 |
| 2750 } // namespace blin | 2793 } // namespace blin |
| OLD | NEW |