| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2010 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 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 using namespace std; | 38 using namespace std; |
| 39 | 39 |
| 40 namespace WebCore { | 40 namespace WebCore { |
| 41 | 41 |
| 42 using namespace HTMLNames; | 42 using namespace HTMLNames; |
| 43 | 43 |
| 44 RenderTextControlSingleLine::RenderTextControlSingleLine(HTMLInputElement* eleme
nt) | 44 RenderTextControlSingleLine::RenderTextControlSingleLine(HTMLInputElement* eleme
nt) |
| 45 : RenderTextControl(element) | 45 : RenderTextControl(element) |
| 46 , m_shouldDrawCapsLockIndicator(false) | 46 , m_shouldDrawCapsLockIndicator(false) |
| 47 , m_desiredInnerTextLogicalHeight(-1) | 47 , m_desiredInnerEditorLogicalHeight(-1) |
| 48 { | 48 { |
| 49 } | 49 } |
| 50 | 50 |
| 51 RenderTextControlSingleLine::~RenderTextControlSingleLine() | 51 RenderTextControlSingleLine::~RenderTextControlSingleLine() |
| 52 { | 52 { |
| 53 } | 53 } |
| 54 | 54 |
| 55 inline Element* RenderTextControlSingleLine::containerElement() const | 55 inline Element* RenderTextControlSingleLine::containerElement() const |
| 56 { | 56 { |
| 57 return inputElement()->userAgentShadowRoot()->getElementById(ShadowElementNa
mes::textFieldContainer()); | 57 return inputElement()->userAgentShadowRoot()->getElementById(ShadowElementNa
mes::textFieldContainer()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // styleDidChange(). We need them because | 99 // styleDidChange(). We need them because |
| 100 // - Center the inner elements vertically if the input height is taller than | 100 // - Center the inner elements vertically if the input height is taller than |
| 101 // the intrinsic height of the inner elements. | 101 // the intrinsic height of the inner elements. |
| 102 // - Shrink the inner elment heights if the input height is samller than the | 102 // - Shrink the inner elment heights if the input height is samller than the |
| 103 // intrinsic heights of the inner elements. | 103 // intrinsic heights of the inner elements. |
| 104 | 104 |
| 105 // We don't honor paddings and borders for textfields without decorations | 105 // We don't honor paddings and borders for textfields without decorations |
| 106 // and type=search if the text height is taller than the contentHeight() | 106 // and type=search if the text height is taller than the contentHeight() |
| 107 // because of compability. | 107 // because of compability. |
| 108 | 108 |
| 109 RenderBox* innerTextRenderer = innerTextElement()->renderBox(); | 109 RenderBox* innerEditorRenderer = innerEditorElement()->renderBox(); |
| 110 RenderBox* viewPortRenderer = editingViewPortElement() ? editingViewPortElem
ent()->renderBox() : 0; | 110 RenderBox* viewPortRenderer = editingViewPortElement() ? editingViewPortElem
ent()->renderBox() : 0; |
| 111 | 111 |
| 112 // To ensure consistency between layouts, we need to reset any conditionally
overriden height. | 112 // To ensure consistency between layouts, we need to reset any conditionally
overriden height. |
| 113 if (innerTextRenderer && !innerTextRenderer->style()->logicalHeight().isAuto
()) { | 113 if (innerEditorRenderer && !innerEditorRenderer->style()->logicalHeight().is
Auto()) { |
| 114 innerTextRenderer->style()->setLogicalHeight(Length(Auto)); | 114 innerEditorRenderer->style()->setLogicalHeight(Length(Auto)); |
| 115 layoutScope.setNeedsLayout(innerTextRenderer); | 115 layoutScope.setNeedsLayout(innerEditorRenderer); |
| 116 HTMLElement* placeholderElement = inputElement()->placeholderElement(); | 116 HTMLElement* placeholderElement = inputElement()->placeholderElement(); |
| 117 if (RenderBox* placeholderBox = placeholderElement ? placeholderElement-
>renderBox() : 0) | 117 if (RenderBox* placeholderBox = placeholderElement ? placeholderElement-
>renderBox() : 0) |
| 118 layoutScope.setNeedsLayout(placeholderBox); | 118 layoutScope.setNeedsLayout(placeholderBox); |
| 119 } | 119 } |
| 120 if (viewPortRenderer && !viewPortRenderer->style()->logicalHeight().isAuto()
) { | 120 if (viewPortRenderer && !viewPortRenderer->style()->logicalHeight().isAuto()
) { |
| 121 viewPortRenderer->style()->setLogicalHeight(Length(Auto)); | 121 viewPortRenderer->style()->setLogicalHeight(Length(Auto)); |
| 122 layoutScope.setNeedsLayout(viewPortRenderer); | 122 layoutScope.setNeedsLayout(viewPortRenderer); |
| 123 } | 123 } |
| 124 | 124 |
| 125 RenderBlockFlow::layoutBlock(false); | 125 RenderBlockFlow::layoutBlock(false); |
| 126 | 126 |
| 127 Element* container = containerElement(); | 127 Element* container = containerElement(); |
| 128 RenderBox* containerRenderer = container ? container->renderBox() : 0; | 128 RenderBox* containerRenderer = container ? container->renderBox() : 0; |
| 129 | 129 |
| 130 // Set the text block height | 130 // Set the text block height |
| 131 LayoutUnit desiredLogicalHeight = textBlockLogicalHeight(); | 131 LayoutUnit desiredLogicalHeight = textBlockLogicalHeight(); |
| 132 LayoutUnit logicalHeightLimit = computeLogicalHeightLimit(); | 132 LayoutUnit logicalHeightLimit = computeLogicalHeightLimit(); |
| 133 if (innerTextRenderer && innerTextRenderer->logicalHeight() > logicalHeightL
imit) { | 133 if (innerEditorRenderer && innerEditorRenderer->logicalHeight() > logicalHei
ghtLimit) { |
| 134 if (desiredLogicalHeight != innerTextRenderer->logicalHeight()) | 134 if (desiredLogicalHeight != innerEditorRenderer->logicalHeight()) |
| 135 layoutScope.setNeedsLayout(this); | 135 layoutScope.setNeedsLayout(this); |
| 136 | 136 |
| 137 m_desiredInnerTextLogicalHeight = desiredLogicalHeight; | 137 m_desiredInnerEditorLogicalHeight = desiredLogicalHeight; |
| 138 | 138 |
| 139 innerTextRenderer->style()->setLogicalHeight(Length(desiredLogicalHeight
, Fixed)); | 139 innerEditorRenderer->style()->setLogicalHeight(Length(desiredLogicalHeig
ht, Fixed)); |
| 140 layoutScope.setNeedsLayout(innerTextRenderer); | 140 layoutScope.setNeedsLayout(innerEditorRenderer); |
| 141 if (viewPortRenderer) { | 141 if (viewPortRenderer) { |
| 142 viewPortRenderer->style()->setLogicalHeight(Length(desiredLogicalHei
ght, Fixed)); | 142 viewPortRenderer->style()->setLogicalHeight(Length(desiredLogicalHei
ght, Fixed)); |
| 143 layoutScope.setNeedsLayout(viewPortRenderer); | 143 layoutScope.setNeedsLayout(viewPortRenderer); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 // The container might be taller because of decoration elements. | 146 // The container might be taller because of decoration elements. |
| 147 if (containerRenderer) { | 147 if (containerRenderer) { |
| 148 containerRenderer->layoutIfNeeded(); | 148 containerRenderer->layoutIfNeeded(); |
| 149 LayoutUnit containerLogicalHeight = containerRenderer->logicalHeight(); | 149 LayoutUnit containerLogicalHeight = containerRenderer->logicalHeight(); |
| 150 if (containerLogicalHeight > logicalHeightLimit) { | 150 if (containerLogicalHeight > logicalHeightLimit) { |
| 151 containerRenderer->style()->setLogicalHeight(Length(logicalHeightLim
it, Fixed)); | 151 containerRenderer->style()->setLogicalHeight(Length(logicalHeightLim
it, Fixed)); |
| 152 layoutScope.setNeedsLayout(this); | 152 layoutScope.setNeedsLayout(this); |
| 153 } else if (containerRenderer->logicalHeight() < contentLogicalHeight())
{ | 153 } else if (containerRenderer->logicalHeight() < contentLogicalHeight())
{ |
| 154 containerRenderer->style()->setLogicalHeight(Length(contentLogicalHe
ight(), Fixed)); | 154 containerRenderer->style()->setLogicalHeight(Length(contentLogicalHe
ight(), Fixed)); |
| 155 layoutScope.setNeedsLayout(this); | 155 layoutScope.setNeedsLayout(this); |
| 156 } else | 156 } else |
| 157 containerRenderer->style()->setLogicalHeight(Length(containerLogical
Height, Fixed)); | 157 containerRenderer->style()->setLogicalHeight(Length(containerLogical
Height, Fixed)); |
| 158 } | 158 } |
| 159 | 159 |
| 160 // If we need another layout pass, we have changed one of children's height
so we need to relayout them. | 160 // If we need another layout pass, we have changed one of children's height
so we need to relayout them. |
| 161 if (needsLayout()) | 161 if (needsLayout()) |
| 162 RenderBlockFlow::layoutBlock(true); | 162 RenderBlockFlow::layoutBlock(true); |
| 163 | 163 |
| 164 // Center the child block in the block progression direction (vertical cente
ring for horizontal text fields). | 164 // Center the child block in the block progression direction (vertical cente
ring for horizontal text fields). |
| 165 if (!container && innerTextRenderer && innerTextRenderer->height() != conten
tLogicalHeight()) { | 165 if (!container && innerEditorRenderer && innerEditorRenderer->height() != co
ntentLogicalHeight()) { |
| 166 LayoutUnit logicalHeightDiff = innerTextRenderer->logicalHeight() - cont
entLogicalHeight(); | 166 LayoutUnit logicalHeightDiff = innerEditorRenderer->logicalHeight() - co
ntentLogicalHeight(); |
| 167 innerTextRenderer->setLogicalTop(innerTextRenderer->logicalTop() - (logi
calHeightDiff / 2 + layoutMod(logicalHeightDiff, 2))); | 167 innerEditorRenderer->setLogicalTop(innerEditorRenderer->logicalTop() - (
logicalHeightDiff / 2 + layoutMod(logicalHeightDiff, 2))); |
| 168 } else | 168 } else |
| 169 centerContainerIfNeeded(containerRenderer); | 169 centerContainerIfNeeded(containerRenderer); |
| 170 | 170 |
| 171 HTMLElement* placeholderElement = inputElement()->placeholderElement(); | 171 HTMLElement* placeholderElement = inputElement()->placeholderElement(); |
| 172 if (RenderBox* placeholderBox = placeholderElement ? placeholderElement->ren
derBox() : 0) { | 172 if (RenderBox* placeholderBox = placeholderElement ? placeholderElement->ren
derBox() : 0) { |
| 173 LayoutSize innerTextSize; | 173 LayoutSize innerEditorSize; |
| 174 | 174 |
| 175 if (innerTextRenderer) | 175 if (innerEditorRenderer) |
| 176 innerTextSize = innerTextRenderer->size(); | 176 innerEditorSize = innerEditorRenderer->size(); |
| 177 placeholderBox->style()->setWidth(Length(innerTextSize.width() - placeho
lderBox->borderAndPaddingWidth(), Fixed)); | 177 placeholderBox->style()->setWidth(Length(innerEditorSize.width() - place
holderBox->borderAndPaddingWidth(), Fixed)); |
| 178 placeholderBox->style()->setHeight(Length(innerTextSize.height() - place
holderBox->borderAndPaddingHeight(), Fixed)); | 178 placeholderBox->style()->setHeight(Length(innerEditorSize.height() - pla
ceholderBox->borderAndPaddingHeight(), Fixed)); |
| 179 bool neededLayout = placeholderBox->needsLayout(); | 179 bool neededLayout = placeholderBox->needsLayout(); |
| 180 bool placeholderBoxHadLayout = placeholderBox->everHadLayout(); | 180 bool placeholderBoxHadLayout = placeholderBox->everHadLayout(); |
| 181 placeholderBox->layoutIfNeeded(); | 181 placeholderBox->layoutIfNeeded(); |
| 182 LayoutPoint textOffset; | 182 LayoutPoint textOffset; |
| 183 if (innerTextRenderer) | 183 if (innerEditorRenderer) |
| 184 textOffset = innerTextRenderer->location(); | 184 textOffset = innerEditorRenderer->location(); |
| 185 if (editingViewPortElement() && editingViewPortElement()->renderBox()) | 185 if (editingViewPortElement() && editingViewPortElement()->renderBox()) |
| 186 textOffset += toLayoutSize(editingViewPortElement()->renderBox()->lo
cation()); | 186 textOffset += toLayoutSize(editingViewPortElement()->renderBox()->lo
cation()); |
| 187 if (containerRenderer) | 187 if (containerRenderer) |
| 188 textOffset += toLayoutSize(containerRenderer->location()); | 188 textOffset += toLayoutSize(containerRenderer->location()); |
| 189 placeholderBox->setLocation(textOffset); | 189 placeholderBox->setLocation(textOffset); |
| 190 | 190 |
| 191 if (!placeholderBoxHadLayout && placeholderBox->checkForPaintInvalidatio
nDuringLayout()) { | 191 if (!placeholderBoxHadLayout && placeholderBox->checkForPaintInvalidatio
nDuringLayout()) { |
| 192 // This assumes a shadow tree without floats. If floats are added, t
he | 192 // This assumes a shadow tree without floats. If floats are added, t
he |
| 193 // logic should be shared with RenderBlockFlow::layoutBlockChild. | 193 // logic should be shared with RenderBlockFlow::layoutBlockChild. |
| 194 placeholderBox->paintInvalidationForWholeRenderer(); | 194 placeholderBox->paintInvalidationForWholeRenderer(); |
| 195 } | 195 } |
| 196 // The placeholder gets layout last, after the parent text control and i
ts other children, | 196 // The placeholder gets layout last, after the parent text control and i
ts other children, |
| 197 // so in order to get the correct overflow from the placeholder we need
to recompute it now. | 197 // so in order to get the correct overflow from the placeholder we need
to recompute it now. |
| 198 if (neededLayout) | 198 if (neededLayout) |
| 199 computeOverflow(clientLogicalBottom()); | 199 computeOverflow(clientLogicalBottom()); |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 | 202 |
| 203 bool RenderTextControlSingleLine::nodeAtPoint(const HitTestRequest& request, Hit
TestResult& result, const HitTestLocation& locationInContainer, const LayoutPoin
t& accumulatedOffset, HitTestAction hitTestAction) | 203 bool RenderTextControlSingleLine::nodeAtPoint(const HitTestRequest& request, Hit
TestResult& result, const HitTestLocation& locationInContainer, const LayoutPoin
t& accumulatedOffset, HitTestAction hitTestAction) |
| 204 { | 204 { |
| 205 if (!RenderTextControl::nodeAtPoint(request, result, locationInContainer, ac
cumulatedOffset, hitTestAction)) | 205 if (!RenderTextControl::nodeAtPoint(request, result, locationInContainer, ac
cumulatedOffset, hitTestAction)) |
| 206 return false; | 206 return false; |
| 207 | 207 |
| 208 // Say that we hit the inner text element if | 208 // Say that we hit the inner text element if |
| 209 // - we hit a node inside the inner text element, | 209 // - we hit a node inside the inner text element, |
| 210 // - we hit the <input> element (e.g. we're over the border or padding), or | 210 // - we hit the <input> element (e.g. we're over the border or padding), or |
| 211 // - we hit regions not in any decoration buttons. | 211 // - we hit regions not in any decoration buttons. |
| 212 Element* container = containerElement(); | 212 Element* container = containerElement(); |
| 213 if (result.innerNode()->isDescendantOf(innerTextElement()) || result.innerNo
de() == node() || (container && container == result.innerNode())) { | 213 if (result.innerNode()->isDescendantOf(innerEditorElement()) || result.inner
Node() == node() || (container && container == result.innerNode())) { |
| 214 LayoutPoint pointInParent = locationInContainer.point(); | 214 LayoutPoint pointInParent = locationInContainer.point(); |
| 215 if (container && editingViewPortElement()) { | 215 if (container && editingViewPortElement()) { |
| 216 if (editingViewPortElement()->renderBox()) | 216 if (editingViewPortElement()->renderBox()) |
| 217 pointInParent -= toLayoutSize(editingViewPortElement()->renderBo
x()->location()); | 217 pointInParent -= toLayoutSize(editingViewPortElement()->renderBo
x()->location()); |
| 218 if (container->renderBox()) | 218 if (container->renderBox()) |
| 219 pointInParent -= toLayoutSize(container->renderBox()->location()
); | 219 pointInParent -= toLayoutSize(container->renderBox()->location()
); |
| 220 } | 220 } |
| 221 hitInnerTextElement(result, pointInParent, accumulatedOffset); | 221 hitInnerEditorElement(result, pointInParent, accumulatedOffset); |
| 222 } | 222 } |
| 223 return true; | 223 return true; |
| 224 } | 224 } |
| 225 | 225 |
| 226 void RenderTextControlSingleLine::styleDidChange(StyleDifference diff, const Ren
derStyle* oldStyle) | 226 void RenderTextControlSingleLine::styleDidChange(StyleDifference diff, const Ren
derStyle* oldStyle) |
| 227 { | 227 { |
| 228 m_desiredInnerTextLogicalHeight = -1; | 228 m_desiredInnerEditorLogicalHeight = -1; |
| 229 RenderTextControl::styleDidChange(diff, oldStyle); | 229 RenderTextControl::styleDidChange(diff, oldStyle); |
| 230 | 230 |
| 231 // We may have set the width and the height in the old style in layout(). | 231 // We may have set the width and the height in the old style in layout(). |
| 232 // Reset them now to avoid getting a spurious layout hint. | 232 // Reset them now to avoid getting a spurious layout hint. |
| 233 Element* viewPort = editingViewPortElement(); | 233 Element* viewPort = editingViewPortElement(); |
| 234 if (RenderObject* viewPortRenderer = viewPort ? viewPort->renderer() : 0) { | 234 if (RenderObject* viewPortRenderer = viewPort ? viewPort->renderer() : 0) { |
| 235 viewPortRenderer->style()->setHeight(Length()); | 235 viewPortRenderer->style()->setHeight(Length()); |
| 236 viewPortRenderer->style()->setWidth(Length()); | 236 viewPortRenderer->style()->setWidth(Length()); |
| 237 } | 237 } |
| 238 Element* container = containerElement(); | 238 Element* container = containerElement(); |
| 239 if (RenderObject* containerRenderer = container ? container->renderer() : 0)
{ | 239 if (RenderObject* containerRenderer = container ? container->renderer() : 0)
{ |
| 240 containerRenderer->style()->setHeight(Length()); | 240 containerRenderer->style()->setHeight(Length()); |
| 241 containerRenderer->style()->setWidth(Length()); | 241 containerRenderer->style()->setWidth(Length()); |
| 242 } | 242 } |
| 243 RenderObject* innerTextRenderer = innerTextElement()->renderer(); | 243 RenderObject* innerEditorRenderer = innerEditorElement()->renderer(); |
| 244 if (innerTextRenderer && diff.needsFullLayout()) | 244 if (innerEditorRenderer && diff.needsFullLayout()) |
| 245 innerTextRenderer->setNeedsLayoutAndFullPaintInvalidation(); | 245 innerEditorRenderer->setNeedsLayoutAndFullPaintInvalidation(); |
| 246 if (HTMLElement* placeholder = inputElement()->placeholderElement()) | 246 if (HTMLElement* placeholder = inputElement()->placeholderElement()) |
| 247 placeholder->setInlineStyleProperty(CSSPropertyTextOverflow, textShouldB
eTruncated() ? CSSValueEllipsis : CSSValueClip); | 247 placeholder->setInlineStyleProperty(CSSPropertyTextOverflow, textShouldB
eTruncated() ? CSSValueEllipsis : CSSValueClip); |
| 248 setHasOverflowClip(false); | 248 setHasOverflowClip(false); |
| 249 } | 249 } |
| 250 | 250 |
| 251 void RenderTextControlSingleLine::capsLockStateMayHaveChanged() | 251 void RenderTextControlSingleLine::capsLockStateMayHaveChanged() |
| 252 { | 252 { |
| 253 if (!node()) | 253 if (!node()) |
| 254 return; | 254 return; |
| 255 | 255 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 } | 332 } |
| 333 | 333 |
| 334 return result; | 334 return result; |
| 335 } | 335 } |
| 336 | 336 |
| 337 LayoutUnit RenderTextControlSingleLine::computeControlLogicalHeight(LayoutUnit l
ineHeight, LayoutUnit nonContentHeight) const | 337 LayoutUnit RenderTextControlSingleLine::computeControlLogicalHeight(LayoutUnit l
ineHeight, LayoutUnit nonContentHeight) const |
| 338 { | 338 { |
| 339 return lineHeight + nonContentHeight; | 339 return lineHeight + nonContentHeight; |
| 340 } | 340 } |
| 341 | 341 |
| 342 PassRefPtr<RenderStyle> RenderTextControlSingleLine::createInnerTextStyle(const
RenderStyle* startStyle) const | 342 PassRefPtr<RenderStyle> RenderTextControlSingleLine::createInnerEditorStyle(cons
t RenderStyle* startStyle) const |
| 343 { | 343 { |
| 344 RefPtr<RenderStyle> textBlockStyle = RenderStyle::create(); | 344 RefPtr<RenderStyle> textBlockStyle = RenderStyle::create(); |
| 345 textBlockStyle->inheritFrom(startStyle); | 345 textBlockStyle->inheritFrom(startStyle); |
| 346 adjustInnerTextStyle(textBlockStyle.get()); | 346 adjustInnerEditorStyle(textBlockStyle.get()); |
| 347 | 347 |
| 348 textBlockStyle->setWhiteSpace(PRE); | 348 textBlockStyle->setWhiteSpace(PRE); |
| 349 textBlockStyle->setOverflowWrap(NormalOverflowWrap); | 349 textBlockStyle->setOverflowWrap(NormalOverflowWrap); |
| 350 textBlockStyle->setOverflowX(OHIDDEN); | 350 textBlockStyle->setOverflowX(OHIDDEN); |
| 351 textBlockStyle->setOverflowY(OHIDDEN); | 351 textBlockStyle->setOverflowY(OHIDDEN); |
| 352 textBlockStyle->setTextOverflow(textShouldBeTruncated() ? TextOverflowEllips
is : TextOverflowClip); | 352 textBlockStyle->setTextOverflow(textShouldBeTruncated() ? TextOverflowEllips
is : TextOverflowClip); |
| 353 | 353 |
| 354 if (m_desiredInnerTextLogicalHeight >= 0) | 354 if (m_desiredInnerEditorLogicalHeight >= 0) |
| 355 textBlockStyle->setLogicalHeight(Length(m_desiredInnerTextLogicalHeight,
Fixed)); | 355 textBlockStyle->setLogicalHeight(Length(m_desiredInnerEditorLogicalHeigh
t, Fixed)); |
| 356 // Do not allow line-height to be smaller than our default. | 356 // Do not allow line-height to be smaller than our default. |
| 357 if (textBlockStyle->fontMetrics().lineSpacing() > lineHeight(true, Horizonta
lLine, PositionOfInteriorLineBoxes)) | 357 if (textBlockStyle->fontMetrics().lineSpacing() > lineHeight(true, Horizonta
lLine, PositionOfInteriorLineBoxes)) |
| 358 textBlockStyle->setLineHeight(RenderStyle::initialLineHeight()); | 358 textBlockStyle->setLineHeight(RenderStyle::initialLineHeight()); |
| 359 | 359 |
| 360 textBlockStyle->setDisplay(BLOCK); | 360 textBlockStyle->setDisplay(BLOCK); |
| 361 textBlockStyle->setUnique(); | 361 textBlockStyle->setUnique(); |
| 362 | 362 |
| 363 if (inputElement()->shouldRevealPassword()) | 363 if (inputElement()->shouldRevealPassword()) |
| 364 textBlockStyle->setTextSecurity(TSNONE); | 364 textBlockStyle->setTextSecurity(TSNONE); |
| 365 | 365 |
| 366 return textBlockStyle.release(); | 366 return textBlockStyle.release(); |
| 367 } | 367 } |
| 368 | 368 |
| 369 bool RenderTextControlSingleLine::textShouldBeTruncated() const | 369 bool RenderTextControlSingleLine::textShouldBeTruncated() const |
| 370 { | 370 { |
| 371 return document().focusedElement() != node() && style()->textOverflow() == T
extOverflowEllipsis; | 371 return document().focusedElement() != node() && style()->textOverflow() == T
extOverflowEllipsis; |
| 372 } | 372 } |
| 373 | 373 |
| 374 void RenderTextControlSingleLine::autoscroll(const IntPoint& position) | 374 void RenderTextControlSingleLine::autoscroll(const IntPoint& position) |
| 375 { | 375 { |
| 376 RenderBox* renderer = innerTextElement()->renderBox(); | 376 RenderBox* renderer = innerEditorElement()->renderBox(); |
| 377 if (!renderer) | 377 if (!renderer) |
| 378 return; | 378 return; |
| 379 | 379 |
| 380 renderer->autoscroll(position); | 380 renderer->autoscroll(position); |
| 381 } | 381 } |
| 382 | 382 |
| 383 LayoutUnit RenderTextControlSingleLine::scrollWidth() const | 383 LayoutUnit RenderTextControlSingleLine::scrollWidth() const |
| 384 { | 384 { |
| 385 if (innerTextElement()) | 385 if (innerEditorElement()) |
| 386 return innerTextElement()->scrollWidth(); | 386 return innerEditorElement()->scrollWidth(); |
| 387 return RenderBlockFlow::scrollWidth(); | 387 return RenderBlockFlow::scrollWidth(); |
| 388 } | 388 } |
| 389 | 389 |
| 390 LayoutUnit RenderTextControlSingleLine::scrollHeight() const | 390 LayoutUnit RenderTextControlSingleLine::scrollHeight() const |
| 391 { | 391 { |
| 392 if (innerTextElement()) | 392 if (innerEditorElement()) |
| 393 return innerTextElement()->scrollHeight(); | 393 return innerEditorElement()->scrollHeight(); |
| 394 return RenderBlockFlow::scrollHeight(); | 394 return RenderBlockFlow::scrollHeight(); |
| 395 } | 395 } |
| 396 | 396 |
| 397 LayoutUnit RenderTextControlSingleLine::scrollLeft() const | 397 LayoutUnit RenderTextControlSingleLine::scrollLeft() const |
| 398 { | 398 { |
| 399 if (innerTextElement()) | 399 if (innerEditorElement()) |
| 400 return innerTextElement()->scrollLeft(); | 400 return innerEditorElement()->scrollLeft(); |
| 401 return RenderBlockFlow::scrollLeft(); | 401 return RenderBlockFlow::scrollLeft(); |
| 402 } | 402 } |
| 403 | 403 |
| 404 LayoutUnit RenderTextControlSingleLine::scrollTop() const | 404 LayoutUnit RenderTextControlSingleLine::scrollTop() const |
| 405 { | 405 { |
| 406 if (innerTextElement()) | 406 if (innerEditorElement()) |
| 407 return innerTextElement()->scrollTop(); | 407 return innerEditorElement()->scrollTop(); |
| 408 return RenderBlockFlow::scrollTop(); | 408 return RenderBlockFlow::scrollTop(); |
| 409 } | 409 } |
| 410 | 410 |
| 411 void RenderTextControlSingleLine::setScrollLeft(LayoutUnit newLeft) | 411 void RenderTextControlSingleLine::setScrollLeft(LayoutUnit newLeft) |
| 412 { | 412 { |
| 413 if (innerTextElement()) | 413 if (innerEditorElement()) |
| 414 innerTextElement()->setScrollLeft(newLeft); | 414 innerEditorElement()->setScrollLeft(newLeft); |
| 415 } | 415 } |
| 416 | 416 |
| 417 void RenderTextControlSingleLine::setScrollTop(LayoutUnit newTop) | 417 void RenderTextControlSingleLine::setScrollTop(LayoutUnit newTop) |
| 418 { | 418 { |
| 419 if (innerTextElement()) | 419 if (innerEditorElement()) |
| 420 innerTextElement()->setScrollTop(newTop); | 420 innerEditorElement()->setScrollTop(newTop); |
| 421 } | 421 } |
| 422 | 422 |
| 423 HTMLInputElement* RenderTextControlSingleLine::inputElement() const | 423 HTMLInputElement* RenderTextControlSingleLine::inputElement() const |
| 424 { | 424 { |
| 425 return toHTMLInputElement(node()); | 425 return toHTMLInputElement(node()); |
| 426 } | 426 } |
| 427 | 427 |
| 428 } | 428 } |
| OLD | NEW |