| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2012 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 const UChar character = '0'; | 94 const UChar character = '0'; |
| 95 const String characterAsString = String(&character, 1); | 95 const String characterAsString = String(&character, 1); |
| 96 const Font& font = style()->font(); | 96 const Font& font = style()->font(); |
| 97 // FIXME: Remove the need for this const_cast by making constructTextRun tak
e a const LayoutObject*. | 97 // FIXME: Remove the need for this const_cast by making constructTextRun tak
e a const LayoutObject*. |
| 98 LayoutFileUploadControl* renderer = const_cast<LayoutFileUploadControl*>(thi
s); | 98 LayoutFileUploadControl* renderer = const_cast<LayoutFileUploadControl*>(thi
s); |
| 99 float minDefaultLabelWidth = defaultWidthNumChars * font.width(constructText
Run(renderer, font, characterAsString, styleRef(), TextRun::AllowTrailingExpansi
on)); | 99 float minDefaultLabelWidth = defaultWidthNumChars * font.width(constructText
Run(renderer, font, characterAsString, styleRef(), TextRun::AllowTrailingExpansi
on)); |
| 100 | 100 |
| 101 const String label = toHTMLInputElement(node())->locale().queryString(WebLoc
alizedString::FileButtonNoFileSelectedLabel); | 101 const String label = toHTMLInputElement(node())->locale().queryString(WebLoc
alizedString::FileButtonNoFileSelectedLabel); |
| 102 float defaultLabelWidth = font.width(constructTextRun(renderer, font, label,
styleRef(), TextRun::AllowTrailingExpansion)); | 102 float defaultLabelWidth = font.width(constructTextRun(renderer, font, label,
styleRef(), TextRun::AllowTrailingExpansion)); |
| 103 if (HTMLInputElement* button = uploadButton()) { | 103 if (HTMLInputElement* button = uploadButton()) { |
| 104 if (LayoutObject* buttonRenderer = button->renderer()) | 104 if (LayoutObject* buttonRenderer = button->layoutObject()) |
| 105 defaultLabelWidth += buttonRenderer->maxPreferredLogicalWidth() + af
terButtonSpacing; | 105 defaultLabelWidth += buttonRenderer->maxPreferredLogicalWidth() + af
terButtonSpacing; |
| 106 } | 106 } |
| 107 maxLogicalWidth = static_cast<int>(ceilf(std::max(minDefaultLabelWidth, defa
ultLabelWidth))); | 107 maxLogicalWidth = static_cast<int>(ceilf(std::max(minDefaultLabelWidth, defa
ultLabelWidth))); |
| 108 | 108 |
| 109 if (!style()->width().isPercent()) | 109 if (!style()->width().isPercent()) |
| 110 minLogicalWidth = maxLogicalWidth; | 110 minLogicalWidth = maxLogicalWidth; |
| 111 } | 111 } |
| 112 | 112 |
| 113 void LayoutFileUploadControl::computePreferredLogicalWidths() | 113 void LayoutFileUploadControl::computePreferredLogicalWidths() |
| 114 { | 114 { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 | 163 |
| 164 String LayoutFileUploadControl::fileTextValue() const | 164 String LayoutFileUploadControl::fileTextValue() const |
| 165 { | 165 { |
| 166 HTMLInputElement* input = toHTMLInputElement(node()); | 166 HTMLInputElement* input = toHTMLInputElement(node()); |
| 167 ASSERT(input->files()); | 167 ASSERT(input->files()); |
| 168 return LayoutTheme::theme().fileListNameForWidth(input->locale(), input->fil
es(), style()->font(), maxFilenameWidth()); | 168 return LayoutTheme::theme().fileListNameForWidth(input->locale(), input->fil
es(), style()->font(), maxFilenameWidth()); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace blink | 171 } // namespace blink |
| OLD | NEW |