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

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

Issue 2191233002: Add platform/geometry pretty printers for logging and testing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust tests to work around uninteresting cross-platform differences 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) 2003, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2005 Nokia. All rights reserved. 3 * Copyright (C) 2005 Nokia. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) 182 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
183 FloatRect(const NSRect&); 183 FloatRect(const NSRect&);
184 operator NSRect() const; 184 operator NSRect() const;
185 #endif 185 #endif
186 #endif 186 #endif
187 187
188 operator SkRect() const { return SkRect::MakeXYWH(x(), y(), width(), height( )); } 188 operator SkRect() const { return SkRect::MakeXYWH(x(), y(), width(), height( )); }
189 operator gfx::RectF() const; 189 operator gfx::RectF() const;
190 190
191 #if ENABLE(ASSERT) 191 #if ENABLE(ASSERT)
192 // Prints the rect to the screen.
193 void show() const;
194 bool mayNotHaveExactIntRectRepresentation() const; 192 bool mayNotHaveExactIntRectRepresentation() const;
195 #endif 193 #endif
196 194
197 #ifndef NDEBUG
198 String toString() const;
199 #endif
200
201 private: 195 private:
202 FloatPoint m_location; 196 FloatPoint m_location;
203 FloatSize m_size; 197 FloatSize m_size;
204 198
205 void setLocationAndSizeFromEdges(float left, float top, float right, float b ottom) 199 void setLocationAndSizeFromEdges(float left, float top, float right, float b ottom)
206 { 200 {
207 m_location.set(left, top); 201 m_location.set(left, top);
208 m_size.setWidth(right - left); 202 m_size.setWidth(right - left);
209 m_size.setHeight(bottom - top); 203 m_size.setHeight(bottom - top);
210 } 204 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 PLATFORM_EXPORT IntRect enclosingIntRect(const FloatRect&); 248 PLATFORM_EXPORT IntRect enclosingIntRect(const FloatRect&);
255 249
256 // Returns a valid IntRect contained within the given FloatRect. 250 // Returns a valid IntRect contained within the given FloatRect.
257 PLATFORM_EXPORT IntRect enclosedIntRect(const FloatRect&); 251 PLATFORM_EXPORT IntRect enclosedIntRect(const FloatRect&);
258 252
259 PLATFORM_EXPORT IntRect roundedIntRect(const FloatRect&); 253 PLATFORM_EXPORT IntRect roundedIntRect(const FloatRect&);
260 254
261 // Map supplied rect from srcRect to an equivalent rect in destRect. 255 // Map supplied rect from srcRect to an equivalent rect in destRect.
262 PLATFORM_EXPORT FloatRect mapRect(const FloatRect&, const FloatRect& srcRect, co nst FloatRect& destRect); 256 PLATFORM_EXPORT FloatRect mapRect(const FloatRect&, const FloatRect& srcRect, co nst FloatRect& destRect);
263 257
264 // Redeclared here to avoid ODR issues. 258 PLATFORM_EXPORT std::ostream& operator<<(std::ostream&, const FloatRect&);
265 // See platform/testing/GeometryPrinters.h.
266 void PrintTo(const FloatRect&, std::ostream*);
267 259
268 } // namespace blink 260 } // namespace blink
269 261
270 #endif 262 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698