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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 return alt; 105 return alt;
106 106
107 const AtomicString& title = toHTMLElement(node)->getAttribute(titleAttr) ; 107 const AtomicString& title = toHTMLElement(node)->getAttribute(titleAttr) ;
108 if (!title.isEmpty()) 108 if (!title.isEmpty())
109 return title; 109 return title;
110 } 110 }
111 111
112 return String(); 112 return String();
113 } 113 }
114 114
115 String AXNodeObject::accessibilityDescriptionForElements(WillBeHeapVector<RawPtr WillBeMember<Element>> &elements) const 115 String AXNodeObject::accessibilityDescriptionForElements(HeapVector<Member<Eleme nt>> &elements) const
116 { 116 {
117 StringBuilder builder; 117 StringBuilder builder;
118 unsigned size = elements.size(); 118 unsigned size = elements.size();
119 for (unsigned i = 0; i < size; ++i) { 119 for (unsigned i = 0; i < size; ++i) {
120 Element* idElement = elements[i]; 120 Element* idElement = elements[i];
121 121
122 builder.append(accessibleNameForNode(idElement)); 122 builder.append(accessibleNameForNode(idElement));
123 for (Node& n : NodeTraversal::descendantsOf(*idElement)) 123 for (Node& n : NodeTraversal::descendantsOf(*idElement))
124 builder.append(accessibleNameForNode(&n)); 124 builder.append(accessibleNameForNode(&n));
125 125
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 role = remapAriaRoleDueToParent(role); 545 role = remapAriaRoleDueToParent(role);
546 546
547 if (role) 547 if (role)
548 return role; 548 return role;
549 549
550 return UnknownRole; 550 return UnknownRole;
551 } 551 }
552 552
553 void AXNodeObject::accessibilityChildrenFromAttribute(QualifiedName attr, AXObje ct::AXObjectVector& children) const 553 void AXNodeObject::accessibilityChildrenFromAttribute(QualifiedName attr, AXObje ct::AXObjectVector& children) const
554 { 554 {
555 WillBeHeapVector<RawPtrWillBeMember<Element>> elements; 555 HeapVector<Member<Element>> elements;
556 elementsFromAttribute(elements, attr); 556 elementsFromAttribute(elements, attr);
557 557
558 AXObjectCacheImpl& cache = axObjectCache(); 558 AXObjectCacheImpl& cache = axObjectCache();
559 for (const auto& element : elements) { 559 for (const auto& element : elements) {
560 if (AXObject* child = cache.getOrCreate(element)) 560 if (AXObject* child = cache.getOrCreate(element))
561 children.append(child); 561 children.append(child);
562 } 562 }
563 } 563 }
564 564
565 // This only returns true if this is the element that actually has the 565 // This only returns true if this is the element that actually has the
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 if (equalIgnoringCase(attributeValue, "grammar")) 1285 if (equalIgnoringCase(attributeValue, "grammar"))
1286 return InvalidStateGrammar; 1286 return InvalidStateGrammar;
1287 // A yet unknown value. 1287 // A yet unknown value.
1288 if (!attributeValue.isEmpty()) 1288 if (!attributeValue.isEmpty())
1289 return InvalidStateOther; 1289 return InvalidStateOther;
1290 } 1290 }
1291 1291
1292 if (node() && node()->isElementNode() 1292 if (node() && node()->isElementNode()
1293 && toElement(node())->isFormControlElement()) { 1293 && toElement(node())->isFormControlElement()) {
1294 HTMLFormControlElement* element = toHTMLFormControlElement(node()); 1294 HTMLFormControlElement* element = toHTMLFormControlElement(node());
1295 WillBeHeapVector<RefPtrWillBeMember<HTMLFormControlElement>> 1295 HeapVector<Member<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::posInSet() const 1305 int AXNodeObject::posInSet() const
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 1397
1398 String AXNodeObject::stringValue() const 1398 String AXNodeObject::stringValue() const
1399 { 1399 {
1400 Node* node = this->node(); 1400 Node* node = this->node();
1401 if (!node) 1401 if (!node)
1402 return String(); 1402 return String();
1403 1403
1404 if (isHTMLSelectElement(*node)) { 1404 if (isHTMLSelectElement(*node)) {
1405 HTMLSelectElement& selectElement = toHTMLSelectElement(*node); 1405 HTMLSelectElement& selectElement = toHTMLSelectElement(*node);
1406 int selectedIndex = selectElement.selectedIndex(); 1406 int selectedIndex = selectElement.selectedIndex();
1407 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems = sel ectElement.listItems(); 1407 const HeapVector<Member<HTMLElement>>& listItems = selectElement.listIte ms();
1408 if (selectedIndex >= 0 && static_cast<size_t>(selectedIndex) < listItems .size()) { 1408 if (selectedIndex >= 0 && static_cast<size_t>(selectedIndex) < listItems .size()) {
1409 const AtomicString& overriddenDescription = listItems[selectedIndex] ->fastGetAttribute(aria_labelAttr); 1409 const AtomicString& overriddenDescription = listItems[selectedIndex] ->fastGetAttribute(aria_labelAttr);
1410 if (!overriddenDescription.isNull()) 1410 if (!overriddenDescription.isNull())
1411 return overriddenDescription; 1411 return overriddenDescription;
1412 } 1412 }
1413 if (!selectElement.multiple()) 1413 if (!selectElement.multiple())
1414 return selectElement.value(); 1414 return selectElement.value();
1415 return String(); 1415 return String();
1416 } 1416 }
1417 1417
1418 if (isNativeTextControl()) 1418 if (isNativeTextControl())
1419 return text(); 1419 return text();
1420 1420
1421 // Handle other HTML input elements that aren't text controls, like date and time 1421 // Handle other HTML input elements that aren't text controls, like date and time
1422 // controls, by returning the string value, with the exception of checkboxes 1422 // controls, by returning the string value, with the exception of checkboxes
1423 // and radio buttons (which would return "on"). 1423 // and radio buttons (which would return "on").
1424 if (isHTMLInputElement(node)) { 1424 if (isHTMLInputElement(node)) {
1425 HTMLInputElement* input = toHTMLInputElement(node); 1425 HTMLInputElement* input = toHTMLInputElement(node);
1426 if (input->type() != InputTypeNames::checkbox && input->type() != InputT ypeNames::radio) 1426 if (input->type() != InputTypeNames::checkbox && input->type() != InputT ypeNames::radio)
1427 return input->value(); 1427 return input->value();
1428 } 1428 }
1429 1429
1430 return String(); 1430 return String();
1431 } 1431 }
1432 1432
1433 String AXNodeObject::ariaDescribedByAttribute() const 1433 String AXNodeObject::ariaDescribedByAttribute() const
1434 { 1434 {
1435 WillBeHeapVector<RawPtrWillBeMember<Element>> elements; 1435 HeapVector<Member<Element>> elements;
1436 elementsFromAttribute(elements, aria_describedbyAttr); 1436 elementsFromAttribute(elements, aria_describedbyAttr);
1437 1437
1438 return accessibilityDescriptionForElements(elements); 1438 return accessibilityDescriptionForElements(elements);
1439 } 1439 }
1440 1440
1441 String AXNodeObject::ariaLabelledbyAttribute() const 1441 String AXNodeObject::ariaLabelledbyAttribute() const
1442 { 1442 {
1443 WillBeHeapVector<RawPtrWillBeMember<Element>> elements; 1443 HeapVector<Member<Element>> elements;
1444 ariaLabelledbyElementVector(elements); 1444 ariaLabelledbyElementVector(elements);
1445 1445
1446 return accessibilityDescriptionForElements(elements); 1446 return accessibilityDescriptionForElements(elements);
1447 } 1447 }
1448 1448
1449 AccessibilityRole AXNodeObject::ariaRoleAttribute() const 1449 AccessibilityRole AXNodeObject::ariaRoleAttribute() const
1450 { 1450 {
1451 return m_ariaRole; 1451 return m_ariaRole;
1452 } 1452 }
1453 1453
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 // computeAccessibilityIsIgnored, which isn't allowed to call axObjectCache- >getOrCreate. 1645 // computeAccessibilityIsIgnored, which isn't allowed to call axObjectCache- >getOrCreate.
1646 1646
1647 if (!node() && !layoutObject()) 1647 if (!node() && !layoutObject())
1648 return false; 1648 return false;
1649 1649
1650 // Step 2A from: http://www.w3.org/TR/accname-aam-1.1 1650 // Step 2A from: http://www.w3.org/TR/accname-aam-1.1
1651 if (isHiddenForTextAlternativeCalculation()) 1651 if (isHiddenForTextAlternativeCalculation())
1652 return false; 1652 return false;
1653 1653
1654 // Step 2B from: http://www.w3.org/TR/accname-aam-1.1 1654 // Step 2B from: http://www.w3.org/TR/accname-aam-1.1
1655 WillBeHeapVector<RawPtrWillBeMember<Element>> elements; 1655 HeapVector<Member<Element>> elements;
1656 ariaLabelledbyElementVector(elements); 1656 ariaLabelledbyElementVector(elements);
1657 if (elements.size() > 0) 1657 if (elements.size() > 0)
1658 return false; 1658 return false;
1659 1659
1660 // Step 2C from: http://www.w3.org/TR/accname-aam-1.1 1660 // Step 2C from: http://www.w3.org/TR/accname-aam-1.1
1661 const AtomicString& ariaLabel = getAttribute(aria_labelAttr); 1661 const AtomicString& ariaLabel = getAttribute(aria_labelAttr);
1662 if (!ariaLabel.isEmpty()) 1662 if (!ariaLabel.isEmpty())
1663 return false; 1663 return false;
1664 1664
1665 // Based on http://rawgit.com/w3c/aria/master/html-aam/html-aam.html#accessi ble-name-and-description-calculation 1665 // Based on http://rawgit.com/w3c/aria/master/html-aam/html-aam.html#accessi ble-name-and-description-calculation
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
2751 return placeholder; 2751 return placeholder;
2752 } 2752 }
2753 2753
2754 DEFINE_TRACE(AXNodeObject) 2754 DEFINE_TRACE(AXNodeObject)
2755 { 2755 {
2756 visitor->trace(m_node); 2756 visitor->trace(m_node);
2757 AXObject::trace(visitor); 2757 AXObject::trace(visitor);
2758 } 2758 }
2759 2759
2760 } // namespace blink 2760 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698