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

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
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()) {
913 RefPtrWillBeRawPtr<FileList> fileList(FileList::create());
914 size_t size = sourceElement.files()->length();
Inactive 2014/05/07 13:28:00 nit: "unsigned" (this is what FileList::length() r
gnana 2014/05/07 14:22:37 Done.
915 for (size_t i = 0; i < size; i++) {
Inactive 2014/05/07 13:28:00 nit: ++i nit: Use unsigned
gnana 2014/05/07 14:22:37 Done.
916 File* file = sourceElement.files()->item(i);
Inactive 2014/05/07 13:28:00 HTMLInputElement::files() is not inlined so you mi
gnana 2014/05/07 14:22:37 Done.
917 fileList->append(File::createWithRelativePath(file->path(), file->we bkitRelativePath()));
918 }
919 setFiles(fileList.release());
920 }
912 921
913 HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source); 922 HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source);
914 923
915 m_needsToUpdateViewValue = true; 924 m_needsToUpdateViewValue = true;
916 m_inputTypeView->updateView(); 925 m_inputTypeView->updateView();
917 } 926 }
918 927
919 String HTMLInputElement::value() const 928 String HTMLInputElement::value() const
920 { 929 {
921 String value; 930 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."); 1321 exceptionState.throwDOMException(IndexSizeError, "The value provided is 0, which is an invalid size.");
1313 else 1322 else
1314 setSize(size); 1323 setSize(size);
1315 } 1324 }
1316 1325
1317 KURL HTMLInputElement::src() const 1326 KURL HTMLInputElement::src() const
1318 { 1327 {
1319 return document().completeURL(fastGetAttribute(srcAttr)); 1328 return document().completeURL(fastGetAttribute(srcAttr));
1320 } 1329 }
1321 1330
1322 FileList* HTMLInputElement::files() 1331 FileList* HTMLInputElement::files() const
1323 { 1332 {
1324 return m_inputType->files(); 1333 return m_inputType->files();
1325 } 1334 }
1326 1335
1327 void HTMLInputElement::setFiles(PassRefPtrWillBeRawPtr<FileList> files) 1336 void HTMLInputElement::setFiles(PassRefPtrWillBeRawPtr<FileList> files)
1328 { 1337 {
1329 m_inputType->setFiles(files); 1338 m_inputType->setFiles(files);
1330 } 1339 }
1331 1340
1332 bool HTMLInputElement::receiveDroppedFiles(const DragData* dragData) 1341 bool HTMLInputElement::receiveDroppedFiles(const DragData* dragData)
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 } 1885 }
1877 1886
1878 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 1887 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
1879 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() 1888 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer()
1880 { 1889 {
1881 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); 1890 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer());
1882 } 1891 }
1883 #endif 1892 #endif
1884 1893
1885 } // namespace 1894 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698