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

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

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

Powered by Google App Engine
This is Rietveld 408576698