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

Side by Side Diff: Source/core/layout/LayoutTextControlSingleLine.cpp

Issue 952663002: Text inside input field gets misaligned when relaying out (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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 | « LayoutTests/fast/forms/relayout-shifts-inner-editor-expected.html ('k') | no next file » | 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 containerRenderer->style()->setLogicalHeight(Length(logicalHeightLim it, Fixed)); 150 containerRenderer->style()->setLogicalHeight(Length(logicalHeightLim it, Fixed));
151 layoutScope.setNeedsLayout(this); 151 layoutScope.setNeedsLayout(this);
152 } else if (containerRenderer->logicalHeight() < contentLogicalHeight()) { 152 } else if (containerRenderer->logicalHeight() < contentLogicalHeight()) {
153 containerRenderer->style()->setLogicalHeight(Length(contentLogicalHe ight(), Fixed)); 153 containerRenderer->style()->setLogicalHeight(Length(contentLogicalHe ight(), Fixed));
154 layoutScope.setNeedsLayout(this); 154 layoutScope.setNeedsLayout(this);
155 } else { 155 } else {
156 containerRenderer->style()->setLogicalHeight(Length(containerLogical Height, Fixed)); 156 containerRenderer->style()->setLogicalHeight(Length(containerLogical Height, Fixed));
157 } 157 }
158 } 158 }
159 159
160 // Make sure the inner editor renderer is relaid out here. This prevents any possibility
161 // of bad placement below as we read stale values.
162 if (!container && innerEditorRenderer && innerEditorRenderer->size().height( ) != contentLogicalHeight())
dsinclair 2015/02/23 21:00:43 We don't care about width() != contentLogicalWidth
leviw_travelin_and_unemployed 2015/02/23 21:02:00 The conditions of this "if" are a little weird, an
Julien - ping for review 2015/02/24 01:15:35 Spot on. I was trying to be smart about when to re
163 layoutScope.setNeedsLayout(innerEditorRenderer);
164
160 // If we need another layout pass, we have changed one of children's height so we need to relayout them. 165 // If we need another layout pass, we have changed one of children's height so we need to relayout them.
161 if (needsLayout()) 166 if (needsLayout())
162 RenderBlockFlow::layoutBlock(true); 167 RenderBlockFlow::layoutBlock(true);
163 168
164 // Center the child block in the block progression direction (vertical cente ring for horizontal text fields). 169 // Center the child block in the block progression direction (vertical cente ring for horizontal text fields).
165 if (!container && innerEditorRenderer && innerEditorRenderer->size().height( ) != contentLogicalHeight()) { 170 if (!container && innerEditorRenderer && innerEditorRenderer->size().height( ) != contentLogicalHeight()) {
166 LayoutUnit logicalHeightDiff = innerEditorRenderer->logicalHeight() - co ntentLogicalHeight(); 171 LayoutUnit logicalHeightDiff = innerEditorRenderer->logicalHeight() - co ntentLogicalHeight();
167 innerEditorRenderer->setLogicalTop(innerEditorRenderer->logicalTop() - ( logicalHeightDiff / 2 + layoutMod(logicalHeightDiff, 2))); 172 innerEditorRenderer->setLogicalTop(innerEditorRenderer->logicalTop() - ( logicalHeightDiff / 2 + layoutMod(logicalHeightDiff, 2)));
168 } else { 173 } else {
169 centerContainerIfNeeded(containerRenderer); 174 centerContainerIfNeeded(containerRenderer);
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 if (innerEditorElement()) 427 if (innerEditorElement())
423 innerEditorElement()->setScrollTop(newTop); 428 innerEditorElement()->setScrollTop(newTop);
424 } 429 }
425 430
426 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const 431 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const
427 { 432 {
428 return toHTMLInputElement(node()); 433 return toHTMLInputElement(node());
429 } 434 }
430 435
431 } 436 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/relayout-shifts-inner-editor-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698