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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 bool FileInputType::isFileUpload() const | 242 bool FileInputType::isFileUpload() const |
243 { | 243 { |
244 return true; | 244 return true; |
245 } | 245 } |
246 | 246 |
247 void FileInputType::createShadowSubtree() | 247 void FileInputType::createShadowSubtree() |
248 { | 248 { |
249 ASSERT(element().shadow()); | 249 ASSERT(element().shadow()); |
250 RefPtr<HTMLInputElement> button = HTMLInputElement::create(element().documen
t(), 0, false); | 250 RefPtr<HTMLInputElement> button = HTMLInputElement::create(element().documen
t(), 0, false); |
251 button->setType(InputTypeNames::button); | 251 button->setType(InputTypeNames::button); |
252 button->setAttribute(valueAttr, locale().queryString(element().multiple() ?
WebLocalizedString::FileButtonChooseMultipleFilesLabel : WebLocalizedString::Fil
eButtonChooseFileLabel)); | 252 button->setAttribute(valueAttr, AtomicString(locale().queryString(element().
multiple() ? WebLocalizedString::FileButtonChooseMultipleFilesLabel : WebLocaliz
edString::FileButtonChooseFileLabel))); |
253 button->setShadowPseudoId(AtomicString("-webkit-file-upload-button", AtomicS
tring::ConstructFromLiteral)); | 253 button->setShadowPseudoId(AtomicString("-webkit-file-upload-button", AtomicS
tring::ConstructFromLiteral)); |
254 element().userAgentShadowRoot()->appendChild(button.release()); | 254 element().userAgentShadowRoot()->appendChild(button.release()); |
255 } | 255 } |
256 | 256 |
257 void FileInputType::disabledAttributeChanged() | 257 void FileInputType::disabledAttributeChanged() |
258 { | 258 { |
259 ASSERT(element().shadow()); | 259 ASSERT(element().shadow()); |
260 if (Element* button = toElement(element().userAgentShadowRoot()->firstChild(
))) | 260 if (Element* button = toElement(element().userAgentShadowRoot()->firstChild(
))) |
261 button->setBooleanAttribute(disabledAttr, element().isDisabledFormContro
l()); | 261 button->setBooleanAttribute(disabledAttr, element().isDisabledFormContro
l()); |
262 } | 262 } |
263 | 263 |
264 void FileInputType::multipleAttributeChanged() | 264 void FileInputType::multipleAttributeChanged() |
265 { | 265 { |
266 ASSERT(element().shadow()); | 266 ASSERT(element().shadow()); |
267 if (Element* button = toElement(element().userAgentShadowRoot()->firstChild(
))) | 267 if (Element* button = toElement(element().userAgentShadowRoot()->firstChild(
))) |
268 button->setAttribute(valueAttr, locale().queryString(element().multiple(
) ? WebLocalizedString::FileButtonChooseMultipleFilesLabel : WebLocalizedString:
:FileButtonChooseFileLabel)); | 268 button->setAttribute(valueAttr, AtomicString(locale().queryString(elemen
t().multiple() ? WebLocalizedString::FileButtonChooseMultipleFilesLabel : WebLoc
alizedString::FileButtonChooseFileLabel))); |
269 } | 269 } |
270 | 270 |
271 void FileInputType::setFiles(PassRefPtr<FileList> files) | 271 void FileInputType::setFiles(PassRefPtr<FileList> files) |
272 { | 272 { |
273 if (!files) | 273 if (!files) |
274 return; | 274 return; |
275 | 275 |
276 RefPtr<HTMLInputElement> input(element()); | 276 RefPtr<HTMLInputElement> input(element()); |
277 | 277 |
278 bool pathsChanged = false; | 278 bool pathsChanged = false; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 StringBuilder names; | 372 StringBuilder names; |
373 for (size_t i = 0; i < listSize; ++i) { | 373 for (size_t i = 0; i < listSize; ++i) { |
374 names.append(fileList->item(i)->name()); | 374 names.append(fileList->item(i)->name()); |
375 if (i != listSize - 1) | 375 if (i != listSize - 1) |
376 names.append('\n'); | 376 names.append('\n'); |
377 } | 377 } |
378 return names.toString(); | 378 return names.toString(); |
379 } | 379 } |
380 | 380 |
381 } // namespace WebCore | 381 } // namespace WebCore |
OLD | NEW |