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

Side by Side Diff: third_party/WebKit/Source/platform/geometry/LayoutRect.h

Issue 1647313003: Continue converting to explicit LayoutUnit constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@explicitContstructors
Patch Set: Add TODO Created 4 years, 10 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/Source/platform/LayoutUnit.h ('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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 void contractEdges(LayoutUnit top, LayoutUnit right, LayoutUnit bottom, Layo utUnit left) 114 void contractEdges(LayoutUnit top, LayoutUnit right, LayoutUnit bottom, Layo utUnit left)
115 { 115 {
116 m_location.move(left, top); 116 m_location.move(left, top);
117 m_size.shrink(left + right, top + bottom); 117 m_size.shrink(left + right, top + bottom);
118 } 118 }
119 119
120 void shiftXEdgeTo(LayoutUnit edge) 120 void shiftXEdgeTo(LayoutUnit edge)
121 { 121 {
122 LayoutUnit delta = edge - x(); 122 LayoutUnit delta = edge - x();
123 setX(edge); 123 setX(edge);
124 setWidth((width() - delta).clampToZero()); 124 setWidth((width() - delta).clampNegativeToZero());
125 } 125 }
126 void shiftMaxXEdgeTo(LayoutUnit edge) 126 void shiftMaxXEdgeTo(LayoutUnit edge)
127 { 127 {
128 LayoutUnit delta = edge - maxX(); 128 LayoutUnit delta = edge - maxX();
129 setWidth((width() + delta).clampToZero()); 129 setWidth((width() + delta).clampNegativeToZero());
130 } 130 }
131 void shiftYEdgeTo(LayoutUnit edge) 131 void shiftYEdgeTo(LayoutUnit edge)
132 { 132 {
133 LayoutUnit delta = edge - y(); 133 LayoutUnit delta = edge - y();
134 setY(edge); 134 setY(edge);
135 setHeight((height() - delta).clampToZero()); 135 setHeight((height() - delta).clampNegativeToZero());
136 } 136 }
137 void shiftMaxYEdgeTo(LayoutUnit edge) 137 void shiftMaxYEdgeTo(LayoutUnit edge)
138 { 138 {
139 LayoutUnit delta = edge - maxY(); 139 LayoutUnit delta = edge - maxY();
140 setHeight((height() + delta).clampToZero()); 140 setHeight((height() + delta).clampNegativeToZero());
141 } 141 }
142 142
143 LayoutPoint minXMinYCorner() const { return m_location; } // typically topLe ft 143 LayoutPoint minXMinYCorner() const { return m_location; } // typically topLe ft
144 LayoutPoint maxXMinYCorner() const { return LayoutPoint(m_location.x() + m_s ize.width(), m_location.y()); } // typically topRight 144 LayoutPoint maxXMinYCorner() const { return LayoutPoint(m_location.x() + m_s ize.width(), m_location.y()); } // typically topRight
145 LayoutPoint minXMaxYCorner() const { return LayoutPoint(m_location.x(), m_lo cation.y() + m_size.height()); } // typically bottomLeft 145 LayoutPoint minXMaxYCorner() const { return LayoutPoint(m_location.x(), m_lo cation.y() + m_size.height()); } // typically bottomLeft
146 LayoutPoint maxXMaxYCorner() const { return LayoutPoint(m_location.x() + m_s ize.width(), m_location.y() + m_size.height()); } // typically bottomRight 146 LayoutPoint maxXMaxYCorner() const { return LayoutPoint(m_location.x() + m_s ize.width(), m_location.y() + m_size.height()); } // typically bottomRight
147 147
148 bool intersects(const LayoutRect&) const; 148 bool intersects(const LayoutRect&) const;
149 bool contains(const LayoutRect&) const; 149 bool contains(const LayoutRect&) const;
150 150
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location )); 255 return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location ));
256 } 256 }
257 257
258 // Redeclared here to avoid ODR issues. 258 // Redeclared here to avoid ODR issues.
259 // See platform/testing/GeometryPrinters.h. 259 // See platform/testing/GeometryPrinters.h.
260 void PrintTo(const LayoutRect&, std::ostream*); 260 void PrintTo(const LayoutRect&, std::ostream*);
261 261
262 } // namespace blink 262 } // namespace blink
263 263
264 #endif // LayoutRect_h 264 #endif // LayoutRect_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/LayoutUnit.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698