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

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: Rebaselined 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 c83a48e971e2f320ad1aa51b36de679d5811e4eb..0d003dce3090c7a377da7946b2673288fdc594f7 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)
// 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.
LayoutBox* innerEditorRenderer = innerEditorElement()->layoutBox();
+ bool innerEditorRendererHadLayout = innerEditorRenderer && innerEditorRenderer->needsLayout();
LayoutBox* viewPortRenderer = editingViewPortElement() ? editingViewPortElement()->layoutBox() : 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