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 "StyleFilterData.h"
31 #include "StyleTransformData.h"
32 #include "StyleImage.h"
36 StyleRareNonInheritedData::StyleRareNonInheritedData()
37 : opacity(RenderStyle::initialOpacity())
38 , m_aspectRatioDenominator(RenderStyle::initialAspectRatioDenominator())
39 , m_aspectRatioNumerator(RenderStyle::initialAspectRatioNumerator())
40 , m_counterIncrement(0)
42 , m_perspective(RenderStyle::initialPerspective())
43 , m_perspectiveOriginX(RenderStyle::initialPerspectiveOriginX())
44 , m_perspectiveOriginY(RenderStyle::initialPerspectiveOriginY())
45 , lineClamp(RenderStyle::initialLineClamp())
46 , m_mask(FillLayer(MaskFillLayer))
48 , m_wrapShapeInside(RenderStyle::initialWrapShapeInside())
49 , m_wrapShapeOutside(RenderStyle::initialWrapShapeOutside())
50 , m_wrapMargin(RenderStyle::initialWrapMargin())
51 , m_wrapPadding(RenderStyle::initialWrapPadding())
52 , m_visitedLinkBackgroundColor(RenderStyle::initialBackgroundColor())
53 , m_flowThread(RenderStyle::initialFlowThread())
54 , m_regionThread(RenderStyle::initialRegionThread())
55 , m_regionOverflow(RenderStyle::initialRegionOverflow())
56 , m_regionBreakAfter(RenderStyle::initialPageBreak())
57 , m_regionBreakBefore(RenderStyle::initialPageBreak())
58 , m_regionBreakInside(RenderStyle::initialPageBreak())
59 , m_pageSizeType(PAGE_SIZE_AUTO)
60 , m_transformStyle3D(RenderStyle::initialTransformStyle3D())
61 , m_backfaceVisibility(RenderStyle::initialBackfaceVisibility())
62 , userDrag(RenderStyle::initialUserDrag())
63 , textOverflow(RenderStyle::initialTextOverflow())
64 , marginBeforeCollapse(MCOLLAPSE)
65 , marginAfterCollapse(MCOLLAPSE)
66 , matchNearestMailBlockquoteColor(RenderStyle::initialMatchNearestMailBlockquoteColor())
67 , m_appearance(RenderStyle::initialAppearance())
68 , m_borderFit(RenderStyle::initialBorderFit())
69 , m_textCombine(RenderStyle::initialTextCombine())
70 , m_wrapFlow(RenderStyle::initialWrapFlow())
71 , m_wrapThrough(RenderStyle::initialWrapThrough())
72 , m_hasAspectRatio(false)
73 #if USE(ACCELERATED_COMPOSITING)
74 , m_runningAcceleratedAnimation(false)
77 m_maskBoxImage.setMaskDefaults();
80 StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInheritedData& o)
81 : RefCounted<StyleRareNonInheritedData>()
83 , m_aspectRatioDenominator(o.m_aspectRatioDenominator)
84 , m_aspectRatioNumerator(o.m_aspectRatioNumerator)
85 , m_counterIncrement(o.m_counterIncrement)
86 , m_counterReset(o.m_counterReset)
87 , m_perspective(o.m_perspective)
88 , m_perspectiveOriginX(o.m_perspectiveOriginX)
89 , m_perspectiveOriginY(o.m_perspectiveOriginY)
90 , lineClamp(o.lineClamp)
91 , m_deprecatedFlexibleBox(o.m_deprecatedFlexibleBox)
92 , m_flexibleBox(o.m_flexibleBox)
93 , m_marquee(o.m_marquee)
94 , m_multiCol(o.m_multiCol)
95 , m_transform(o.m_transform)
96 #if ENABLE(CSS_FILTERS)
97 , m_filter(o.m_filter)
99 #if ENABLE(CSS_GRID_LAYOUT)
102 , m_content(o.m_content ? o.m_content->clone() : nullptr)
103 , m_counterDirectives(o.m_counterDirectives ? clone(*o.m_counterDirectives) : nullptr)
104 , m_boxShadow(o.m_boxShadow ? adoptPtr(new ShadowData(*o.m_boxShadow)) : nullptr)
105 , m_boxReflect(o.m_boxReflect)
106 , m_animations(o.m_animations ? adoptPtr(new AnimationList(*o.m_animations)) : nullptr)
107 , m_transitions(o.m_transitions ? adoptPtr(new AnimationList(*o.m_transitions)) : nullptr)
109 , m_maskBoxImage(o.m_maskBoxImage)
110 , m_pageSize(o.m_pageSize)
111 , m_wrapShapeInside(o.m_wrapShapeInside)
112 , m_wrapShapeOutside(o.m_wrapShapeOutside)
113 , m_wrapMargin(o.m_wrapMargin)
114 , m_wrapPadding(o.m_wrapPadding)
115 , m_visitedLinkBackgroundColor(o.m_visitedLinkBackgroundColor)
116 , m_visitedLinkOutlineColor(o.m_visitedLinkBackgroundColor)
117 , m_visitedLinkBorderLeftColor(o.m_visitedLinkBorderLeftColor)
118 , m_visitedLinkBorderRightColor(o.m_visitedLinkBorderRightColor)
119 , m_visitedLinkBorderTopColor(o.m_visitedLinkBorderTopColor)
120 , m_visitedLinkBorderBottomColor(o.m_visitedLinkBorderBottomColor)
121 , m_flowThread(o.m_flowThread)
122 , m_regionThread(o.m_regionThread)
123 , m_regionOverflow(o.m_regionOverflow)
124 , m_regionBreakAfter(o.m_regionBreakAfter)
125 , m_regionBreakBefore(o.m_regionBreakBefore)
126 , m_regionBreakInside(o.m_regionBreakInside)
127 , m_pageSizeType(o.m_pageSizeType)
128 , m_transformStyle3D(o.m_transformStyle3D)
129 , m_backfaceVisibility(o.m_backfaceVisibility)
130 , userDrag(o.userDrag)
131 , textOverflow(o.textOverflow)
132 , marginBeforeCollapse(o.marginBeforeCollapse)
133 , marginAfterCollapse(o.marginAfterCollapse)
134 , matchNearestMailBlockquoteColor(o.matchNearestMailBlockquoteColor)
135 , m_appearance(o.m_appearance)
136 , m_borderFit(o.m_borderFit)
137 , m_textCombine(o.m_textCombine)
138 , m_wrapFlow(o.m_wrapFlow)
139 , m_wrapThrough(o.m_wrapThrough)
140 , m_hasAspectRatio(o.m_hasAspectRatio)
141 #if USE(ACCELERATED_COMPOSITING)
142 , m_runningAcceleratedAnimation(o.m_runningAcceleratedAnimation)
147 StyleRareNonInheritedData::~StyleRareNonInheritedData()
151 bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) const
153 return lineClamp == o.lineClamp
154 #if ENABLE(DASHBOARD_SUPPORT)
155 && m_dashboardRegions == o.m_dashboardRegions
157 && opacity == o.opacity
158 && m_deprecatedFlexibleBox == o.m_deprecatedFlexibleBox
159 && m_flexibleBox == o.m_flexibleBox
160 && m_marquee == o.m_marquee
161 && m_multiCol == o.m_multiCol
162 && m_transform == o.m_transform
163 #if ENABLE(CSS_FILTERS)
164 && m_filter == o.m_filter
166 #if ENABLE(CSS_GRID_LAYOUT)
167 && m_grid == o.m_grid
169 && contentDataEquivalent(o)
170 && counterDataEquivalent(o)
171 && userDrag == o.userDrag
172 && textOverflow == o.textOverflow
173 && marginBeforeCollapse == o.marginBeforeCollapse
174 && marginAfterCollapse == o.marginAfterCollapse
175 && matchNearestMailBlockquoteColor == o.matchNearestMailBlockquoteColor
176 && m_appearance == o.m_appearance
177 && m_borderFit == o.m_borderFit
178 && m_textCombine == o.m_textCombine
179 && m_aspectRatioDenominator == o.m_aspectRatioDenominator
180 && m_aspectRatioNumerator == o.m_aspectRatioNumerator
181 && m_counterIncrement == o.m_counterIncrement
182 && m_counterReset == o.m_counterReset
183 && m_hasAspectRatio == o.m_hasAspectRatio
184 #if USE(ACCELERATED_COMPOSITING)
185 && !m_runningAcceleratedAnimation && !o.m_runningAcceleratedAnimation
187 && shadowDataEquivalent(o)
188 && reflectionDataEquivalent(o)
189 && animationDataEquivalent(o)
190 && transitionDataEquivalent(o)
191 && m_mask == o.m_mask
192 && m_maskBoxImage == o.m_maskBoxImage
193 && (m_transformStyle3D == o.m_transformStyle3D)
194 && (m_backfaceVisibility == o.m_backfaceVisibility)
195 && (m_perspective == o.m_perspective)
196 && (m_perspectiveOriginX == o.m_perspectiveOriginX)
197 && (m_perspectiveOriginY == o.m_perspectiveOriginY)
198 && (m_pageSize == o.m_pageSize)
199 && (m_pageSizeType == o.m_pageSizeType)
200 && (m_flowThread == o.m_flowThread)
201 && (m_regionThread == o.m_regionThread)
202 && (m_regionOverflow == o.m_regionOverflow)
203 && (m_wrapShapeInside == o.m_wrapShapeInside)
204 && (m_wrapShapeOutside == o.m_wrapShapeOutside)
205 && (m_wrapFlow == o.m_wrapFlow)
206 && (m_wrapThrough == o.m_wrapThrough)
207 && (m_wrapMargin == o.m_wrapMargin)
208 && (m_wrapPadding == o.m_wrapPadding)
209 && m_visitedLinkBackgroundColor == o.m_visitedLinkBackgroundColor
210 && m_visitedLinkOutlineColor == o.m_visitedLinkOutlineColor
211 && m_visitedLinkBorderLeftColor == o.m_visitedLinkBorderLeftColor
212 && m_visitedLinkBorderRightColor == o.m_visitedLinkBorderRightColor
213 && m_visitedLinkBorderTopColor == o.m_visitedLinkBorderTopColor
214 && m_visitedLinkBorderBottomColor == o.m_visitedLinkBorderBottomColor
215 && (m_regionBreakAfter == o.m_regionBreakAfter)
216 && (m_regionBreakBefore == o.m_regionBreakBefore)
217 && (m_regionBreakInside == o.m_regionBreakInside);
220 bool StyleRareNonInheritedData::contentDataEquivalent(const StyleRareNonInheritedData& o) const
222 if (m_content.get() == o.m_content.get())
225 if (m_content && o.m_content && *m_content == *o.m_content)
231 bool StyleRareNonInheritedData::counterDataEquivalent(const StyleRareNonInheritedData& o) const
233 if (m_counterDirectives.get() == o.m_counterDirectives.get())
236 if (m_counterDirectives && o.m_counterDirectives && *m_counterDirectives == *o.m_counterDirectives)
242 bool StyleRareNonInheritedData::shadowDataEquivalent(const StyleRareNonInheritedData& o) const
244 if ((!m_boxShadow && o.m_boxShadow) || (m_boxShadow && !o.m_boxShadow))
246 if (m_boxShadow && o.m_boxShadow && (*m_boxShadow != *o.m_boxShadow))
251 bool StyleRareNonInheritedData::reflectionDataEquivalent(const StyleRareNonInheritedData& o) const
253 if (m_boxReflect != o.m_boxReflect) {
254 if (!m_boxReflect || !o.m_boxReflect)
256 return *m_boxReflect == *o.m_boxReflect;
261 bool StyleRareNonInheritedData::animationDataEquivalent(const StyleRareNonInheritedData& o) const
263 if ((!m_animations && o.m_animations) || (m_animations && !o.m_animations))
265 if (m_animations && o.m_animations && (*m_animations != *o.m_animations))
270 bool StyleRareNonInheritedData::transitionDataEquivalent(const StyleRareNonInheritedData& o) const
272 if ((!m_transitions && o.m_transitions) || (m_transitions && !o.m_transitions))
274 if (m_transitions && o.m_transitions && (*m_transitions != *o.m_transitions))
279 } // namespace WebCore