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

Side by Side Diff: Source/WebCore/rendering/RenderFileUploadControl.cpp

Issue 7792032: Merge 94045 - REGRESSION(r88115): Disabling a file upload control causes an endless busyloop. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 3 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 | « no previous file | 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) 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 RenderFileUploadControl::~RenderFileUploadControl() 57 RenderFileUploadControl::~RenderFileUploadControl()
58 { 58 {
59 } 59 }
60 60
61 void RenderFileUploadControl::updateFromElement() 61 void RenderFileUploadControl::updateFromElement()
62 { 62 {
63 HTMLInputElement* input = static_cast<HTMLInputElement*>(node()); 63 HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
64 ASSERT(input->isFileUpload()); 64 ASSERT(input->isFileUpload());
65 65
66 if (HTMLInputElement* button = uploadButton()) 66 if (HTMLInputElement* button = uploadButton()) {
67 button->setDisabled(!theme()->isEnabled(this)); 67 bool newDisabled = !theme()->isEnabled(this);
68 // We should avoid to call HTMLFormControlElement::setDisabled() as
69 // possible because setAttribute() in setDisabled() can cause style
70 // recalculation, and HTMLFormControlElement::recalcStyle() calls
71 // updateFromElement() eventually.
72 if (button->disabled() != newDisabled)
73 button->setDisabled(newDisabled);
74 }
68 75
69 // This only supports clearing out the files, but that's OK because for 76 // This only supports clearing out the files, but that's OK because for
70 // security reasons that's the only change the DOM is allowed to make. 77 // security reasons that's the only change the DOM is allowed to make.
71 FileList* files = input->files(); 78 FileList* files = input->files();
72 ASSERT(files); 79 ASSERT(files);
73 if (files && files->isEmpty()) 80 if (files && files->isEmpty())
74 repaint(); 81 repaint();
75 } 82 }
76 83
77 static int nodeWidth(Node* node) 84 static int nodeWidth(Node* node)
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 225 }
219 226
220 String RenderFileUploadControl::fileTextValue() const 227 String RenderFileUploadControl::fileTextValue() const
221 { 228 {
222 HTMLInputElement* input = static_cast<HTMLInputElement*>(node()); 229 HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
223 ASSERT(input->files()); 230 ASSERT(input->files());
224 return theme()->fileListNameForWidth(input->files()->paths(), style()->font( ), maxFilenameWidth()); 231 return theme()->fileListNameForWidth(input->files()->paths(), style()->font( ), maxFilenameWidth());
225 } 232 }
226 233
227 } // namespace WebCore 234 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698