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 | |
28 | namespace WebCore { |
29 | |
30 | struct SameSizeAsStyleBoxData : public RefCounted<SameSizeAsStyleBoxData> { |
31 | Length length[7]; |
32 | int m_zIndex; |
33 | uint32_t bitfields; |
34 | }; |
35 | |
36 | COMPILE_ASSERT(sizeof(StyleBoxData) == sizeof(SameSizeAsStyleBoxData), StyleBoxData_should_not_grow); |
37 | |
38 | StyleBoxData::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(static_cast<unsigned>(BoxSizing::ContentBox)) |
46 | #if ENABLE(CSS_BOX_DECORATION_BREAK) |
47 | , m_boxDecorationBreak(static_cast<unsigned>(BoxDecorationBreak::Slice)) |
48 | #endif |
49 | { |
50 | } |
51 | |
52 | inline StyleBoxData::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 | |
70 | Ref<StyleBoxData> StyleBoxData::copy() const |
71 | { |
72 | return adoptRef(*new StyleBoxData(*this)); |
73 | } |
74 | |
75 | bool StyleBoxData::operator==(const StyleBoxData& o) const |
76 | { |
77 | return m_width == o.m_width |
78 | && m_height == o.m_height |
79 | && m_minWidth == o.m_minWidth |
80 | && m_maxWidth == o.m_maxWidth |
81 | && m_minHeight == o.m_minHeight |
82 | && m_maxHeight == o.m_maxHeight |
83 | && m_verticalAlign == o.m_verticalAlign |
84 | && m_zIndex == o.m_zIndex |
85 | && m_hasAutoZIndex == o.m_hasAutoZIndex |
86 | && m_boxSizing == o.m_boxSizing |
87 | #if ENABLE(CSS_BOX_DECORATION_BREAK) |
88 | && m_boxDecorationBreak == o.m_boxDecorationBreak |
89 | #endif |
90 | ; |
91 | } |
92 | |
93 | } // namespace WebCore |
94 | |