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

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

Issue 1071483002: Implement aria properties setsize and posinset. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixing nits Created 5 years, 8 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
« no previous file with comments | « Source/modules/accessibility/AXObject.h ('k') | Source/web/WebAXObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 711
712 bool AXObject::supportsRangeValue() const 712 bool AXObject::supportsRangeValue() const
713 { 713 {
714 return isProgressIndicator() 714 return isProgressIndicator()
715 || isMeter() 715 || isMeter()
716 || isSlider() 716 || isSlider()
717 || isScrollbar() 717 || isScrollbar()
718 || isSpinButton(); 718 || isSpinButton();
719 } 719 }
720 720
721 bool AXObject::supportsSetSizeAndPosInSet() const
722 {
723 AXObject* parent = parentObject();
724 if (!parent)
725 return false;
726
727 int role = roleValue();
728 int parentRole = parent->roleValue();
729
730 if ((role == ListBoxOptionRole && parentRole == ListBoxRole)
731 || (role == ListItemRole && parentRole == ListRole)
732 || (role == MenuItemRole && parentRole == MenuRole)
733 || (role == RadioButtonRole && parentRole == RadioGroupRole)
734 || (role == TabRole && parentRole == TabListRole)
735 || (role == TreeItemRole && parentRole == TreeRole))
736 return true;
737
738 return false;
739 }
740
741 int AXObject::indexInParent() const
742 {
743 if (!parentObject())
744 return 0;
745
746 const auto& siblings = parentObject()->children();
747 int childCount = siblings.size();
748
749 for (int index = 0; index < childCount; ++index) {
750 if (siblings[index].get() == this) {
751 return index;
752 }
753 }
754 return 0;
755 }
756
721 void AXObject::ariaTreeRows(AccessibilityChildrenVector& result) 757 void AXObject::ariaTreeRows(AccessibilityChildrenVector& result)
722 { 758 {
723 for (const auto& child : children()) { 759 for (const auto& child : children()) {
724 // Add tree items as the rows. 760 // Add tree items as the rows.
725 if (child->roleValue() == TreeItemRole) 761 if (child->roleValue() == TreeItemRole)
726 result.append(child); 762 result.append(child);
727 763
728 // Now see if this item also has rows hiding inside of it. 764 // Now see if this item also has rows hiding inside of it.
729 child->ariaTreeRows(result); 765 child->ariaTreeRows(result);
730 } 766 }
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 } 1335 }
1300 1336
1301 const AtomicString& AXObject::internalRoleName(AccessibilityRole role) 1337 const AtomicString& AXObject::internalRoleName(AccessibilityRole role)
1302 { 1338 {
1303 static const Vector<AtomicString>* internalRoleNameVector = createInternalRo leNameVector(); 1339 static const Vector<AtomicString>* internalRoleNameVector = createInternalRo leNameVector();
1304 1340
1305 return internalRoleNameVector->at(role); 1341 return internalRoleNameVector->at(role);
1306 } 1342 }
1307 1343
1308 } // namespace blink 1344 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXObject.h ('k') | Source/web/WebAXObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698