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

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

Issue 775533002: Limit the heading level to 1 - 9. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporating comments 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
« no previous file with comments | « no previous file | no next file » | 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) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, Google 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 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 return true; 871 return true;
872 } 872 }
873 873
874 int AXNodeObject::headingLevel() const 874 int AXNodeObject::headingLevel() const
875 { 875 {
876 // headings can be in block flow and non-block flow 876 // headings can be in block flow and non-block flow
877 Node* node = this->node(); 877 Node* node = this->node();
878 if (!node) 878 if (!node)
879 return 0; 879 return 0;
880 880
881 if (roleValue() == HeadingRole && hasAttribute(aria_levelAttr)) 881 if (roleValue() == HeadingRole && hasAttribute(aria_levelAttr)) {
882 return getAttribute(aria_levelAttr).toInt(); 882 int level = getAttribute(aria_levelAttr).toInt();
883 if (level >= 1 && level <= 9)
884 return level;
885 }
883 886
884 if (!node->isHTMLElement()) 887 if (!node->isHTMLElement())
885 return 0; 888 return 0;
886 889
887 HTMLElement& element = toHTMLElement(*node); 890 HTMLElement& element = toHTMLElement(*node);
888 if (element.hasTagName(h1Tag)) 891 if (element.hasTagName(h1Tag))
889 return 1; 892 return 1;
890 893
891 if (element.hasTagName(h2Tag)) 894 if (element.hasTagName(h2Tag))
892 return 2; 895 return 2;
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
1820 float range = maxValueForRange() - minValueForRange(); 1823 float range = maxValueForRange() - minValueForRange();
1821 float value = valueForRange(); 1824 float value = valueForRange();
1822 1825
1823 value += range * (percentChange / 100); 1826 value += range * (percentChange / 100);
1824 setValue(String::number(value)); 1827 setValue(String::number(value));
1825 1828
1826 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged, true); 1829 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged, true);
1827 } 1830 }
1828 1831
1829 } // namespace blink 1832 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698