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. |
| 4 * (http://www.torchmobile.com/) |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 5 * Copyright (C) 2010 Google Inc. All rights reserved. |
5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 6 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
6 * | 7 * |
7 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
11 * | 12 * |
12 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 int innerEditorBaseline = | 147 int innerEditorBaseline = |
147 innerEditorLayoutObject->inlineBlockBaseline(HorizontalLine); | 148 innerEditorLayoutObject->inlineBlockBaseline(HorizontalLine); |
148 // We use firstLineBoxBaseline() for placeholder. | 149 // We use firstLineBoxBaseline() for placeholder. |
149 // TODO(tkent): It's inconsistent with innerEditorBaseline. However | 150 // TODO(tkent): It's inconsistent with innerEditorBaseline. However |
150 // placeholderBox->inlineBlockBase() is unexpectedly larger. | 151 // placeholderBox->inlineBlockBase() is unexpectedly larger. |
151 int placeholderBaseline = placeholderBox->firstLineBoxBaseline(); | 152 int placeholderBaseline = placeholderBox->firstLineBoxBaseline(); |
152 textOffset += LayoutSize(0, innerEditorBaseline - placeholderBaseline); | 153 textOffset += LayoutSize(0, innerEditorBaseline - placeholderBaseline); |
153 } | 154 } |
154 placeholderBox->setLocation(textOffset); | 155 placeholderBox->setLocation(textOffset); |
155 | 156 |
156 // The placeholder gets layout last, after the parent text control and its o
ther children, | 157 // The placeholder gets layout last, after the parent text control and its |
157 // so in order to get the correct overflow from the placeholder we need to r
ecompute it now. | 158 // other children, so in order to get the correct overflow from the |
| 159 // placeholder we need to recompute it now. |
158 if (neededLayout) | 160 if (neededLayout) |
159 computeOverflow(clientLogicalBottom()); | 161 computeOverflow(clientLogicalBottom()); |
160 } | 162 } |
161 } | 163 } |
162 | 164 |
163 bool LayoutTextControlSingleLine::nodeAtPoint( | 165 bool LayoutTextControlSingleLine::nodeAtPoint( |
164 HitTestResult& result, | 166 HitTestResult& result, |
165 const HitTestLocation& locationInContainer, | 167 const HitTestLocation& locationInContainer, |
166 const LayoutPoint& accumulatedOffset, | 168 const LayoutPoint& accumulatedOffset, |
167 HitTestAction hitTestAction) { | 169 HitTestAction hitTestAction) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 272 |
271 // For text inputs, IE adds some extra width. | 273 // For text inputs, IE adds some extra width. |
272 if (maxCharWidth > 0.f) | 274 if (maxCharWidth > 0.f) |
273 result += maxCharWidth - charWidth; | 275 result += maxCharWidth - charWidth; |
274 | 276 |
275 if (includesDecoration) { | 277 if (includesDecoration) { |
276 HTMLElement* spinButton = innerSpinButtonElement(); | 278 HTMLElement* spinButton = innerSpinButtonElement(); |
277 if (LayoutBox* spinLayoutObject = | 279 if (LayoutBox* spinLayoutObject = |
278 spinButton ? spinButton->layoutBox() : 0) { | 280 spinButton ? spinButton->layoutBox() : 0) { |
279 result += spinLayoutObject->borderAndPaddingLogicalWidth(); | 281 result += spinLayoutObject->borderAndPaddingLogicalWidth(); |
280 // Since the width of spinLayoutObject is not calculated yet, spinLayoutOb
ject->logicalWidth() returns 0. | 282 // Since the width of spinLayoutObject is not calculated yet, |
| 283 // spinLayoutObject->logicalWidth() returns 0. |
281 // So ensureComputedStyle()->logicalWidth() is used instead. | 284 // So ensureComputedStyle()->logicalWidth() is used instead. |
282 result += spinButton->ensureComputedStyle()->logicalWidth().value(); | 285 result += spinButton->ensureComputedStyle()->logicalWidth().value(); |
283 } | 286 } |
284 } | 287 } |
285 | 288 |
286 return result; | 289 return result; |
287 } | 290 } |
288 | 291 |
289 LayoutUnit LayoutTextControlSingleLine::computeControlLogicalHeight( | 292 LayoutUnit LayoutTextControlSingleLine::computeControlLogicalHeight( |
290 LayoutUnit lineHeight, | 293 LayoutUnit lineHeight, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 // If the INPUT content height is smaller than the font height, the | 405 // If the INPUT content height is smaller than the font height, the |
403 // inner-editor element overflows the INPUT box intentionally, however it | 406 // inner-editor element overflows the INPUT box intentionally, however it |
404 // shouldn't affect outside of the INPUT box. So we ignore child overflow. | 407 // shouldn't affect outside of the INPUT box. So we ignore child overflow. |
405 } | 408 } |
406 | 409 |
407 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const { | 410 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const { |
408 return toHTMLInputElement(node()); | 411 return toHTMLInputElement(node()); |
409 } | 412 } |
410 | 413 |
411 } // namespace blink | 414 } // namespace blink |
OLD | NEW |