| OLD | NEW |
| (Empty) |
| 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 "core/layout/style/StyleRareNonInheritedData.h" | |
| 24 | |
| 25 #include "core/layout/style/ContentData.h" | |
| 26 #include "core/layout/style/DataEquivalency.h" | |
| 27 #include "core/layout/style/ComputedStyle.h" | |
| 28 #include "core/layout/style/ShadowList.h" | |
| 29 #include "core/layout/style/StyleFilterData.h" | |
| 30 #include "core/layout/style/StyleTransformData.h" | |
| 31 #include "core/layout/svg/ReferenceFilterBuilder.h" | |
| 32 | |
| 33 namespace blink { | |
| 34 | |
| 35 StyleRareNonInheritedData::StyleRareNonInheritedData() | |
| 36 : opacity(ComputedStyle::initialOpacity()) | |
| 37 , m_perspective(ComputedStyle::initialPerspective()) | |
| 38 , m_perspectiveOrigin(ComputedStyle::initialPerspectiveOrigin()) | |
| 39 , lineClamp(ComputedStyle::initialLineClamp()) | |
| 40 , m_draggableRegionMode(DraggableRegionNone) | |
| 41 , m_mask(MaskFillLayer, true) | |
| 42 , m_pageSize() | |
| 43 , m_shapeOutside(ComputedStyle::initialShapeOutside()) | |
| 44 , m_shapeMargin(ComputedStyle::initialShapeMargin()) | |
| 45 , m_shapeImageThreshold(ComputedStyle::initialShapeImageThreshold()) | |
| 46 , m_clipPath(ComputedStyle::initialClipPath()) | |
| 47 , m_textDecorationColor(StyleColor::currentColor()) | |
| 48 , m_visitedLinkTextDecorationColor(StyleColor::currentColor()) | |
| 49 , m_visitedLinkBackgroundColor(ComputedStyle::initialBackgroundColor()) | |
| 50 , m_visitedLinkOutlineColor(StyleColor::currentColor()) | |
| 51 , m_visitedLinkBorderLeftColor(StyleColor::currentColor()) | |
| 52 , m_visitedLinkBorderRightColor(StyleColor::currentColor()) | |
| 53 , m_visitedLinkBorderTopColor(StyleColor::currentColor()) | |
| 54 , m_visitedLinkBorderBottomColor(StyleColor::currentColor()) | |
| 55 , m_order(ComputedStyle::initialOrder()) | |
| 56 , m_objectPosition(ComputedStyle::initialObjectPosition()) | |
| 57 , m_pageSizeType(PAGE_SIZE_AUTO) | |
| 58 , m_transformStyle3D(ComputedStyle::initialTransformStyle3D()) | |
| 59 , m_backfaceVisibility(ComputedStyle::initialBackfaceVisibility()) | |
| 60 , m_alignContent(ComputedStyle::initialAlignContent()) | |
| 61 , m_alignContentDistribution(ComputedStyle::initialAlignContentDistribution(
)) | |
| 62 , m_alignContentOverflowAlignment(ComputedStyle::initialAlignContentOverflow
Alignment()) | |
| 63 , m_alignItems(ComputedStyle::initialAlignItems()) | |
| 64 , m_alignItemsOverflowAlignment(ComputedStyle::initialAlignItemsOverflowAlig
nment()) | |
| 65 , m_alignSelf(ComputedStyle::initialAlignSelf()) | |
| 66 , m_alignSelfOverflowAlignment(ComputedStyle::initialAlignSelfOverflowAlignm
ent()) | |
| 67 , m_justifyContent(ComputedStyle::initialJustifyContent()) | |
| 68 , m_justifyContentDistribution(ComputedStyle::initialJustifyContentDistribut
ion()) | |
| 69 , m_justifyContentOverflowAlignment(ComputedStyle::initialJustifyContentOver
flowAlignment()) | |
| 70 , userDrag(ComputedStyle::initialUserDrag()) | |
| 71 , textOverflow(ComputedStyle::initialTextOverflow()) | |
| 72 , marginBeforeCollapse(MCOLLAPSE) | |
| 73 , marginAfterCollapse(MCOLLAPSE) | |
| 74 , m_appearance(ComputedStyle::initialAppearance()) | |
| 75 , m_textCombine(ComputedStyle::initialTextCombine()) | |
| 76 , m_textDecorationStyle(ComputedStyle::initialTextDecorationStyle()) | |
| 77 , m_wrapFlow(ComputedStyle::initialWrapFlow()) | |
| 78 , m_wrapThrough(ComputedStyle::initialWrapThrough()) | |
| 79 , m_hasCurrentOpacityAnimation(false) | |
| 80 , m_hasCurrentTransformAnimation(false) | |
| 81 , m_hasCurrentFilterAnimation(false) | |
| 82 , m_runningOpacityAnimationOnCompositor(false) | |
| 83 , m_runningTransformAnimationOnCompositor(false) | |
| 84 , m_runningFilterAnimationOnCompositor(false) | |
| 85 , m_effectiveBlendMode(ComputedStyle::initialBlendMode()) | |
| 86 , m_touchAction(ComputedStyle::initialTouchAction()) | |
| 87 , m_objectFit(ComputedStyle::initialObjectFit()) | |
| 88 , m_isolation(ComputedStyle::initialIsolation()) | |
| 89 , m_justifyItems(ComputedStyle::initialJustifyItems()) | |
| 90 , m_justifyItemsOverflowAlignment(ComputedStyle::initialJustifyItemsOverflow
Alignment()) | |
| 91 , m_justifyItemsPositionType(ComputedStyle::initialJustifyItemsPositionType(
)) | |
| 92 , m_justifySelf(ComputedStyle::initialJustifySelf()) | |
| 93 , m_justifySelfOverflowAlignment(ComputedStyle::initialJustifySelfOverflowAl
ignment()) | |
| 94 , m_scrollBehavior(ComputedStyle::initialScrollBehavior()) | |
| 95 , m_scrollBlocksOn(ComputedStyle::initialScrollBlocksOn()) | |
| 96 , m_requiresAcceleratedCompositingForExternalReasons(false) | |
| 97 , m_hasInlineTransform(false) | |
| 98 , m_resize(ComputedStyle::initialResize()) | |
| 99 { | |
| 100 m_maskBoxImage.setMaskDefaults(); | |
| 101 } | |
| 102 | |
| 103 StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
Data& o) | |
| 104 : RefCounted<StyleRareNonInheritedData>() | |
| 105 , opacity(o.opacity) | |
| 106 , m_perspective(o.m_perspective) | |
| 107 , m_perspectiveOrigin(o.m_perspectiveOrigin) | |
| 108 , lineClamp(o.lineClamp) | |
| 109 , m_draggableRegionMode(o.m_draggableRegionMode) | |
| 110 , m_deprecatedFlexibleBox(o.m_deprecatedFlexibleBox) | |
| 111 , m_flexibleBox(o.m_flexibleBox) | |
| 112 , m_multiCol(o.m_multiCol) | |
| 113 , m_transform(o.m_transform) | |
| 114 , m_willChange(o.m_willChange) | |
| 115 , m_filter(o.m_filter) | |
| 116 , m_grid(o.m_grid) | |
| 117 , m_gridItem(o.m_gridItem) | |
| 118 , m_content(o.m_content ? o.m_content->clone() : nullptr) | |
| 119 , m_counterDirectives(o.m_counterDirectives ? clone(*o.m_counterDirectives)
: nullptr) | |
| 120 , m_boxShadow(o.m_boxShadow) | |
| 121 , m_boxReflect(o.m_boxReflect) | |
| 122 , m_animations(o.m_animations ? CSSAnimationData::create(*o.m_animations) :
nullptr) | |
| 123 , m_transitions(o.m_transitions ? CSSTransitionData::create(*o.m_transitions
) : nullptr) | |
| 124 , m_mask(o.m_mask) | |
| 125 , m_maskBoxImage(o.m_maskBoxImage) | |
| 126 , m_pageSize(o.m_pageSize) | |
| 127 , m_shapeOutside(o.m_shapeOutside) | |
| 128 , m_shapeMargin(o.m_shapeMargin) | |
| 129 , m_shapeImageThreshold(o.m_shapeImageThreshold) | |
| 130 , m_clipPath(o.m_clipPath) | |
| 131 , m_textDecorationColor(o.m_textDecorationColor) | |
| 132 , m_visitedLinkTextDecorationColor(o.m_visitedLinkTextDecorationColor) | |
| 133 , m_visitedLinkBackgroundColor(o.m_visitedLinkBackgroundColor) | |
| 134 , m_visitedLinkOutlineColor(o.m_visitedLinkOutlineColor) | |
| 135 , m_visitedLinkBorderLeftColor(o.m_visitedLinkBorderLeftColor) | |
| 136 , m_visitedLinkBorderRightColor(o.m_visitedLinkBorderRightColor) | |
| 137 , m_visitedLinkBorderTopColor(o.m_visitedLinkBorderTopColor) | |
| 138 , m_visitedLinkBorderBottomColor(o.m_visitedLinkBorderBottomColor) | |
| 139 , m_order(o.m_order) | |
| 140 , m_objectPosition(o.m_objectPosition) | |
| 141 , m_pageSizeType(o.m_pageSizeType) | |
| 142 , m_transformStyle3D(o.m_transformStyle3D) | |
| 143 , m_backfaceVisibility(o.m_backfaceVisibility) | |
| 144 , m_alignContent(o.m_alignContent) | |
| 145 , m_alignContentDistribution(o.m_alignContentDistribution) | |
| 146 , m_alignContentOverflowAlignment(o.m_alignContentOverflowAlignment) | |
| 147 , m_alignItems(o.m_alignItems) | |
| 148 , m_alignItemsOverflowAlignment(o.m_alignItemsOverflowAlignment) | |
| 149 , m_alignSelf(o.m_alignSelf) | |
| 150 , m_alignSelfOverflowAlignment(o.m_alignSelfOverflowAlignment) | |
| 151 , m_justifyContent(o.m_justifyContent) | |
| 152 , m_justifyContentDistribution(o.m_justifyContentDistribution) | |
| 153 , m_justifyContentOverflowAlignment(o.m_justifyContentOverflowAlignment) | |
| 154 , userDrag(o.userDrag) | |
| 155 , textOverflow(o.textOverflow) | |
| 156 , marginBeforeCollapse(o.marginBeforeCollapse) | |
| 157 , marginAfterCollapse(o.marginAfterCollapse) | |
| 158 , m_appearance(o.m_appearance) | |
| 159 , m_textCombine(o.m_textCombine) | |
| 160 , m_textDecorationStyle(o.m_textDecorationStyle) | |
| 161 , m_wrapFlow(o.m_wrapFlow) | |
| 162 , m_wrapThrough(o.m_wrapThrough) | |
| 163 , m_hasCurrentOpacityAnimation(o.m_hasCurrentOpacityAnimation) | |
| 164 , m_hasCurrentTransformAnimation(o.m_hasCurrentTransformAnimation) | |
| 165 , m_hasCurrentFilterAnimation(o.m_hasCurrentFilterAnimation) | |
| 166 , m_runningOpacityAnimationOnCompositor(o.m_runningOpacityAnimationOnComposi
tor) | |
| 167 , m_runningTransformAnimationOnCompositor(o.m_runningTransformAnimationOnCom
positor) | |
| 168 , m_runningFilterAnimationOnCompositor(o.m_runningFilterAnimationOnComposito
r) | |
| 169 , m_effectiveBlendMode(o.m_effectiveBlendMode) | |
| 170 , m_touchAction(o.m_touchAction) | |
| 171 , m_objectFit(o.m_objectFit) | |
| 172 , m_isolation(o.m_isolation) | |
| 173 , m_justifyItems(o.m_justifyItems) | |
| 174 , m_justifyItemsOverflowAlignment(o.m_justifyItemsOverflowAlignment) | |
| 175 , m_justifyItemsPositionType(o.m_justifyItemsPositionType) | |
| 176 , m_justifySelf(o.m_justifySelf) | |
| 177 , m_justifySelfOverflowAlignment(o.m_justifySelfOverflowAlignment) | |
| 178 , m_scrollBehavior(o.m_scrollBehavior) | |
| 179 , m_scrollBlocksOn(o.m_scrollBlocksOn) | |
| 180 , m_requiresAcceleratedCompositingForExternalReasons(o.m_requiresAccelerated
CompositingForExternalReasons) | |
| 181 , m_hasInlineTransform(o.m_hasInlineTransform) | |
| 182 , m_resize(o.m_resize) | |
| 183 { | |
| 184 } | |
| 185 | |
| 186 StyleRareNonInheritedData::~StyleRareNonInheritedData() | |
| 187 { | |
| 188 const FilterOperations& filterOperations = m_filter->m_operations; | |
| 189 for (unsigned i = 0; i < filterOperations.size(); ++i) | |
| 190 ReferenceFilterBuilder::clearDocumentResourceReference(filterOperations.
at(i)); | |
| 191 } | |
| 192 | |
| 193 bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
onst | |
| 194 { | |
| 195 return opacity == o.opacity | |
| 196 && m_perspective == o.m_perspective | |
| 197 && m_perspectiveOrigin == o.m_perspectiveOrigin | |
| 198 && lineClamp == o.lineClamp | |
| 199 && m_draggableRegionMode == o.m_draggableRegionMode | |
| 200 && m_deprecatedFlexibleBox == o.m_deprecatedFlexibleBox | |
| 201 && m_flexibleBox == o.m_flexibleBox | |
| 202 && m_multiCol == o.m_multiCol | |
| 203 && m_transform == o.m_transform | |
| 204 && m_willChange == o.m_willChange | |
| 205 && m_filter == o.m_filter | |
| 206 && m_grid == o.m_grid | |
| 207 && m_gridItem == o.m_gridItem | |
| 208 && contentDataEquivalent(o) | |
| 209 && counterDataEquivalent(o) | |
| 210 && shadowDataEquivalent(o) | |
| 211 && reflectionDataEquivalent(o) | |
| 212 && animationDataEquivalent(o) | |
| 213 && transitionDataEquivalent(o) | |
| 214 && m_mask == o.m_mask | |
| 215 && m_maskBoxImage == o.m_maskBoxImage | |
| 216 && m_pageSize == o.m_pageSize | |
| 217 && shapeOutsideDataEquivalent(o) | |
| 218 && m_shapeMargin == o.m_shapeMargin | |
| 219 && m_shapeImageThreshold == o.m_shapeImageThreshold | |
| 220 && clipPathDataEquivalent(o) | |
| 221 && m_textDecorationColor == o.m_textDecorationColor | |
| 222 && m_visitedLinkTextDecorationColor == o.m_visitedLinkTextDecorationColo
r | |
| 223 && m_visitedLinkBackgroundColor == o.m_visitedLinkBackgroundColor | |
| 224 && m_visitedLinkOutlineColor == o.m_visitedLinkOutlineColor | |
| 225 && m_visitedLinkBorderLeftColor == o.m_visitedLinkBorderLeftColor | |
| 226 && m_visitedLinkBorderRightColor == o.m_visitedLinkBorderRightColor | |
| 227 && m_visitedLinkBorderTopColor == o.m_visitedLinkBorderTopColor | |
| 228 && m_visitedLinkBorderBottomColor == o.m_visitedLinkBorderBottomColor | |
| 229 && m_order == o.m_order | |
| 230 && m_objectPosition == o.m_objectPosition | |
| 231 && m_callbackSelectors == o.m_callbackSelectors | |
| 232 && m_pageSizeType == o.m_pageSizeType | |
| 233 && m_transformStyle3D == o.m_transformStyle3D | |
| 234 && m_backfaceVisibility == o.m_backfaceVisibility | |
| 235 && m_alignContent == o.m_alignContent | |
| 236 && m_alignContentDistribution == o.m_alignContentDistribution | |
| 237 && m_alignContentOverflowAlignment == o.m_alignContentOverflowAlignment | |
| 238 && m_alignItems == o.m_alignItems | |
| 239 && m_alignItemsOverflowAlignment == o.m_alignItemsOverflowAlignment | |
| 240 && m_alignSelf == o.m_alignSelf | |
| 241 && m_alignSelfOverflowAlignment == o.m_alignSelfOverflowAlignment | |
| 242 && m_justifyContent == o.m_justifyContent | |
| 243 && m_justifyContentDistribution == o.m_justifyContentDistribution | |
| 244 && m_justifyContentOverflowAlignment == o.m_justifyContentOverflowAlignm
ent | |
| 245 && userDrag == o.userDrag | |
| 246 && textOverflow == o.textOverflow | |
| 247 && marginBeforeCollapse == o.marginBeforeCollapse | |
| 248 && marginAfterCollapse == o.marginAfterCollapse | |
| 249 && m_appearance == o.m_appearance | |
| 250 && m_textCombine == o.m_textCombine | |
| 251 && m_textDecorationStyle == o.m_textDecorationStyle | |
| 252 && m_wrapFlow == o.m_wrapFlow | |
| 253 && m_wrapThrough == o.m_wrapThrough | |
| 254 && m_hasCurrentOpacityAnimation == o.m_hasCurrentOpacityAnimation | |
| 255 && m_hasCurrentTransformAnimation == o.m_hasCurrentTransformAnimation | |
| 256 && m_hasCurrentFilterAnimation == o.m_hasCurrentFilterAnimation | |
| 257 && m_effectiveBlendMode == o.m_effectiveBlendMode | |
| 258 && m_touchAction == o.m_touchAction | |
| 259 && m_objectFit == o.m_objectFit | |
| 260 && m_isolation == o.m_isolation | |
| 261 && m_justifyItems == o.m_justifyItems | |
| 262 && m_justifyItemsOverflowAlignment == o.m_justifyItemsOverflowAlignment | |
| 263 && m_justifyItemsPositionType == o.m_justifyItemsPositionType | |
| 264 && m_justifySelf == o.m_justifySelf | |
| 265 && m_justifySelfOverflowAlignment == o.m_justifySelfOverflowAlignment | |
| 266 && m_scrollBehavior == o.m_scrollBehavior | |
| 267 && m_scrollBlocksOn == o.m_scrollBlocksOn | |
| 268 && m_requiresAcceleratedCompositingForExternalReasons == o.m_requiresAcc
eleratedCompositingForExternalReasons | |
| 269 && m_hasInlineTransform == o.m_hasInlineTransform | |
| 270 && m_resize == o.m_resize; | |
| 271 } | |
| 272 | |
| 273 bool StyleRareNonInheritedData::contentDataEquivalent(const StyleRareNonInherite
dData& o) const | |
| 274 { | |
| 275 ContentData* a = m_content.get(); | |
| 276 ContentData* b = o.m_content.get(); | |
| 277 | |
| 278 while (a && b && *a == *b) { | |
| 279 a = a->next(); | |
| 280 b = b->next(); | |
| 281 } | |
| 282 | |
| 283 return !a && !b; | |
| 284 } | |
| 285 | |
| 286 bool StyleRareNonInheritedData::counterDataEquivalent(const StyleRareNonInherite
dData& o) const | |
| 287 { | |
| 288 return dataEquivalent(m_counterDirectives, o.m_counterDirectives); | |
| 289 } | |
| 290 | |
| 291 bool StyleRareNonInheritedData::shadowDataEquivalent(const StyleRareNonInherited
Data& o) const | |
| 292 { | |
| 293 return dataEquivalent(m_boxShadow, o.m_boxShadow); | |
| 294 } | |
| 295 | |
| 296 bool StyleRareNonInheritedData::reflectionDataEquivalent(const StyleRareNonInher
itedData& o) const | |
| 297 { | |
| 298 return dataEquivalent(m_boxReflect, o.m_boxReflect); | |
| 299 } | |
| 300 | |
| 301 bool StyleRareNonInheritedData::animationDataEquivalent(const StyleRareNonInheri
tedData& o) const | |
| 302 { | |
| 303 if (!m_animations && !o.m_animations) | |
| 304 return true; | |
| 305 if (!m_animations || !o.m_animations) | |
| 306 return false; | |
| 307 return m_animations->animationsMatchForStyleRecalc(*o.m_animations); | |
| 308 } | |
| 309 | |
| 310 bool StyleRareNonInheritedData::transitionDataEquivalent(const StyleRareNonInher
itedData& o) const | |
| 311 { | |
| 312 if (!m_transitions && !o.m_transitions) | |
| 313 return true; | |
| 314 if (!m_transitions || !o.m_transitions) | |
| 315 return false; | |
| 316 return m_transitions->transitionsMatchForStyleRecalc(*o.m_transitions); | |
| 317 } | |
| 318 | |
| 319 bool StyleRareNonInheritedData::hasFilters() const | |
| 320 { | |
| 321 return m_filter.get() && !m_filter->m_operations.isEmpty(); | |
| 322 } | |
| 323 | |
| 324 bool StyleRareNonInheritedData::shapeOutsideDataEquivalent(const StyleRareNonInh
eritedData& o) const | |
| 325 { | |
| 326 return dataEquivalent(m_shapeOutside, o.m_shapeOutside); | |
| 327 } | |
| 328 | |
| 329 bool StyleRareNonInheritedData::clipPathDataEquivalent(const StyleRareNonInherit
edData& o) const | |
| 330 { | |
| 331 return dataEquivalent(m_clipPath, o.m_clipPath); | |
| 332 } | |
| 333 | |
| 334 } // namespace blink | |
| OLD | NEW |