| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/animation/css/CSSPropertyEquality.h" | 6 #include "core/animation/css/CSSPropertyEquality.h" |
| 7 | 7 |
| 8 #include "core/animation/css/CSSAnimations.h" | 8 #include "core/animation/css/CSSAnimations.h" |
| 9 #include "core/rendering/style/DataEquivalency.h" | 9 #include "core/rendering/style/DataEquivalency.h" |
| 10 #include "core/rendering/style/RenderStyle.h" | 10 #include "core/rendering/style/RenderStyle.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // FIXME: Shouldn't this be return !aLayer && !bLayer; ? | 53 // FIXME: Shouldn't this be return !aLayer && !bLayer; ? |
| 54 return true; | 54 return true; |
| 55 } | 55 } |
| 56 | 56 |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool CSSPropertyEquality::propertiesEqual(CSSPropertyID prop, const RenderStyle&
a, const RenderStyle& b) | 59 bool CSSPropertyEquality::propertiesEqual(CSSPropertyID prop, const RenderStyle&
a, const RenderStyle& b) |
| 60 { | 60 { |
| 61 switch (prop) { | 61 switch (prop) { |
| 62 case CSSPropertyBackgroundColor: | 62 case CSSPropertyBackgroundColor: |
| 63 return a.backgroundColor().resolve(a.color()) == b.backgroundColor().res
olve(b.color()) | 63 return a.backgroundColor() == b.backgroundColor() |
| 64 && a.visitedLinkBackgroundColor().resolve(a.color()) == b.visitedLin
kBackgroundColor().resolve(b.color()); | 64 && a.visitedLinkBackgroundColor() == b.visitedLinkBackgroundColor(); |
| 65 case CSSPropertyBackgroundImage: | 65 case CSSPropertyBackgroundImage: |
| 66 return fillLayersEqual<CSSPropertyBackgroundImage>(a.backgroundLayers(),
b.backgroundLayers()); | 66 return fillLayersEqual<CSSPropertyBackgroundImage>(a.backgroundLayers(),
b.backgroundLayers()); |
| 67 case CSSPropertyBackgroundPositionX: | 67 case CSSPropertyBackgroundPositionX: |
| 68 return fillLayersEqual<CSSPropertyBackgroundPositionX>(a.backgroundLayer
s(), b.backgroundLayers()); | 68 return fillLayersEqual<CSSPropertyBackgroundPositionX>(a.backgroundLayer
s(), b.backgroundLayers()); |
| 69 case CSSPropertyBackgroundPositionY: | 69 case CSSPropertyBackgroundPositionY: |
| 70 return fillLayersEqual<CSSPropertyBackgroundPositionY>(a.backgroundLayer
s(), b.backgroundLayers()); | 70 return fillLayersEqual<CSSPropertyBackgroundPositionY>(a.backgroundLayer
s(), b.backgroundLayers()); |
| 71 case CSSPropertyBackgroundSize: | 71 case CSSPropertyBackgroundSize: |
| 72 return fillLayersEqual<CSSPropertyBackgroundSize>(a.backgroundLayers(),
b.backgroundLayers()); | 72 return fillLayersEqual<CSSPropertyBackgroundSize>(a.backgroundLayers(),
b.backgroundLayers()); |
| 73 case CSSPropertyBaselineShift: | 73 case CSSPropertyBaselineShift: |
| 74 return dataEquivalent(a.baselineShiftValue(), b.baselineShiftValue()); | 74 return dataEquivalent(a.baselineShiftValue(), b.baselineShiftValue()); |
| 75 case CSSPropertyBorderBottomColor: | 75 case CSSPropertyBorderBottomColor: |
| 76 return a.borderBottomColor().resolve(a.color()) == b.borderBottomColor()
.resolve(b.color()) | 76 return a.borderBottomColor() == b.borderBottomColor() |
| 77 && a.visitedLinkBorderBottomColor().resolve(a.color()) == b.visitedL
inkBorderBottomColor().resolve(b.color()); | 77 && a.visitedLinkBorderBottomColor() == b.visitedLinkBorderBottomColo
r(); |
| 78 case CSSPropertyBorderBottomLeftRadius: | 78 case CSSPropertyBorderBottomLeftRadius: |
| 79 return a.borderBottomLeftRadius() == b.borderBottomLeftRadius(); | 79 return a.borderBottomLeftRadius() == b.borderBottomLeftRadius(); |
| 80 case CSSPropertyBorderBottomRightRadius: | 80 case CSSPropertyBorderBottomRightRadius: |
| 81 return a.borderBottomRightRadius() == b.borderBottomRightRadius(); | 81 return a.borderBottomRightRadius() == b.borderBottomRightRadius(); |
| 82 case CSSPropertyBorderBottomWidth: | 82 case CSSPropertyBorderBottomWidth: |
| 83 return a.borderBottomWidth() == b.borderBottomWidth(); | 83 return a.borderBottomWidth() == b.borderBottomWidth(); |
| 84 case CSSPropertyBorderImageOutset: | 84 case CSSPropertyBorderImageOutset: |
| 85 return a.borderImageOutset() == b.borderImageOutset(); | 85 return a.borderImageOutset() == b.borderImageOutset(); |
| 86 case CSSPropertyBorderImageSlice: | 86 case CSSPropertyBorderImageSlice: |
| 87 return a.borderImageSlices() == b.borderImageSlices(); | 87 return a.borderImageSlices() == b.borderImageSlices(); |
| 88 case CSSPropertyBorderImageSource: | 88 case CSSPropertyBorderImageSource: |
| 89 return dataEquivalent(a.borderImageSource(), b.borderImageSource()); | 89 return dataEquivalent(a.borderImageSource(), b.borderImageSource()); |
| 90 case CSSPropertyBorderImageWidth: | 90 case CSSPropertyBorderImageWidth: |
| 91 return a.borderImageWidth() == b.borderImageWidth(); | 91 return a.borderImageWidth() == b.borderImageWidth(); |
| 92 case CSSPropertyBorderLeftColor: | 92 case CSSPropertyBorderLeftColor: |
| 93 return a.borderLeftColor().resolve(a.color()) == b.borderLeftColor().res
olve(b.color()) | 93 return a.borderLeftColor() == b.borderLeftColor() |
| 94 && a.visitedLinkBorderLeftColor().resolve(a.color()) == b.visitedLin
kBorderLeftColor().resolve(b.color()); | 94 && a.visitedLinkBorderLeftColor() == b.visitedLinkBorderLeftColor(); |
| 95 case CSSPropertyBorderLeftWidth: | 95 case CSSPropertyBorderLeftWidth: |
| 96 return a.borderLeftWidth() == b.borderLeftWidth(); | 96 return a.borderLeftWidth() == b.borderLeftWidth(); |
| 97 case CSSPropertyBorderRightColor: | 97 case CSSPropertyBorderRightColor: |
| 98 return a.borderRightColor().resolve(a.color()) == b.borderRightColor().r
esolve(b.color()) | 98 return a.borderRightColor() == b.borderRightColor() |
| 99 && a.visitedLinkBorderRightColor().resolve(a.color()) == b.visitedLi
nkBorderRightColor().resolve(b.color()); | 99 && a.visitedLinkBorderRightColor() == b.visitedLinkBorderRightColor(
); |
| 100 case CSSPropertyBorderRightWidth: | 100 case CSSPropertyBorderRightWidth: |
| 101 return a.borderRightWidth() == b.borderRightWidth(); | 101 return a.borderRightWidth() == b.borderRightWidth(); |
| 102 case CSSPropertyBorderTopColor: | 102 case CSSPropertyBorderTopColor: |
| 103 return a.borderTopColor().resolve(a.color()) == b.borderTopColor().resol
ve(b.color()) | 103 return a.borderTopColor() == b.borderTopColor() |
| 104 && a.visitedLinkBorderTopColor().resolve(a.color()) == b.visitedLink
BorderTopColor().resolve(b.color()); | 104 && a.visitedLinkBorderTopColor() == b.visitedLinkBorderTopColor(); |
| 105 case CSSPropertyBorderTopLeftRadius: | 105 case CSSPropertyBorderTopLeftRadius: |
| 106 return a.borderTopLeftRadius() == b.borderTopLeftRadius(); | 106 return a.borderTopLeftRadius() == b.borderTopLeftRadius(); |
| 107 case CSSPropertyBorderTopRightRadius: | 107 case CSSPropertyBorderTopRightRadius: |
| 108 return a.borderTopRightRadius() == b.borderTopRightRadius(); | 108 return a.borderTopRightRadius() == b.borderTopRightRadius(); |
| 109 case CSSPropertyBorderTopWidth: | 109 case CSSPropertyBorderTopWidth: |
| 110 return a.borderTopWidth() == b.borderTopWidth(); | 110 return a.borderTopWidth() == b.borderTopWidth(); |
| 111 case CSSPropertyBottom: | 111 case CSSPropertyBottom: |
| 112 return a.bottom() == b.bottom(); | 112 return a.bottom() == b.bottom(); |
| 113 case CSSPropertyBoxShadow: | 113 case CSSPropertyBoxShadow: |
| 114 return dataEquivalent(a.boxShadow(), b.boxShadow()); | 114 return dataEquivalent(a.boxShadow(), b.boxShadow()); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return a.minHeight() == b.minHeight(); | 174 return a.minHeight() == b.minHeight(); |
| 175 case CSSPropertyMinWidth: | 175 case CSSPropertyMinWidth: |
| 176 return a.minWidth() == b.minWidth(); | 176 return a.minWidth() == b.minWidth(); |
| 177 case CSSPropertyObjectPosition: | 177 case CSSPropertyObjectPosition: |
| 178 return a.objectPosition() == b.objectPosition(); | 178 return a.objectPosition() == b.objectPosition(); |
| 179 case CSSPropertyOpacity: | 179 case CSSPropertyOpacity: |
| 180 return a.opacity() == b.opacity(); | 180 return a.opacity() == b.opacity(); |
| 181 case CSSPropertyOrphans: | 181 case CSSPropertyOrphans: |
| 182 return a.orphans() == b.orphans(); | 182 return a.orphans() == b.orphans(); |
| 183 case CSSPropertyOutlineColor: | 183 case CSSPropertyOutlineColor: |
| 184 return a.outlineColor().resolve(a.color()) == b.outlineColor().resolve(b
.color()) | 184 return a.outlineColor() == b.outlineColor() |
| 185 && a.visitedLinkOutlineColor().resolve(a.color()) == b.visitedLinkOu
tlineColor().resolve(b.color()); | 185 && a.visitedLinkOutlineColor() == b.visitedLinkOutlineColor(); |
| 186 case CSSPropertyOutlineOffset: | 186 case CSSPropertyOutlineOffset: |
| 187 return a.outlineOffset() == b.outlineOffset(); | 187 return a.outlineOffset() == b.outlineOffset(); |
| 188 case CSSPropertyOutlineWidth: | 188 case CSSPropertyOutlineWidth: |
| 189 return a.outlineWidth() == b.outlineWidth(); | 189 return a.outlineWidth() == b.outlineWidth(); |
| 190 case CSSPropertyPaddingBottom: | 190 case CSSPropertyPaddingBottom: |
| 191 return a.paddingBottom() == b.paddingBottom(); | 191 return a.paddingBottom() == b.paddingBottom(); |
| 192 case CSSPropertyPaddingLeft: | 192 case CSSPropertyPaddingLeft: |
| 193 return a.paddingLeft() == b.paddingLeft(); | 193 return a.paddingLeft() == b.paddingLeft(); |
| 194 case CSSPropertyPaddingRight: | 194 case CSSPropertyPaddingRight: |
| 195 return a.paddingRight() == b.paddingRight(); | 195 return a.paddingRight() == b.paddingRight(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 219 return dataEquivalent(a.strokeDashArray(), b.strokeDashArray()); | 219 return dataEquivalent(a.strokeDashArray(), b.strokeDashArray()); |
| 220 case CSSPropertyStrokeDashoffset: | 220 case CSSPropertyStrokeDashoffset: |
| 221 return dataEquivalent(a.strokeDashOffset(), b.strokeDashOffset()); | 221 return dataEquivalent(a.strokeDashOffset(), b.strokeDashOffset()); |
| 222 case CSSPropertyStrokeMiterlimit: | 222 case CSSPropertyStrokeMiterlimit: |
| 223 return a.strokeMiterLimit() == b.strokeMiterLimit(); | 223 return a.strokeMiterLimit() == b.strokeMiterLimit(); |
| 224 case CSSPropertyStrokeOpacity: | 224 case CSSPropertyStrokeOpacity: |
| 225 return a.strokeOpacity() == b.strokeOpacity(); | 225 return a.strokeOpacity() == b.strokeOpacity(); |
| 226 case CSSPropertyStrokeWidth: | 226 case CSSPropertyStrokeWidth: |
| 227 return dataEquivalent(a.strokeWidth(), b.strokeWidth()); | 227 return dataEquivalent(a.strokeWidth(), b.strokeWidth()); |
| 228 case CSSPropertyTextDecorationColor: | 228 case CSSPropertyTextDecorationColor: |
| 229 return a.textDecorationColor().resolve(a.color()) == b.textDecorationCol
or().resolve(b.color()) | 229 return a.textDecorationColor() == b.textDecorationColor() |
| 230 && a.visitedLinkTextDecorationColor().resolve(a.color()) == b.visite
dLinkTextDecorationColor().resolve(b.color()); | 230 && a.visitedLinkTextDecorationColor() == b.visitedLinkTextDecoration
Color(); |
| 231 case CSSPropertyTextIndent: | 231 case CSSPropertyTextIndent: |
| 232 return a.textIndent() == b.textIndent(); | 232 return a.textIndent() == b.textIndent(); |
| 233 case CSSPropertyTextShadow: | 233 case CSSPropertyTextShadow: |
| 234 return dataEquivalent(a.textShadow(), b.textShadow()); | 234 return dataEquivalent(a.textShadow(), b.textShadow()); |
| 235 case CSSPropertyTop: | 235 case CSSPropertyTop: |
| 236 return a.top() == b.top(); | 236 return a.top() == b.top(); |
| 237 case CSSPropertyVerticalAlign: | 237 case CSSPropertyVerticalAlign: |
| 238 return a.verticalAlign() == b.verticalAlign() | 238 return a.verticalAlign() == b.verticalAlign() |
| 239 && (a.verticalAlign() != LENGTH || a.verticalAlignLength() == b.vert
icalAlignLength()); | 239 && (a.verticalAlign() != LENGTH || a.verticalAlignLength() == b.vert
icalAlignLength()); |
| 240 case CSSPropertyVisibility: | 240 case CSSPropertyVisibility: |
| 241 return a.visibility() == b.visibility(); | 241 return a.visibility() == b.visibility(); |
| 242 case CSSPropertyWebkitBackgroundSize: | 242 case CSSPropertyWebkitBackgroundSize: |
| 243 return fillLayersEqual<CSSPropertyWebkitBackgroundSize>(a.backgroundLaye
rs(), b.backgroundLayers()); | 243 return fillLayersEqual<CSSPropertyWebkitBackgroundSize>(a.backgroundLaye
rs(), b.backgroundLayers()); |
| 244 case CSSPropertyWebkitBorderHorizontalSpacing: | 244 case CSSPropertyWebkitBorderHorizontalSpacing: |
| 245 return a.horizontalBorderSpacing() == b.horizontalBorderSpacing(); | 245 return a.horizontalBorderSpacing() == b.horizontalBorderSpacing(); |
| 246 case CSSPropertyWebkitBorderVerticalSpacing: | 246 case CSSPropertyWebkitBorderVerticalSpacing: |
| 247 return a.verticalBorderSpacing() == b.verticalBorderSpacing(); | 247 return a.verticalBorderSpacing() == b.verticalBorderSpacing(); |
| 248 case CSSPropertyWebkitBoxShadow: | 248 case CSSPropertyWebkitBoxShadow: |
| 249 return dataEquivalent(a.boxShadow(), b.boxShadow()); | 249 return dataEquivalent(a.boxShadow(), b.boxShadow()); |
| 250 case CSSPropertyWebkitClipPath: | 250 case CSSPropertyWebkitClipPath: |
| 251 return dataEquivalent(a.clipPath(), b.clipPath()); | 251 return dataEquivalent(a.clipPath(), b.clipPath()); |
| 252 case CSSPropertyWebkitColumnCount: | 252 case CSSPropertyWebkitColumnCount: |
| 253 return a.columnCount() == b.columnCount(); | 253 return a.columnCount() == b.columnCount(); |
| 254 case CSSPropertyWebkitColumnGap: | 254 case CSSPropertyWebkitColumnGap: |
| 255 return a.columnGap() == b.columnGap(); | 255 return a.columnGap() == b.columnGap(); |
| 256 case CSSPropertyWebkitColumnRuleColor: | 256 case CSSPropertyWebkitColumnRuleColor: |
| 257 return a.columnRuleColor().resolve(a.color()) == b.columnRuleColor().res
olve(b.color()) | 257 return a.columnRuleColor() == b.columnRuleColor() |
| 258 && a.visitedLinkColumnRuleColor().resolve(a.color()) == b.visitedLin
kColumnRuleColor().resolve(b.color()); | 258 && a.visitedLinkColumnRuleColor() == b.visitedLinkColumnRuleColor(); |
| 259 case CSSPropertyWebkitColumnRuleWidth: | 259 case CSSPropertyWebkitColumnRuleWidth: |
| 260 return a.columnRuleWidth() == b.columnRuleWidth(); | 260 return a.columnRuleWidth() == b.columnRuleWidth(); |
| 261 case CSSPropertyWebkitColumnWidth: | 261 case CSSPropertyWebkitColumnWidth: |
| 262 return a.columnWidth() == b.columnWidth(); | 262 return a.columnWidth() == b.columnWidth(); |
| 263 case CSSPropertyWebkitFilter: | 263 case CSSPropertyWebkitFilter: |
| 264 return a.filter() == b.filter(); | 264 return a.filter() == b.filter(); |
| 265 case CSSPropertyWebkitMaskBoxImageOutset: | 265 case CSSPropertyWebkitMaskBoxImageOutset: |
| 266 return a.maskBoxImageOutset() == b.maskBoxImageOutset(); | 266 return a.maskBoxImageOutset() == b.maskBoxImageOutset(); |
| 267 case CSSPropertyWebkitMaskBoxImageSlice: | 267 case CSSPropertyWebkitMaskBoxImageSlice: |
| 268 return a.maskBoxImageSlices() == b.maskBoxImageSlices(); | 268 return a.maskBoxImageSlices() == b.maskBoxImageSlices(); |
| 269 case CSSPropertyWebkitMaskBoxImageSource: | 269 case CSSPropertyWebkitMaskBoxImageSource: |
| 270 return dataEquivalent(a.maskBoxImageSource(), b.maskBoxImageSource()); | 270 return dataEquivalent(a.maskBoxImageSource(), b.maskBoxImageSource()); |
| 271 case CSSPropertyWebkitMaskBoxImageWidth: | 271 case CSSPropertyWebkitMaskBoxImageWidth: |
| 272 return a.maskBoxImageWidth() == b.maskBoxImageWidth(); | 272 return a.maskBoxImageWidth() == b.maskBoxImageWidth(); |
| 273 case CSSPropertyWebkitMaskImage: | 273 case CSSPropertyWebkitMaskImage: |
| 274 return dataEquivalent(a.maskImage(), b.maskImage()); | 274 return dataEquivalent(a.maskImage(), b.maskImage()); |
| 275 case CSSPropertyWebkitMaskPositionX: | 275 case CSSPropertyWebkitMaskPositionX: |
| 276 return fillLayersEqual<CSSPropertyWebkitMaskPositionX>(a.maskLayers(), b
.maskLayers()); | 276 return fillLayersEqual<CSSPropertyWebkitMaskPositionX>(a.maskLayers(), b
.maskLayers()); |
| 277 case CSSPropertyWebkitMaskPositionY: | 277 case CSSPropertyWebkitMaskPositionY: |
| 278 return fillLayersEqual<CSSPropertyWebkitMaskPositionY>(a.maskLayers(), b
.maskLayers()); | 278 return fillLayersEqual<CSSPropertyWebkitMaskPositionY>(a.maskLayers(), b
.maskLayers()); |
| 279 case CSSPropertyWebkitMaskSize: | 279 case CSSPropertyWebkitMaskSize: |
| 280 return fillLayersEqual<CSSPropertyWebkitMaskSize>(a.maskLayers(), b.mask
Layers()); | 280 return fillLayersEqual<CSSPropertyWebkitMaskSize>(a.maskLayers(), b.mask
Layers()); |
| 281 case CSSPropertyPerspective: | 281 case CSSPropertyPerspective: |
| 282 return a.perspective() == b.perspective(); | 282 return a.perspective() == b.perspective(); |
| 283 case CSSPropertyPerspectiveOrigin: | 283 case CSSPropertyPerspectiveOrigin: |
| 284 return a.perspectiveOriginX() == b.perspectiveOriginX() && a.perspective
OriginY() == b.perspectiveOriginY(); | 284 return a.perspectiveOriginX() == b.perspectiveOriginX() && a.perspective
OriginY() == b.perspectiveOriginY(); |
| 285 case CSSPropertyWebkitTextStrokeColor: | 285 case CSSPropertyWebkitTextStrokeColor: |
| 286 return a.textStrokeColor().resolve(a.color()) == b.textStrokeColor().res
olve(b.color()) | 286 return a.textStrokeColor() == b.textStrokeColor() |
| 287 && a.visitedLinkTextStrokeColor().resolve(a.color()) == b.visitedLin
kTextStrokeColor().resolve(b.color()); | 287 && a.visitedLinkTextStrokeColor() == b.visitedLinkTextStrokeColor(); |
| 288 case CSSPropertyTransform: | 288 case CSSPropertyTransform: |
| 289 return a.transform() == b.transform(); | 289 return a.transform() == b.transform(); |
| 290 case CSSPropertyTransformOrigin: | 290 case CSSPropertyTransformOrigin: |
| 291 return a.transformOriginX() == b.transformOriginX() && a.transformOrigin
Y() == b.transformOriginY() && a.transformOriginZ() == b.transformOriginZ(); | 291 return a.transformOriginX() == b.transformOriginX() && a.transformOrigin
Y() == b.transformOriginY() && a.transformOriginZ() == b.transformOriginZ(); |
| 292 case CSSPropertyWidows: | 292 case CSSPropertyWidows: |
| 293 return a.widows() == b.widows(); | 293 return a.widows() == b.widows(); |
| 294 case CSSPropertyWidth: | 294 case CSSPropertyWidth: |
| 295 return a.width() == b.width(); | 295 return a.width() == b.width(); |
| 296 case CSSPropertyWordSpacing: | 296 case CSSPropertyWordSpacing: |
| 297 return a.wordSpacing() == b.wordSpacing(); | 297 return a.wordSpacing() == b.wordSpacing(); |
| 298 case CSSPropertyZIndex: | 298 case CSSPropertyZIndex: |
| 299 return a.zIndex() == b.zIndex(); | 299 return a.zIndex() == b.zIndex(); |
| 300 case CSSPropertyZoom: | 300 case CSSPropertyZoom: |
| 301 return a.zoom() == b.zoom(); | 301 return a.zoom() == b.zoom(); |
| 302 default: | 302 default: |
| 303 ASSERT_NOT_REACHED(); | 303 ASSERT_NOT_REACHED(); |
| 304 return true; | 304 return true; |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 | 307 |
| 308 } | 308 } |
| OLD | NEW |