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

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

Issue 2502413004: WTF/std normalization: replace WTF::Vector::last with ::back (Closed)
Patch Set: rebase Created 4 years, 1 month 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) 2008, 2009, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 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 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 // Step 2B from: http://www.w3.org/TR/accname-aam-1.1 748 // Step 2B from: http://www.w3.org/TR/accname-aam-1.1
749 // If you change this logic, update AXNodeObject::nameFromLabelElement, too. 749 // If you change this logic, update AXNodeObject::nameFromLabelElement, too.
750 if (!inAriaLabelledByTraversal && !alreadyVisited) { 750 if (!inAriaLabelledByTraversal && !alreadyVisited) {
751 const QualifiedName& attr = 751 const QualifiedName& attr =
752 hasAttribute(aria_labeledbyAttr) && !hasAttribute(aria_labelledbyAttr) 752 hasAttribute(aria_labeledbyAttr) && !hasAttribute(aria_labelledbyAttr)
753 ? aria_labeledbyAttr 753 ? aria_labeledbyAttr
754 : aria_labelledbyAttr; 754 : aria_labelledbyAttr;
755 nameFrom = AXNameFromRelatedElement; 755 nameFrom = AXNameFromRelatedElement;
756 if (nameSources) { 756 if (nameSources) {
757 nameSources->append(NameSource(*foundTextAlternative, attr)); 757 nameSources->append(NameSource(*foundTextAlternative, attr));
758 nameSources->last().type = nameFrom; 758 nameSources->back().type = nameFrom;
759 } 759 }
760 760
761 const AtomicString& ariaLabelledby = getAttribute(attr); 761 const AtomicString& ariaLabelledby = getAttribute(attr);
762 if (!ariaLabelledby.isNull()) { 762 if (!ariaLabelledby.isNull()) {
763 if (nameSources) 763 if (nameSources)
764 nameSources->last().attributeValue = ariaLabelledby; 764 nameSources->back().attributeValue = ariaLabelledby;
765 765
766 // Operate on a copy of |visited| so that if |nameSources| is not null, 766 // Operate on a copy of |visited| so that if |nameSources| is not null,
767 // the set of visited objects is preserved unmodified for future 767 // the set of visited objects is preserved unmodified for future
768 // calculations. 768 // calculations.
769 AXObjectSet visitedCopy = visited; 769 AXObjectSet visitedCopy = visited;
770 textAlternative = textFromAriaLabelledby(visitedCopy, relatedObjects); 770 textAlternative = textFromAriaLabelledby(visitedCopy, relatedObjects);
771 if (!textAlternative.isNull()) { 771 if (!textAlternative.isNull()) {
772 if (nameSources) { 772 if (nameSources) {
773 NameSource& source = nameSources->last(); 773 NameSource& source = nameSources->back();
774 source.type = nameFrom; 774 source.type = nameFrom;
775 source.relatedObjects = *relatedObjects; 775 source.relatedObjects = *relatedObjects;
776 source.text = textAlternative; 776 source.text = textAlternative;
777 *foundTextAlternative = true; 777 *foundTextAlternative = true;
778 } else { 778 } else {
779 *foundTextAlternative = true; 779 *foundTextAlternative = true;
780 return textAlternative; 780 return textAlternative;
781 } 781 }
782 } else if (nameSources) { 782 } else if (nameSources) {
783 nameSources->last().invalid = true; 783 nameSources->back().invalid = true;
784 } 784 }
785 } 785 }
786 } 786 }
787 787
788 // Step 2C from: http://www.w3.org/TR/accname-aam-1.1 788 // Step 2C from: http://www.w3.org/TR/accname-aam-1.1
789 // If you change this logic, update AXNodeObject::nameFromLabelElement, too. 789 // If you change this logic, update AXNodeObject::nameFromLabelElement, too.
790 nameFrom = AXNameFromAttribute; 790 nameFrom = AXNameFromAttribute;
791 if (nameSources) { 791 if (nameSources) {
792 nameSources->append(NameSource(*foundTextAlternative, aria_labelAttr)); 792 nameSources->append(NameSource(*foundTextAlternative, aria_labelAttr));
793 nameSources->last().type = nameFrom; 793 nameSources->back().type = nameFrom;
794 } 794 }
795 const AtomicString& ariaLabel = getAttribute(aria_labelAttr); 795 const AtomicString& ariaLabel = getAttribute(aria_labelAttr);
796 if (!ariaLabel.isEmpty()) { 796 if (!ariaLabel.isEmpty()) {
797 textAlternative = ariaLabel; 797 textAlternative = ariaLabel;
798 798
799 if (nameSources) { 799 if (nameSources) {
800 NameSource& source = nameSources->last(); 800 NameSource& source = nameSources->back();
801 source.text = textAlternative; 801 source.text = textAlternative;
802 source.attributeValue = ariaLabel; 802 source.attributeValue = ariaLabel;
803 *foundTextAlternative = true; 803 *foundTextAlternative = true;
804 } else { 804 } else {
805 *foundTextAlternative = true; 805 *foundTextAlternative = true;
806 return textAlternative; 806 return textAlternative;
807 } 807 }
808 } 808 }
809 809
810 return textAlternative; 810 return textAlternative;
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 } 1742 }
1743 1743
1744 DEFINE_TRACE(AXObject) { 1744 DEFINE_TRACE(AXObject) {
1745 visitor->trace(m_children); 1745 visitor->trace(m_children);
1746 visitor->trace(m_parent); 1746 visitor->trace(m_parent);
1747 visitor->trace(m_cachedLiveRegionRoot); 1747 visitor->trace(m_cachedLiveRegionRoot);
1748 visitor->trace(m_axObjectCache); 1748 visitor->trace(m_axObjectCache);
1749 } 1749 }
1750 1750
1751 } // namespace blink 1751 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698