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

Side by Side 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: Created 4 years, 7 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /** 1 /**
2 * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved.
3 * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 3 * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
4 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 PassRefPtr<ComputedStyle> LayoutTextControlSingleLine::createInnerEditorStyle(co nst ComputedStyle& startStyle) const 266 PassRefPtr<ComputedStyle> LayoutTextControlSingleLine::createInnerEditorStyle(co nst ComputedStyle& startStyle) const
267 { 267 {
268 RefPtr<ComputedStyle> textBlockStyle = ComputedStyle::create(); 268 RefPtr<ComputedStyle> textBlockStyle = ComputedStyle::create();
269 textBlockStyle->inheritFrom(startStyle); 269 textBlockStyle->inheritFrom(startStyle);
270 adjustInnerEditorStyle(*textBlockStyle); 270 adjustInnerEditorStyle(*textBlockStyle);
271 271
272 textBlockStyle->setWhiteSpace(PRE); 272 textBlockStyle->setWhiteSpace(PRE);
273 textBlockStyle->setOverflowWrap(NormalOverflowWrap); 273 textBlockStyle->setOverflowWrap(NormalOverflowWrap);
274 textBlockStyle->setTextOverflow(textShouldBeTruncated() ? TextOverflowEllips is : TextOverflowClip); 274 textBlockStyle->setTextOverflow(textShouldBeTruncated() ? TextOverflowEllips is : TextOverflowClip);
275 275
276 int computedLineHeight = lineHeight(true, HorizontalLine, PositionOfInterior LineBoxes);
276 // Do not allow line-height to be smaller than our default. 277 // Do not allow line-height to be smaller than our default.
277 if (textBlockStyle->fontSize() >= lineHeight(true, HorizontalLine, PositionO fInteriorLineBoxes) || !startStyle.logicalHeight().isIntrinsicOrAuto()) 278 if (textBlockStyle->fontSize() >= computedLineHeight)
279 textBlockStyle->setLineHeight(ComputedStyle::initialLineHeight());
280
281 // We'd like to remove line-height if it's unnecessary because
282 // overflow:scroll clips editing text by line-height.
283 Length logicalHeight = startStyle.logicalHeight();
284 // Here, we remove line-height if the INPUT fixed height is taller than the
285 // line-height. It's not the precise condition because logicalHeight
286 // includes border and padding if box-sizing:border-box, and non-fixed
287 // heights are possible.
288 if (logicalHeight.isFixed() && logicalHeight.getFloatValue() > computedLineH eight)
kojii 2016/04/26 06:03:21 Are Percent and Calculated converted to Fixed at t
tkent 2016/04/26 07:03:28 No. We are unable to determine if it's ok to remo
tkent 2016/04/26 07:44:49 We discussed offline, and agreed that we should no
278 textBlockStyle->setLineHeight(ComputedStyle::initialLineHeight()); 289 textBlockStyle->setLineHeight(ComputedStyle::initialLineHeight());
279 290
280 textBlockStyle->setDisplay(BLOCK); 291 textBlockStyle->setDisplay(BLOCK);
281 textBlockStyle->setUnique(); 292 textBlockStyle->setUnique();
282 293
283 if (inputElement()->shouldRevealPassword()) 294 if (inputElement()->shouldRevealPassword())
284 textBlockStyle->setTextSecurity(TSNONE); 295 textBlockStyle->setTextSecurity(TSNONE);
285 296
286 textBlockStyle->setOverflowX(OverflowScroll); 297 textBlockStyle->setOverflowX(OverflowScroll);
298 // overflow-y:visible doesn't work because overflow-x:scroll makes a layer.
287 textBlockStyle->setOverflowY(OverflowScroll); 299 textBlockStyle->setOverflowY(OverflowScroll);
288 RefPtr<ComputedStyle> noScrollbarStyle = ComputedStyle::create(); 300 RefPtr<ComputedStyle> noScrollbarStyle = ComputedStyle::create();
289 noScrollbarStyle->setStyleType(PseudoIdScrollbar); 301 noScrollbarStyle->setStyleType(PseudoIdScrollbar);
290 noScrollbarStyle->setDisplay(NONE); 302 noScrollbarStyle->setDisplay(NONE);
291 textBlockStyle->addCachedPseudoStyle(noScrollbarStyle); 303 textBlockStyle->addCachedPseudoStyle(noScrollbarStyle);
292 textBlockStyle->setHasPseudoStyle(PseudoIdScrollbar); 304 textBlockStyle->setHasPseudoStyle(PseudoIdScrollbar);
293 305
294 return textBlockStyle.release(); 306 return textBlockStyle.release();
295 } 307 }
296 308
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 // inner-editor element overflows the INPUT box intentionally, however it 374 // inner-editor element overflows the INPUT box intentionally, however it
363 // shouldn't affect outside of the INPUT box. So we ignore child overflow. 375 // shouldn't affect outside of the INPUT box. So we ignore child overflow.
364 } 376 }
365 377
366 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const 378 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const
367 { 379 {
368 return toHTMLInputElement(node()); 380 return toHTMLInputElement(node());
369 } 381 }
370 382
371 } // namespace blink 383 } // namespace blink
OLDNEW
« 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