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

Side by Side Diff: Source/core/rendering/style/BorderImageLengthBox.h

Issue 55813002: Convert animation and renderer code to know about BorderImageLength (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@length-relative-die-step-1-4
Patch Set: Rebased to latest master Created 7 years, 1 month 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) 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
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 "core/rendering/style/BorderImageLength.h" 34 #include "core/rendering/style/BorderImageLength.h"
35 #include "platform/LengthBox.h"
36 35
37 namespace WebCore { 36 namespace WebCore {
38 37
39 // Represents a computed border image width or outset. 38 // Represents a computed border image width or outset.
40 // 39 //
41 // http://www.w3.org/TR/css3-background/#border-image-width 40 // http://www.w3.org/TR/css3-background/#border-image-width
42 // http://www.w3.org/TR/css3-background/#border-image-outset 41 // http://www.w3.org/TR/css3-background/#border-image-outset
43 class BorderImageLengthBox { 42 class BorderImageLengthBox {
44 public: 43 public:
45 BorderImageLengthBox() 44 BorderImageLengthBox()
46 { 45 {
47 } 46 }
48 47
49 BorderImageLengthBox(Length top, Length right, Length bottom, Length left) 48 BorderImageLengthBox(Length top, Length right, Length bottom, Length left)
50 : m_left(left) 49 : m_left(left)
51 , m_right(right) 50 , m_right(right)
52 , m_top(top) 51 , m_top(top)
53 , m_bottom(bottom) 52 , m_bottom(bottom)
54 { 53 {
55 } 54 }
56 55
57 BorderImageLengthBox(double top, double right, double bottom, double left) 56 BorderImageLengthBox(double top, double right, double bottom, double left)
58 : m_left(left) 57 : m_left(left)
59 , m_right(right) 58 , m_right(right)
60 , m_top(top) 59 , m_top(top)
61 , m_bottom(bottom) 60 , m_bottom(bottom)
62 { 61 {
63 } 62 }
64 63
65 // FIXME: Remove when the conversion to BorderImageLengthBox is complete. 64 BorderImageLengthBox(const BorderImageLength& top, const BorderImageLength& right,
66 explicit BorderImageLengthBox(LengthBox lengthBox) 65 const BorderImageLength& bottom, const BorderImageLength& left)
67 : m_left(lengthBox.m_left) 66 : m_left(left)
68 , m_right(lengthBox.m_right) 67 , m_right(right)
69 , m_top(lengthBox.m_top) 68 , m_top(top)
70 , m_bottom(lengthBox.m_bottom) 69 , m_bottom(bottom)
71 { 70 {
72 } 71 }
73 72
74 const BorderImageLength& left() const { return m_left; } 73 const BorderImageLength& left() const { return m_left; }
75 const BorderImageLength& right() const { return m_right; } 74 const BorderImageLength& right() const { return m_right; }
76 const BorderImageLength& top() const { return m_top; } 75 const BorderImageLength& top() const { return m_top; }
77 const BorderImageLength& bottom() const { return m_bottom; } 76 const BorderImageLength& bottom() const { return m_bottom; }
78 77
79 void setLeft(const BorderImageLength& left) { m_left = left; } 78 void setLeft(const BorderImageLength& left) { m_left = left; }
80 void setRight(const BorderImageLength& right) { m_right = right; } 79 void setRight(const BorderImageLength& right) { m_right = right; }
81 void setTop(const BorderImageLength& top) { m_top = top; } 80 void setTop(const BorderImageLength& top) { m_top = top; }
82 void setBottom(const BorderImageLength& bottom) { m_bottom = bottom; } 81 void setBottom(const BorderImageLength& bottom) { m_bottom = bottom; }
83 82
84 bool operator==(const BorderImageLengthBox& other) const 83 bool operator==(const BorderImageLengthBox& other) const
85 { 84 {
86 return m_left == other.m_left && m_right == other.m_right 85 return m_left == other.m_left && m_right == other.m_right
87 && m_top == other.m_top && m_bottom == other.m_bottom; 86 && m_top == other.m_top && m_bottom == other.m_bottom;
88 } 87 }
89 88
90 bool operator!=(const BorderImageLengthBox& other) const 89 bool operator!=(const BorderImageLengthBox& other) const
91 { 90 {
92 return !(*this == other); 91 return !(*this == other);
93 } 92 }
94 93
95 bool nonZero() const 94 bool nonZero() const
96 { 95 {
97 return !(m_left.isZero() && m_right.isZero() && m_top.isZero() && m_bott om.isZero()); 96 return !(m_left.isZero() && m_right.isZero() && m_top.isZero() && m_bott om.isZero());
98 } 97 }
99 98
100 // FIXME: Remove when the conversion to BorderImageLengthBox is complete.
101 LengthBox deprecatedLengthBox() const
102 {
103 return LengthBox(m_top.deprecatedUnifiedLength(), m_right.deprecatedUnif iedLength(),
104 m_bottom.deprecatedUnifiedLength(), m_left.deprecatedUnifiedLength() );
105 }
106
107 private: 99 private:
108 BorderImageLength m_left; 100 BorderImageLength m_left;
109 BorderImageLength m_right; 101 BorderImageLength m_right;
110 BorderImageLength m_top; 102 BorderImageLength m_top;
111 BorderImageLength m_bottom; 103 BorderImageLength m_bottom;
112 }; 104 };
113 105
114 } // namespace WebCore 106 } // namespace WebCore
115 107
116 #endif // BorderImageLengthBox_h 108 #endif // BorderImageLengthBox_h
OLDNEW
« no previous file with comments | « Source/core/rendering/style/BorderImageLength.h ('k') | Source/core/rendering/style/NinePieceImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698