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

Side by Side Diff: Source/platform/BorderImageLengthBox.h

Issue 55783002: Introduce BorderImageLength and BorderImageLengthBox (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address review comments 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
(Empty)
1 /*
2 * Copyright (c) 2013, Opera Software ASA. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Opera Software ASA nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
29 */
30
31 #ifndef BorderImageLengthBox_h
32 #define BorderImageLengthBox_h
33
34 #include "platform/BorderImageLength.h"
35 #include "platform/LengthBox.h"
36
37 namespace WebCore {
38
39 class PLATFORM_EXPORT BorderImageLengthBox {
40 public:
41 BorderImageLengthBox()
42 {
43 }
44
45 BorderImageLengthBox(Length t, Length r, Length b, Length l)
46 : m_left(l)
47 , m_right(r)
48 , m_top(t)
49 , m_bottom(b)
50 {
51 }
52
53 BorderImageLengthBox(double t, double r, double b, double l)
54 : m_left(l)
55 , m_right(r)
56 , m_top(t)
57 , m_bottom(b)
58 {
59 }
60
61 // FIXME: Remove when the conversion to BorderImageLengthBox is complete
62 explicit BorderImageLengthBox(LengthBox lengthBox)
63 : m_left(lengthBox.m_left)
64 , m_right(lengthBox.m_right)
65 , m_top(lengthBox.m_top)
66 , m_bottom(lengthBox.m_bottom)
67 {
68 }
69
70 const BorderImageLength& left() const { return m_left; }
71 const BorderImageLength& right() const { return m_right; }
72 const BorderImageLength& top() const { return m_top; }
73 const BorderImageLength& bottom() const { return m_bottom; }
74
75 void setLeft(const BorderImageLength& left) { m_left = left; }
76 void setRight(const BorderImageLength& right) { m_right = right; }
77 void setTop(const BorderImageLength& top) { m_top = top; }
78 void setBottom(const BorderImageLength& bottom) { m_bottom = bottom; }
79
80 bool operator==(const BorderImageLengthBox& other) const
81 {
82 return m_left == other.m_left && m_right == other.m_right
83 && m_top == other.m_top && m_bottom == other.m_bottom;
84 }
85
86 bool operator!=(const BorderImageLengthBox& other) const
87 {
88 return !(*this == other);
89 }
90
91 bool nonZero() const
92 {
93 return !(m_left.isZero() && m_right.isZero() && m_top.isZero() && m_bott om.isZero());
94 }
95
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:
104 BorderImageLength m_left;
105 BorderImageLength m_right;
106 BorderImageLength m_top;
107 BorderImageLength m_bottom;
108 };
109
110 } // namespace WebCore
111
112 #endif // BorderImageLengthBox_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698