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

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

Issue 2550083002: Inline LayoutRect::enclosingIntRect (Closed)
Patch Set: Created 4 years 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 | « no previous file | third_party/WebKit/Source/platform/geometry/LayoutRect.cpp » ('j') | 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 inline bool operator!=(const LayoutRect& a, const LayoutRect& b) { 271 inline bool operator!=(const LayoutRect& a, const LayoutRect& b) {
272 return a.location() != b.location() || a.size() != b.size(); 272 return a.location() != b.location() || a.size() != b.size();
273 } 273 }
274 274
275 inline IntRect pixelSnappedIntRect(const LayoutRect& rect) { 275 inline IntRect pixelSnappedIntRect(const LayoutRect& rect) {
276 return IntRect(roundedIntPoint(rect.location()), 276 return IntRect(roundedIntPoint(rect.location()),
277 IntSize(snapSizeToPixel(rect.width(), rect.x()), 277 IntSize(snapSizeToPixel(rect.width(), rect.x()),
278 snapSizeToPixel(rect.height(), rect.y()))); 278 snapSizeToPixel(rect.height(), rect.y())));
279 } 279 }
280 280
281 PLATFORM_EXPORT IntRect enclosingIntRect(const LayoutRect&); 281 inline IntRect enclosingIntRect(const LayoutRect& rect) {
282 IntPoint location = flooredIntPoint(rect.minXMinYCorner());
283 IntPoint maxPoint = ceiledIntPoint(rect.maxXMaxYCorner());
284 return IntRect(location, maxPoint - location);
285 }
286
282 PLATFORM_EXPORT LayoutRect enclosingLayoutRect(const FloatRect&); 287 PLATFORM_EXPORT LayoutRect enclosingLayoutRect(const FloatRect&);
283 288
284 inline IntRect pixelSnappedIntRect(LayoutUnit left, 289 inline IntRect pixelSnappedIntRect(LayoutUnit left,
285 LayoutUnit top, 290 LayoutUnit top,
286 LayoutUnit width, 291 LayoutUnit width,
287 LayoutUnit height) { 292 LayoutUnit height) {
288 return IntRect(left.round(), top.round(), snapSizeToPixel(width, left), 293 return IntRect(left.round(), top.round(), snapSizeToPixel(width, left),
289 snapSizeToPixel(height, top)); 294 snapSizeToPixel(height, top));
290 } 295 }
291 296
(...skipping 10 matching lines...) Expand all
302 pixelSnappedIntSize(size, location)); 307 pixelSnappedIntSize(size, location));
303 } 308 }
304 309
305 // Redeclared here to avoid ODR issues. 310 // Redeclared here to avoid ODR issues.
306 // See platform/testing/GeometryPrinters.h. 311 // See platform/testing/GeometryPrinters.h.
307 void PrintTo(const LayoutRect&, std::ostream*); 312 void PrintTo(const LayoutRect&, std::ostream*);
308 313
309 } // namespace blink 314 } // namespace blink
310 315
311 #endif // LayoutRect_h 316 #endif // LayoutRect_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/geometry/LayoutRect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698