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

Side by Side Diff: Source/WebKit/chromium/src/WebFormElement.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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 void WebFormElement::getFormControlElements(WebVector<WebFormControlElement>& re sult) const 87 void WebFormElement::getFormControlElements(WebVector<WebFormControlElement>& re sult) const
88 { 88 {
89 const HTMLFormElement* form = constUnwrap<HTMLFormElement>(); 89 const HTMLFormElement* form = constUnwrap<HTMLFormElement>();
90 Vector<RefPtr<HTMLFormControlElement> > tempVector; 90 Vector<RefPtr<HTMLFormControlElement> > tempVector;
91 // FIXME: We should move the for-loop condition into a variable instead of 91 // FIXME: We should move the for-loop condition into a variable instead of
92 // re-evaluating size each time. Also, consider refactoring this code so tha t 92 // re-evaluating size each time. Also, consider refactoring this code so tha t
93 // we don't call form->associatedElements() multiple times. 93 // we don't call form->associatedElements() multiple times.
94 for (size_t i = 0; i < form->associatedElements().size(); i++) { 94 for (size_t i = 0; i < form->associatedElements().size(); i++) {
95 if (!form->associatedElements()[i]->isFormControlElement()) 95 if (!form->associatedElements()[i]->isFormControlElement())
96 continue; 96 continue;
97 HTMLFormControlElement* element = static_cast<HTMLFormControlElement*>(f orm->associatedElements()[i]); 97 HTMLFormControlElement* element = toHTMLFormControlElement(form->associa tedElements()[i]);
98 if (element->hasLocalName(HTMLNames::inputTag) 98 if (element->hasLocalName(HTMLNames::inputTag)
99 || element->hasLocalName(HTMLNames::selectTag)) 99 || element->hasLocalName(HTMLNames::selectTag))
100 tempVector.append(element); 100 tempVector.append(element);
101 } 101 }
102 result.assign(tempVector); 102 result.assign(tempVector);
103 } 103 }
104 104
105 bool WebFormElement::checkValidityWithoutDispatchingEvents() 105 bool WebFormElement::checkValidityWithoutDispatchingEvents()
106 { 106 {
107 return unwrap<HTMLFormElement>()->checkValidityWithoutDispatchingEvents(); 107 return unwrap<HTMLFormElement>()->checkValidityWithoutDispatchingEvents();
(...skipping 14 matching lines...) Expand all
122 m_private = e; 122 m_private = e;
123 return *this; 123 return *this;
124 } 124 }
125 125
126 WebFormElement::operator PassRefPtr<HTMLFormElement>() const 126 WebFormElement::operator PassRefPtr<HTMLFormElement>() const
127 { 127 {
128 return static_cast<HTMLFormElement*>(m_private.get()); 128 return static_cast<HTMLFormElement*>(m_private.get());
129 } 129 }
130 130
131 } // namespace WebKit 131 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/WebFormControlElement.cpp ('k') | Source/WebKit/chromium/src/WebPasswordFormUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698