INPUT text field: Fix a chopped editing text issue.

This CL fixes crbug.com/576589.  The editing text looked to be chopped because:
 - the selected font height is taller than the specified |line-height|.
 - the specified |height| is taller than the |line-height|.
 - So, the inner-editor element is shorter though the INPUT box has enough space.

This CL fixes the problem by the following changes:

* Resetting CSS line-height if CSS height is specified.
  In such case line-height makes no sense, and we don't need to clip the
  inner-editor element with it.

  However, this change causes a regression for crbug.com/519331.  So we need
  the change below.  It's an alternative fix for crbug.com/519331 rather than
  crbug.com/576589.

* Always center the inner-editor element vertically regardless of its height,
  don't override the height, and clip editing text with controlClipRect().

  Before this change, if the inner-editor height was taller than the INPUT box
  height, we put the inner-editor element on the top edge of the INPUT box, and
  overrode its height to clip the text.
  Instead of it, we always center the inner-editor element vertically like
  Firefox does. Also, this change also removes the quirky behavior such that
  editing text poked INPUT padding and border.

BUG=576589, 461117, 361728
TEST=automated

Review URL: https://codereview.chromium.org/1584683002

Cr-Commit-Position: refs/heads/master@{#369975}
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index 5c03ec2..ed6ba59 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -246,6 +246,14 @@
 
 crbug.com/569139 fast/js/string-replace-2.html [ NeedsManualRebaseline ]
 crbug.com/569139 fast/js/regexp-caching.html [ NeedsManualRebaseline ]
+crbug.com/576589 editing/selection/select-across-readonly-input-3.html [ NeedsRebaseline ]
+crbug.com/576589 fast/forms/search/search-vertical-alignment.html [ NeedsRebaseline ]
+crbug.com/576589 fast/forms/text/textfield-overflow-by-value-update.html [ NeedsRebaseline ]
+crbug.com/576589 fast/forms/text/textfield-overflow.html [ NeedsRebaseline ]
+crbug.com/576589 fast/repaint/change-text-content-and-background-color.html [ NeedsRebaseline ]
+crbug.com/576589 fast/repaint/multi-layout-one-frame.html [ NeedsRebaseline ]
+crbug.com/576589 fast/repaint/subtree-root-skipped.html [ NeedsRebaseline ]
+crbug.com/576589 fast/text/international/mixed-directionality-selection.html [ NeedsRebaseline ]
 
 crbug.com/498539 http/tests/inspector/elements/styles/selector-line.html [ Pass Timeout ]
 crbug.com/498539 http/tests/inspector/network/network-datareceived.html [ Pass Timeout ]
@@ -1102,7 +1110,6 @@
 crbug.com/521730 [ Win10 ] fast/text/international/bidi-linebreak-003.html [ Failure ]
 crbug.com/521730 [ Win10 ] fast/text/international/bidi-word-spacing-rtl.html [ Failure ]
 crbug.com/521730 [ Win10 ] fast/text/international/inline-block-with-mixed-direction-words.html [ Failure ]
-crbug.com/521730 [ Win10 ] fast/text/international/mixed-directionality-selection.html [ Failure ]
 crbug.com/521730 [ Win10 ] fast/text/international/plane2.html [ Failure ]
 crbug.com/521730 [ Win10 ] fast/text/letter-spacing-negative-opacity.html [ Failure ]
 crbug.com/521730 [ Win10 ] fast/text/line-breaks-after-white-space.html [ Failure ]
@@ -1375,7 +1382,7 @@
 crbug.com/568559 [ Android Linux Win ] tables/mozilla/bugs/bug29326.html [ NeedsRebaseline ]
 crbug.com/568559 [ Android Linux Win ] fast/forms/select/HTMLOptionElement_label06.html [ NeedsRebaseline ]
 crbug.com/568559 [ Android Linux Win ] fast/parser/document-write-option.html [ NeedsRebaseline ]
-crbug.com/568559 [ Android Linux Win ] fast/forms/text/text-font-height-mismatch.html [ NeedsRebaseline ]
+crbug.com/568559 fast/forms/text/text-font-height-mismatch.html [ NeedsRebaseline ]
 crbug.com/568559 [ Android Linux Win ] editing/selection/select-box.html [ NeedsRebaseline ]
 crbug.com/568559 [ Android Linux Win ] fast/forms/001.html [ NeedsRebaseline ]
 crbug.com/568559 [ Android Linux Win ] fast/forms/select-popup/popup-menu-appearance.html [ NeedsRebaseline ]
diff --git a/third_party/WebKit/LayoutTests/fast/forms/input-textarea-padding-match-expected.html b/third_party/WebKit/LayoutTests/fast/forms/input-textarea-padding-match-expected.html
index fca67f4..69677bb0 100644
--- a/third_party/WebKit/LayoutTests/fast/forms/input-textarea-padding-match-expected.html
+++ b/third_party/WebKit/LayoutTests/fast/forms/input-textarea-padding-match-expected.html
@@ -11,7 +11,6 @@
   margin: 0;
   resize: none;
   width: 20px;
-  height: 10px;
   overflow: hidden;
 }
 </style>
diff --git a/third_party/WebKit/LayoutTests/fast/forms/input-textarea-padding-match.html b/third_party/WebKit/LayoutTests/fast/forms/input-textarea-padding-match.html
index 35347d3..9949f06 100644
--- a/third_party/WebKit/LayoutTests/fast/forms/input-textarea-padding-match.html
+++ b/third_party/WebKit/LayoutTests/fast/forms/input-textarea-padding-match.html
@@ -11,7 +11,6 @@
   margin: 0;
   resize: none;
   width: 20px;
-  height: 10px;
   overflow: hidden;
 }
 </style>
diff --git a/third_party/WebKit/LayoutTests/fast/forms/text/text-font-height-mismatch.html b/third_party/WebKit/LayoutTests/fast/forms/text/text-font-height-mismatch.html
index 168dea30..5ac3278 100644
--- a/third_party/WebKit/LayoutTests/fast/forms/text/text-font-height-mismatch.html
+++ b/third_party/WebKit/LayoutTests/fast/forms/text/text-font-height-mismatch.html
@@ -19,7 +19,12 @@
 document.fonts.ready.then(function() {
     document.getElementById('webfont').innerHTML = '<input style="border:' +
         'solid 1px black; font-size:16px; font-family:NotoSansCJK;"' + 
+        'value="&#x3075; ABCgjy">' +
+        '<input style="border: solid 1px black; font-size:16px; ' +
+        'line-height:17px; height:24px; font-family:NotoSansCJK;"' + 
         'value="&#x3075; ABCgjy">';
+    // The first INPUT is for crbug.com/519331.
+    // The second INPUT is for crbug.com/576589.
     if (window.testRunner)
         testRunner.notifyDone();
 });
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search/search-vertical-alignment-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search/search-vertical-alignment-expected.png
index 7c1adcb..996553ec 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search/search-vertical-alignment-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search/search-vertical-alignment-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search/search-vertical-alignment-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search/search-vertical-alignment-expected.txt
index c88ba26a..8f2911b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search/search-vertical-alignment-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search/search-vertical-alignment-expected.txt
@@ -29,13 +29,13 @@
         LayoutTextControl {INPUT} at (135,2) size 131x16 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {P} at (0,147) size 784x18
-        LayoutTextControl {INPUT} at (0,0) size 131x12 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutTextControl {INPUT} at (0,4) size 131x12 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
           LayoutFlexibleBox {DIV} at (3,0) size 125x12
             LayoutBlockFlow {DIV} at (0,0) size 16x13
-            LayoutBlockFlow {DIV} at (16,3) size 97x6
+            LayoutBlockFlow {DIV} at (16,-0.50) size 97x13
         LayoutText {#text} at (131,0) size 4x18
           text run at (131,0) width 4: " "
-        LayoutTextControl {INPUT} at (135,0) size 131x12 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutTextControl {INPUT} at (135,4) size 131x12 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
 layer at (27,76) size 97x13
   LayoutBlockFlow {DIV} at (0,0) size 97x13
@@ -53,17 +53,17 @@
   LayoutBlockFlow {DIV} at (3,1.50) size 125x13
     LayoutText {#text} at (0,0) size 21x13
       text run at (0,0) width 21: "Text"
-layer at (27,158) size 97x6 scrollHeight 13
-  LayoutBlockFlow {DIV} at (0,0) size 97x6
+layer at (27,159) size 97x13
+  LayoutBlockFlow {DIV} at (0,0) size 97x13
     LayoutText {#text} at (0,0) size 21x13
       text run at (0,0) width 21: "Text"
-layer at (146,158) size 125x6 scrollHeight 13
-  LayoutBlockFlow {DIV} at (3,3) size 125x6
+layer at (146,159) size 125x13
+  LayoutBlockFlow {DIV} at (3,-0.50) size 125x13
     LayoutText {#text} at (0,0) size 21x13
       text run at (0,0) width 21: "Text"
 layer at (125,77) size 11x11 transparent
   LayoutBlockFlow {DIV} at (114,14) size 11x11
 layer at (125,126) size 11x11 transparent
   LayoutBlockFlow {DIV} at (114,1) size 11x11
-layer at (125,156) size 11x11 transparent
+layer at (125,160) size 11x11 transparent
   LayoutBlockFlow {DIV} at (114,0.50) size 11x11
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/text-font-height-mismatch-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/text-font-height-mismatch-expected.png
index a01ef7c..4c2c034c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/text-font-height-mismatch-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/text-font-height-mismatch-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/text-font-height-mismatch-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/text-font-height-mismatch-expected.txt
index 1f30f7f..36474e3c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/text-font-height-mismatch-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/text-font-height-mismatch-expected.txt
@@ -8,6 +8,7 @@
           text run at (0,0) width 273: "Editable text should be centered vertically."
       LayoutBlockFlow {DIV} at (0,34) size 784x28
         LayoutTextControl {INPUT} at (0,0) size 251x28 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+        LayoutTextControl {INPUT} at (251,0) size 251x28 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
       LayoutBlockFlow {DIV} at (0,62) size 784x28
         LayoutTextControl {INPUT} at (0,0) size 274x28 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
       LayoutBlockFlow {DIV} at (0,90) size 784x28
@@ -16,6 +17,10 @@
   LayoutBlockFlow {DIV} at (2,2) size 247x24
     LayoutText {#text} at (0,0) size 74x24
       text run at (0,0) width 74: "\x{3075} ABCgjy"
+layer at (261,52) size 247x24
+  LayoutBlockFlow {DIV} at (2,2) size 247x24
+    LayoutText {#text} at (0,0) size 74x24
+      text run at (0,0) width 74: "\x{3075} ABCgjy"
 layer at (10,78) size 270x28
   LayoutBlockFlow {DIV} at (2,0) size 270x28
     LayoutText {#text} at (0,0) size 82x28
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/textfield-overflow-by-value-update-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/textfield-overflow-by-value-update-expected.txt
index d53c4510..3584f87a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/textfield-overflow-by-value-update-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/textfield-overflow-by-value-update-expected.txt
@@ -1,12 +1,12 @@
 layer at (0,0) size 800x600
   LayoutView at (0,0) size 800x600
-layer at (0,0) size 800x52
-  LayoutBlockFlow {HTML} at (0,0) size 800x52
-    LayoutBlockFlow {BODY} at (8,8) size 784x36
-      LayoutTextControl {INPUT} at (0,0) size 102x2 [bgcolor=#FFFFFF]
+layer at (0,0) size 800x34
+  LayoutBlockFlow {HTML} at (0,0) size 800x34
+    LayoutBlockFlow {BODY} at (8,8) size 784x18
+      LayoutTextControl {INPUT} at (0,2) size 100x0 [bgcolor=#FFFFFF]
       LayoutText {#text} at (0,0) size 0x0
       LayoutText {#text} at (0,0) size 0x0
-layer at (9,9) size 100x0 scrollHeight 38
-  LayoutBlockFlow {DIV} at (1,1) size 100x0
+layer at (8,-9) size 100x38 backgroundClip at (8,0) size 100x29 clip at (8,0) size 100x29
+  LayoutBlockFlow {DIV} at (0,-19) size 100x38
     LayoutText {#text} at (0,0) size 65x38
       text run at (0,0) width 65: "FAIL"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/textfield-overflow-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/textfield-overflow-expected.txt
index d1915d8..47a1e1cb 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/textfield-overflow-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/textfield-overflow-expected.txt
@@ -6,6 +6,6 @@
       LayoutTextControl {INPUT} at (0,0) size 131x10 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
       LayoutText {#text} at (0,0) size 0x0
-layer at (11,11) size 125x4 scrollHeight 13
-  LayoutBlockFlow {DIV} at (3,3) size 125x4
+layer at (11,7) size 125x13
+  LayoutBlockFlow {DIV} at (3,-1.50) size 125x13
 caret: position 0 of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/change-text-content-and-background-color-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/change-text-content-and-background-color-expected.txt
index 14c7ab7..bb90eaaf1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/change-text-content-and-background-color-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/change-text-content-and-background-color-expected.txt
@@ -12,11 +12,10 @@
         [8, 8, 244, 67]
       ],
       "paintInvalidationClients": [
-        "RootInlineBox",
         "InlineTextBox ''",
+        "RootInlineBox",
         "LayoutTextControl (positioned) INPUT id='input'",
         "LayoutBlockFlow DIV id='inner-editor'",
-        "RootInlineBox",
         "LayoutText #text",
         "InlineTextBox 'NEW'"
       ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/multi-layout-one-frame-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/multi-layout-one-frame-expected.txt
index 1b1d47b..604b122 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/multi-layout-one-frame-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/multi-layout-one-frame-expected.txt
@@ -14,16 +14,14 @@
         [11, 11, 37, 13]
       ],
       "paintInvalidationClients": [
-        "RootInlineBox",
         "InlineTextBox ''",
         "RootInlineBox",
         "InlineTextBox ''",
+        "RootInlineBox",
         "LayoutBlockFlow DIV id='inner-editor'",
-        "RootInlineBox",
         "LayoutText #text",
         "InlineTextBox 'PASSED'",
         "LayoutBlockFlow DIV id='inner-editor'",
-        "RootInlineBox",
         "LayoutText #text",
         "InlineTextBox 'PASSED'"
       ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/subtree-root-skipped-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/subtree-root-skipped-expected.txt
index a865b58..3f32cc3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/subtree-root-skipped-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/subtree-root-skipped-expected.txt
@@ -13,10 +13,9 @@
         [8, 288, 10, 20]
       ],
       "paintInvalidationClients": [
-        "RootInlineBox",
         "InlineTextBox ''",
-        "LayoutBlockFlow DIV id='inner-editor'",
         "RootInlineBox",
+        "LayoutBlockFlow DIV id='inner-editor'",
         "LayoutText #text",
         "InlineTextBox 'PASS'",
         "LayoutBlockFlow (positioned) DIV id='div'"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/mixed-directionality-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/mixed-directionality-selection-expected.png
index 3248e15..beecdf30 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/mixed-directionality-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/mixed-directionality-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/mixed-directionality-selection-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/mixed-directionality-selection-expected.txt
index 7c04f35..53a6428a3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/mixed-directionality-selection-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/mixed-directionality-selection-expected.txt
@@ -10,8 +10,8 @@
         LayoutText {#text} at (0,0) size 560x18
           text run at (0,0) width 367: "The last character (and only the last character) should be "
           text run at (366,0) width 194: "selected in the text box above."
-layer at (11,11) size 200x76 scrollHeight 88
-  LayoutBlockFlow {DIV} at (3,3) size 200x76
+layer at (11,5) size 200x88
+  LayoutBlockFlow {DIV} at (3,-3) size 200x88
     LayoutText {#text} at (27,0) size 173x76
       text run at (27,0) width 173 RTL: "[[\x{645}\x{642}\x{627}\x{644}\x{647}]]"
 selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
diff --git a/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.cpp b/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.cpp
index bc07abd..a86df4b 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.cpp
@@ -46,7 +46,6 @@
 LayoutTextControlSingleLine::LayoutTextControlSingleLine(HTMLInputElement* element)
     : LayoutTextControl(element)
     , m_shouldDrawCapsLockIndicator(false)
-    , m_desiredInnerEditorLogicalHeight(-1)
 {
 }
 
@@ -110,32 +109,14 @@
     //   the intrinsic height of the inner elements.
     // - Shrink the inner elment heights if the input height is samller than the
     //   intrinsic heights of the inner elements.
+    // The hack was removed for the inner-editor element.  We should remove it
+    // for containerElement() too.
 
-    // We don't honor paddings and borders for textfields without decorations
-    // and type=search if the text height is taller than the contentHeight()
-    // because of compability.
+    // We don't honor paddings and borders for type=search if the text height is
+    // taller than the contentHeight() because of compatibility.
 
     LayoutBox* innerEditorLayoutObject = innerEditorElement()->layoutBox();
     bool innerEditorLayoutObjectHadLayout = innerEditorLayoutObject && innerEditorLayoutObject->needsLayout();
-    LayoutBox* viewPortLayoutObject = editingViewPortElement() ? editingViewPortElement()->layoutBox() : 0;
-
-    // To ensure consistency between layouts, we need to reset any conditionally overriden height.
-    if (innerEditorLayoutObject) {
-        innerEditorLayoutObject->clearOverrideLogicalContentHeight();
-        // TODO(jchaffraix): We could probably skip some of these due to
-        // forcing children relayout below but keeping them for safety for now.
-        layoutScope.setNeedsLayout(innerEditorLayoutObject, LayoutInvalidationReason::TextControlChanged);
-        HTMLElement* placeholderElement = inputElement()->placeholderElement();
-        if (LayoutBox* placeholderBox = placeholderElement ? placeholderElement->layoutBox() : 0)
-            layoutScope.setNeedsLayout(placeholderBox, LayoutInvalidationReason::TextControlChanged);
-    }
-    // TODO(jchaffraix): This logic is not correct and will yield to bugs such
-    // as crbug.com/529252. The fix is similar to what is done with
-    // innerEditorLayoutObject above.
-    if (viewPortLayoutObject && !viewPortLayoutObject->styleRef().logicalHeight().isAuto()) {
-        viewPortLayoutObject->mutableStyleRef().setLogicalHeight(Length(Auto));
-        layoutScope.setNeedsLayout(viewPortLayoutObject, LayoutInvalidationReason::TextControlChanged);
-    }
 
     // This is the measuring phase. Thus we force children to be relayout so
     // that the checks below are executed consistently.
@@ -144,22 +125,7 @@
     Element* container = containerElement();
     LayoutBox* containerLayoutObject = container ? container->layoutBox() : 0;
 
-    // Set the text block height
-    LayoutUnit desiredLogicalHeight = textBlockLogicalHeight();
     LayoutUnit logicalHeightLimit = computeLogicalHeightLimit();
-    if (innerEditorLayoutObject && innerEditorLayoutObject->logicalHeight() > logicalHeightLimit) {
-        if (desiredLogicalHeight != innerEditorLayoutObject->logicalHeight())
-            layoutScope.setNeedsLayout(this, LayoutInvalidationReason::TextControlChanged);
-
-        m_desiredInnerEditorLogicalHeight = desiredLogicalHeight;
-
-        innerEditorLayoutObject->setOverrideLogicalContentHeight(desiredLogicalHeight);
-        layoutScope.setNeedsLayout(innerEditorLayoutObject, LayoutInvalidationReason::TextControlChanged);
-        if (viewPortLayoutObject) {
-            viewPortLayoutObject->mutableStyleRef().setLogicalHeight(Length(desiredLogicalHeight, Fixed));
-            layoutScope.setNeedsLayout(viewPortLayoutObject, LayoutInvalidationReason::TextControlChanged);
-        }
-    }
     // The container might be taller because of decoration elements.
     if (containerLayoutObject) {
         containerLayoutObject->layoutIfNeeded();
@@ -243,16 +209,10 @@
 
 void LayoutTextControlSingleLine::styleDidChange(StyleDifference diff, const ComputedStyle* oldStyle)
 {
-    m_desiredInnerEditorLogicalHeight = -1;
     LayoutTextControl::styleDidChange(diff, oldStyle);
 
     // We may have set the width and the height in the old style in layout().
     // Reset them now to avoid getting a spurious layout hint.
-    Element* viewPort = editingViewPortElement();
-    if (LayoutObject* viewPortLayoutObject = viewPort ? viewPort->layoutObject() : 0) {
-        viewPortLayoutObject->mutableStyleRef().setHeight(Length());
-        viewPortLayoutObject->mutableStyleRef().setWidth(Length());
-    }
     Element* container = containerElement();
     if (LayoutObject* containerLayoutObject = container ? container->layoutObject() : 0) {
         containerLayoutObject->mutableStyleRef().setHeight(Length());
@@ -286,15 +246,13 @@
 
 bool LayoutTextControlSingleLine::hasControlClip() const
 {
-    // Apply control clip for text fields with decorations.
-    return !!containerElement();
+    return true;
 }
 
 LayoutRect LayoutTextControlSingleLine::controlClipRect(const LayoutPoint& additionalOffset) const
 {
-    ASSERT(hasControlClip());
     LayoutRect clipRect = contentBoxRect();
-    if (containerElement()->layoutBox())
+    if (containerElement() && containerElement()->layoutBox())
         clipRect = unionRect(clipRect, containerElement()->layoutBox()->frameRect());
     clipRect.moveBy(additionalOffset);
     return clipRect;
@@ -364,10 +322,8 @@
     textBlockStyle->setOverflowWrap(NormalOverflowWrap);
     textBlockStyle->setTextOverflow(textShouldBeTruncated() ? TextOverflowEllipsis : TextOverflowClip);
 
-    if (m_desiredInnerEditorLogicalHeight >= 0)
-        textBlockStyle->setLogicalHeight(Length(m_desiredInnerEditorLogicalHeight, Fixed));
     // Do not allow line-height to be smaller than our default.
-    if (textBlockStyle->fontSize() >= lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes))
+    if (textBlockStyle->fontSize() >= lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes) || !startStyle.logicalHeight().isIntrinsicOrAuto())
         textBlockStyle->setLineHeight(ComputedStyle::initialLineHeight());
 
     textBlockStyle->setDisplay(BLOCK);
diff --git a/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.h b/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.h
index 6e99885..389c599 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.h
+++ b/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.h
@@ -78,7 +78,6 @@
     HTMLElement* innerSpinButtonElement() const;
 
     bool m_shouldDrawCapsLockIndicator;
-    LayoutUnit m_desiredInnerEditorLogicalHeight;
 };
 
 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTextControlSingleLine, isTextField());