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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTextControl.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, 4 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 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 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 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // The inner block, if present, always has its direction set to LTR, 76 // The inner block, if present, always has its direction set to LTR,
77 // so we need to inherit the direction and unicode-bidi style from the eleme nt. 77 // so we need to inherit the direction and unicode-bidi style from the eleme nt.
78 textBlockStyle.setDirection(style()->direction()); 78 textBlockStyle.setDirection(style()->direction());
79 textBlockStyle.setUnicodeBidi(style()->unicodeBidi()); 79 textBlockStyle.setUnicodeBidi(style()->unicodeBidi());
80 80
81 updateUserModifyProperty(*textFormControlElement(), textBlockStyle); 81 updateUserModifyProperty(*textFormControlElement(), textBlockStyle);
82 } 82 }
83 83
84 int LayoutTextControl::textBlockLogicalHeight() const 84 int LayoutTextControl::textBlockLogicalHeight() const
85 { 85 {
86 return logicalHeight() - borderAndPaddingLogicalHeight(); 86 return (logicalHeight() - borderAndPaddingLogicalHeight()).toInt();
87 } 87 }
88 88
89 int LayoutTextControl::textBlockLogicalWidth() const 89 int LayoutTextControl::textBlockLogicalWidth() const
90 { 90 {
91 Element* innerEditor = innerEditorElement(); 91 Element* innerEditor = innerEditorElement();
92 ASSERT(innerEditor); 92 ASSERT(innerEditor);
93 93
94 LayoutUnit unitWidth = logicalWidth() - borderAndPaddingLogicalWidth(); 94 LayoutUnit unitWidth = logicalWidth() - borderAndPaddingLogicalWidth();
95 if (innerEditor->layoutObject()) 95 if (innerEditor->layoutObject())
96 unitWidth -= innerEditor->layoutBox()->paddingStart() + innerEditor->lay outBox()->paddingEnd(); 96 unitWidth -= innerEditor->layoutBox()->paddingStart() + innerEditor->lay outBox()->paddingEnd();
97 97
98 return unitWidth; 98 return unitWidth.toInt();
99 } 99 }
100 100
101 void LayoutTextControl::updateFromElement() 101 void LayoutTextControl::updateFromElement()
102 { 102 {
103 Element* innerEditor = innerEditorElement(); 103 Element* innerEditor = innerEditorElement();
104 if (innerEditor && innerEditor->layoutObject()) 104 if (innerEditor && innerEditor->layoutObject())
105 updateUserModifyProperty(*textFormControlElement(), innerEditor->layoutO bject()->mutableStyleRef()); 105 updateUserModifyProperty(*textFormControlElement(), innerEditor->layoutO bject()->mutableStyleRef());
106 } 106 }
107 107
108 int LayoutTextControl::scrollbarThickness() const 108 int LayoutTextControl::scrollbarThickness() const
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder Element(); 287 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder Element();
288 LayoutObject* placeholderLayoutObject = placeholder ? placeholder->layoutObj ect() : nullptr; 288 LayoutObject* placeholderLayoutObject = placeholder ? placeholder->layoutObj ect() : nullptr;
289 if (!placeholderLayoutObject) 289 if (!placeholderLayoutObject)
290 return nullptr; 290 return nullptr;
291 if (relayoutChildren) 291 if (relayoutChildren)
292 layoutScope.setChildNeedsLayout(placeholderLayoutObject); 292 layoutScope.setChildNeedsLayout(placeholderLayoutObject);
293 return placeholderLayoutObject; 293 return placeholderLayoutObject;
294 } 294 }
295 295
296 } // namespace blink 296 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698