2 Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
4 Copyright (c) 2012, Google Inc. All rights reserved.
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
25 #include "platform/Length.h"
26 #include "platform/PlatformExport.h"
27 #include "platform/text/TextDirection.h"
28 #include "platform/text/WritingMode.h"
32 class PLATFORM_EXPORT LengthBox
{
38 LengthBox(LengthType t
)
47 : m_left(Length(v
, Fixed
))
48 , m_right(Length(v
, Fixed
))
49 , m_top(Length(v
, Fixed
))
50 , m_bottom(Length(v
, Fixed
))
54 LengthBox(const Length
& t
, const Length
& r
, const Length
& b
, const Length
& l
)
62 LengthBox(int t
, int r
, int b
, int l
)
63 : m_left(Length(l
, Fixed
))
64 , m_right(Length(r
, Fixed
))
65 , m_top(Length(t
, Fixed
))
66 , m_bottom(Length(b
, Fixed
))
70 const Length
& left() const { return m_left
; }
71 const Length
& right() const { return m_right
; }
72 const Length
& top() const { return m_top
; }
73 const Length
& bottom() const { return m_bottom
; }
75 const Length
& logicalLeft(WritingMode
) const;
76 const Length
& logicalRight(WritingMode
) const;
78 const Length
& before(WritingMode
) const;
79 const Length
& after(WritingMode
) const;
80 const Length
& start(WritingMode
, TextDirection
) const;
81 const Length
& end(WritingMode
, TextDirection
) const;
83 bool operator==(const LengthBox
& o
) const
85 return m_left
== o
.m_left
&& m_right
== o
.m_right
&& m_top
== o
.m_top
&& m_bottom
== o
.m_bottom
;
88 bool operator!=(const LengthBox
& o
) const
95 return !(m_left
.isZero() && m_right
.isZero() && m_top
.isZero() && m_bottom
.isZero());
98 // Must be public for SET_VAR in ComputedStyle.h
107 #endif // LengthBox_h