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

Unified 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: Better change. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/forms/relayout-shifts-inner-editor-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutTextControlSingleLine.cpp
diff --git a/Source/core/layout/LayoutTextControlSingleLine.cpp b/Source/core/layout/LayoutTextControlSingleLine.cpp
index d3dbf3ca121cc03bd9f1c982de55cbc3710a8045..0dc7d8cade72f937eaf548918d7e44388434e8b2 100644
--- a/Source/core/layout/LayoutTextControlSingleLine.cpp
+++ b/Source/core/layout/LayoutTextControlSingleLine.cpp
@@ -94,6 +94,7 @@ void LayoutTextControlSingleLine::layout()
{
SubtreeLayoutScope layoutScope(*this);
+ // FIXME: This code is madness (https://crbug.com/461117)
leviw_travelin_and_unemployed 2015/02/24 18:38:25 Well said, sir!
// FIXME: We should remove the height-related hacks in layout() and
// styleDidChange(). We need them because
// - Center the inner elements vertically if the input height is taller than
@@ -106,6 +107,7 @@ void LayoutTextControlSingleLine::layout()
// because of compability.
RenderBox* innerEditorRenderer = innerEditorElement()->renderBox();
+ bool innerEditorRendererHadLayout = innerEditorRenderer && innerEditorRenderer->needsLayout();
leviw_travelin_and_unemployed 2015/02/24 18:38:25 innerEditorRendererHadNeedsLayout?
Julien - ping for review 2015/02/24 18:48:01 I prefer HadLayout as it corresponds to what's hap
RenderBox* viewPortRenderer = editingViewPortElement() ? editingViewPortElement()->renderBox() : 0;
// To ensure consistency between layouts, we need to reset any conditionally overriden height.
@@ -157,6 +159,11 @@ void LayoutTextControlSingleLine::layout()
}
}
+ // We ensure that the inner editor renderer is laid out at least once. This is
+ // required as the logic below assumes that we don't carry over previous layout values.
+ if (innerEditorRenderer && !innerEditorRendererHadLayout)
+ layoutScope.setNeedsLayout(innerEditorRenderer);
+
// If we need another layout pass, we have changed one of children's height so we need to relayout them.
if (needsLayout())
RenderBlockFlow::layoutBlock(true);
« 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