Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Opera Software ASA. All rights reserved. | 2 * Copyright (c) 2013, Opera Software ASA. 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 14 matching lines...) Expand all Loading... | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef BorderImageLengthBox_h | 31 #ifndef BorderImageLengthBox_h |
| 32 #define BorderImageLengthBox_h | 32 #define BorderImageLengthBox_h |
| 33 | 33 |
| 34 #include "platform/BorderImageLength.h" | 34 #include "platform/BorderImageLength.h" |
| 35 #include "platform/LengthBox.h" | |
| 36 | 35 |
| 37 namespace WebCore { | 36 namespace WebCore { |
| 38 | 37 |
| 39 class PLATFORM_EXPORT BorderImageLengthBox { | 38 class PLATFORM_EXPORT BorderImageLengthBox { |
| 40 public: | 39 public: |
| 41 BorderImageLengthBox() | 40 BorderImageLengthBox() |
| 42 { | 41 { |
| 43 } | 42 } |
| 44 | 43 |
| 45 BorderImageLengthBox(Length t, Length r, Length b, Length l) | 44 BorderImageLengthBox(Length t, Length r, Length b, Length l) |
|
Julien - ping for review
2013/11/04 18:15:54
Do we still want to keep this constructor?
| |
| 46 : m_left(l) | 45 : m_left(l) |
| 47 , m_right(r) | 46 , m_right(r) |
| 48 , m_top(t) | 47 , m_top(t) |
| 49 , m_bottom(b) | 48 , m_bottom(b) |
| 50 { | 49 { |
| 51 } | 50 } |
| 52 | 51 |
| 53 BorderImageLengthBox(double t, double r, double b, double l) | 52 BorderImageLengthBox(double t, double r, double b, double l) |
| 54 : m_left(l) | 53 : m_left(l) |
| 55 , m_right(r) | 54 , m_right(r) |
| 56 , m_top(t) | 55 , m_top(t) |
| 57 , m_bottom(b) | 56 , m_bottom(b) |
| 58 { | 57 { |
| 59 } | 58 } |
| 60 | 59 |
| 61 // FIXME: Remove when the conversion to BorderImageLengthBox is complete | 60 BorderImageLengthBox(const BorderImageLength& t, const BorderImageLength& r, const BorderImageLength& b, const BorderImageLength& l) |
|
Julien - ping for review
2013/11/04 18:15:54
Remember my stick about |o|, well it applies also
davve
2013/11/07 13:18:45
OK.
| |
| 62 explicit BorderImageLengthBox(LengthBox lengthBox) | 61 : m_left(l) |
| 63 : m_left(lengthBox.m_left) | 62 , m_right(r) |
| 64 , m_right(lengthBox.m_right) | 63 , m_top(t) |
| 65 , m_top(lengthBox.m_top) | 64 , m_bottom(b) |
| 66 , m_bottom(lengthBox.m_bottom) | |
| 67 { | 65 { |
| 68 } | 66 } |
| 69 | 67 |
| 70 const BorderImageLength& left() const { return m_left; } | 68 const BorderImageLength& left() const { return m_left; } |
| 71 const BorderImageLength& right() const { return m_right; } | 69 const BorderImageLength& right() const { return m_right; } |
| 72 const BorderImageLength& top() const { return m_top; } | 70 const BorderImageLength& top() const { return m_top; } |
| 73 const BorderImageLength& bottom() const { return m_bottom; } | 71 const BorderImageLength& bottom() const { return m_bottom; } |
| 74 | 72 |
| 75 void setLeft(const BorderImageLength& left) { m_left = left; } | 73 void setLeft(const BorderImageLength& left) { m_left = left; } |
| 76 void setRight(const BorderImageLength& right) { m_right = right; } | 74 void setRight(const BorderImageLength& right) { m_right = right; } |
| 77 void setTop(const BorderImageLength& top) { m_top = top; } | 75 void setTop(const BorderImageLength& top) { m_top = top; } |
| 78 void setBottom(const BorderImageLength& bottom) { m_bottom = bottom; } | 76 void setBottom(const BorderImageLength& bottom) { m_bottom = bottom; } |
| 79 | 77 |
| 80 bool operator==(const BorderImageLengthBox& other) const | 78 bool operator==(const BorderImageLengthBox& other) const |
| 81 { | 79 { |
| 82 return m_left == other.m_left && m_right == other.m_right | 80 return m_left == other.m_left && m_right == other.m_right |
| 83 && m_top == other.m_top && m_bottom == other.m_bottom; | 81 && m_top == other.m_top && m_bottom == other.m_bottom; |
| 84 } | 82 } |
| 85 | 83 |
| 86 bool operator!=(const BorderImageLengthBox& other) const | 84 bool operator!=(const BorderImageLengthBox& other) const |
| 87 { | 85 { |
| 88 return !(*this == other); | 86 return !(*this == other); |
| 89 } | 87 } |
| 90 | 88 |
| 91 bool nonZero() const | 89 bool nonZero() const |
| 92 { | 90 { |
| 93 return !(m_left.isZero() && m_right.isZero() && m_top.isZero() && m_bott om.isZero()); | 91 return !(m_left.isZero() && m_right.isZero() && m_top.isZero() && m_bott om.isZero()); |
| 94 } | 92 } |
| 95 | 93 |
| 96 // FIXME: Remove when the conversion to BorderImageLengthBox is complete | |
| 97 LengthBox deprecatedLengthBox() const | |
| 98 { | |
| 99 return LengthBox(m_top.deprecatedUnifiedLength(), m_right.deprecatedUnif iedLength(), | |
| 100 m_bottom.deprecatedUnifiedLength(), m_left.deprecatedUnifiedLength() ); | |
| 101 } | |
| 102 | |
| 103 private: | 94 private: |
| 104 BorderImageLength m_left; | 95 BorderImageLength m_left; |
| 105 BorderImageLength m_right; | 96 BorderImageLength m_right; |
| 106 BorderImageLength m_top; | 97 BorderImageLength m_top; |
| 107 BorderImageLength m_bottom; | 98 BorderImageLength m_bottom; |
| 108 }; | 99 }; |
| 109 | 100 |
| 110 } // namespace WebCore | 101 } // namespace WebCore |
| 111 | 102 |
| 112 #endif // BorderImageLengthBox_h | 103 #endif // BorderImageLengthBox_h |
| OLD | NEW |