Index: third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.cpp b/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.cpp |
index a86df4b6cec4bb37ef1f3601a7e9612ad6e4c39a..b8619f2aff453f0e0820542e1c912c14261effdc 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.cpp |
@@ -165,7 +165,6 @@ void LayoutTextControlSingleLine::layout() |
if (innerEditorLayoutObject) |
innerEditorSize = innerEditorLayoutObject->size(); |
placeholderBox->mutableStyleRef().setWidth(Length(innerEditorSize.width() - placeholderBox->borderAndPaddingWidth(), Fixed)); |
- placeholderBox->mutableStyleRef().setHeight(Length(innerEditorSize.height() - placeholderBox->borderAndPaddingHeight(), Fixed)); |
bool neededLayout = placeholderBox->needsLayout(); |
placeholderBox->layoutIfNeeded(); |
LayoutPoint textOffset; |
@@ -175,6 +174,16 @@ void LayoutTextControlSingleLine::layout() |
textOffset += toLayoutSize(editingViewPortElement()->layoutBox()->location()); |
if (containerLayoutObject) |
textOffset += toLayoutSize(containerLayoutObject->location()); |
+ if (innerEditorLayoutObject) { |
+ // We use inlineBlockBaseline() for innerEditor because it has no |
+ // inline boxes when we show the placeholder. |
+ int innerEditorBaseline = innerEditorLayoutObject->inlineBlockBaseline(HorizontalLine); |
+ // We use firstLineBoxBaseline() for placeholder. |
+ // TODO(tkent): It's inconsistent with innerEditorBaseline. However |
+ // placeholderBox->inlineBlockBase() is unexpectedly larger. |
+ int placeholderBaseline = placeholderBox->firstLineBoxBaseline(); |
+ textOffset += LayoutSize(0, innerEditorBaseline - placeholderBaseline); |
+ } |
placeholderBox->setLocation(textOffset); |
// The placeholder gets layout last, after the parent text control and its other children, |