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

Side by Side Diff: third_party/WebKit/Source/platform/geometry/IntRect.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, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2009 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 14 matching lines...) Expand all
25 25
26 #ifndef IntRect_h 26 #ifndef IntRect_h
27 #define IntRect_h 27 #define IntRect_h
28 28
29 #include "platform/geometry/IntPoint.h" 29 #include "platform/geometry/IntPoint.h"
30 #include "platform/geometry/IntRectOutsets.h" 30 #include "platform/geometry/IntRectOutsets.h"
31 #include "wtf/Allocator.h" 31 #include "wtf/Allocator.h"
32 #include "wtf/Forward.h" 32 #include "wtf/Forward.h"
33 #include "wtf/Vector.h" 33 #include "wtf/Vector.h"
34 #include "wtf/VectorTraits.h" 34 #include "wtf/VectorTraits.h"
35 #include <iosfwd>
35 36
36 #if OS(MACOSX) 37 #if OS(MACOSX)
37 typedef struct CGRect CGRect; 38 typedef struct CGRect CGRect;
38 39
39 #ifdef __OBJC__ 40 #ifdef __OBJC__
40 #import <Foundation/Foundation.h> 41 #import <Foundation/Foundation.h>
41 #endif 42 #endif
42 #endif 43 #endif
43 44
44 struct SkRect; 45 struct SkRect;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) 173 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
173 operator NSRect() const; 174 operator NSRect() const;
174 #endif 175 #endif
175 #endif 176 #endif
176 177
177 operator SkRect() const; 178 operator SkRect() const;
178 operator SkIRect() const; 179 operator SkIRect() const;
179 180
180 operator gfx::Rect() const; 181 operator gfx::Rect() const;
181 182
182 #ifndef NDEBUG
183 // Prints the rect to the screen.
184 void show() const;
185 String toString() const;
186 #endif
187
188 private: 183 private:
189 IntPoint m_location; 184 IntPoint m_location;
190 IntSize m_size; 185 IntSize m_size;
191 }; 186 };
192 187
193 inline IntRect intersection(const IntRect& a, const IntRect& b) 188 inline IntRect intersection(const IntRect& a, const IntRect& b)
194 { 189 {
195 IntRect c = a; 190 IntRect c = a;
196 c.intersect(b); 191 c.intersect(b);
197 return c; 192 return c;
(...skipping 27 matching lines...) Expand all
225 return a.location() != b.location() || a.size() != b.size(); 220 return a.location() != b.location() || a.size() != b.size();
226 } 221 }
227 222
228 #if OS(MACOSX) 223 #if OS(MACOSX)
229 PLATFORM_EXPORT IntRect enclosingIntRect(const CGRect&); 224 PLATFORM_EXPORT IntRect enclosingIntRect(const CGRect&);
230 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) 225 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
231 PLATFORM_EXPORT IntRect enclosingIntRect(const NSRect&); 226 PLATFORM_EXPORT IntRect enclosingIntRect(const NSRect&);
232 #endif 227 #endif
233 #endif 228 #endif
234 229
235 // Redeclared here to avoid ODR issues. 230 PLATFORM_EXPORT std::ostream& operator<<(std::ostream&, const IntRect&);
236 // See platform/testing/GeometryPrinters.h.
237 void PrintTo(const IntRect&, std::ostream*);
238 231
239 } // namespace blink 232 } // namespace blink
240 233
241 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::IntRect); 234 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::IntRect);
242 235
243 #endif // IntRect_h 236 #endif // IntRect_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698