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

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

Issue 1952863003: Implemented the "aria-current" state on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed switch statements to handle NONE case. Created 4 years, 7 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) 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 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 if (!equalIgnoringCase(type, "color")) 1302 if (!equalIgnoringCase(type, "color"))
1303 return AXObject::colorValue(); 1303 return AXObject::colorValue();
1304 1304
1305 // HTMLInputElement::value always returns a string parseable by Color. 1305 // HTMLInputElement::value always returns a string parseable by Color.
1306 Color color; 1306 Color color;
1307 bool success = color.setFromString(input->value()); 1307 bool success = color.setFromString(input->value());
1308 ASSERT_UNUSED(success, success); 1308 ASSERT_UNUSED(success, success);
1309 return color.rgb(); 1309 return color.rgb();
1310 } 1310 }
1311 1311
1312 AriaCurrentState AXNodeObject::ariaCurrentState() const
1313 {
1314 if (!hasAttribute(aria_currentAttr))
1315 return AXObject::ariaCurrentState();
1316
1317 const AtomicString& attributeValue = getAttribute(aria_currentAttr);
1318 if (attributeValue.isEmpty() || equalIgnoringCase(attributeValue, "false"))
1319 return AriaCurrentStateFalse;
1320 if (equalIgnoringCase(attributeValue, "true"))
1321 return AriaCurrentStateTrue;
1322 if (equalIgnoringCase(attributeValue, "page"))
1323 return AriaCurrentStatePage;
1324 if (equalIgnoringCase(attributeValue, "step"))
1325 return AriaCurrentStateStep;
1326 if (equalIgnoringCase(attributeValue, "location"))
1327 return AriaCurrentStateLocation;
1328 if (equalIgnoringCase(attributeValue, "date"))
1329 return AriaCurrentStateDate;
1330 if (equalIgnoringCase(attributeValue, "time"))
1331 return AriaCurrentStateTime;
1332 // An unknown value should return true.
1333 if (!attributeValue.isEmpty())
1334 return AriaCurrentStateTrue;
1335
1336 return AXObject::ariaCurrentState();
1337 }
1338
1312 InvalidState AXNodeObject::getInvalidState() const 1339 InvalidState AXNodeObject::getInvalidState() const
1313 { 1340 {
1314 if (hasAttribute(aria_invalidAttr)) { 1341 if (hasAttribute(aria_invalidAttr)) {
1315 const AtomicString& attributeValue = getAttribute(aria_invalidAttr); 1342 const AtomicString& attributeValue = getAttribute(aria_invalidAttr);
1316 if (equalIgnoringCase(attributeValue, "false")) 1343 if (equalIgnoringCase(attributeValue, "false"))
1317 return InvalidStateFalse; 1344 return InvalidStateFalse;
1318 if (equalIgnoringCase(attributeValue, "true")) 1345 if (equalIgnoringCase(attributeValue, "true"))
1319 return InvalidStateTrue; 1346 return InvalidStateTrue;
1320 if (equalIgnoringCase(attributeValue, "spelling")) 1347 if (equalIgnoringCase(attributeValue, "spelling"))
1321 return InvalidStateSpelling; 1348 return InvalidStateSpelling;
1322 if (equalIgnoringCase(attributeValue, "grammar")) 1349 if (equalIgnoringCase(attributeValue, "grammar"))
1323 return InvalidStateGrammar; 1350 return InvalidStateGrammar;
1324 // A yet unknown value. 1351 // A yet unknown value.
1325 if (!attributeValue.isEmpty()) 1352 if (!attributeValue.isEmpty())
1326 return InvalidStateOther; 1353 return InvalidStateOther;
1327 } 1354 }
1328 1355
1329 if (getNode() && getNode()->isElementNode() 1356 if (getNode() && getNode()->isElementNode()
1330 && toElement(getNode())->isFormControlElement()) { 1357 && toElement(getNode())->isFormControlElement()) {
1331 HTMLFormControlElement* element = toHTMLFormControlElement(getNode()); 1358 HTMLFormControlElement* element = toHTMLFormControlElement(getNode());
1332 HeapVector<Member<HTMLFormControlElement>> 1359 HeapVector<Member<HTMLFormControlElement>>
1333 invalidControls; 1360 invalidControls;
1334 bool isInvalid = !element->checkValidity( 1361 bool isInvalid = !element->checkValidity(
1335 &invalidControls, CheckValidityDispatchNoEvent); 1362 &invalidControls, CheckValidityDispatchNoEvent);
1336 return isInvalid ? InvalidStateTrue : InvalidStateFalse; 1363 return isInvalid ? InvalidStateTrue : InvalidStateFalse;
1337 } 1364 }
1338 1365
1339 return InvalidStateUndefined; 1366 return AXObject::getInvalidState();
1340 } 1367 }
1341 1368
1342 int AXNodeObject::posInSet() const 1369 int AXNodeObject::posInSet() const
1343 { 1370 {
1344 if (supportsSetSizeAndPosInSet()) { 1371 if (supportsSetSizeAndPosInSet()) {
1345 if (hasAttribute(aria_posinsetAttr)) 1372 if (hasAttribute(aria_posinsetAttr))
1346 return getAttribute(aria_posinsetAttr).toInt(); 1373 return getAttribute(aria_posinsetAttr).toInt();
1347 return AXObject::indexInParent() + 1; 1374 return AXObject::indexInParent() + 1;
1348 } 1375 }
1349 1376
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after
2792 return placeholder; 2819 return placeholder;
2793 } 2820 }
2794 2821
2795 DEFINE_TRACE(AXNodeObject) 2822 DEFINE_TRACE(AXNodeObject)
2796 { 2823 {
2797 visitor->trace(m_node); 2824 visitor->trace(m_node);
2798 AXObject::trace(visitor); 2825 AXObject::trace(visitor);
2799 } 2826 }
2800 2827
2801 } // namespace blink 2828 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698