| 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 12 matching lines...) Expand all Loading... |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 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 #include "public/platform/WebCommon.h" | 31 #include "public/platform/WebCommon.h" |
| 32 | 32 |
| 33 #if OS(MACOSX) | |
| 34 typedef struct CGSize CGSize; | |
| 35 | |
| 36 #ifdef __OBJC__ | |
| 37 #import <Foundation/Foundation.h> | |
| 38 #endif | |
| 39 #endif | |
| 40 | |
| 41 namespace blink { | 33 namespace blink { |
| 42 | 34 |
| 43 class PLATFORM_EXPORT IntSize { | 35 class PLATFORM_EXPORT IntSize { |
| 44 public: | 36 public: |
| 45 IntSize() : m_width(0), m_height(0) { } | 37 IntSize() : m_width(0), m_height(0) { } |
| 46 IntSize(int width, int height) : m_width(width), m_height(height) { } | 38 IntSize(int width, int height) : m_width(width), m_height(height) { } |
| 47 | 39 |
| 48 int width() const { return m_width; } | 40 int width() const { return m_width; } |
| 49 int height() const { return m_height; } | 41 int height() const { return m_height; } |
| 50 | 42 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 int diagonalLengthSquared() const | 99 int diagonalLengthSquared() const |
| 108 { | 100 { |
| 109 return m_width * m_width + m_height * m_height; | 101 return m_width * m_width + m_height * m_height; |
| 110 } | 102 } |
| 111 | 103 |
| 112 IntSize transposedSize() const | 104 IntSize transposedSize() const |
| 113 { | 105 { |
| 114 return IntSize(m_height, m_width); | 106 return IntSize(m_height, m_width); |
| 115 } | 107 } |
| 116 | 108 |
| 117 #if OS(MACOSX) | |
| 118 explicit IntSize(const CGSize&); // don't do this implicitly since it's loss
y | |
| 119 operator CGSize() const; | |
| 120 | |
| 121 #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 | |
| 123 operator NSSize() const; | |
| 124 #endif | |
| 125 #endif | |
| 126 | |
| 127 private: | 109 private: |
| 128 int m_width, m_height; | 110 int m_width, m_height; |
| 129 }; | 111 }; |
| 130 | 112 |
| 131 inline IntSize& operator+=(IntSize& a, const IntSize& b) | 113 inline IntSize& operator+=(IntSize& a, const IntSize& b) |
| 132 { | 114 { |
| 133 a.setWidth(a.width() + b.width()); | 115 a.setWidth(a.width() + b.width()); |
| 134 a.setHeight(a.height() + b.height()); | 116 a.setHeight(a.height() + b.height()); |
| 135 return a; | 117 return a; |
| 136 } | 118 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 163 } | 145 } |
| 164 | 146 |
| 165 inline bool operator!=(const IntSize& a, const IntSize& b) | 147 inline bool operator!=(const IntSize& a, const IntSize& b) |
| 166 { | 148 { |
| 167 return a.width() != b.width() || a.height() != b.height(); | 149 return a.width() != b.width() || a.height() != b.height(); |
| 168 } | 150 } |
| 169 | 151 |
| 170 } // namespace blink | 152 } // namespace blink |
| 171 | 153 |
| 172 #endif // IntSize_h | 154 #endif // IntSize_h |
| OLD | NEW |