OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 Google Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // HTML5 tells us that we're supposed to use this goofy value for | 193 // HTML5 tells us that we're supposed to use this goofy value for |
194 // file input controls. Historically, browsers revealed the real | 194 // file input controls. Historically, browsers revealed the real |
195 // file path, but that's a privacy problem. Code on the web | 195 // file path, but that's a privacy problem. Code on the web |
196 // decided to try to parse the value by looking for backslashes | 196 // decided to try to parse the value by looking for backslashes |
197 // (because that's what Windows file paths use). To be compatible | 197 // (because that's what Windows file paths use). To be compatible |
198 // with that code, we make up a fake path for the file. | 198 // with that code, we make up a fake path for the file. |
199 value = "C:\\fakepath\\" + m_fileList->item(0)->name(); | 199 value = "C:\\fakepath\\" + m_fileList->item(0)->name(); |
200 return true; | 200 return true; |
201 } | 201 } |
202 | 202 |
203 void FileInputType::setValue(const String&, bool, TextFieldEventBehavior) | 203 void FileInputType::setValue(const String&, bool valueChanged, TextFieldEventBeh
avior) |
204 { | 204 { |
| 205 if (!valueChanged) |
| 206 return; |
| 207 |
205 m_fileList->clear(); | 208 m_fileList->clear(); |
206 element().setNeedsStyleRecalc(); | 209 element().setNeedsStyleRecalc(); |
| 210 element().setNeedsValidityCheck(); |
207 } | 211 } |
208 | 212 |
209 PassRefPtr<FileList> FileInputType::createFileList(const Vector<FileChooserFileI
nfo>& files) const | 213 PassRefPtr<FileList> FileInputType::createFileList(const Vector<FileChooserFileI
nfo>& files) const |
210 { | 214 { |
211 RefPtr<FileList> fileList(FileList::create()); | 215 RefPtr<FileList> fileList(FileList::create()); |
212 size_t size = files.size(); | 216 size_t size = files.size(); |
213 | 217 |
214 // If a directory is being selected, the UI allows a directory to be chosen | 218 // If a directory is being selected, the UI allows a directory to be chosen |
215 // and the paths provided here share a root directory somewhere up the tree; | 219 // and the paths provided here share a root directory somewhere up the tree; |
216 // we want to store only the relative paths from that point. | 220 // we want to store only the relative paths from that point. |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 StringBuilder names; | 376 StringBuilder names; |
373 for (size_t i = 0; i < listSize; ++i) { | 377 for (size_t i = 0; i < listSize; ++i) { |
374 names.append(fileList->item(i)->name()); | 378 names.append(fileList->item(i)->name()); |
375 if (i != listSize - 1) | 379 if (i != listSize - 1) |
376 names.append('\n'); | 380 names.append('\n'); |
377 } | 381 } |
378 return names.toString(); | 382 return names.toString(); |
379 } | 383 } |
380 | 384 |
381 } // namespace WebCore | 385 } // namespace WebCore |
OLD | NEW |