| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 LayoutUnit RenderTextControlSingleLine::computeLogicalHeightLimit() const | 89 LayoutUnit RenderTextControlSingleLine::computeLogicalHeightLimit() const |
| 90 { | 90 { |
| 91 return containerElement() ? contentLogicalHeight() : logicalHeight(); | 91 return containerElement() ? contentLogicalHeight() : logicalHeight(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void RenderTextControlSingleLine::layout() | 94 void RenderTextControlSingleLine::layout() |
| 95 { | 95 { |
| 96 SubtreeLayoutScope layoutScope(*this); | 96 SubtreeLayoutScope layoutScope(*this); |
| 97 | 97 |
| 98 setMayNeedInvalidation(true); |
| 99 |
| 98 // FIXME: We should remove the height-related hacks in layout() and | 100 // FIXME: We should remove the height-related hacks in layout() and |
| 99 // styleDidChange(). We need them because | 101 // styleDidChange(). We need them because |
| 100 // - Center the inner elements vertically if the input height is taller than | 102 // - Center the inner elements vertically if the input height is taller than |
| 101 // the intrinsic height of the inner elements. | 103 // the intrinsic height of the inner elements. |
| 102 // - Shrink the inner elment heights if the input height is samller than the | 104 // - Shrink the inner elment heights if the input height is samller than the |
| 103 // intrinsic heights of the inner elements. | 105 // intrinsic heights of the inner elements. |
| 104 | 106 |
| 105 // We don't honor paddings and borders for textfields without decorations | 107 // We don't honor paddings and borders for textfields without decorations |
| 106 // and type=search if the text height is taller than the contentHeight() | 108 // and type=search if the text height is taller than the contentHeight() |
| 107 // because of compability. | 109 // because of compability. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 if (!container && innerTextRenderer && innerTextRenderer->height() != conten
tLogicalHeight()) { | 167 if (!container && innerTextRenderer && innerTextRenderer->height() != conten
tLogicalHeight()) { |
| 166 LayoutUnit logicalHeightDiff = innerTextRenderer->logicalHeight() - cont
entLogicalHeight(); | 168 LayoutUnit logicalHeightDiff = innerTextRenderer->logicalHeight() - cont
entLogicalHeight(); |
| 167 innerTextRenderer->setLogicalTop(innerTextRenderer->logicalTop() - (logi
calHeightDiff / 2 + layoutMod(logicalHeightDiff, 2))); | 169 innerTextRenderer->setLogicalTop(innerTextRenderer->logicalTop() - (logi
calHeightDiff / 2 + layoutMod(logicalHeightDiff, 2))); |
| 168 } else | 170 } else |
| 169 centerContainerIfNeeded(containerRenderer); | 171 centerContainerIfNeeded(containerRenderer); |
| 170 | 172 |
| 171 HTMLElement* placeholderElement = inputElement()->placeholderElement(); | 173 HTMLElement* placeholderElement = inputElement()->placeholderElement(); |
| 172 if (RenderBox* placeholderBox = placeholderElement ? placeholderElement->ren
derBox() : 0) { | 174 if (RenderBox* placeholderBox = placeholderElement ? placeholderElement->ren
derBox() : 0) { |
| 173 LayoutSize innerTextSize; | 175 LayoutSize innerTextSize; |
| 174 | 176 |
| 177 placeholderBox->setMayNeedInvalidation(true); |
| 178 |
| 175 if (innerTextRenderer) | 179 if (innerTextRenderer) |
| 176 innerTextSize = innerTextRenderer->size(); | 180 innerTextSize = innerTextRenderer->size(); |
| 177 placeholderBox->style()->setWidth(Length(innerTextSize.width() - placeho
lderBox->borderAndPaddingWidth(), Fixed)); | 181 placeholderBox->style()->setWidth(Length(innerTextSize.width() - placeho
lderBox->borderAndPaddingWidth(), Fixed)); |
| 178 placeholderBox->style()->setHeight(Length(innerTextSize.height() - place
holderBox->borderAndPaddingHeight(), Fixed)); | 182 placeholderBox->style()->setHeight(Length(innerTextSize.height() - place
holderBox->borderAndPaddingHeight(), Fixed)); |
| 179 bool neededLayout = placeholderBox->needsLayout(); | 183 bool neededLayout = placeholderBox->needsLayout(); |
| 180 bool placeholderBoxHadLayout = placeholderBox->everHadLayout(); | 184 bool placeholderBoxHadLayout = placeholderBox->everHadLayout(); |
| 181 placeholderBox->layoutIfNeeded(); | 185 placeholderBox->layoutIfNeeded(); |
| 182 LayoutPoint textOffset; | 186 LayoutPoint textOffset; |
| 183 if (innerTextRenderer) | 187 if (innerTextRenderer) |
| 184 textOffset = innerTextRenderer->location(); | 188 textOffset = innerTextRenderer->location(); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 if (innerTextElement()) | 428 if (innerTextElement()) |
| 425 innerTextElement()->setScrollTop(newTop); | 429 innerTextElement()->setScrollTop(newTop); |
| 426 } | 430 } |
| 427 | 431 |
| 428 HTMLInputElement* RenderTextControlSingleLine::inputElement() const | 432 HTMLInputElement* RenderTextControlSingleLine::inputElement() const |
| 429 { | 433 { |
| 430 return toHTMLInputElement(node()); | 434 return toHTMLInputElement(node()); |
| 431 } | 435 } |
| 432 | 436 |
| 433 } | 437 } |
| OLD | NEW |