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 10 matching lines...) Expand all Loading... |
21 | 21 |
22 #include "config.h" | 22 #include "config.h" |
23 #include "core/rendering/RenderTextControl.h" | 23 #include "core/rendering/RenderTextControl.h" |
24 | 24 |
25 #include "core/html/HTMLTextFormControlElement.h" | 25 #include "core/html/HTMLTextFormControlElement.h" |
26 #include "core/rendering/HitTestResult.h" | 26 #include "core/rendering/HitTestResult.h" |
27 #include "core/rendering/RenderTheme.h" | 27 #include "core/rendering/RenderTheme.h" |
28 #include "platform/scroll/ScrollbarTheme.h" | 28 #include "platform/scroll/ScrollbarTheme.h" |
29 #include "wtf/unicode/CharacterNames.h" | 29 #include "wtf/unicode/CharacterNames.h" |
30 | 30 |
31 using namespace std; | |
32 | |
33 namespace WebCore { | 31 namespace WebCore { |
34 | 32 |
35 RenderTextControl::RenderTextControl(HTMLTextFormControlElement* element) | 33 RenderTextControl::RenderTextControl(HTMLTextFormControlElement* element) |
36 : RenderBlockFlow(element) | 34 : RenderBlockFlow(element) |
37 { | 35 { |
38 ASSERT(element); | 36 ASSERT(element); |
39 } | 37 } |
40 | 38 |
41 RenderTextControl::~RenderTextControl() | 39 RenderTextControl::~RenderTextControl() |
42 { | 40 { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 m_minPreferredLogicalWidth = 0; | 259 m_minPreferredLogicalWidth = 0; |
262 m_maxPreferredLogicalWidth = 0; | 260 m_maxPreferredLogicalWidth = 0; |
263 RenderStyle* styleToUse = style(); | 261 RenderStyle* styleToUse = style(); |
264 | 262 |
265 if (styleToUse->logicalWidth().isFixed() && styleToUse->logicalWidth().value
() >= 0) | 263 if (styleToUse->logicalWidth().isFixed() && styleToUse->logicalWidth().value
() >= 0) |
266 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB
oxLogicalWidthForBoxSizing(styleToUse->logicalWidth().value()); | 264 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB
oxLogicalWidthForBoxSizing(styleToUse->logicalWidth().value()); |
267 else | 265 else |
268 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred
LogicalWidth); | 266 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred
LogicalWidth); |
269 | 267 |
270 if (styleToUse->logicalMinWidth().isFixed() && styleToUse->logicalMinWidth()
.value() > 0) { | 268 if (styleToUse->logicalMinWidth().isFixed() && styleToUse->logicalMinWidth()
.value() > 0) { |
271 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value())); | 269 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjust
ContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value())); |
272 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value())); | 270 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjust
ContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value())); |
273 } | 271 } |
274 | 272 |
275 if (styleToUse->logicalMaxWidth().isFixed()) { | 273 if (styleToUse->logicalMaxWidth().isFixed()) { |
276 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value())); | 274 m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjust
ContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value())); |
277 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustConte
ntBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value())); | 275 m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, adjust
ContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value())); |
278 } | 276 } |
279 | 277 |
280 LayoutUnit toAdd = borderAndPaddingLogicalWidth(); | 278 LayoutUnit toAdd = borderAndPaddingLogicalWidth(); |
281 | 279 |
282 m_minPreferredLogicalWidth += toAdd; | 280 m_minPreferredLogicalWidth += toAdd; |
283 m_maxPreferredLogicalWidth += toAdd; | 281 m_maxPreferredLogicalWidth += toAdd; |
284 | 282 |
285 clearPreferredLogicalWidthsDirty(); | 283 clearPreferredLogicalWidthsDirty(); |
286 } | 284 } |
287 | 285 |
288 void RenderTextControl::addFocusRingRects(Vector<IntRect>& rects, const LayoutPo
int& additionalOffset, const RenderLayerModelObject*) | 286 void RenderTextControl::addFocusRingRects(Vector<IntRect>& rects, const LayoutPo
int& additionalOffset, const RenderLayerModelObject*) |
289 { | 287 { |
290 if (!size().isEmpty()) | 288 if (!size().isEmpty()) |
291 rects.append(pixelSnappedIntRect(additionalOffset, size())); | 289 rects.append(pixelSnappedIntRect(additionalOffset, size())); |
292 } | 290 } |
293 | 291 |
294 RenderObject* RenderTextControl::layoutSpecialExcludedChild(bool relayoutChildre
n, SubtreeLayoutScope& layoutScope) | 292 RenderObject* RenderTextControl::layoutSpecialExcludedChild(bool relayoutChildre
n, SubtreeLayoutScope& layoutScope) |
295 { | 293 { |
296 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder
Element(); | 294 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder
Element(); |
297 RenderObject* placeholderRenderer = placeholder ? placeholder->renderer() :
0; | 295 RenderObject* placeholderRenderer = placeholder ? placeholder->renderer() :
0; |
298 if (!placeholderRenderer) | 296 if (!placeholderRenderer) |
299 return 0; | 297 return 0; |
300 if (relayoutChildren) | 298 if (relayoutChildren) |
301 layoutScope.setChildNeedsLayout(placeholderRenderer); | 299 layoutScope.setChildNeedsLayout(placeholderRenderer); |
302 return placeholderRenderer; | 300 return placeholderRenderer; |
303 } | 301 } |
304 | 302 |
305 } // namespace WebCore | 303 } // namespace WebCore |
OLD | NEW |