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

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

Issue 215903003: Autofill/rAc: dispatch "input" events when changing text contents of <textarea>, (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add back dispatchFormControlChangeEvent() temporarily to not break chrome when blink gets rolled in Created 6 years, 9 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 bool WebFormControlElement::autoComplete() const 86 bool WebFormControlElement::autoComplete() const
87 { 87 {
88 if (isHTMLInputElement(*m_private)) 88 if (isHTMLInputElement(*m_private))
89 return constUnwrap<HTMLInputElement>()->shouldAutocomplete(); 89 return constUnwrap<HTMLInputElement>()->shouldAutocomplete();
90 if (isHTMLTextAreaElement(*m_private)) 90 if (isHTMLTextAreaElement(*m_private))
91 return constUnwrap<HTMLTextAreaElement>()->shouldAutocomplete(); 91 return constUnwrap<HTMLTextAreaElement>()->shouldAutocomplete();
92 return false; 92 return false;
93 } 93 }
94 94
95 void WebFormControlElement::setValue(const WebString& value, bool sendChangeEven t) 95 void WebFormControlElement::setValue(const WebString& value, bool sendEvents)
96 { 96 {
97 if (isHTMLInputElement(*m_private)) 97 if (isHTMLInputElement(*m_private))
98 unwrap<HTMLInputElement>()->setValue(value, sendChangeEvent ? DispatchCh angeEvent : DispatchNoEvent); 98 unwrap<HTMLInputElement>()->setValue(value, sendEvents ? DispatchInputAn dChangeEvent : DispatchNoEvent);
99 if (isHTMLTextAreaElement(*m_private)) 99 else if (isHTMLTextAreaElement(*m_private))
100 unwrap<HTMLTextAreaElement>()->setValue(value); 100 unwrap<HTMLTextAreaElement>()->setValue(value, sendEvents ? DispatchInpu tAndChangeEvent : DispatchNoEvent);
101 if (isHTMLSelectElement(*m_private)) 101 else if (isHTMLSelectElement(*m_private))
102 unwrap<HTMLSelectElement>()->setValue(value); 102 unwrap<HTMLSelectElement>()->setValue(value, sendEvents);
103 } 103 }
104 104
105 WebString WebFormControlElement::value() const 105 WebString WebFormControlElement::value() const
106 { 106 {
107 if (isHTMLInputElement(*m_private)) 107 if (isHTMLInputElement(*m_private))
108 return constUnwrap<HTMLInputElement>()->value(); 108 return constUnwrap<HTMLInputElement>()->value();
109 if (isHTMLTextAreaElement(*m_private)) 109 if (isHTMLTextAreaElement(*m_private))
110 return constUnwrap<HTMLTextAreaElement>()->value(); 110 return constUnwrap<HTMLTextAreaElement>()->value();
111 if (isHTMLSelectElement(*m_private)) 111 if (isHTMLSelectElement(*m_private))
112 return constUnwrap<HTMLSelectElement>()->value(); 112 return constUnwrap<HTMLSelectElement>()->value();
113 return WebString(); 113 return WebString();
114 } 114 }
115 115
116 void WebFormControlElement::setSuggestedValue(const WebString& value) 116 void WebFormControlElement::setSuggestedValue(const WebString& value)
117 { 117 {
118 if (isHTMLInputElement(*m_private)) 118 if (isHTMLInputElement(*m_private))
119 unwrap<HTMLInputElement>()->setSuggestedValue(value); 119 unwrap<HTMLInputElement>()->setSuggestedValue(value);
120 if (isHTMLTextAreaElement(*m_private)) 120 else if (isHTMLTextAreaElement(*m_private))
121 unwrap<HTMLTextAreaElement>()->setSuggestedValue(value); 121 unwrap<HTMLTextAreaElement>()->setSuggestedValue(value);
122 if (isHTMLSelectElement(*m_private)) 122 else if (isHTMLSelectElement(*m_private))
123 unwrap<HTMLSelectElement>()->setSuggestedValue(value); 123 unwrap<HTMLSelectElement>()->setSuggestedValue(value);
124 } 124 }
125 125
126 WebString WebFormControlElement::suggestedValue() const 126 WebString WebFormControlElement::suggestedValue() const
127 { 127 {
128 if (isHTMLInputElement(*m_private)) 128 if (isHTMLInputElement(*m_private))
129 return constUnwrap<HTMLInputElement>()->suggestedValue(); 129 return constUnwrap<HTMLInputElement>()->suggestedValue();
130 if (isHTMLTextAreaElement(*m_private)) 130 if (isHTMLTextAreaElement(*m_private))
131 return constUnwrap<HTMLTextAreaElement>()->suggestedValue(); 131 return constUnwrap<HTMLTextAreaElement>()->suggestedValue();
132 if (isHTMLSelectElement(*m_private)) 132 if (isHTMLSelectElement(*m_private))
133 return constUnwrap<HTMLSelectElement>()->suggestedValue(); 133 return constUnwrap<HTMLSelectElement>()->suggestedValue();
134 return WebString(); 134 return WebString();
135 } 135 }
136 136
137 WebString WebFormControlElement::editingValue() const 137 WebString WebFormControlElement::editingValue() const
138 { 138 {
139 if (isHTMLInputElement(*m_private)) 139 if (isHTMLInputElement(*m_private))
140 return constUnwrap<HTMLInputElement>()->innerTextValue(); 140 return constUnwrap<HTMLInputElement>()->innerTextValue();
141 if (isHTMLTextAreaElement(*m_private)) 141 if (isHTMLTextAreaElement(*m_private))
142 return constUnwrap<HTMLTextAreaElement>()->innerTextValue(); 142 return constUnwrap<HTMLTextAreaElement>()->innerTextValue();
143 return WebString(); 143 return WebString();
144 } 144 }
145 145
146 void WebFormControlElement::setSelectionRange(int start, int end) 146 void WebFormControlElement::setSelectionRange(int start, int end)
147 { 147 {
148 if (isHTMLInputElement(*m_private)) 148 if (isHTMLInputElement(*m_private))
149 unwrap<HTMLInputElement>()->setSelectionRange(start, end); 149 unwrap<HTMLInputElement>()->setSelectionRange(start, end);
150 if (isHTMLTextAreaElement(*m_private)) 150 else if (isHTMLTextAreaElement(*m_private))
151 unwrap<HTMLTextAreaElement>()->setSelectionRange(start, end); 151 unwrap<HTMLTextAreaElement>()->setSelectionRange(start, end);
152 } 152 }
153 153
154 int WebFormControlElement::selectionStart() const 154 int WebFormControlElement::selectionStart() const
155 { 155 {
156 if (isHTMLInputElement(*m_private)) 156 if (isHTMLInputElement(*m_private))
157 return constUnwrap<HTMLInputElement>()->selectionStart(); 157 return constUnwrap<HTMLInputElement>()->selectionStart();
158 if (isHTMLTextAreaElement(*m_private)) 158 if (isHTMLTextAreaElement(*m_private))
159 return constUnwrap<HTMLTextAreaElement>()->selectionStart(); 159 return constUnwrap<HTMLTextAreaElement>()->selectionStart();
160 return 0; 160 return 0;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 m_private = elem; 193 m_private = elem;
194 return *this; 194 return *this;
195 } 195 }
196 196
197 WebFormControlElement::operator PassRefPtr<HTMLFormControlElement>() const 197 WebFormControlElement::operator PassRefPtr<HTMLFormControlElement>() const
198 { 198 {
199 return toHTMLFormControlElement(m_private.get()); 199 return toHTMLFormControlElement(m_private.get());
200 } 200 }
201 201
202 } // namespace blink 202 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698