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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.cpp

Issue 2261663002: Disallow cast/implicit conversion from LayoutUnit to int/unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 3 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
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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 PassRefPtr<ComputedStyle> LayoutTextControlSingleLine::createInnerEditorStyle(co nst ComputedStyle& startStyle) const 267 PassRefPtr<ComputedStyle> LayoutTextControlSingleLine::createInnerEditorStyle(co nst ComputedStyle& startStyle) const
268 { 268 {
269 RefPtr<ComputedStyle> textBlockStyle = ComputedStyle::create(); 269 RefPtr<ComputedStyle> textBlockStyle = ComputedStyle::create();
270 textBlockStyle->inheritFrom(startStyle); 270 textBlockStyle->inheritFrom(startStyle);
271 adjustInnerEditorStyle(*textBlockStyle); 271 adjustInnerEditorStyle(*textBlockStyle);
272 272
273 textBlockStyle->setWhiteSpace(PRE); 273 textBlockStyle->setWhiteSpace(PRE);
274 textBlockStyle->setOverflowWrap(NormalOverflowWrap); 274 textBlockStyle->setOverflowWrap(NormalOverflowWrap);
275 textBlockStyle->setTextOverflow(textShouldBeTruncated() ? TextOverflowEllips is : TextOverflowClip); 275 textBlockStyle->setTextOverflow(textShouldBeTruncated() ? TextOverflowEllips is : TextOverflowClip);
276 276
277 int computedLineHeight = lineHeight(true, HorizontalLine, PositionOfInterior LineBoxes); 277 int computedLineHeight = lineHeight(true, HorizontalLine, PositionOfInterior LineBoxes).toInt();
278 // Do not allow line-height to be smaller than our default. 278 // Do not allow line-height to be smaller than our default.
279 if (textBlockStyle->fontSize() >= computedLineHeight) 279 if (textBlockStyle->fontSize() >= computedLineHeight)
280 textBlockStyle->setLineHeight(ComputedStyle::initialLineHeight()); 280 textBlockStyle->setLineHeight(ComputedStyle::initialLineHeight());
281 281
282 // We'd like to remove line-height if it's unnecessary because 282 // We'd like to remove line-height if it's unnecessary because
283 // overflow:scroll clips editing text by line-height. 283 // overflow:scroll clips editing text by line-height.
284 Length logicalHeight = startStyle.logicalHeight(); 284 Length logicalHeight = startStyle.logicalHeight();
285 // Here, we remove line-height if the INPUT fixed height is taller than the 285 // Here, we remove line-height if the INPUT fixed height is taller than the
286 // line-height. It's not the precise condition because logicalHeight 286 // line-height. It's not the precise condition because logicalHeight
287 // includes border and padding if box-sizing:border-box, and there are cases 287 // includes border and padding if box-sizing:border-box, and there are cases
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 // inner-editor element overflows the INPUT box intentionally, however it 377 // inner-editor element overflows the INPUT box intentionally, however it
378 // shouldn't affect outside of the INPUT box. So we ignore child overflow. 378 // shouldn't affect outside of the INPUT box. So we ignore child overflow.
379 } 379 }
380 380
381 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const 381 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const
382 { 382 {
383 return toHTMLInputElement(node()); 383 return toHTMLInputElement(node());
384 } 384 }
385 385
386 } // namespace blink 386 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTextControl.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutTheme.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698