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

Side by Side Diff: Source/core/html/RadioNodeList.cpp

Issue 17381010: Introduce toHTMLFormControlElement, and use it. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLSelectElement.h ('k') | Source/core/loader/FormSubmission.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 Motorola Mobility, Inc. All rights reserved. 2 * Copyright (c) 2012 Motorola Mobility, 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 bool RadioNodeList::checkElementMatchesRadioNodeListFilter(Element* testElement) const 87 bool RadioNodeList::checkElementMatchesRadioNodeListFilter(Element* testElement) const
88 { 88 {
89 ASSERT(testElement->hasTagName(objectTag) || testElement->isFormControlEleme nt()); 89 ASSERT(testElement->hasTagName(objectTag) || testElement->isFormControlEleme nt());
90 if (ownerNode()->hasTagName(formTag)) { 90 if (ownerNode()->hasTagName(formTag)) {
91 HTMLFormElement* formElement = 0; 91 HTMLFormElement* formElement = 0;
92 if (testElement->hasTagName(objectTag)) 92 if (testElement->hasTagName(objectTag))
93 formElement = static_cast<HTMLObjectElement*>(testElement)->form(); 93 formElement = static_cast<HTMLObjectElement*>(testElement)->form();
94 else 94 else
95 formElement = static_cast<HTMLFormControlElement*>(testElement)->for m(); 95 formElement = toHTMLFormControlElement(testElement)->form();
96 if (!formElement || formElement != ownerNode()) 96 if (!formElement || formElement != ownerNode())
97 return false; 97 return false;
98 } 98 }
99 99
100 return testElement->getIdAttribute() == m_name || testElement->getNameAttrib ute() == m_name; 100 return testElement->getIdAttribute() == m_name || testElement->getNameAttrib ute() == m_name;
101 } 101 }
102 102
103 bool RadioNodeList::nodeMatches(Element* testElement) const 103 bool RadioNodeList::nodeMatches(Element* testElement) const
104 { 104 {
105 if (!testElement->hasTagName(objectTag) && !testElement->isFormControlElemen t()) 105 if (!testElement->hasTagName(objectTag) && !testElement->isFormControlElemen t())
106 return false; 106 return false;
107 107
108 if (testElement->hasTagName(inputTag) && toHTMLInputElement(testElement)->is ImageButton()) 108 if (testElement->hasTagName(inputTag) && toHTMLInputElement(testElement)->is ImageButton())
109 return false; 109 return false;
110 110
111 return checkElementMatchesRadioNodeListFilter(testElement); 111 return checkElementMatchesRadioNodeListFilter(testElement);
112 } 112 }
113 113
114 } // namspace 114 } // namspace
115 115
OLDNEW
« no previous file with comments | « Source/core/html/HTMLSelectElement.h ('k') | Source/core/loader/FormSubmission.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698