OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. All rights reserve
d. | 2 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. All rights reserve
d. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. 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 14 matching lines...) Expand all Loading... |
25 */ | 25 */ |
26 | 26 |
27 #ifndef IntSize_h | 27 #ifndef IntSize_h |
28 #define IntSize_h | 28 #define IntSize_h |
29 | 29 |
30 #include "platform/PlatformExport.h" | 30 #include "platform/PlatformExport.h" |
31 | 31 |
32 #if OS(MACOSX) | 32 #if OS(MACOSX) |
33 typedef struct CGSize CGSize; | 33 typedef struct CGSize CGSize; |
34 | 34 |
35 #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES | 35 #ifdef __OBJC__ |
36 typedef struct CGSize NSSize; | 36 #import <Foundation/Foundation.h> |
37 #else | |
38 typedef struct _NSSize NSSize; | |
39 #endif | 37 #endif |
40 #endif | 38 #endif |
41 | 39 |
42 namespace WebCore { | 40 namespace WebCore { |
43 | 41 |
44 class PLATFORM_EXPORT IntSize { | 42 class PLATFORM_EXPORT IntSize { |
45 public: | 43 public: |
46 IntSize() : m_width(0), m_height(0) { } | 44 IntSize() : m_width(0), m_height(0) { } |
47 IntSize(int width, int height) : m_width(width), m_height(height) { } | 45 IntSize(int width, int height) : m_width(width), m_height(height) { } |
48 | 46 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 109 |
112 IntSize transposedSize() const | 110 IntSize transposedSize() const |
113 { | 111 { |
114 return IntSize(m_height, m_width); | 112 return IntSize(m_height, m_width); |
115 } | 113 } |
116 | 114 |
117 #if OS(MACOSX) | 115 #if OS(MACOSX) |
118 explicit IntSize(const CGSize&); // don't do this implicitly since it's loss
y | 116 explicit IntSize(const CGSize&); // don't do this implicitly since it's loss
y |
119 operator CGSize() const; | 117 operator CGSize() const; |
120 | 118 |
121 #if !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) | 119 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) |
122 explicit IntSize(const NSSize &); // don't do this implicitly since it's los
sy | 120 explicit IntSize(const NSSize &); // don't do this implicitly since it's los
sy |
123 operator NSSize() const; | 121 operator NSSize() const; |
124 #endif | 122 #endif |
125 #endif | 123 #endif |
126 | 124 |
127 private: | 125 private: |
128 int m_width, m_height; | 126 int m_width, m_height; |
129 }; | 127 }; |
130 | 128 |
131 inline IntSize& operator+=(IntSize& a, const IntSize& b) | 129 inline IntSize& operator+=(IntSize& a, const IntSize& b) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 161 } |
164 | 162 |
165 inline bool operator!=(const IntSize& a, const IntSize& b) | 163 inline bool operator!=(const IntSize& a, const IntSize& b) |
166 { | 164 { |
167 return a.width() != b.width() || a.height() != b.height(); | 165 return a.width() != b.width() || a.height() != b.height(); |
168 } | 166 } |
169 | 167 |
170 } // namespace WebCore | 168 } // namespace WebCore |
171 | 169 |
172 #endif // IntSize_h | 170 #endif // IntSize_h |
OLD | NEW |