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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 if (!style()->logicalWidth().isPercent()) | 247 if (!style()->logicalWidth().isPercent()) |
248 minLogicalWidth = maxLogicalWidth; | 248 minLogicalWidth = maxLogicalWidth; |
249 } | 249 } |
250 | 250 |
251 void RenderTextControl::computePreferredLogicalWidths() | 251 void RenderTextControl::computePreferredLogicalWidths() |
252 { | 252 { |
253 ASSERT(preferredLogicalWidthsDirty()); | 253 ASSERT(preferredLogicalWidthsDirty()); |
254 | 254 |
255 m_minPreferredLogicalWidth = 0; | 255 m_minPreferredLogicalWidth = 0; |
256 m_maxPreferredLogicalWidth = 0; | 256 m_maxPreferredLogicalWidth = 0; |
| 257 RenderStyle* styleToUse = style(); |
257 | 258 |
258 if (style()->logicalWidth().isFixed() && style()->logicalWidth().value() >=
0) | 259 if (styleToUse->logicalWidth().isFixed() && styleToUse->logicalWidth().value
() >= 0) |
259 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB
oxLogicalWidthForBoxSizing(style()->logicalWidth().value()); | 260 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB
oxLogicalWidthForBoxSizing(styleToUse->logicalWidth().value()); |
260 else | 261 else |
261 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred
LogicalWidth); | 262 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred
LogicalWidth); |
262 | 263 |
263 if (style()->logicalMinWidth().isFixed() && style()->logicalMinWidth().value
() > 0) { | 264 if (styleToUse->logicalMinWidth().isFixed() && styleToUse->logicalMinWidth()
.value() > 0) { |
264 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(style()->logicalMinWidth().value())); | 265 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value())); |
265 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(style()->logicalMinWidth().value())); | 266 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value())); |
266 } | 267 } |
267 | 268 |
268 if (style()->logicalMaxWidth().isFixed()) { | 269 if (styleToUse->logicalMaxWidth().isFixed()) { |
269 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(style()->logicalMaxWidth().value())); | 270 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value())); |
270 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(style()->logicalMaxWidth().value())); | 271 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value())); |
271 } | 272 } |
272 | 273 |
273 LayoutUnit toAdd = borderAndPaddingLogicalWidth(); | 274 LayoutUnit toAdd = borderAndPaddingLogicalWidth(); |
274 | 275 |
275 m_minPreferredLogicalWidth += toAdd; | 276 m_minPreferredLogicalWidth += toAdd; |
276 m_maxPreferredLogicalWidth += toAdd; | 277 m_maxPreferredLogicalWidth += toAdd; |
277 | 278 |
278 clearPreferredLogicalWidthsDirty(); | 279 clearPreferredLogicalWidthsDirty(); |
279 } | 280 } |
280 | 281 |
281 void RenderTextControl::addFocusRingRects(Vector<IntRect>& rects, const LayoutPo
int& additionalOffset, const RenderLayerModelObject*) | 282 void RenderTextControl::addFocusRingRects(Vector<IntRect>& rects, const LayoutPo
int& additionalOffset, const RenderLayerModelObject*) |
282 { | 283 { |
283 if (!size().isEmpty()) | 284 if (!size().isEmpty()) |
284 rects.append(pixelSnappedIntRect(additionalOffset, size())); | 285 rects.append(pixelSnappedIntRect(additionalOffset, size())); |
285 } | 286 } |
286 | 287 |
287 RenderObject* RenderTextControl::layoutSpecialExcludedChild(bool relayoutChildre
n, SubtreeLayoutScope& layoutScope) | 288 RenderObject* RenderTextControl::layoutSpecialExcludedChild(bool relayoutChildre
n, SubtreeLayoutScope& layoutScope) |
288 { | 289 { |
289 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder
Element(); | 290 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder
Element(); |
290 RenderObject* placeholderRenderer = placeholder ? placeholder->renderer() :
0; | 291 RenderObject* placeholderRenderer = placeholder ? placeholder->renderer() :
0; |
291 if (!placeholderRenderer) | 292 if (!placeholderRenderer) |
292 return 0; | 293 return 0; |
293 if (relayoutChildren) | 294 if (relayoutChildren) |
294 layoutScope.setChildNeedsLayout(placeholderRenderer); | 295 layoutScope.setChildNeedsLayout(placeholderRenderer); |
295 return placeholderRenderer; | 296 return placeholderRenderer; |
296 } | 297 } |
297 | 298 |
298 } // namespace WebCore | 299 } // namespace WebCore |
OLD | NEW |