2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
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.
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.
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.
23 #include "StyleRareNonInheritedData.h"
25 #include "CSSStyleSelector.h"
26 #include "ContentData.h"
27 #include "RenderCounter.h"
28 #include "RenderStyle.h"
29 #include "ShadowData.h"
30 #include "StyleImage.h"
34 StyleRareNonInheritedData::StyleRareNonInheritedData()
35 : lineClamp(RenderStyle::initialLineClamp())
36 , opacity(RenderStyle::initialOpacity())
37 , userDrag(RenderStyle::initialUserDrag())
38 , textOverflow(RenderStyle::initialTextOverflow())
39 , marginBeforeCollapse(MCOLLAPSE)
40 , marginAfterCollapse(MCOLLAPSE)
41 , matchNearestMailBlockquoteColor(RenderStyle::initialMatchNearestMailBlockquoteColor())
42 , m_appearance(RenderStyle::initialAppearance())
43 , m_borderFit(RenderStyle::initialBorderFit())
44 , m_textCombine(RenderStyle::initialTextCombine())
45 , m_counterIncrement(0)
47 #if USE(ACCELERATED_COMPOSITING)
48 , m_runningAcceleratedAnimation(false)
50 , m_mask(FillLayer(MaskFillLayer))
51 , m_transformStyle3D(RenderStyle::initialTransformStyle3D())
52 , m_backfaceVisibility(RenderStyle::initialBackfaceVisibility())
53 , m_perspective(RenderStyle::initialPerspective())
54 , m_perspectiveOriginX(RenderStyle::initialPerspectiveOriginX())
55 , m_perspectiveOriginY(RenderStyle::initialPerspectiveOriginY())
57 , m_pageSizeType(PAGE_SIZE_AUTO)
58 , m_flowThread(RenderStyle::initialFlowThread())
59 , m_regionThread(RenderStyle::initialRegionThread())
60 , m_regionIndex(RenderStyle::initialRegionIndex())
61 , m_regionOverflow(RenderStyle::initialRegionOverflow())
62 , m_wrapShape(RenderStyle::initialWrapShape())
63 , m_regionBreakAfter(RenderStyle::initialPageBreak())
64 , m_regionBreakBefore(RenderStyle::initialPageBreak())
65 , m_regionBreakInside(RenderStyle::initialPageBreak())
67 m_maskBoxImage.setMaskDefaults();
70 StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInheritedData& o)
71 : RefCounted<StyleRareNonInheritedData>()
72 , lineClamp(o.lineClamp)
74 , m_deprecatedFlexibleBox(o.m_deprecatedFlexibleBox)
75 #if ENABLE(CSS3_FLEXBOX)
76 , m_flexibleBox(o.m_flexibleBox)
78 , m_marquee(o.m_marquee)
79 , m_multiCol(o.m_multiCol)
80 , m_transform(o.m_transform)
81 , m_content(o.m_content ? o.m_content->clone() : nullptr)
82 , m_counterDirectives(o.m_counterDirectives ? clone(*o.m_counterDirectives) : nullptr)
83 , userDrag(o.userDrag)
84 , textOverflow(o.textOverflow)
85 , marginBeforeCollapse(o.marginBeforeCollapse)
86 , marginAfterCollapse(o.marginAfterCollapse)
87 , matchNearestMailBlockquoteColor(o.matchNearestMailBlockquoteColor)
88 , m_appearance(o.m_appearance)
89 , m_borderFit(o.m_borderFit)
90 , m_textCombine(o.m_textCombine)
91 , m_counterIncrement(o.m_counterIncrement)
92 , m_counterReset(o.m_counterReset)
93 #if USE(ACCELERATED_COMPOSITING)
94 , m_runningAcceleratedAnimation(o.m_runningAcceleratedAnimation)
96 , m_boxShadow(o.m_boxShadow ? adoptPtr(new ShadowData(*o.m_boxShadow)) : nullptr)
97 , m_boxReflect(o.m_boxReflect)
98 , m_animations(o.m_animations ? adoptPtr(new AnimationList(*o.m_animations)) : nullptr)
99 , m_transitions(o.m_transitions ? adoptPtr(new AnimationList(*o.m_transitions)) : nullptr)
101 , m_maskBoxImage(o.m_maskBoxImage)
102 , m_transformStyle3D(o.m_transformStyle3D)
103 , m_backfaceVisibility(o.m_backfaceVisibility)
104 , m_perspective(o.m_perspective)
105 , m_perspectiveOriginX(o.m_perspectiveOriginX)
106 , m_perspectiveOriginY(o.m_perspectiveOriginY)
107 , m_pageSize(o.m_pageSize)
108 , m_pageSizeType(o.m_pageSizeType)
109 , m_flowThread(o.m_flowThread)
110 , m_regionThread(o.m_regionThread)
111 , m_regionIndex(o.m_regionIndex)
112 , m_regionOverflow(o.m_regionOverflow)
113 , m_wrapShape(o.m_wrapShape)
114 , m_regionBreakAfter(o.m_regionBreakAfter)
115 , m_regionBreakBefore(o.m_regionBreakBefore)
116 , m_regionBreakInside(o.m_regionBreakInside)
120 StyleRareNonInheritedData::~StyleRareNonInheritedData()
124 bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) const
126 return lineClamp == o.lineClamp
127 #if ENABLE(DASHBOARD_SUPPORT)
128 && m_dashboardRegions == o.m_dashboardRegions
130 && opacity == o.opacity
131 && m_deprecatedFlexibleBox == o.m_deprecatedFlexibleBox
132 #if ENABLE(CSS3_FLEXBOX)
133 && m_flexibleBox == o.m_flexibleBox
135 && m_marquee == o.m_marquee
136 && m_multiCol == o.m_multiCol
137 && m_transform == o.m_transform
138 && contentDataEquivalent(o)
139 && counterDataEquivalent(o)
140 && userDrag == o.userDrag
141 && textOverflow == o.textOverflow
142 && marginBeforeCollapse == o.marginBeforeCollapse
143 && marginAfterCollapse == o.marginAfterCollapse
144 && matchNearestMailBlockquoteColor == o.matchNearestMailBlockquoteColor
145 && m_appearance == o.m_appearance
146 && m_borderFit == o.m_borderFit
147 && m_textCombine == o.m_textCombine
148 && m_counterIncrement == o.m_counterIncrement
149 && m_counterReset == o.m_counterReset
150 #if USE(ACCELERATED_COMPOSITING)
151 && !m_runningAcceleratedAnimation && !o.m_runningAcceleratedAnimation
153 && shadowDataEquivalent(o)
154 && reflectionDataEquivalent(o)
155 && animationDataEquivalent(o)
156 && transitionDataEquivalent(o)
157 && m_mask == o.m_mask
158 && m_maskBoxImage == o.m_maskBoxImage
159 && (m_transformStyle3D == o.m_transformStyle3D)
160 && (m_backfaceVisibility == o.m_backfaceVisibility)
161 && (m_perspective == o.m_perspective)
162 && (m_perspectiveOriginX == o.m_perspectiveOriginX)
163 && (m_perspectiveOriginY == o.m_perspectiveOriginY)
164 && (m_pageSize == o.m_pageSize)
165 && (m_pageSizeType == o.m_pageSizeType)
166 && (m_flowThread == o.m_flowThread)
167 && (m_regionThread == o.m_regionThread)
168 && (m_regionIndex == o.m_regionIndex)
169 && (m_regionOverflow == o.m_regionOverflow)
170 && (m_wrapShape == o.m_wrapShape)
171 && (m_regionBreakAfter == o.m_regionBreakAfter)
172 && (m_regionBreakBefore == o.m_regionBreakBefore)
173 && (m_regionBreakInside == o.m_regionBreakInside);
176 bool StyleRareNonInheritedData::contentDataEquivalent(const StyleRareNonInheritedData& o) const
178 if (m_content.get() == o.m_content.get())
181 if (m_content && o.m_content && *m_content == *o.m_content)
187 bool StyleRareNonInheritedData::counterDataEquivalent(const StyleRareNonInheritedData& o) const
189 if (m_counterDirectives.get() == o.m_counterDirectives.get())
192 if (m_counterDirectives && o.m_counterDirectives && *m_counterDirectives == *o.m_counterDirectives)
198 bool StyleRareNonInheritedData::shadowDataEquivalent(const StyleRareNonInheritedData& o) const
200 if ((!m_boxShadow && o.m_boxShadow) || (m_boxShadow && !o.m_boxShadow))
202 if (m_boxShadow && o.m_boxShadow && (*m_boxShadow != *o.m_boxShadow))
207 bool StyleRareNonInheritedData::reflectionDataEquivalent(const StyleRareNonInheritedData& o) const
209 if (m_boxReflect != o.m_boxReflect) {
210 if (!m_boxReflect || !o.m_boxReflect)
212 return *m_boxReflect == *o.m_boxReflect;
217 bool StyleRareNonInheritedData::animationDataEquivalent(const StyleRareNonInheritedData& o) const
219 if ((!m_animations && o.m_animations) || (m_animations && !o.m_animations))
221 if (m_animations && o.m_animations && (*m_animations != *o.m_animations))
226 bool StyleRareNonInheritedData::transitionDataEquivalent(const StyleRareNonInheritedData& o) const
228 if ((!m_transitions && o.m_transitions) || (m_transitions && !o.m_transitions))
230 if (m_transitions && o.m_transitions && (*m_transitions != *o.m_transitions))
235 } // namespace WebCore