1/*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB.  If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 *
20 */
21
22#include "config.h"
23#include "StyleBoxData.h"
24
25#include "RenderStyle.h"
26#include "RenderStyleConstants.h"
27
28namespace WebCore {
29
30struct SameSizeAsStyleBoxData : public RefCounted<SameSizeAsStyleBoxData> {
31    Length length[7];
32    int m_zIndex;
33    uint32_t bitfields;
34};
35
36COMPILE_ASSERT(sizeof(StyleBoxData) == sizeof(SameSizeAsStyleBoxData), StyleBoxData_should_not_grow);
37
38StyleBoxData::StyleBoxData()
39    : m_minWidth(RenderStyle::initialMinSize())
40    , m_maxWidth(RenderStyle::initialMaxSize())
41    , m_minHeight(RenderStyle::initialMinSize())
42    , m_maxHeight(RenderStyle::initialMaxSize())
43    , m_zIndex(0)
44    , m_hasAutoZIndex(true)
45    , m_boxSizing(CONTENT_BOX)
46#if ENABLE(CSS_BOX_DECORATION_BREAK)
47    , m_boxDecorationBreak(DSLICE)
48#endif
49{
50}
51
52StyleBoxData::StyleBoxData(const StyleBoxData& o)
53    : RefCounted<StyleBoxData>()
54    , m_width(o.m_width)
55    , m_height(o.m_height)
56    , m_minWidth(o.m_minWidth)
57    , m_maxWidth(o.m_maxWidth)
58    , m_minHeight(o.m_minHeight)
59    , m_maxHeight(o.m_maxHeight)
60    , m_verticalAlign(o.m_verticalAlign)
61    , m_zIndex(o.m_zIndex)
62    , m_hasAutoZIndex(o.m_hasAutoZIndex)
63    , m_boxSizing(o.m_boxSizing)
64#if ENABLE(CSS_BOX_DECORATION_BREAK)
65    , m_boxDecorationBreak(o.m_boxDecorationBreak)
66#endif
67{
68}
69
70bool StyleBoxData::operator==(const StyleBoxData& o) const
71{
72    return m_width == o.m_width
73           && m_height == o.m_height
74           && m_minWidth == o.m_minWidth
75           && m_maxWidth == o.m_maxWidth
76           && m_minHeight == o.m_minHeight
77           && m_maxHeight == o.m_maxHeight
78           && m_verticalAlign == o.m_verticalAlign
79           && m_zIndex == o.m_zIndex
80           && m_hasAutoZIndex == o.m_hasAutoZIndex
81           && m_boxSizing == o.m_boxSizing
82#if ENABLE(CSS_BOX_DECORATION_BREAK)
83           && m_boxDecorationBreak == o.m_boxDecorationBreak
84#endif
85            ;
86}
87
88} // namespace WebCore
89