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

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

Issue 1346733002: Added layout test for aria-orientation and cleaned up code. Also exposed hr element with an orienta… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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) 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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 if (!m_layoutObject) 835 if (!m_layoutObject)
836 return AXNodeObject::fontSize(); 836 return AXNodeObject::fontSize();
837 837
838 const ComputedStyle* style = m_layoutObject->style(); 838 const ComputedStyle* style = m_layoutObject->style();
839 if (!style) 839 if (!style)
840 return AXNodeObject::fontSize(); 840 return AXNodeObject::fontSize();
841 841
842 return style->computedFontSize(); 842 return style->computedFontSize();
843 } 843 }
844 844
845 AccessibilityOrientation AXLayoutObject::orientation() const
846 {
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
881 if (equalIgnoringCase(ariaOrientation, "horizontal"))
882 axorientation = AccessibilityOrientationHorizontal;
883 if (equalIgnoringCase(ariaOrientation, "vertical"))
884 axorientation = AccessibilityOrientationVertical;
885 return axorientation;
886 }
887
888 String AXLayoutObject::text() const 845 String AXLayoutObject::text() const
889 { 846 {
890 if (isPasswordFieldAndShouldHideValue()) { 847 if (isPasswordFieldAndShouldHideValue()) {
891 if (!m_layoutObject) 848 if (!m_layoutObject)
892 return String(); 849 return String();
893 850
894 const ComputedStyle* style = m_layoutObject->style(); 851 const ComputedStyle* style = m_layoutObject->style();
895 if (!style) 852 if (!style)
896 return String(); 853 return String();
897 854
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
2659 if (label && label->layoutObject()) { 2616 if (label && label->layoutObject()) {
2660 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct(); 2617 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct();
2661 result.unite(labelRect); 2618 result.unite(labelRect);
2662 } 2619 }
2663 } 2620 }
2664 2621
2665 return result; 2622 return result;
2666 } 2623 }
2667 2624
2668 } // namespace blink 2625 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698