| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/rendering/style/BorderImageLength.h" | 34 #include "core/rendering/style/BorderImageLength.h" |
| 35 | 35 |
| 36 namespace WebCore { | 36 namespace WebCore { |
| 37 | 37 |
| 38 // Represents a computed border image width or outset. | 38 // Represents a computed border image width or outset. |
| 39 // | 39 // |
| 40 // http://www.w3.org/TR/css3-background/#border-image-width | 40 // http://www.w3.org/TR/css3-background/#border-image-width |
| 41 // http://www.w3.org/TR/css3-background/#border-image-outset | 41 // http://www.w3.org/TR/css3-background/#border-image-outset |
| 42 class BorderImageLengthBox { | 42 class BorderImageLengthBox { |
| 43 public: | 43 public: |
| 44 BorderImageLengthBox() | 44 BorderImageLengthBox(Length length) |
| 45 : m_left(length) |
| 46 , m_right(length) |
| 47 , m_top(length) |
| 48 , m_bottom(length) |
| 45 { | 49 { |
| 46 } | 50 } |
| 47 | 51 |
| 48 BorderImageLengthBox(Length top, Length right, Length bottom, Length left) | 52 BorderImageLengthBox(double number) |
| 49 : m_left(left) | 53 : m_left(number) |
| 50 , m_right(right) | 54 , m_right(number) |
| 51 , m_top(top) | 55 , m_top(number) |
| 52 , m_bottom(bottom) | 56 , m_bottom(number) |
| 53 { | 57 { |
| 54 } | 58 } |
| 55 | 59 |
| 56 BorderImageLengthBox(double top, double right, double bottom, double left) | |
| 57 : m_left(left) | |
| 58 , m_right(right) | |
| 59 , m_top(top) | |
| 60 , m_bottom(bottom) | |
| 61 { | |
| 62 } | |
| 63 | |
| 64 BorderImageLengthBox(const BorderImageLength& top, const BorderImageLength&
right, | 60 BorderImageLengthBox(const BorderImageLength& top, const BorderImageLength&
right, |
| 65 const BorderImageLength& bottom, const BorderImageLength& left) | 61 const BorderImageLength& bottom, const BorderImageLength& left) |
| 66 : m_left(left) | 62 : m_left(left) |
| 67 , m_right(right) | 63 , m_right(right) |
| 68 , m_top(top) | 64 , m_top(top) |
| 69 , m_bottom(bottom) | 65 , m_bottom(bottom) |
| 70 { | 66 { |
| 71 } | 67 } |
| 72 | 68 |
| 73 const BorderImageLength& left() const { return m_left; } | 69 const BorderImageLength& left() const { return m_left; } |
| 74 const BorderImageLength& right() const { return m_right; } | 70 const BorderImageLength& right() const { return m_right; } |
| 75 const BorderImageLength& top() const { return m_top; } | 71 const BorderImageLength& top() const { return m_top; } |
| 76 const BorderImageLength& bottom() const { return m_bottom; } | 72 const BorderImageLength& bottom() const { return m_bottom; } |
| 77 | 73 |
| 78 void setLeft(const BorderImageLength& left) { m_left = left; } | |
| 79 void setRight(const BorderImageLength& right) { m_right = right; } | |
| 80 void setTop(const BorderImageLength& top) { m_top = top; } | |
| 81 void setBottom(const BorderImageLength& bottom) { m_bottom = bottom; } | |
| 82 | |
| 83 bool operator==(const BorderImageLengthBox& other) const | 74 bool operator==(const BorderImageLengthBox& other) const |
| 84 { | 75 { |
| 85 return m_left == other.m_left && m_right == other.m_right | 76 return m_left == other.m_left && m_right == other.m_right |
| 86 && m_top == other.m_top && m_bottom == other.m_bottom; | 77 && m_top == other.m_top && m_bottom == other.m_bottom; |
| 87 } | 78 } |
| 88 | 79 |
| 89 bool operator!=(const BorderImageLengthBox& other) const | 80 bool operator!=(const BorderImageLengthBox& other) const |
| 90 { | 81 { |
| 91 return !(*this == other); | 82 return !(*this == other); |
| 92 } | 83 } |
| 93 | 84 |
| 94 bool nonZero() const | 85 bool nonZero() const |
| 95 { | 86 { |
| 96 return !(m_left.isZero() && m_right.isZero() && m_top.isZero() && m_bott
om.isZero()); | 87 return !(m_left.isZero() && m_right.isZero() && m_top.isZero() && m_bott
om.isZero()); |
| 97 } | 88 } |
| 98 | 89 |
| 99 private: | 90 private: |
| 100 BorderImageLength m_left; | 91 BorderImageLength m_left; |
| 101 BorderImageLength m_right; | 92 BorderImageLength m_right; |
| 102 BorderImageLength m_top; | 93 BorderImageLength m_top; |
| 103 BorderImageLength m_bottom; | 94 BorderImageLength m_bottom; |
| 104 }; | 95 }; |
| 105 | 96 |
| 106 } // namespace WebCore | 97 } // namespace WebCore |
| 107 | 98 |
| 108 #endif // BorderImageLengthBox_h | 99 #endif // BorderImageLengthBox_h |
| OLD | NEW |