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

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

Issue 141683004: Use more const references in HTMLCollection / LiveNodeList (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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) 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 for (unsigned i = 0; i < length(); ++i) { 82 for (unsigned i = 0; i < length(); ++i) {
83 Node* node = item(i); 83 Node* node = item(i);
84 HTMLInputElement* inputElement = toRadioButtonInputElement(node); 84 HTMLInputElement* inputElement = toRadioButtonInputElement(node);
85 if (!inputElement || inputElement->value() != value) 85 if (!inputElement || inputElement->value() != value)
86 continue; 86 continue;
87 inputElement->setChecked(true); 87 inputElement->setChecked(true);
88 return; 88 return;
89 } 89 }
90 } 90 }
91 91
92 bool RadioNodeList::checkElementMatchesRadioNodeListFilter(Element* testElement) const 92 bool RadioNodeList::checkElementMatchesRadioNodeListFilter(const Element& testEl ement) const
93 { 93 {
94 ASSERT(!m_onlyMatchImgElements); 94 ASSERT(!m_onlyMatchImgElements);
95 ASSERT(testElement->hasTagName(objectTag) || testElement->isFormControlEleme nt()); 95 ASSERT(testElement.hasTagName(objectTag) || testElement.isFormControlElement ());
96 if (ownerNode()->hasTagName(formTag)) { 96 if (ownerNode()->hasTagName(formTag)) {
97 HTMLFormElement* formElement = toHTMLElement(testElement)->formOwner(); 97 HTMLFormElement* formElement = toHTMLElement(testElement).formOwner();
98 if (!formElement || formElement != ownerNode()) 98 if (!formElement || formElement != ownerNode())
99 return false; 99 return false;
100 } 100 }
101 101
102 return testElement->getIdAttribute() == m_name || testElement->getNameAttrib ute() == m_name; 102 return testElement.getIdAttribute() == m_name || testElement.getNameAttribut e() == m_name;
103 } 103 }
104 104
105 bool RadioNodeList::nodeMatches(Element* testElement) const 105 bool RadioNodeList::nodeMatches(const Element& testElement) const
106 { 106 {
107 if (m_onlyMatchImgElements) 107 if (m_onlyMatchImgElements)
108 return testElement->hasTagName(imgTag); 108 return testElement.hasTagName(imgTag);
109 109
110 if (!testElement->hasTagName(objectTag) && !testElement->isFormControlElemen t()) 110 if (!testElement.hasTagName(objectTag) && !testElement.isFormControlElement( ))
111 return false; 111 return false;
112 112
113 if (testElement->hasTagName(inputTag) && toHTMLInputElement(testElement)->is ImageButton()) 113 if (testElement.hasTagName(inputTag) && toHTMLInputElement(testElement).isIm ageButton())
114 return false; 114 return false;
115 115
116 return checkElementMatchesRadioNodeListFilter(testElement); 116 return checkElementMatchesRadioNodeListFilter(testElement);
117 } 117 }
118 118
119 } // namespace 119 } // namespace
120 120
OLDNEW
« Source/core/html/HTMLLabelElement.cpp ('K') | « Source/core/html/RadioNodeList.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698