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 * (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 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 const UChar ch = '0'; | 220 const UChar ch = '0'; |
221 const String str = String(&ch, 1); | 221 const String str = String(&ch, 1); |
222 TextRun textRun = constructTextRun(font, str, styleRef(), TextRun::AllowTrai
lingExpansion); | 222 TextRun textRun = constructTextRun(font, str, styleRef(), TextRun::AllowTrai
lingExpansion); |
223 return font.width(textRun); | 223 return font.width(textRun); |
224 } | 224 } |
225 | 225 |
226 float LayoutTextControl::scaleEmToUnits(int x) const | 226 float LayoutTextControl::scaleEmToUnits(int x) const |
227 { | 227 { |
228 // This matches the unitsPerEm value for MS Shell Dlg and Courier New from t
he "head" font table. | 228 // This matches the unitsPerEm value for MS Shell Dlg and Courier New from t
he "head" font table. |
229 float unitsPerEm = 2048.0f; | 229 float unitsPerEm = 2048.0f; |
230 return roundf(style()->font().fontDescription().computedSize() * x / unitsPe
rEm); | 230 return roundf(style()->font().getFontDescription().computedSize() * x / unit
sPerEm); |
231 } | 231 } |
232 | 232 |
233 void LayoutTextControl::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidt
h, LayoutUnit& maxLogicalWidth) const | 233 void LayoutTextControl::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidt
h, LayoutUnit& maxLogicalWidth) const |
234 { | 234 { |
235 // Use average character width. Matches IE. | 235 // Use average character width. Matches IE. |
236 AtomicString family = style()->font().fontDescription().family().family(); | 236 AtomicString family = style()->font().getFontDescription().family().family()
; |
237 maxLogicalWidth = preferredContentLogicalWidth(const_cast<LayoutTextControl*
>(this)->getAvgCharWidth(family)); | 237 maxLogicalWidth = preferredContentLogicalWidth(const_cast<LayoutTextControl*
>(this)->getAvgCharWidth(family)); |
238 if (LayoutBox* innerEditorLayoutBox = innerEditorElement()->layoutBox()) | 238 if (LayoutBox* innerEditorLayoutBox = innerEditorElement()->layoutBox()) |
239 maxLogicalWidth += innerEditorLayoutBox->paddingStart() + innerEditorLay
outBox->paddingEnd(); | 239 maxLogicalWidth += innerEditorLayoutBox->paddingStart() + innerEditorLay
outBox->paddingEnd(); |
240 if (!style()->logicalWidth().hasPercent()) | 240 if (!style()->logicalWidth().hasPercent()) |
241 minLogicalWidth = maxLogicalWidth; | 241 minLogicalWidth = maxLogicalWidth; |
242 } | 242 } |
243 | 243 |
244 void LayoutTextControl::computePreferredLogicalWidths() | 244 void LayoutTextControl::computePreferredLogicalWidths() |
245 { | 245 { |
246 ASSERT(preferredLogicalWidthsDirty()); | 246 ASSERT(preferredLogicalWidthsDirty()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder
Element(); | 282 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder
Element(); |
283 LayoutObject* placeholderLayoutObject = placeholder ? placeholder->layoutObj
ect() : nullptr; | 283 LayoutObject* placeholderLayoutObject = placeholder ? placeholder->layoutObj
ect() : nullptr; |
284 if (!placeholderLayoutObject) | 284 if (!placeholderLayoutObject) |
285 return nullptr; | 285 return nullptr; |
286 if (relayoutChildren) | 286 if (relayoutChildren) |
287 layoutScope.setChildNeedsLayout(placeholderLayoutObject); | 287 layoutScope.setChildNeedsLayout(placeholderLayoutObject); |
288 return placeholderLayoutObject; | 288 return placeholderLayoutObject; |
289 } | 289 } |
290 | 290 |
291 } // namespace blink | 291 } // namespace blink |
OLD | NEW |