| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. |
| 3 * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 3 * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 LayoutUnit LayoutTextControlSingleLine::preferredContentLogicalWidth(float charW
idth) const | 224 LayoutUnit LayoutTextControlSingleLine::preferredContentLogicalWidth(float charW
idth) const |
| 225 { | 225 { |
| 226 int factor; | 226 int factor; |
| 227 bool includesDecoration = inputElement()->sizeShouldIncludeDecoration(factor
); | 227 bool includesDecoration = inputElement()->sizeShouldIncludeDecoration(factor
); |
| 228 if (factor <= 0) | 228 if (factor <= 0) |
| 229 factor = 20; | 229 factor = 20; |
| 230 | 230 |
| 231 LayoutUnit result = LayoutUnit::fromFloatCeil(charWidth * factor); | 231 LayoutUnit result = LayoutUnit::fromFloatCeil(charWidth * factor); |
| 232 | 232 |
| 233 float maxCharWidth = 0.f; | 233 float maxCharWidth = 0.f; |
| 234 AtomicString family = styleRef().font().fontDescription().family().family(); | 234 AtomicString family = styleRef().font().getFontDescription().family().family
(); |
| 235 // Match the default system font to the width of MS Shell Dlg, the default | 235 // Match the default system font to the width of MS Shell Dlg, the default |
| 236 // font for textareas in Firefox, Safari Win and IE for some encodings (in | 236 // font for textareas in Firefox, Safari Win and IE for some encodings (in |
| 237 // IE, the default font is encoding specific). 4027 is the (xMax - xMin) | 237 // IE, the default font is encoding specific). 4027 is the (xMax - xMin) |
| 238 // value in the "head" font table for MS Shell Dlg. | 238 // value in the "head" font table for MS Shell Dlg. |
| 239 if (LayoutTheme::theme().needsHackForTextControlWithFontFamily(family)) | 239 if (LayoutTheme::theme().needsHackForTextControlWithFontFamily(family)) |
| 240 maxCharWidth = scaleEmToUnits(4027); | 240 maxCharWidth = scaleEmToUnits(4027); |
| 241 else if (hasValidAvgCharWidth(family)) | 241 else if (hasValidAvgCharWidth(family)) |
| 242 maxCharWidth = roundf(styleRef().font().primaryFont()->maxCharWidth()); | 242 maxCharWidth = roundf(styleRef().font().primaryFont()->maxCharWidth()); |
| 243 | 243 |
| 244 // For text inputs, IE adds some extra width. | 244 // For text inputs, IE adds some extra width. |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 // inner-editor element overflows the INPUT box intentionally, however it | 362 // inner-editor element overflows the INPUT box intentionally, however it |
| 363 // shouldn't affect outside of the INPUT box. So we ignore child overflow. | 363 // shouldn't affect outside of the INPUT box. So we ignore child overflow. |
| 364 } | 364 } |
| 365 | 365 |
| 366 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const | 366 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const |
| 367 { | 367 { |
| 368 return toHTMLInputElement(node()); | 368 return toHTMLInputElement(node()); |
| 369 } | 369 } |
| 370 | 370 |
| 371 } // namespace blink | 371 } // namespace blink |
| OLD | NEW |