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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.cpp

Issue 1915353003: INPUT textfield: Do not remove line-height of innerEditor if we don't need to remove it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 | « third_party/WebKit/LayoutTests/fast/forms/text/text-lineheight-centering-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 820c0a70ea0a8799d252b7b87cf0b379e01b4d79..47e6e63e040e414729a7a7b6f0f30b4184bfa28d 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.cpp
@@ -273,8 +273,21 @@ PassRefPtr<ComputedStyle> LayoutTextControlSingleLine::createInnerEditorStyle(co
textBlockStyle->setOverflowWrap(NormalOverflowWrap);
textBlockStyle->setTextOverflow(textShouldBeTruncated() ? TextOverflowEllipsis : TextOverflowClip);
+ int computedLineHeight = lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes);
// Do not allow line-height to be smaller than our default.
- if (textBlockStyle->fontSize() >= lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes) || !startStyle.logicalHeight().isIntrinsicOrAuto())
+ if (textBlockStyle->fontSize() >= computedLineHeight)
+ textBlockStyle->setLineHeight(ComputedStyle::initialLineHeight());
+
+ // We'd like to remove line-height if it's unnecessary because
+ // overflow:scroll clips editing text by line-height.
+ Length logicalHeight = startStyle.logicalHeight();
+ // Here, we remove line-height if the INPUT fixed height is taller than the
+ // line-height. It's not the precise condition because logicalHeight
+ // includes border and padding if box-sizing:border-box, and there are cases
+ // in which we don't want to remove line-height with percent or calculated
+ // length.
+ // TODO(tkent): This should be done during layout.
+ if (logicalHeight.hasPercent() || (logicalHeight.isFixed() && logicalHeight.getFloatValue() > computedLineHeight))
textBlockStyle->setLineHeight(ComputedStyle::initialLineHeight());
textBlockStyle->setDisplay(BLOCK);
@@ -284,6 +297,7 @@ PassRefPtr<ComputedStyle> LayoutTextControlSingleLine::createInnerEditorStyle(co
textBlockStyle->setTextSecurity(TSNONE);
textBlockStyle->setOverflowX(OverflowScroll);
+ // overflow-y:visible doesn't work because overflow-x:scroll makes a layer.
textBlockStyle->setOverflowY(OverflowScroll);
RefPtr<ComputedStyle> noScrollbarStyle = ComputedStyle::create();
noScrollbarStyle->setStyleType(PseudoIdScrollbar);
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/text/text-lineheight-centering-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698