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

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

Issue 19096009: Use isHTMLTextAreaElement and toHTMLTextAreaElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years, 5 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 | « no previous file | Source/core/accessibility/AccessibilityRenderObject.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) 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 const AtomicString& type = input->getAttribute(typeAttr); 194 const AtomicString& type = input->getAttribute(typeAttr);
195 if (equalIgnoringCase(type, "color")) 195 if (equalIgnoringCase(type, "color"))
196 return ColorWellRole; 196 return ColorWellRole;
197 197
198 return TextFieldRole; 198 return TextFieldRole;
199 } 199 }
200 if (node()->hasTagName(selectTag)) { 200 if (node()->hasTagName(selectTag)) {
201 HTMLSelectElement* selectElement = toHTMLSelectElement(node()); 201 HTMLSelectElement* selectElement = toHTMLSelectElement(node());
202 return selectElement->multiple() ? ListBoxRole : PopUpButtonRole; 202 return selectElement->multiple() ? ListBoxRole : PopUpButtonRole;
203 } 203 }
204 if (node()->hasTagName(textareaTag)) 204 if (isHTMLTextAreaElement(node()))
205 return TextAreaRole; 205 return TextAreaRole;
206 if (headingLevel()) 206 if (headingLevel())
207 return HeadingRole; 207 return HeadingRole;
208 if (node()->hasTagName(divTag)) 208 if (node()->hasTagName(divTag))
209 return DivRole; 209 return DivRole;
210 if (node()->hasTagName(pTag)) 210 if (node()->hasTagName(pTag))
211 return ParagraphRole; 211 return ParagraphRole;
212 if (isHTMLLabelElement(node())) 212 if (isHTMLLabelElement(node()))
213 return LabelRole; 213 return LabelRole;
214 if (node()->isFocusable()) 214 if (node()->isFocusable())
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 575
576 return false; 576 return false;
577 } 577 }
578 578
579 bool AccessibilityNodeObject::isNativeTextControl() const 579 bool AccessibilityNodeObject::isNativeTextControl() const
580 { 580 {
581 Node* node = this->node(); 581 Node* node = this->node();
582 if (!node) 582 if (!node)
583 return false; 583 return false;
584 584
585 if (node->hasTagName(textareaTag)) 585 if (isHTMLTextAreaElement(node))
586 return true; 586 return true;
587 587
588 if (node->hasTagName(inputTag)) { 588 if (node->hasTagName(inputTag)) {
589 HTMLInputElement* input = toHTMLInputElement(node); 589 HTMLInputElement* input = toHTMLInputElement(node);
590 return input->isText() || input->isNumberField(); 590 return input->isText() || input->isNumberField();
591 } 591 }
592 592
593 return false; 593 return false;
594 } 594 }
595 595
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 690
691 return node->active(); 691 return node->active();
692 } 692 }
693 693
694 bool AccessibilityNodeObject::isReadOnly() const 694 bool AccessibilityNodeObject::isReadOnly() const
695 { 695 {
696 Node* node = this->node(); 696 Node* node = this->node();
697 if (!node) 697 if (!node)
698 return true; 698 return true;
699 699
700 if (node->hasTagName(textareaTag)) 700 if (isHTMLTextAreaElement(node))
701 return toHTMLFormControlElement(node)->isReadOnly(); 701 return toHTMLFormControlElement(node)->isReadOnly();
702 702
703 if (node->hasTagName(inputTag)) { 703 if (node->hasTagName(inputTag)) {
704 HTMLInputElement* input = toHTMLInputElement(node); 704 HTMLInputElement* input = toHTMLInputElement(node);
705 if (input->isTextField()) 705 if (input->isTextField())
706 return input->isReadOnly(); 706 return input->isReadOnly();
707 } 707 }
708 708
709 return !node->rendererIsEditable(); 709 return !node->rendererIsEditable();
710 } 710 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 if (ariaRoleAttribute() == StaticTextRole) 824 if (ariaRoleAttribute() == StaticTextRole)
825 return ariaAccessibilityDescription(); 825 return ariaAccessibilityDescription();
826 826
827 if (!isTextControl()) 827 if (!isTextControl())
828 return String(); 828 return String();
829 829
830 Node* node = this->node(); 830 Node* node = this->node();
831 if (!node) 831 if (!node)
832 return String(); 832 return String();
833 833
834 if (isNativeTextControl() && (node->hasTagName(textareaTag) || node->hasTagN ame(inputTag))) 834 if (isNativeTextControl() && (isHTMLTextAreaElement(node) || node->hasTagNam e(inputTag)))
835 return toHTMLTextFormControlElement(node)->value(); 835 return toHTMLTextFormControlElement(node)->value();
836 836
837 if (!node->isElementNode()) 837 if (!node->isElementNode())
838 return String(); 838 return String();
839 839
840 return toElement(node)->innerText(); 840 return toElement(node)->innerText();
841 } 841 }
842 842
843 AccessibilityButtonState AccessibilityNodeObject::checkboxOrRadioValue() const 843 AccessibilityButtonState AccessibilityNodeObject::checkboxOrRadioValue() const
844 { 844 {
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 useTextUnderElement = true; 1666 useTextUnderElement = true;
1667 1667
1668 if (useTextUnderElement) { 1668 if (useTextUnderElement) {
1669 String text = textUnderElement(); 1669 String text = textUnderElement();
1670 if (!text.isEmpty()) 1670 if (!text.isEmpty())
1671 textOrder.append(AccessibilityText(text, ChildrenText)); 1671 textOrder.append(AccessibilityText(text, ChildrenText));
1672 } 1672 }
1673 } 1673 }
1674 1674
1675 } // namespace WebCore 1675 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/accessibility/AccessibilityRenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698