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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 void RenderTextControl::styleDidChange(StyleDifference diff, const RenderStyle*
oldStyle) | 65 void RenderTextControl::styleDidChange(StyleDifference diff, const RenderStyle*
oldStyle) |
66 { | 66 { |
67 RenderBlockFlow::styleDidChange(diff, oldStyle); | 67 RenderBlockFlow::styleDidChange(diff, oldStyle); |
68 Element* innerEditor = innerEditorElement(); | 68 Element* innerEditor = innerEditorElement(); |
69 if (!innerEditor) | 69 if (!innerEditor) |
70 return; | 70 return; |
71 RenderBlock* innerEditorRenderer = toRenderBlock(innerEditor->renderer()); | 71 RenderBlock* innerEditorRenderer = toRenderBlock(innerEditor->renderer()); |
72 if (innerEditorRenderer) { | 72 if (innerEditorRenderer) { |
73 // We may have set the width and the height in the old style in layout()
. | 73 // We may have set the width and the height in the old style in layout()
. |
74 // Reset them now to avoid getting a spurious layout hint. | 74 // Reset them now to avoid getting a spurious layout hint. |
75 innerEditorRenderer->style()->setHeight(Length()); | 75 innerEditorRenderer->deprecatedMutableStyle()->setHeight(Length()); |
76 innerEditorRenderer->style()->setWidth(Length()); | 76 innerEditorRenderer->deprecatedMutableStyle()->setWidth(Length()); |
77 innerEditorRenderer->setStyle(createInnerEditorStyle(style())); | 77 innerEditorRenderer->setStyle(createInnerEditorStyle(style())); |
78 innerEditor->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonFo
rTracing::create(StyleChangeReason::Control)); | 78 innerEditor->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonFo
rTracing::create(StyleChangeReason::Control)); |
79 } | 79 } |
80 textFormControlElement()->updatePlaceholderVisibility(false); | 80 textFormControlElement()->updatePlaceholderVisibility(false); |
81 } | 81 } |
82 | 82 |
83 static inline void updateUserModifyProperty(HTMLTextFormControlElement* node, Re
nderStyle* style) | 83 static inline void updateUserModifyProperty(HTMLTextFormControlElement* node, Re
nderStyle* style) |
84 { | 84 { |
85 style->setUserModify(node->isDisabledOrReadOnly() ? READ_ONLY : READ_WRITE_P
LAINTEXT_ONLY); | 85 style->setUserModify(node->isDisabledOrReadOnly() ? READ_ONLY : READ_WRITE_P
LAINTEXT_ONLY); |
86 } | 86 } |
(...skipping 22 matching lines...) Expand all Loading... |
109 if (innerEditor->renderer()) | 109 if (innerEditor->renderer()) |
110 unitWidth -= innerEditor->renderBox()->paddingStart() + innerEditor->ren
derBox()->paddingEnd(); | 110 unitWidth -= innerEditor->renderBox()->paddingStart() + innerEditor->ren
derBox()->paddingEnd(); |
111 | 111 |
112 return unitWidth; | 112 return unitWidth; |
113 } | 113 } |
114 | 114 |
115 void RenderTextControl::updateFromElement() | 115 void RenderTextControl::updateFromElement() |
116 { | 116 { |
117 Element* innerEditor = innerEditorElement(); | 117 Element* innerEditor = innerEditorElement(); |
118 if (innerEditor && innerEditor->renderer()) | 118 if (innerEditor && innerEditor->renderer()) |
119 updateUserModifyProperty(textFormControlElement(), innerEditor->renderer
()->style()); | 119 updateUserModifyProperty(textFormControlElement(), innerEditor->renderer
()->deprecatedMutableStyle()); |
120 } | 120 } |
121 | 121 |
122 int RenderTextControl::scrollbarThickness() const | 122 int RenderTextControl::scrollbarThickness() const |
123 { | 123 { |
124 // FIXME: We should get the size of the scrollbar from the LayoutTheme inste
ad. | 124 // FIXME: We should get the size of the scrollbar from the LayoutTheme inste
ad. |
125 return ScrollbarTheme::theme()->scrollbarThickness(); | 125 return ScrollbarTheme::theme()->scrollbarThickness(); |
126 } | 126 } |
127 | 127 |
128 void RenderTextControl::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUni
t logicalTop, LogicalExtentComputedValues& computedValues) const | 128 void RenderTextControl::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUni
t logicalTop, LogicalExtentComputedValues& computedValues) const |
129 { | 129 { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 if (!style()->logicalWidth().isPercent()) | 251 if (!style()->logicalWidth().isPercent()) |
252 minLogicalWidth = maxLogicalWidth; | 252 minLogicalWidth = maxLogicalWidth; |
253 } | 253 } |
254 | 254 |
255 void RenderTextControl::computePreferredLogicalWidths() | 255 void RenderTextControl::computePreferredLogicalWidths() |
256 { | 256 { |
257 ASSERT(preferredLogicalWidthsDirty()); | 257 ASSERT(preferredLogicalWidthsDirty()); |
258 | 258 |
259 m_minPreferredLogicalWidth = 0; | 259 m_minPreferredLogicalWidth = 0; |
260 m_maxPreferredLogicalWidth = 0; | 260 m_maxPreferredLogicalWidth = 0; |
261 RenderStyle* styleToUse = style(); | 261 const RenderStyle* styleToUse = style(); |
262 | 262 |
263 if (styleToUse->logicalWidth().isFixed() && styleToUse->logicalWidth().value
() >= 0) | 263 if (styleToUse->logicalWidth().isFixed() && styleToUse->logicalWidth().value
() >= 0) |
264 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB
oxLogicalWidthForBoxSizing(styleToUse->logicalWidth().value()); | 264 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB
oxLogicalWidthForBoxSizing(styleToUse->logicalWidth().value()); |
265 else | 265 else |
266 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred
LogicalWidth); | 266 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred
LogicalWidth); |
267 | 267 |
268 if (styleToUse->logicalMinWidth().isFixed() && styleToUse->logicalMinWidth()
.value() > 0) { | 268 if (styleToUse->logicalMinWidth().isFixed() && styleToUse->logicalMinWidth()
.value() > 0) { |
269 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjust
ContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value())); | 269 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjust
ContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value())); |
270 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjust
ContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value())); | 270 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjust
ContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value())); |
271 } | 271 } |
(...skipping 22 matching lines...) Expand all Loading... |
294 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder
Element(); | 294 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder
Element(); |
295 RenderObject* placeholderRenderer = placeholder ? placeholder->renderer() :
0; | 295 RenderObject* placeholderRenderer = placeholder ? placeholder->renderer() :
0; |
296 if (!placeholderRenderer) | 296 if (!placeholderRenderer) |
297 return 0; | 297 return 0; |
298 if (relayoutChildren) | 298 if (relayoutChildren) |
299 layoutScope.setChildNeedsLayout(placeholderRenderer); | 299 layoutScope.setChildNeedsLayout(placeholderRenderer); |
300 return placeholderRenderer; | 300 return placeholderRenderer; |
301 } | 301 } |
302 | 302 |
303 } // namespace blink | 303 } // namespace blink |
OLD | NEW |