| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 // This matches the unitsPerEm value for MS Shell Dlg and Courier New from t
he "head" font table. | 232 // This matches the unitsPerEm value for MS Shell Dlg and Courier New from t
he "head" font table. |
| 233 float unitsPerEm = 2048.0f; | 233 float unitsPerEm = 2048.0f; |
| 234 return roundf(style()->font().getFontDescription().computedSize() * x / unit
sPerEm); | 234 return roundf(style()->font().getFontDescription().computedSize() * x / unit
sPerEm); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void LayoutTextControl::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidt
h, LayoutUnit& maxLogicalWidth) const | 237 void LayoutTextControl::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidt
h, LayoutUnit& maxLogicalWidth) const |
| 238 { | 238 { |
| 239 // Use average character width. Matches IE. | 239 // Use average character width. Matches IE. |
| 240 AtomicString family = style()->font().getFontDescription().family().family()
; | 240 AtomicString family = style()->font().getFontDescription().family().family()
; |
| 241 maxLogicalWidth = preferredContentLogicalWidth(const_cast<LayoutTextControl*
>(this)->getAvgCharWidth(family)); | 241 maxLogicalWidth = preferredContentLogicalWidth(const_cast<LayoutTextControl*
>(this)->getAvgCharWidth(family)); |
| 242 if (LayoutBox* innerEditorLayoutBox = innerEditorElement()->layoutBox()) | 242 if (innerEditorElement()) { |
| 243 maxLogicalWidth += innerEditorLayoutBox->paddingStart() + innerEditorLay
outBox->paddingEnd(); | 243 if (LayoutBox* innerEditorLayoutBox = innerEditorElement()->layoutBox()) |
| 244 maxLogicalWidth += innerEditorLayoutBox->paddingStart() + innerEdito
rLayoutBox->paddingEnd(); |
| 245 } |
| 244 if (!style()->logicalWidth().hasPercent()) | 246 if (!style()->logicalWidth().hasPercent()) |
| 245 minLogicalWidth = maxLogicalWidth; | 247 minLogicalWidth = maxLogicalWidth; |
| 246 } | 248 } |
| 247 | 249 |
| 248 void LayoutTextControl::computePreferredLogicalWidths() | 250 void LayoutTextControl::computePreferredLogicalWidths() |
| 249 { | 251 { |
| 250 ASSERT(preferredLogicalWidthsDirty()); | 252 ASSERT(preferredLogicalWidthsDirty()); |
| 251 | 253 |
| 252 m_minPreferredLogicalWidth = LayoutUnit(); | 254 m_minPreferredLogicalWidth = LayoutUnit(); |
| 253 m_maxPreferredLogicalWidth = LayoutUnit(); | 255 m_maxPreferredLogicalWidth = LayoutUnit(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder
Element(); | 288 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder
Element(); |
| 287 LayoutObject* placeholderLayoutObject = placeholder ? placeholder->layoutObj
ect() : nullptr; | 289 LayoutObject* placeholderLayoutObject = placeholder ? placeholder->layoutObj
ect() : nullptr; |
| 288 if (!placeholderLayoutObject) | 290 if (!placeholderLayoutObject) |
| 289 return nullptr; | 291 return nullptr; |
| 290 if (relayoutChildren) | 292 if (relayoutChildren) |
| 291 layoutScope.setChildNeedsLayout(placeholderLayoutObject); | 293 layoutScope.setChildNeedsLayout(placeholderLayoutObject); |
| 292 return placeholderLayoutObject; | 294 return placeholderLayoutObject; |
| 293 } | 295 } |
| 294 | 296 |
| 295 } // namespace blink | 297 } // namespace blink |
| OLD | NEW |