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/layout/style/DataEquivalency.h" | 9 #include "core/layout/style/DataEquivalency.h" |
10 #include "core/layout/style/LayoutStyle.h" | 10 #include "core/layout/style/ComputedStyle.h" |
11 #include "core/layout/style/ShadowList.h" | 11 #include "core/layout/style/ShadowList.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 template <CSSPropertyID property> | 17 template <CSSPropertyID property> |
18 bool fillLayersEqual(const FillLayer& aLayers, const FillLayer& bLayers) | 18 bool fillLayersEqual(const FillLayer& aLayers, const FillLayer& bLayers) |
19 { | 19 { |
20 const FillLayer* aLayer = &aLayers; | 20 const FillLayer* aLayer = &aLayers; |
(...skipping 28 matching lines...) Expand all Loading... |
49 aLayer = aLayer->next(); | 49 aLayer = aLayer->next(); |
50 bLayer = bLayer->next(); | 50 bLayer = bLayer->next(); |
51 } | 51 } |
52 | 52 |
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 LayoutStyle&
a, const LayoutStyle& b) | 59 bool CSSPropertyEquality::propertiesEqual(CSSPropertyID prop, const ComputedStyl
e& a, const ComputedStyle& b) |
60 { | 60 { |
61 switch (prop) { | 61 switch (prop) { |
62 case CSSPropertyBackgroundColor: | 62 case CSSPropertyBackgroundColor: |
63 return a.backgroundColor() == b.backgroundColor() | 63 return a.backgroundColor() == b.backgroundColor() |
64 && a.visitedLinkBackgroundColor() == b.visitedLinkBackgroundColor(); | 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: |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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()); |
115 case CSSPropertyClip: | 115 case CSSPropertyClip: |
116 return a.clip() == b.clip(); | 116 return a.clip() == b.clip(); |
117 case CSSPropertyColor: | 117 case CSSPropertyColor: |
118 return a.color() == b.color() && a.visitedLinkColor() == b.visitedLinkCo
lor(); | 118 return a.color() == b.color() && a.visitedLinkColor() == b.visitedLinkCo
lor(); |
119 case CSSPropertyFill: { | 119 case CSSPropertyFill: { |
120 const SVGLayoutStyle& aSVG = a.svgStyle(); | 120 const SVGComputedStyle& aSVG = a.svgStyle(); |
121 const SVGLayoutStyle& bSVG = b.svgStyle(); | 121 const SVGComputedStyle& bSVG = b.svgStyle(); |
122 return aSVG.fillPaintType() == bSVG.fillPaintType() | 122 return aSVG.fillPaintType() == bSVG.fillPaintType() |
123 && (aSVG.fillPaintType() != SVG_PAINTTYPE_RGBCOLOR || aSVG.fillPaint
Color() == bSVG.fillPaintColor()) | 123 && (aSVG.fillPaintType() != SVG_PAINTTYPE_RGBCOLOR || aSVG.fillPaint
Color() == bSVG.fillPaintColor()) |
124 && aSVG.visitedLinkFillPaintType() == bSVG.visitedLinkFillPaintType(
) | 124 && aSVG.visitedLinkFillPaintType() == bSVG.visitedLinkFillPaintType(
) |
125 && (aSVG.visitedLinkFillPaintType() != SVG_PAINTTYPE_RGBCOLOR || aSV
G.visitedLinkFillPaintColor() == bSVG.visitedLinkFillPaintColor()); | 125 && (aSVG.visitedLinkFillPaintType() != SVG_PAINTTYPE_RGBCOLOR || aSV
G.visitedLinkFillPaintColor() == bSVG.visitedLinkFillPaintColor()); |
126 } | 126 } |
127 case CSSPropertyFillOpacity: | 127 case CSSPropertyFillOpacity: |
128 return a.fillOpacity() == b.fillOpacity(); | 128 return a.fillOpacity() == b.fillOpacity(); |
129 case CSSPropertyFlexBasis: | 129 case CSSPropertyFlexBasis: |
130 return a.flexBasis() == b.flexBasis(); | 130 return a.flexBasis() == b.flexBasis(); |
131 case CSSPropertyFlexGrow: | 131 case CSSPropertyFlexGrow: |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 return a.shapeImageThreshold() == b.shapeImageThreshold(); | 208 return a.shapeImageThreshold() == b.shapeImageThreshold(); |
209 case CSSPropertyShapeMargin: | 209 case CSSPropertyShapeMargin: |
210 return a.shapeMargin() == b.shapeMargin(); | 210 return a.shapeMargin() == b.shapeMargin(); |
211 case CSSPropertyShapeOutside: | 211 case CSSPropertyShapeOutside: |
212 return dataEquivalent(a.shapeOutside(), b.shapeOutside()); | 212 return dataEquivalent(a.shapeOutside(), b.shapeOutside()); |
213 case CSSPropertyStopColor: | 213 case CSSPropertyStopColor: |
214 return a.stopColor() == b.stopColor(); | 214 return a.stopColor() == b.stopColor(); |
215 case CSSPropertyStopOpacity: | 215 case CSSPropertyStopOpacity: |
216 return a.stopOpacity() == b.stopOpacity(); | 216 return a.stopOpacity() == b.stopOpacity(); |
217 case CSSPropertyStroke: { | 217 case CSSPropertyStroke: { |
218 const SVGLayoutStyle& aSVG = a.svgStyle(); | 218 const SVGComputedStyle& aSVG = a.svgStyle(); |
219 const SVGLayoutStyle& bSVG = b.svgStyle(); | 219 const SVGComputedStyle& bSVG = b.svgStyle(); |
220 return aSVG.strokePaintType() == bSVG.strokePaintType() | 220 return aSVG.strokePaintType() == bSVG.strokePaintType() |
221 && (aSVG.strokePaintType() != SVG_PAINTTYPE_RGBCOLOR || aSVG.strokeP
aintColor() == bSVG.strokePaintColor()) | 221 && (aSVG.strokePaintType() != SVG_PAINTTYPE_RGBCOLOR || aSVG.strokeP
aintColor() == bSVG.strokePaintColor()) |
222 && aSVG.visitedLinkStrokePaintType() == bSVG.visitedLinkStrokePaintT
ype() | 222 && aSVG.visitedLinkStrokePaintType() == bSVG.visitedLinkStrokePaintT
ype() |
223 && (aSVG.visitedLinkStrokePaintType() != SVG_PAINTTYPE_RGBCOLOR || a
SVG.visitedLinkStrokePaintColor() == bSVG.visitedLinkStrokePaintColor()); | 223 && (aSVG.visitedLinkStrokePaintType() != SVG_PAINTTYPE_RGBCOLOR || a
SVG.visitedLinkStrokePaintColor() == bSVG.visitedLinkStrokePaintColor()); |
224 } | 224 } |
225 case CSSPropertyStrokeDasharray: | 225 case CSSPropertyStrokeDasharray: |
226 return a.strokeDashArray() == b.strokeDashArray(); | 226 return a.strokeDashArray() == b.strokeDashArray(); |
227 case CSSPropertyStrokeDashoffset: | 227 case CSSPropertyStrokeDashoffset: |
228 return a.strokeDashOffset() == b.strokeDashOffset(); | 228 return a.strokeDashOffset() == b.strokeDashOffset(); |
229 case CSSPropertyStrokeMiterlimit: | 229 case CSSPropertyStrokeMiterlimit: |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 return a.svgStyle().ry() == b.svgStyle().ry(); | 328 return a.svgStyle().ry() == b.svgStyle().ry(); |
329 case CSSPropertyZIndex: | 329 case CSSPropertyZIndex: |
330 return a.zIndex() == b.zIndex(); | 330 return a.zIndex() == b.zIndex(); |
331 default: | 331 default: |
332 ASSERT_NOT_REACHED(); | 332 ASSERT_NOT_REACHED(); |
333 return true; | 333 return true; |
334 } | 334 } |
335 } | 335 } |
336 | 336 |
337 } | 337 } |
OLD | NEW |