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

Side by Side Diff: Source/platform/geometry/LayoutSize.h

Issue 200023002: Making LayoutUnit conversions to Float type explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase to trunk Created 6 years, 9 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 | « Source/platform/geometry/FloatSize.cpp ('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) 2012, Google Inc. All rights reserved. 2 * Copyright (c) 2012, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 LayoutUnit width() const { return m_width; } 55 LayoutUnit width() const { return m_width; }
56 LayoutUnit height() const { return m_height; } 56 LayoutUnit height() const { return m_height; }
57 57
58 void setWidth(LayoutUnit width) { m_width = width; } 58 void setWidth(LayoutUnit width) { m_width = width; }
59 void setHeight(LayoutUnit height) { m_height = height; } 59 void setHeight(LayoutUnit height) { m_height = height; }
60 60
61 bool isEmpty() const { return m_width.rawValue() <= 0 || m_height.rawValue() <= 0; } 61 bool isEmpty() const { return m_width.rawValue() <= 0 || m_height.rawValue() <= 0; }
62 bool isZero() const { return !m_width && !m_height; } 62 bool isZero() const { return !m_width && !m_height; }
63 63
64 float aspectRatio() const { return static_cast<float>(m_width) / static_cast <float>(m_height); } 64 float aspectRatio() const { return m_width.toFloat() / m_height.toFloat(); }
65 65
66 void expand(LayoutUnit width, LayoutUnit height) 66 void expand(LayoutUnit width, LayoutUnit height)
67 { 67 {
68 m_width += width; 68 m_width += width;
69 m_height += height; 69 m_height += height;
70 } 70 }
71 71
72 void shrink(LayoutUnit width, LayoutUnit height) 72 void shrink(LayoutUnit width, LayoutUnit height)
73 { 73 {
74 m_width -= width; 74 m_width -= width;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } 185 }
186 186
187 inline LayoutSize roundedLayoutSize(const FloatSize& s) 187 inline LayoutSize roundedLayoutSize(const FloatSize& s)
188 { 188 {
189 return LayoutSize(s); 189 return LayoutSize(s);
190 } 190 }
191 191
192 } // namespace WebCore 192 } // namespace WebCore
193 193
194 #endif // LayoutSize_h 194 #endif // LayoutSize_h
OLDNEW
« no previous file with comments | « Source/platform/geometry/FloatSize.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698