Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: Source/core/rendering/RenderTextControlSingleLine.cpp

Issue 230193002: Spin button in input[type=number] should not ignore paddings. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/css/themeMac.css ('k') | Source/platform/mac/ThemeMac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 if (needsLayout()) 158 if (needsLayout())
159 RenderBlockFlow::layoutBlock(true); 159 RenderBlockFlow::layoutBlock(true);
160 160
161 // Center the child block in the block progression direction (vertical cente ring for horizontal text fields). 161 // Center the child block in the block progression direction (vertical cente ring for horizontal text fields).
162 if (!container && innerTextRenderer && innerTextRenderer->height() != conten tLogicalHeight()) { 162 if (!container && innerTextRenderer && innerTextRenderer->height() != conten tLogicalHeight()) {
163 LayoutUnit logicalHeightDiff = innerTextRenderer->logicalHeight() - cont entLogicalHeight(); 163 LayoutUnit logicalHeightDiff = innerTextRenderer->logicalHeight() - cont entLogicalHeight();
164 innerTextRenderer->setLogicalTop(innerTextRenderer->logicalTop() - (logi calHeightDiff / 2 + layoutMod(logicalHeightDiff, 2))); 164 innerTextRenderer->setLogicalTop(innerTextRenderer->logicalTop() - (logi calHeightDiff / 2 + layoutMod(logicalHeightDiff, 2)));
165 } else 165 } else
166 centerContainerIfNeeded(containerRenderer); 166 centerContainerIfNeeded(containerRenderer);
167 167
168 // Ignores the paddings for the inner spin button.
169 if (RenderBox* innerSpinBox = innerSpinButtonElement() ? innerSpinButtonElem ent()->renderBox() : 0) {
170 RenderBox* parentBox = innerSpinBox->parentBox();
171 if (containerRenderer && !containerRenderer->style()->isLeftToRightDirec tion())
172 innerSpinBox->setLogicalLocation(LayoutPoint(-paddingLogicalLeft(), -paddingBefore()));
173 else
174 innerSpinBox->setLogicalLocation(LayoutPoint(parentBox->logicalWidth () - innerSpinBox->logicalWidth() + paddingLogicalRight(), -paddingBefore()));
175 innerSpinBox->setLogicalHeight(logicalHeight() - borderBefore() - border After());
176 }
177
178 HTMLElement* placeholderElement = inputElement()->placeholderElement(); 168 HTMLElement* placeholderElement = inputElement()->placeholderElement();
179 if (RenderBox* placeholderBox = placeholderElement ? placeholderElement->ren derBox() : 0) { 169 if (RenderBox* placeholderBox = placeholderElement ? placeholderElement->ren derBox() : 0) {
180 LayoutSize innerTextSize; 170 LayoutSize innerTextSize;
181 171
182 if (innerTextRenderer) 172 if (innerTextRenderer)
183 innerTextSize = innerTextRenderer->size(); 173 innerTextSize = innerTextRenderer->size();
184 placeholderBox->style()->setWidth(Length(innerTextSize.width() - placeho lderBox->borderAndPaddingWidth(), Fixed)); 174 placeholderBox->style()->setWidth(Length(innerTextSize.width() - placeho lderBox->borderAndPaddingWidth(), Fixed));
185 placeholderBox->style()->setHeight(Length(innerTextSize.height() - place holderBox->borderAndPaddingHeight(), Fixed)); 175 placeholderBox->style()->setHeight(Length(innerTextSize.height() - place holderBox->borderAndPaddingHeight(), Fixed));
186 bool neededLayout = placeholderBox->needsLayout(); 176 bool neededLayout = placeholderBox->needsLayout();
187 bool placeholderBoxHadLayout = placeholderBox->everHadLayout(); 177 bool placeholderBoxHadLayout = placeholderBox->everHadLayout();
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 if (innerTextElement()) 421 if (innerTextElement())
432 innerTextElement()->setScrollTop(newTop); 422 innerTextElement()->setScrollTop(newTop);
433 } 423 }
434 424
435 HTMLInputElement* RenderTextControlSingleLine::inputElement() const 425 HTMLInputElement* RenderTextControlSingleLine::inputElement() const
436 { 426 {
437 return toHTMLInputElement(node()); 427 return toHTMLInputElement(node());
438 } 428 }
439 429
440 } 430 }
OLDNEW
« no previous file with comments | « Source/core/css/themeMac.css ('k') | Source/platform/mac/ThemeMac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698