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

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

Issue 704363004: Add an accessibility setting to expose password values. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address feedback Created 6 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
« no previous file with comments | « Source/core/accessibility/AXObject.cpp ('k') | Source/core/frame/Settings.in » ('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 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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 if (equalIgnoringCase(ariaOrientation, "horizontal")) 839 if (equalIgnoringCase(ariaOrientation, "horizontal"))
840 return AccessibilityOrientationHorizontal; 840 return AccessibilityOrientationHorizontal;
841 if (equalIgnoringCase(ariaOrientation, "vertical")) 841 if (equalIgnoringCase(ariaOrientation, "vertical"))
842 return AccessibilityOrientationVertical; 842 return AccessibilityOrientationVertical;
843 843
844 return AXObject::orientation(); 844 return AXObject::orientation();
845 } 845 }
846 846
847 String AXRenderObject::text() const 847 String AXRenderObject::text() const
848 { 848 {
849 if (isPasswordField()) 849 if (isPasswordFieldAndShouldHideValue())
850 return String(); 850 return String();
851 851
852 return AXNodeObject::text(); 852 return AXNodeObject::text();
853 } 853 }
854 854
855 int AXRenderObject::textLength() const 855 int AXRenderObject::textLength() const
856 { 856 {
857 if (!isTextControl()) 857 if (!isTextControl())
858 return -1; 858 return -1;
859 859
860 if (isPasswordField()) 860 if (isPasswordFieldAndShouldHideValue())
861 return -1; // need to return something distinct from 0 861 return -1; // need to return something distinct from 0
862 862
863 return text().length(); 863 return text().length();
864 } 864 }
865 865
866 KURL AXRenderObject::url() const 866 KURL AXRenderObject::url() const
867 { 867 {
868 if (isAnchor() && isHTMLAnchorElement(m_renderer->node())) { 868 if (isAnchor() && isHTMLAnchorElement(m_renderer->node())) {
869 if (HTMLAnchorElement* anchor = toHTMLAnchorElement(anchorElement())) 869 if (HTMLAnchorElement* anchor = toHTMLAnchorElement(anchorElement()))
870 return anchor->href(); 870 return anchor->href();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 default: 909 default:
910 return emptyString(); 910 return emptyString();
911 } 911 }
912 } 912 }
913 913
914 String AXRenderObject::stringValue() const 914 String AXRenderObject::stringValue() const
915 { 915 {
916 if (!m_renderer) 916 if (!m_renderer)
917 return String(); 917 return String();
918 918
919 if (isPasswordField()) 919 if (isPasswordFieldAndShouldHideValue())
920 return String(); 920 return String();
921 921
922 RenderBoxModelObject* cssBox = renderBoxModelObject(); 922 RenderBoxModelObject* cssBox = renderBoxModelObject();
923 923
924 if (ariaRoleAttribute() == StaticTextRole) { 924 if (ariaRoleAttribute() == StaticTextRole) {
925 String staticText = text(); 925 String staticText = text();
926 if (!staticText.length()) 926 if (!staticText.length())
927 staticText = textUnderElement(); 927 staticText = textUnderElement();
928 return staticText; 928 return staticText;
929 } 929 }
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 1638
1639 // 1639 //
1640 // Selected text. 1640 // Selected text.
1641 // 1641 //
1642 1642
1643 AXObject::PlainTextRange AXRenderObject::selectedTextRange() const 1643 AXObject::PlainTextRange AXRenderObject::selectedTextRange() const
1644 { 1644 {
1645 if (!isTextControl()) 1645 if (!isTextControl())
1646 return PlainTextRange(); 1646 return PlainTextRange();
1647 1647
1648 if (isPasswordField()) 1648 if (isPasswordFieldAndShouldHideValue())
1649 return PlainTextRange(); 1649 return PlainTextRange();
1650 1650
1651 AccessibilityRole ariaRole = ariaRoleAttribute(); 1651 AccessibilityRole ariaRole = ariaRoleAttribute();
1652 if (isNativeTextControl() && ariaRole == UnknownRole && m_renderer->isTextCo ntrol()) { 1652 if (isNativeTextControl() && ariaRole == UnknownRole && m_renderer->isTextCo ntrol()) {
1653 HTMLTextFormControlElement* textControl = toRenderTextControl(m_renderer )->textFormControlElement(); 1653 HTMLTextFormControlElement* textControl = toRenderTextControl(m_renderer )->textFormControlElement();
1654 return PlainTextRange(textControl->selectionStart(), textControl->select ionEnd() - textControl->selectionStart()); 1654 return PlainTextRange(textControl->selectionStart(), textControl->select ionEnd() - textControl->selectionStart());
1655 } 1655 }
1656 1656
1657 if (ariaRole == UnknownRole) 1657 if (ariaRole == UnknownRole)
1658 return PlainTextRange(); 1658 return PlainTextRange();
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
2428 if (label && label->renderer()) { 2428 if (label && label->renderer()) {
2429 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); 2429 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect();
2430 result.unite(labelRect); 2430 result.unite(labelRect);
2431 } 2431 }
2432 } 2432 }
2433 2433
2434 return result; 2434 return result;
2435 } 2435 }
2436 2436
2437 } // namespace blink 2437 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/accessibility/AXObject.cpp ('k') | Source/core/frame/Settings.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698