OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |