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

Side by Side Diff: Source/web/WebFormElement.cpp

Issue 270573008: Oilpan: Prepare to support garbage-collected Node in WebNode hierarchy. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 void WebFormElement::submit() 73 void WebFormElement::submit()
74 { 74 {
75 unwrap<HTMLFormElement>()->submit(); 75 unwrap<HTMLFormElement>()->submit();
76 } 76 }
77 77
78 void WebFormElement::getNamedElements(const WebString& name, 78 void WebFormElement::getNamedElements(const WebString& name,
79 WebVector<WebNode>& result) 79 WebVector<WebNode>& result)
80 { 80 {
81 Vector<RefPtr<Element> > tempVector; 81 Vector<RefPtr<Element> > tempVector;
82 unwrap<HTMLFormElement>()->getNamedElements(name, tempVector); 82 unwrap<HTMLFormElement>()->getNamedElements(name, tempVector);
83 #if !ENABLE(OILPAN)
haraken 2014/05/08 06:22:37 #if ENABLE(OILPAN) #else #endif would be better.
tkent 2014/05/08 07:39:30 Done.
83 result.assign(tempVector); 84 result.assign(tempVector);
85 #else
86 Vector<WebNode> tempVector2;
wibling-chromium 2014/05/08 07:07:01 Just to make sure i understand. This extra copy is
tkent 2014/05/08 07:39:30 Right. We can remove the extra copy later.
87 tempVector2.reserveCapacity(tempVector.size());
88 for (size_t i = 0; i < tempVector.size(); ++i)
89 tempVector2.append(WebNode(tempVector[i].get()));
90 result.assign(tempVector2);
91 #endif
84 } 92 }
85 93
86 void WebFormElement::getFormControlElements(WebVector<WebFormControlElement>& re sult) const 94 void WebFormElement::getFormControlElements(WebVector<WebFormControlElement>& re sult) const
87 { 95 {
88 const HTMLFormElement* form = constUnwrap<HTMLFormElement>(); 96 const HTMLFormElement* form = constUnwrap<HTMLFormElement>();
89 Vector<RefPtr<HTMLFormControlElement> > formControlElements; 97 Vector<WebFormControlElement> formControlElements;
90 98
91 const Vector<FormAssociatedElement*>& associatedElements = form->associatedE lements(); 99 const Vector<FormAssociatedElement*>& associatedElements = form->associatedE lements();
92 for (Vector<FormAssociatedElement*>::const_iterator it = associatedElements. begin(); it != associatedElements.end(); ++it) { 100 for (Vector<FormAssociatedElement*>::const_iterator it = associatedElements. begin(); it != associatedElements.end(); ++it) {
93 if ((*it)->isFormControlElement()) 101 if ((*it)->isFormControlElement())
94 formControlElements.append(toHTMLFormControlElement(*it)); 102 formControlElements.append(toHTMLFormControlElement(*it));
95 } 103 }
96 result.assign(formControlElements); 104 result.assign(formControlElements);
97 } 105 }
98 106
99 bool WebFormElement::checkValidity() 107 bool WebFormElement::checkValidity()
100 { 108 {
101 return unwrap<HTMLFormElement>()->checkValidity(); 109 return unwrap<HTMLFormElement>()->checkValidity();
102 } 110 }
103 111
104 void WebFormElement::finishRequestAutocomplete(WebFormElement::AutocompleteResul t result) 112 void WebFormElement::finishRequestAutocomplete(WebFormElement::AutocompleteResul t result)
105 { 113 {
106 unwrap<HTMLFormElement>()->finishRequestAutocomplete(static_cast<HTMLFormEle ment::AutocompleteResult>(result)); 114 unwrap<HTMLFormElement>()->finishRequestAutocomplete(static_cast<HTMLFormEle ment::AutocompleteResult>(result));
107 } 115 }
108 116
109 WebFormElement::WebFormElement(const PassRefPtr<HTMLFormElement>& e) 117 WebFormElement::WebFormElement(const PassRefPtrWillBeRawPtr<HTMLFormElement>& e)
110 : WebElement(e) 118 : WebElement(e)
111 { 119 {
112 } 120 }
113 121
114 WebFormElement& WebFormElement::operator=(const PassRefPtr<HTMLFormElement>& e) 122 WebFormElement& WebFormElement::operator=(const PassRefPtrWillBeRawPtr<HTMLFormE lement>& e)
115 { 123 {
116 m_private = e; 124 m_private = e;
117 return *this; 125 return *this;
118 } 126 }
119 127
120 WebFormElement::operator PassRefPtr<HTMLFormElement>() const 128 WebFormElement::operator PassRefPtrWillBeRawPtr<HTMLFormElement>() const
121 { 129 {
122 return toHTMLFormElement(m_private.get()); 130 return toHTMLFormElement(m_private.get());
123 } 131 }
124 132
125 } // namespace blink 133 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698