| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 void LayoutFileUploadControl::paintObject( | 76 void LayoutFileUploadControl::paintObject( |
| 77 const PaintInfo& paintInfo, | 77 const PaintInfo& paintInfo, |
| 78 const LayoutPoint& paintOffset) const { | 78 const LayoutPoint& paintOffset) const { |
| 79 FileUploadControlPainter(*this).paintObject(paintInfo, paintOffset); | 79 FileUploadControlPainter(*this).paintObject(paintInfo, paintOffset); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void LayoutFileUploadControl::computeIntrinsicLogicalWidths( | 82 void LayoutFileUploadControl::computeIntrinsicLogicalWidths( |
| 83 LayoutUnit& minLogicalWidth, | 83 LayoutUnit& minLogicalWidth, |
| 84 LayoutUnit& maxLogicalWidth) const { | 84 LayoutUnit& maxLogicalWidth) const { |
| 85 // Figure out how big the filename space needs to be for a given number of cha
racters | 85 // Figure out how big the filename space needs to be for a given number of |
| 86 // (using "0" as the nominal character). | 86 // characters (using "0" as the nominal character). |
| 87 const UChar character = '0'; | 87 const UChar character = '0'; |
| 88 const String characterAsString = String(&character, 1); | 88 const String characterAsString = String(&character, 1); |
| 89 const Font& font = style()->font(); | 89 const Font& font = style()->font(); |
| 90 float minDefaultLabelWidth = | 90 float minDefaultLabelWidth = |
| 91 defaultWidthNumChars * | 91 defaultWidthNumChars * |
| 92 font.width(constructTextRun(font, characterAsString, styleRef(), | 92 font.width(constructTextRun(font, characterAsString, styleRef(), |
| 93 TextRun::AllowTrailingExpansion)); | 93 TextRun::AllowTrailingExpansion)); |
| 94 | 94 |
| 95 const String label = toHTMLInputElement(node())->locale().queryString( | 95 const String label = toHTMLInputElement(node())->locale().queryString( |
| 96 WebLocalizedString::FileButtonNoFileSelectedLabel); | 96 WebLocalizedString::FileButtonNoFileSelectedLabel); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 clearPreferredLogicalWidthsDirty(); | 152 clearPreferredLogicalWidthsDirty(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 PositionWithAffinity LayoutFileUploadControl::positionForPoint( | 155 PositionWithAffinity LayoutFileUploadControl::positionForPoint( |
| 156 const LayoutPoint&) { | 156 const LayoutPoint&) { |
| 157 return PositionWithAffinity(); | 157 return PositionWithAffinity(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 HTMLInputElement* LayoutFileUploadControl::uploadButton() const { | 160 HTMLInputElement* LayoutFileUploadControl::uploadButton() const { |
| 161 // FIXME: This should be on HTMLInputElement as an API like innerButtonElement
(). | 161 // FIXME: This should be on HTMLInputElement as an API like |
| 162 // innerButtonElement(). |
| 162 HTMLInputElement* input = toHTMLInputElement(node()); | 163 HTMLInputElement* input = toHTMLInputElement(node()); |
| 163 Node* buttonNode = input->userAgentShadowRoot()->firstChild(); | 164 Node* buttonNode = input->userAgentShadowRoot()->firstChild(); |
| 164 return isHTMLInputElement(buttonNode) ? toHTMLInputElement(buttonNode) : 0; | 165 return isHTMLInputElement(buttonNode) ? toHTMLInputElement(buttonNode) : 0; |
| 165 } | 166 } |
| 166 | 167 |
| 167 String LayoutFileUploadControl::buttonValue() { | 168 String LayoutFileUploadControl::buttonValue() { |
| 168 if (HTMLInputElement* button = uploadButton()) | 169 if (HTMLInputElement* button = uploadButton()) |
| 169 return button->value(); | 170 return button->value(); |
| 170 | 171 |
| 171 return String(); | 172 return String(); |
| 172 } | 173 } |
| 173 | 174 |
| 174 String LayoutFileUploadControl::fileTextValue() const { | 175 String LayoutFileUploadControl::fileTextValue() const { |
| 175 HTMLInputElement* input = toHTMLInputElement(node()); | 176 HTMLInputElement* input = toHTMLInputElement(node()); |
| 176 ASSERT(input->files()); | 177 ASSERT(input->files()); |
| 177 return LayoutTheme::theme().fileListNameForWidth( | 178 return LayoutTheme::theme().fileListNameForWidth( |
| 178 input->locale(), input->files(), style()->font(), maxFilenameWidth()); | 179 input->locale(), input->files(), style()->font(), maxFilenameWidth()); |
| 179 } | 180 } |
| 180 | 181 |
| 181 } // namespace blink | 182 } // namespace blink |
| OLD | NEW |