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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 FileChooserSettings settings; | 146 FileChooserSettings settings; |
147 HTMLInputElement* input = element(); | 147 HTMLInputElement* input = element(); |
148 settings.allowsDirectoryUpload = RuntimeEnabledFeatures::directoryUpload
Enabled() && input->fastHasAttribute(webkitdirectoryAttr); | 148 settings.allowsDirectoryUpload = RuntimeEnabledFeatures::directoryUpload
Enabled() && input->fastHasAttribute(webkitdirectoryAttr); |
149 settings.allowsMultipleFiles = settings.allowsDirectoryUpload || input->
fastHasAttribute(multipleAttr); | 149 settings.allowsMultipleFiles = settings.allowsDirectoryUpload || input->
fastHasAttribute(multipleAttr); |
150 settings.acceptMIMETypes = input->acceptMIMETypes(); | 150 settings.acceptMIMETypes = input->acceptMIMETypes(); |
151 settings.acceptFileExtensions = input->acceptFileExtensions(); | 151 settings.acceptFileExtensions = input->acceptFileExtensions(); |
152 settings.selectedFiles = m_fileList->paths(); | 152 settings.selectedFiles = m_fileList->paths(); |
153 #if ENABLE(MEDIA_CAPTURE) | 153 #if ENABLE(MEDIA_CAPTURE) |
154 settings.useMediaCapture = input->capture(); | 154 settings.useMediaCapture = input->capture(); |
155 #endif | 155 #endif |
156 chrome->runOpenPanel(input->document()->frame(), newFileChooser(settings
)); | 156 chrome->runOpenPanel(input->document().frame(), newFileChooser(settings)
); |
157 } | 157 } |
158 event->setDefaultHandled(); | 158 event->setDefaultHandled(); |
159 } | 159 } |
160 | 160 |
161 RenderObject* FileInputType::createRenderer(RenderStyle*) const | 161 RenderObject* FileInputType::createRenderer(RenderStyle*) const |
162 { | 162 { |
163 return new RenderFileUploadControl(element()); | 163 return new RenderFileUploadControl(element()); |
164 } | 164 } |
165 | 165 |
166 bool FileInputType::canSetStringValue() const | 166 bool FileInputType::canSetStringValue() const |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 249 } |
250 | 250 |
251 bool FileInputType::isFileUpload() const | 251 bool FileInputType::isFileUpload() const |
252 { | 252 { |
253 return true; | 253 return true; |
254 } | 254 } |
255 | 255 |
256 void FileInputType::createShadowSubtree() | 256 void FileInputType::createShadowSubtree() |
257 { | 257 { |
258 ASSERT(element()->shadow()); | 258 ASSERT(element()->shadow()); |
259 RefPtr<HTMLInputElement> button = HTMLInputElement::create(inputTag, element
()->document(), 0, false); | 259 RefPtr<HTMLInputElement> button = HTMLInputElement::create(inputTag, &elemen
t()->document(), 0, false); |
260 button->setType(InputTypeNames::button()); | 260 button->setType(InputTypeNames::button()); |
261 button->setAttribute(valueAttr, element()->multiple() ? fileButtonChooseMult
ipleFilesLabel() : fileButtonChooseFileLabel()); | 261 button->setAttribute(valueAttr, element()->multiple() ? fileButtonChooseMult
ipleFilesLabel() : fileButtonChooseFileLabel()); |
262 button->setPart(AtomicString("-webkit-file-upload-button", AtomicString::Con
structFromLiteral)); | 262 button->setPart(AtomicString("-webkit-file-upload-button", AtomicString::Con
structFromLiteral)); |
263 element()->userAgentShadowRoot()->appendChild(button.release()); | 263 element()->userAgentShadowRoot()->appendChild(button.release()); |
264 } | 264 } |
265 | 265 |
266 void FileInputType::disabledAttributeChanged() | 266 void FileInputType::disabledAttributeChanged() |
267 { | 267 { |
268 ASSERT(element()->shadow()); | 268 ASSERT(element()->shadow()); |
269 if (Element* button = toElement(element()->userAgentShadowRoot()->firstChild
())) | 269 if (Element* button = toElement(element()->userAgentShadowRoot()->firstChild
())) |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 StringBuilder names; | 383 StringBuilder names; |
384 for (size_t i = 0; i < listSize; ++i) { | 384 for (size_t i = 0; i < listSize; ++i) { |
385 names.append(fileList->item(i)->name()); | 385 names.append(fileList->item(i)->name()); |
386 if (i != listSize - 1) | 386 if (i != listSize - 1) |
387 names.append('\n'); | 387 names.append('\n'); |
388 } | 388 } |
389 return names.toString(); | 389 return names.toString(); |
390 } | 390 } |
391 | 391 |
392 } // namespace WebCore | 392 } // namespace WebCore |
OLD | NEW |