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

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

Issue 730113003: Introduce new API orientation() to expose aria-orientation correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: updating condition for TreeGridRole Created 6 years 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 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 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 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 if (!node) 838 if (!node)
839 return nullAtom; 839 return nullAtom;
840 if (!node->isElementNode()) 840 if (!node->isElementNode())
841 return nullAtom; 841 return nullAtom;
842 return toElement(node)->getAttribute(accesskeyAttr); 842 return toElement(node)->getAttribute(accesskeyAttr);
843 } 843 }
844 844
845 AccessibilityOrientation AXRenderObject::orientation() const 845 AccessibilityOrientation AXRenderObject::orientation() const
846 { 846 {
847 const AtomicString& ariaOrientation = getAttribute(aria_orientationAttr); 847 const AtomicString& ariaOrientation = getAttribute(aria_orientationAttr);
848 AccessibilityOrientation axorientation = AccessibilityOrientationUndefined;
849
850 // For TreeGridRole, roleValue() can't be compared because its overridden
851 // in AXTable::roleValue()
852 if (ariaRoleAttribute() == TreeGridRole) {
853 if (equalIgnoringCase(ariaOrientation, "horizontal"))
854 axorientation = AccessibilityOrientationHorizontal;
855 if (equalIgnoringCase(ariaOrientation, "vertical"))
856 axorientation = AccessibilityOrientationVertical;
857 return axorientation;
858 }
859
860 switch (roleValue()) {
861 case ComboBoxRole:
862 case ListBoxRole:
863 case MenuRole:
864 case ScrollBarRole:
865 case TreeRole:
866 axorientation = AccessibilityOrientationVertical;
867 break;
868 case MenuBarRole:
869 case SliderRole:
870 case SplitterRole:
871 case TabListRole:
872 case ToolbarRole:
873 axorientation = AccessibilityOrientationHorizontal;
874 break;
875 case RadioGroupRole:
876 break;
877 default:
878 return AXObject::orientation();
879 }
880
848 if (equalIgnoringCase(ariaOrientation, "horizontal")) 881 if (equalIgnoringCase(ariaOrientation, "horizontal"))
849 return AccessibilityOrientationHorizontal; 882 axorientation = AccessibilityOrientationHorizontal;
850 if (equalIgnoringCase(ariaOrientation, "vertical")) 883 if (equalIgnoringCase(ariaOrientation, "vertical"))
851 return AccessibilityOrientationVertical; 884 axorientation = AccessibilityOrientationVertical;
852 885 return axorientation;
853 if (isScrollbar())
854 return AccessibilityOrientationVertical;
855
856 return AXObject::orientation();
857 } 886 }
858 887
859 String AXRenderObject::text() const 888 String AXRenderObject::text() const
860 { 889 {
861 if (isPasswordFieldAndShouldHideValue()) 890 if (isPasswordFieldAndShouldHideValue())
862 return String(); 891 return String();
863 892
864 return AXNodeObject::text(); 893 return AXNodeObject::text();
865 } 894 }
866 895
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after
2463 if (label && label->renderer()) { 2492 if (label && label->renderer()) {
2464 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); 2493 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect();
2465 result.unite(labelRect); 2494 result.unite(labelRect);
2466 } 2495 }
2467 } 2496 }
2468 2497
2469 return result; 2498 return result;
2470 } 2499 }
2471 2500
2472 } // namespace blink 2501 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698