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

Side by Side Diff: Source/core/html/HTMLInputElement.cpp

Issue 267713006: node.cloneNode() should clone the value of file upload elements (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporated review comments 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
« no previous file with comments | « Source/core/html/HTMLInputElement.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 } 902 }
903 903
904 void HTMLInputElement::copyNonAttributePropertiesFromElement(const Element& sour ce) 904 void HTMLInputElement::copyNonAttributePropertiesFromElement(const Element& sour ce)
905 { 905 {
906 const HTMLInputElement& sourceElement = static_cast<const HTMLInputElement&> (source); 906 const HTMLInputElement& sourceElement = static_cast<const HTMLInputElement&> (source);
907 907
908 m_valueIfDirty = sourceElement.m_valueIfDirty; 908 m_valueIfDirty = sourceElement.m_valueIfDirty;
909 setChecked(sourceElement.m_isChecked); 909 setChecked(sourceElement.m_isChecked);
910 m_reflectsCheckedAttribute = sourceElement.m_reflectsCheckedAttribute; 910 m_reflectsCheckedAttribute = sourceElement.m_reflectsCheckedAttribute;
911 m_isIndeterminate = sourceElement.m_isIndeterminate; 911 m_isIndeterminate = sourceElement.m_isIndeterminate;
912 if (isFileUpload()) {
tkent 2014/05/07 23:37:08 Please do not add input-type-specific code to HTML
913 RefPtrWillBeRawPtr<FileList> fileList(FileList::create());
914 FileList* sourceFileList = sourceElement.files();
915 unsigned size = sourceFileList->length();
916 for (unsigned i = 0; i < size; ++i) {
917 File* file = sourceFileList->item(i);
918 fileList->append(File::createWithRelativePath(file->path(), file->we bkitRelativePath()));
919 }
920 setFiles(fileList.release());
921 }
912 922
913 HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source); 923 HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source);
914 924
915 m_needsToUpdateViewValue = true; 925 m_needsToUpdateViewValue = true;
916 m_inputTypeView->updateView(); 926 m_inputTypeView->updateView();
917 } 927 }
918 928
919 String HTMLInputElement::value() const 929 String HTMLInputElement::value() const
920 { 930 {
921 String value; 931 String value;
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 exceptionState.throwDOMException(IndexSizeError, "The value provided is 0, which is an invalid size."); 1322 exceptionState.throwDOMException(IndexSizeError, "The value provided is 0, which is an invalid size.");
1313 else 1323 else
1314 setSize(size); 1324 setSize(size);
1315 } 1325 }
1316 1326
1317 KURL HTMLInputElement::src() const 1327 KURL HTMLInputElement::src() const
1318 { 1328 {
1319 return document().completeURL(fastGetAttribute(srcAttr)); 1329 return document().completeURL(fastGetAttribute(srcAttr));
1320 } 1330 }
1321 1331
1322 FileList* HTMLInputElement::files() 1332 FileList* HTMLInputElement::files() const
1323 { 1333 {
1324 return m_inputType->files(); 1334 return m_inputType->files();
1325 } 1335 }
1326 1336
1327 void HTMLInputElement::setFiles(PassRefPtrWillBeRawPtr<FileList> files) 1337 void HTMLInputElement::setFiles(PassRefPtrWillBeRawPtr<FileList> files)
1328 { 1338 {
1329 m_inputType->setFiles(files); 1339 m_inputType->setFiles(files);
1330 } 1340 }
1331 1341
1332 bool HTMLInputElement::receiveDroppedFiles(const DragData* dragData) 1342 bool HTMLInputElement::receiveDroppedFiles(const DragData* dragData)
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 } 1886 }
1877 1887
1878 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 1888 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
1879 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() 1889 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer()
1880 { 1890 {
1881 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); 1891 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer());
1882 } 1892 }
1883 #endif 1893 #endif
1884 1894
1885 } // namespace 1895 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/HTMLInputElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698