| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 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 | 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, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 * | 19 * |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 #include "core/style/StyleRareNonInheritedData.h" | 22 #include "core/style/StyleRareNonInheritedData.h" |
| 23 | 23 |
| 24 #include "core/animation/css/CSSAnimationData.h" | |
| 25 #include "core/animation/css/CSSTransitionData.h" | |
| 26 #include "core/style/ContentData.h" | |
| 27 #include "core/style/DataEquivalency.h" | |
| 28 #include "core/style/ComputedStyle.h" | |
| 29 #include "core/style/ShadowList.h" | |
| 30 #include "core/style/StyleFilterData.h" | |
| 31 #include "core/style/StyleTransformData.h" | |
| 32 #include "core/layout/svg/ReferenceFilterBuilder.h" | |
| 33 | |
| 34 namespace blink { | 24 namespace blink { |
| 35 | 25 |
| 36 class SameSizeStyleRareNonInheritedData : public RefCounted<StyleRareNonInherite
dData> { | |
| 37 public: | |
| 38 float floats[3]; | |
| 39 int integers; | |
| 40 | |
| 41 LengthPoint lengthPoints[2]; | |
| 42 LineClampValue lineClamps; | |
| 43 DraggableRegionMode draggableRegions; | |
| 44 | |
| 45 void* dataRefs[8]; | |
| 46 DataPersistent<void*> dataPersistents[2]; | |
| 47 void* ownPtrs[4]; | |
| 48 Persistent<void*> persistentHandles[2]; | |
| 49 void* refPtrs[2]; | |
| 50 void* uniquePtrs[1]; | |
| 51 | |
| 52 FillLayer fillLayers; | |
| 53 NinePieceImage ninePieces; | |
| 54 FloatSize floatSize; | |
| 55 Length lengths; | |
| 56 | |
| 57 StyleColor styleColors[8]; | |
| 58 | |
| 59 Vector<String> m_callbackSelectors; | |
| 60 | |
| 61 StyleContentAlignmentData contentAlignmentData[2]; | |
| 62 StyleSelfAlignmentData selfAlignmentData[4]; | |
| 63 | |
| 64 unsigned m_bitFields[2]; | |
| 65 }; | |
| 66 | |
| 67 static_assert(sizeof(StyleRareNonInheritedData) == sizeof(SameSizeStyleRareNonIn
heritedData), "StyleRareNonInheritedData_should_stay_small"); | |
| 68 | |
| 69 StyleRareNonInheritedData::StyleRareNonInheritedData() | |
| 70 : opacity(ComputedStyle::initialOpacity()) | |
| 71 , m_perspective(ComputedStyle::initialPerspective()) | |
| 72 , m_shapeImageThreshold(ComputedStyle::initialShapeImageThreshold()) | |
| 73 , m_order(ComputedStyle::initialOrder()) | |
| 74 , m_perspectiveOrigin(ComputedStyle::initialPerspectiveOrigin()) | |
| 75 , m_objectPosition(ComputedStyle::initialObjectPosition()) | |
| 76 , lineClamp(ComputedStyle::initialLineClamp()) | |
| 77 , m_draggableRegionMode(DraggableRegionNone) | |
| 78 , m_shapeOutside(ComputedStyle::initialShapeOutside()) | |
| 79 , m_clipPath(ComputedStyle::initialClipPath()) | |
| 80 , m_mask(MaskFillLayer, true) | |
| 81 , m_pageSize() | |
| 82 , m_shapeMargin(ComputedStyle::initialShapeMargin()) | |
| 83 , m_textDecorationColor(StyleColor::currentColor()) | |
| 84 , m_visitedLinkTextDecorationColor(StyleColor::currentColor()) | |
| 85 , m_visitedLinkBackgroundColor(ComputedStyle::initialBackgroundColor()) | |
| 86 , m_visitedLinkOutlineColor(StyleColor::currentColor()) | |
| 87 , m_visitedLinkBorderLeftColor(StyleColor::currentColor()) | |
| 88 , m_visitedLinkBorderRightColor(StyleColor::currentColor()) | |
| 89 , m_visitedLinkBorderTopColor(StyleColor::currentColor()) | |
| 90 , m_visitedLinkBorderBottomColor(StyleColor::currentColor()) | |
| 91 , m_alignContent(ComputedStyle::initialContentAlignment()) | |
| 92 , m_alignItems(ComputedStyle::initialDefaultAlignment()) | |
| 93 , m_alignSelf(ComputedStyle::initialSelfAlignment()) | |
| 94 , m_justifyContent(ComputedStyle::initialContentAlignment()) | |
| 95 , m_justifyItems(ComputedStyle::initialSelfAlignment()) | |
| 96 , m_justifySelf(ComputedStyle::initialSelfAlignment()) | |
| 97 , m_pageSizeType(PAGE_SIZE_AUTO) | |
| 98 , m_transformStyle3D(ComputedStyle::initialTransformStyle3D()) | |
| 99 , m_backfaceVisibility(ComputedStyle::initialBackfaceVisibility()) | |
| 100 , userDrag(ComputedStyle::initialUserDrag()) | |
| 101 , textOverflow(ComputedStyle::initialTextOverflow()) | |
| 102 , marginBeforeCollapse(MarginCollapseCollapse) | |
| 103 , marginAfterCollapse(MarginCollapseCollapse) | |
| 104 , m_appearance(ComputedStyle::initialAppearance()) | |
| 105 , m_textDecorationStyle(ComputedStyle::initialTextDecorationStyle()) | |
| 106 , m_hasCurrentOpacityAnimation(false) | |
| 107 , m_hasCurrentTransformAnimation(false) | |
| 108 , m_hasCurrentFilterAnimation(false) | |
| 109 , m_hasCurrentBackdropFilterAnimation(false) | |
| 110 , m_runningOpacityAnimationOnCompositor(false) | |
| 111 , m_runningTransformAnimationOnCompositor(false) | |
| 112 , m_runningFilterAnimationOnCompositor(false) | |
| 113 , m_runningBackdropFilterAnimationOnCompositor(false) | |
| 114 , m_isStackingContext(false) | |
| 115 , m_effectiveBlendMode(ComputedStyle::initialBlendMode()) | |
| 116 , m_touchAction(ComputedStyle::initialTouchAction()) | |
| 117 , m_objectFit(ComputedStyle::initialObjectFit()) | |
| 118 , m_isolation(ComputedStyle::initialIsolation()) | |
| 119 , m_contain(ComputedStyle::initialContain()) | |
| 120 , m_scrollBehavior(ComputedStyle::initialScrollBehavior()) | |
| 121 , m_scrollSnapType(ComputedStyle::initialScrollSnapType()) | |
| 122 , m_requiresAcceleratedCompositingForExternalReasons(false) | |
| 123 , m_hasInlineTransform(false) | |
| 124 , m_resize(ComputedStyle::initialResize()) | |
| 125 , m_hasCompositorProxy(false) | |
| 126 , m_hasAuthorBackground(false) | |
| 127 , m_hasAuthorBorder(false) | |
| 128 { | |
| 129 m_maskBoxImage.setMaskDefaults(); | |
| 130 } | |
| 131 | |
| 132 StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
Data& o) | |
| 133 : RefCounted<StyleRareNonInheritedData>() | |
| 134 , opacity(o.opacity) | |
| 135 , m_perspective(o.m_perspective) | |
| 136 , m_shapeImageThreshold(o.m_shapeImageThreshold) | |
| 137 , m_order(o.m_order) | |
| 138 , m_perspectiveOrigin(o.m_perspectiveOrigin) | |
| 139 , m_objectPosition(o.m_objectPosition) | |
| 140 , lineClamp(o.lineClamp) | |
| 141 , m_draggableRegionMode(o.m_draggableRegionMode) | |
| 142 , m_deprecatedFlexibleBox(o.m_deprecatedFlexibleBox) | |
| 143 , m_flexibleBox(o.m_flexibleBox) | |
| 144 , m_multiCol(o.m_multiCol) | |
| 145 , m_transform(o.m_transform) | |
| 146 , m_willChange(o.m_willChange) | |
| 147 , m_filter(o.m_filter) | |
| 148 , m_backdropFilter(o.m_backdropFilter) | |
| 149 , m_grid(o.m_grid) | |
| 150 , m_gridItem(o.m_gridItem) | |
| 151 , m_scrollSnap(o.m_scrollSnap) | |
| 152 , m_content(o.m_content ? o.m_content->clone() : nullptr) | |
| 153 , m_counterDirectives(o.m_counterDirectives ? clone(*o.m_counterDirectives)
: nullptr) | |
| 154 , m_animations(o.m_animations ? CSSAnimationData::create(*o.m_animations) :
nullptr) | |
| 155 , m_transitions(o.m_transitions ? CSSTransitionData::create(*o.m_transitions
) : nullptr) | |
| 156 , m_boxShadow(o.m_boxShadow) | |
| 157 , m_boxReflect(o.m_boxReflect) | |
| 158 , m_shapeOutside(o.m_shapeOutside) | |
| 159 , m_clipPath(o.m_clipPath) | |
| 160 , m_mask(o.m_mask) | |
| 161 , m_maskBoxImage(o.m_maskBoxImage) | |
| 162 , m_pageSize(o.m_pageSize) | |
| 163 , m_shapeMargin(o.m_shapeMargin) | |
| 164 , m_textDecorationColor(o.m_textDecorationColor) | |
| 165 , m_visitedLinkTextDecorationColor(o.m_visitedLinkTextDecorationColor) | |
| 166 , m_visitedLinkBackgroundColor(o.m_visitedLinkBackgroundColor) | |
| 167 , m_visitedLinkOutlineColor(o.m_visitedLinkOutlineColor) | |
| 168 , m_visitedLinkBorderLeftColor(o.m_visitedLinkBorderLeftColor) | |
| 169 , m_visitedLinkBorderRightColor(o.m_visitedLinkBorderRightColor) | |
| 170 , m_visitedLinkBorderTopColor(o.m_visitedLinkBorderTopColor) | |
| 171 , m_visitedLinkBorderBottomColor(o.m_visitedLinkBorderBottomColor) | |
| 172 , m_alignContent(o.m_alignContent) | |
| 173 , m_alignItems(o.m_alignItems) | |
| 174 , m_alignSelf(o.m_alignSelf) | |
| 175 , m_justifyContent(o.m_justifyContent) | |
| 176 , m_justifyItems(o.m_justifyItems) | |
| 177 , m_justifySelf(o.m_justifySelf) | |
| 178 , m_pageSizeType(o.m_pageSizeType) | |
| 179 , m_transformStyle3D(o.m_transformStyle3D) | |
| 180 , m_backfaceVisibility(o.m_backfaceVisibility) | |
| 181 , userDrag(o.userDrag) | |
| 182 , textOverflow(o.textOverflow) | |
| 183 , marginBeforeCollapse(o.marginBeforeCollapse) | |
| 184 , marginAfterCollapse(o.marginAfterCollapse) | |
| 185 , m_appearance(o.m_appearance) | |
| 186 , m_textDecorationStyle(o.m_textDecorationStyle) | |
| 187 , m_hasCurrentOpacityAnimation(o.m_hasCurrentOpacityAnimation) | |
| 188 , m_hasCurrentTransformAnimation(o.m_hasCurrentTransformAnimation) | |
| 189 , m_hasCurrentFilterAnimation(o.m_hasCurrentFilterAnimation) | |
| 190 , m_hasCurrentBackdropFilterAnimation(o.m_hasCurrentBackdropFilterAnimation) | |
| 191 , m_runningOpacityAnimationOnCompositor(o.m_runningOpacityAnimationOnComposi
tor) | |
| 192 , m_runningTransformAnimationOnCompositor(o.m_runningTransformAnimationOnCom
positor) | |
| 193 , m_runningFilterAnimationOnCompositor(o.m_runningFilterAnimationOnComposito
r) | |
| 194 , m_runningBackdropFilterAnimationOnCompositor(o.m_runningBackdropFilterAnim
ationOnCompositor) | |
| 195 , m_isStackingContext(o.m_isStackingContext) | |
| 196 , m_effectiveBlendMode(o.m_effectiveBlendMode) | |
| 197 , m_touchAction(o.m_touchAction) | |
| 198 , m_objectFit(o.m_objectFit) | |
| 199 , m_isolation(o.m_isolation) | |
| 200 , m_contain(o.m_contain) | |
| 201 , m_scrollBehavior(o.m_scrollBehavior) | |
| 202 , m_scrollSnapType(o.m_scrollSnapType) | |
| 203 , m_requiresAcceleratedCompositingForExternalReasons(o.m_requiresAccelerated
CompositingForExternalReasons) | |
| 204 , m_hasInlineTransform(o.m_hasInlineTransform) | |
| 205 , m_resize(o.m_resize) | |
| 206 , m_hasCompositorProxy(o.m_hasCompositorProxy) | |
| 207 , m_hasAuthorBackground(o.m_hasAuthorBackground) | |
| 208 , m_hasAuthorBorder(o.m_hasAuthorBorder) | |
| 209 { | |
| 210 } | |
| 211 | |
| 212 StyleRareNonInheritedData::~StyleRareNonInheritedData() | |
| 213 { | |
| 214 } | |
| 215 | |
| 216 bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
onst | |
| 217 { | |
| 218 return opacity == o.opacity | |
| 219 && m_perspective == o.m_perspective | |
| 220 && m_shapeImageThreshold == o.m_shapeImageThreshold | |
| 221 && m_order == o.m_order | |
| 222 && m_perspectiveOrigin == o.m_perspectiveOrigin | |
| 223 && m_objectPosition == o.m_objectPosition | |
| 224 && lineClamp == o.lineClamp | |
| 225 && m_draggableRegionMode == o.m_draggableRegionMode | |
| 226 && m_deprecatedFlexibleBox == o.m_deprecatedFlexibleBox | |
| 227 && m_flexibleBox == o.m_flexibleBox | |
| 228 && m_multiCol == o.m_multiCol | |
| 229 && m_transform == o.m_transform | |
| 230 && m_willChange == o.m_willChange | |
| 231 && m_filter == o.m_filter | |
| 232 && m_backdropFilter == o.m_backdropFilter | |
| 233 && m_grid == o.m_grid | |
| 234 && m_gridItem == o.m_gridItem | |
| 235 && m_scrollSnap == o.m_scrollSnap | |
| 236 && contentDataEquivalent(o) | |
| 237 && counterDataEquivalent(o) | |
| 238 && shadowDataEquivalent(o) | |
| 239 && reflectionDataEquivalent(o) | |
| 240 && animationDataEquivalent(o) | |
| 241 && transitionDataEquivalent(o) | |
| 242 && shapeOutsideDataEquivalent(o) | |
| 243 && m_mask == o.m_mask | |
| 244 && m_maskBoxImage == o.m_maskBoxImage | |
| 245 && m_pageSize == o.m_pageSize | |
| 246 && m_shapeMargin == o.m_shapeMargin | |
| 247 && clipPathDataEquivalent(o) | |
| 248 && m_textDecorationColor == o.m_textDecorationColor | |
| 249 && m_visitedLinkTextDecorationColor == o.m_visitedLinkTextDecorationColo
r | |
| 250 && m_visitedLinkBackgroundColor == o.m_visitedLinkBackgroundColor | |
| 251 && m_visitedLinkOutlineColor == o.m_visitedLinkOutlineColor | |
| 252 && m_visitedLinkBorderLeftColor == o.m_visitedLinkBorderLeftColor | |
| 253 && m_visitedLinkBorderRightColor == o.m_visitedLinkBorderRightColor | |
| 254 && m_visitedLinkBorderTopColor == o.m_visitedLinkBorderTopColor | |
| 255 && m_visitedLinkBorderBottomColor == o.m_visitedLinkBorderBottomColor | |
| 256 && m_callbackSelectors == o.m_callbackSelectors | |
| 257 && m_alignContent == o.m_alignContent | |
| 258 && m_alignItems == o.m_alignItems | |
| 259 && m_alignSelf == o.m_alignSelf | |
| 260 && m_justifyContent == o.m_justifyContent | |
| 261 && m_justifyItems == o.m_justifyItems | |
| 262 && m_justifySelf == o.m_justifySelf | |
| 263 && m_pageSizeType == o.m_pageSizeType | |
| 264 && m_transformStyle3D == o.m_transformStyle3D | |
| 265 && m_backfaceVisibility == o.m_backfaceVisibility | |
| 266 && userDrag == o.userDrag | |
| 267 && textOverflow == o.textOverflow | |
| 268 && marginBeforeCollapse == o.marginBeforeCollapse | |
| 269 && marginAfterCollapse == o.marginAfterCollapse | |
| 270 && m_appearance == o.m_appearance | |
| 271 && m_textDecorationStyle == o.m_textDecorationStyle | |
| 272 && m_hasCurrentOpacityAnimation == o.m_hasCurrentOpacityAnimation | |
| 273 && m_hasCurrentTransformAnimation == o.m_hasCurrentTransformAnimation | |
| 274 && m_hasCurrentFilterAnimation == o.m_hasCurrentFilterAnimation | |
| 275 && m_hasCurrentBackdropFilterAnimation == o.m_hasCurrentBackdropFilterAn
imation | |
| 276 && m_isStackingContext == o.m_isStackingContext | |
| 277 && m_effectiveBlendMode == o.m_effectiveBlendMode | |
| 278 && m_touchAction == o.m_touchAction | |
| 279 && m_objectFit == o.m_objectFit | |
| 280 && m_isolation == o.m_isolation | |
| 281 && m_contain == o.m_contain | |
| 282 && m_scrollBehavior == o.m_scrollBehavior | |
| 283 && m_scrollSnapType == o.m_scrollSnapType | |
| 284 && m_requiresAcceleratedCompositingForExternalReasons == o.m_requiresAcc
eleratedCompositingForExternalReasons | |
| 285 && m_hasInlineTransform == o.m_hasInlineTransform | |
| 286 && m_resize == o.m_resize | |
| 287 && m_hasCompositorProxy == o.m_hasCompositorProxy | |
| 288 && m_hasAuthorBackground == o.m_hasAuthorBackground | |
| 289 && m_hasAuthorBorder == o.m_hasAuthorBorder; | |
| 290 } | |
| 291 | |
| 292 bool StyleRareNonInheritedData::contentDataEquivalent(const StyleRareNonInherite
dData& o) const | |
| 293 { | |
| 294 ContentData* a = m_content.get(); | |
| 295 ContentData* b = o.m_content.get(); | |
| 296 | |
| 297 while (a && b && *a == *b) { | |
| 298 a = a->next(); | |
| 299 b = b->next(); | |
| 300 } | |
| 301 | |
| 302 return !a && !b; | |
| 303 } | |
| 304 | |
| 305 bool StyleRareNonInheritedData::counterDataEquivalent(const StyleRareNonInherite
dData& o) const | |
| 306 { | |
| 307 return dataEquivalent(m_counterDirectives, o.m_counterDirectives); | |
| 308 } | |
| 309 | |
| 310 bool StyleRareNonInheritedData::shadowDataEquivalent(const StyleRareNonInherited
Data& o) const | |
| 311 { | |
| 312 return dataEquivalent(m_boxShadow, o.m_boxShadow); | |
| 313 } | |
| 314 | |
| 315 bool StyleRareNonInheritedData::reflectionDataEquivalent(const StyleRareNonInher
itedData& o) const | |
| 316 { | |
| 317 return dataEquivalent(m_boxReflect, o.m_boxReflect); | |
| 318 } | |
| 319 | |
| 320 bool StyleRareNonInheritedData::animationDataEquivalent(const StyleRareNonInheri
tedData& o) const | |
| 321 { | |
| 322 if (!m_animations && !o.m_animations) | |
| 323 return true; | |
| 324 if (!m_animations || !o.m_animations) | |
| 325 return false; | |
| 326 return m_animations->animationsMatchForStyleRecalc(*o.m_animations); | |
| 327 } | |
| 328 | |
| 329 bool StyleRareNonInheritedData::transitionDataEquivalent(const StyleRareNonInher
itedData& o) const | |
| 330 { | |
| 331 if (!m_transitions && !o.m_transitions) | |
| 332 return true; | |
| 333 if (!m_transitions || !o.m_transitions) | |
| 334 return false; | |
| 335 return m_transitions->transitionsMatchForStyleRecalc(*o.m_transitions); | |
| 336 } | |
| 337 | |
| 338 bool StyleRareNonInheritedData::hasFilters() const | |
| 339 { | |
| 340 return m_filter.get() && !m_filter->m_operations.isEmpty(); | |
| 341 } | |
| 342 | |
| 343 bool StyleRareNonInheritedData::hasBackdropFilters() const | |
| 344 { | |
| 345 return m_backdropFilter.get() && !m_backdropFilter->m_operations.isEmpty(); | |
| 346 } | |
| 347 | |
| 348 bool StyleRareNonInheritedData::shapeOutsideDataEquivalent(const StyleRareNonInh
eritedData& o) const | |
| 349 { | |
| 350 return dataEquivalent(m_shapeOutside, o.m_shapeOutside); | |
| 351 } | |
| 352 | |
| 353 bool StyleRareNonInheritedData::clipPathDataEquivalent(const StyleRareNonInherit
edData& o) const | |
| 354 { | |
| 355 return dataEquivalent(m_clipPath, o.m_clipPath); | |
| 356 } | |
| 357 | |
| 358 } // namespace blink | 26 } // namespace blink |
| OLD | NEW |