Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(620)

Side by Side Diff: third_party/WebKit/Source/core/css/CSSPropertyEqualityCustom.cpp

Issue 1910263003: Generate CSSPropertyEquality instead of using hand-updated file. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/CSSPropertyEqualityCustom.h"
6
7 #include "core/CSSPropertyNames.h"
8 #include "core/css/CSSPropertyEquality.h"
9 #include "core/style/ComputedStyle.h"
10 #include "core/style/DataEquivalency.h"
11 #include "core/style/FillLayer.h"
12
13 namespace blink {
14
15 namespace {
16
17 template <CSSPropertyID property>
18 bool fillLayersEqual(const FillLayer& aLayers, const FillLayer& bLayers)
19 {
20 const FillLayer* aLayer = &aLayers;
21 const FillLayer* bLayer = &bLayers;
22 while (aLayer && bLayer) {
23 switch (property) {
24 case CSSPropertyBackgroundPositionX:
25 case CSSPropertyWebkitMaskPositionX:
26 if (aLayer->xPosition() != bLayer->xPosition())
27 return false;
28 break;
29 case CSSPropertyBackgroundPositionY:
30 case CSSPropertyWebkitMaskPositionY:
31 if (aLayer->yPosition() != bLayer->yPosition())
32 return false;
33 break;
34 case CSSPropertyBackgroundSize:
35 case CSSPropertyWebkitMaskSize:
36 if (!(aLayer->sizeLength() == bLayer->sizeLength()))
37 return false;
38 break;
39 case CSSPropertyBackgroundImage:
40 if (!dataEquivalent(aLayer->image(), bLayer->image()))
41 return false;
42 break;
43 case CSSPropertyWebkitMaskComposite:
44 if (aLayer->composite() != bLayer->composite())
45 return false;
46 case CSSPropertyBackgroundOrigin:
47 case CSSPropertyWebkitMaskOrigin:
48 if (aLayer->origin() != bLayer->origin())
49 return false;
50 case CSSPropertyBackgroundBlendMode:
51 if (aLayer->blendMode() != bLayer->blendMode())
52 return false;
53 case CSSPropertyBackgroundAttachment:
54 if (aLayer->attachment() != bLayer->attachment())
55 return false;
56 case CSSPropertyBackgroundRepeatX:
57 case CSSPropertyWebkitMaskRepeatX:
58 if (aLayer->repeatX() != bLayer->repeatX())
59 return false;
60 case CSSPropertyBackgroundRepeatY:
61 case CSSPropertyWebkitMaskRepeatY:
62 if (aLayer->repeatY() != bLayer->repeatY())
63 return false;
64 case CSSPropertyBackgroundClip:
65 case CSSPropertyWebkitMaskClip:
66 if (aLayer->clip() != bLayer->clip())
67 return false;
68 case CSSPropertyMaskSourceType:
69 if (aLayer->maskSourceType() != bLayer->maskSourceType())
70 return false;
71 default:
72 ASSERT_NOT_REACHED();
73 return true;
74 }
75
76 aLayer = aLayer->next();
77 bLayer = bLayer->next();
78 }
79
80 // FIXME: Shouldn't this be return !aLayer && !bLayer; ?
81 return true;
82 }
83
84 } // namespace
85
86 bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskBoxImageWidthEqual(const Co mputedStyle& a, const ComputedStyle& b)
87 {
88 return a.maskBoxImageWidth() == b.maskBoxImageWidth();
89 }
90
91 bool CSSPropertyEqualityCustom::CSSPropertySizeEqual(const ComputedStyle& a, con st ComputedStyle& b)
92 {
93 // TODO test
ikilpatrick 2016/04/27 00:32:17 Anything with TODO test means that I need to do a
alancutter (OOO until 2018) 2016/05/02 02:55:40 Could you test it with layout tests? I think that'
ikilpatrick 2016/05/24 00:16:16 Done.
94 return a.pageSize() == b.pageSize() && a.getPageSizeType() == b.getPageSizeT ype();
95 }
96
97 bool CSSPropertyEqualityCustom::CSSPropertyTransitionDelayEqual(const ComputedSt yle& a, const ComputedStyle& b)
98 {
99 return a.transitions() == b.transitions()
ikilpatrick 2016/04/27 00:32:17 transitions / animations would be auto-gen'd in th
alancutter (OOO until 2018) 2016/05/02 02:55:40 I think it'd be cleaner to make accessors for tran
ikilpatrick 2016/05/24 00:16:16 I had a look at this, we already need a separate f
100 || (a.transitions() && b.transitions() && a.transitions()->delayList() = = b.transitions()->delayList());
101 }
102
103 bool CSSPropertyEqualityCustom::CSSPropertyTextDecorationColorEqual(const Comput edStyle& a, const ComputedStyle& b)
104 {
105 return a.textDecorationColor() == b.textDecorationColor()
ikilpatrick 2016/04/27 00:32:17 Ditto colors, a special flag for color properties,
106 && a.visitedLinkTextDecorationColor() == b.visitedLinkTextDecorationColo r();
107 }
108
109 bool CSSPropertyEqualityCustom::CSSPropertyAnimationNameEqual(const ComputedStyl e& a, const ComputedStyle& b)
110 {
111 return a.animations() == b.animations()
112 || (a.animations() && b.animations() && a.animations()->nameList() == b. animations()->nameList());
113 }
114
115 bool CSSPropertyEqualityCustom::CSSPropertyAnimationDurationEqual(const Computed Style& a, const ComputedStyle& b)
116 {
117 return a.animations() == b.animations()
118 || (a.animations() && b.animations() && a.animations()->durationList() = = b.animations()->durationList());
119 }
120
121 bool CSSPropertyEqualityCustom::CSSPropertyAnimationPlayStateEqual(const Compute dStyle& a, const ComputedStyle& b)
122 {
123 return a.animations() == b.animations()
124 || (a.animations() && b.animations() && a.animations()->playStateList() == b.animations()->playStateList());
125 }
126
127 bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskCompositeEqual(const Comput edStyle& a, const ComputedStyle& b)
128 {
129 return fillLayersEqual<CSSPropertyWebkitMaskComposite>(a.maskLayers(), b.mas kLayers());
ikilpatrick 2016/04/27 00:32:17 Ditto fillLayers.
alancutter (OOO until 2018) 2016/05/02 02:55:40 I'm not entirely for the idea of adding special fl
ikilpatrick 2016/05/24 00:16:16 Acknowledged.
130 }
131
132 bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskPositionYEqual(const Comput edStyle& a, const ComputedStyle& b)
133 {
134 return fillLayersEqual<CSSPropertyWebkitMaskPositionY>(a.maskLayers(), b.mas kLayers());
135 }
136
137 bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskPositionXEqual(const Comput edStyle& a, const ComputedStyle& b)
138 {
139 return fillLayersEqual<CSSPropertyWebkitMaskPositionX>(a.maskLayers(), b.mas kLayers());
140 }
141
142 bool CSSPropertyEqualityCustom::CSSPropertyContentEqual(const ComputedStyle& a, const ComputedStyle& b)
143 {
144 return a.contentDataEquivalent(&b);
145 }
146
147 bool CSSPropertyEqualityCustom::CSSPropertyOutlineColorEqual(const ComputedStyle & a, const ComputedStyle& b)
148 {
149 return a.outlineColor() == b.outlineColor()
150 && a.visitedLinkOutlineColor() == b.visitedLinkOutlineColor();
151 }
152
153 bool CSSPropertyEqualityCustom::CSSPropertyWebkitTextEmphasisStyleEqual(const Co mputedStyle& a, const ComputedStyle& b)
154 {
155 // TODO why isn't this getting picked up as a shorthand?
156 return CSSPropertyEquality::propertiesEqual(CSSPropertyWebkitTextEmphasisCol or, a, b)
157 && CSSPropertyEquality::propertiesEqual(CSSPropertyWebkitTextEmphasisSty le, a, b);
158 }
159
160 bool CSSPropertyEqualityCustom::CSSPropertyAnimationDelayEqual(const ComputedSty le& a, const ComputedStyle& b)
161 {
162 return a.animations() == b.animations()
163 || (a.animations() && b.animations() && a.animations()->delayList() == b .animations()->delayList());
164 }
165
166 bool CSSPropertyEqualityCustom::CSSPropertyWebkitTextStrokeColorEqual(const Comp utedStyle& a, const ComputedStyle& b)
167 {
168 return a.textStrokeColor() == b.textStrokeColor()
169 && a.visitedLinkTextStrokeColor() == b.visitedLinkTextStrokeColor();
170 }
171
172 bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskBoxImageOutsetEqual(const C omputedStyle& a, const ComputedStyle& b)
173 {
174 return a.maskBoxImageOutset() == b.maskBoxImageOutset();
175 }
176
177 bool CSSPropertyEqualityCustom::CSSPropertyTransitionPropertyEqual(const Compute dStyle& a, const ComputedStyle& b)
178 {
179 return a.transitions() == b.transitions()
180 || (a.transitions() && b.transitions() && a.transitions()->transitionsMa tchForStyleRecalc(*b.transitions()));
181 }
182
183 bool CSSPropertyEqualityCustom::CSSPropertyColumnCountEqual(const ComputedStyle& a, const ComputedStyle& b)
184 {
185 return a.columnCount() == b.columnCount();
186 }
187
188 bool CSSPropertyEqualityCustom::CSSPropertyGridTemplateRowsEqual(const ComputedS tyle& a, const ComputedStyle& b)
189 {
190 return a.gridTemplateRows() == b.gridTemplateRows();
191 }
192
193 bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskOriginEqual(const ComputedS tyle& a, const ComputedStyle& b)
194 {
195 return fillLayersEqual<CSSPropertyWebkitMaskOrigin>(a.maskLayers(), b.maskLa yers());
196 }
197
198 bool CSSPropertyEqualityCustom::CSSPropertyFillEqual(const ComputedStyle& a, con st ComputedStyle& b)
199 {
200 const SVGComputedStyle& aSVG = a.svgStyle();
201 const SVGComputedStyle& bSVG = b.svgStyle();
202 return aSVG.fillPaintType() == bSVG.fillPaintType()
203 && (aSVG.fillPaintType() != SVG_PAINTTYPE_RGBCOLOR || aSVG.fillPaintColo r() == bSVG.fillPaintColor())
204 && aSVG.visitedLinkFillPaintType() == bSVG.visitedLinkFillPaintType()
205 && (aSVG.visitedLinkFillPaintType() != SVG_PAINTTYPE_RGBCOLOR || aSVG.vi sitedLinkFillPaintColor() == bSVG.visitedLinkFillPaintColor());
206 }
207
208 bool CSSPropertyEqualityCustom::CSSPropertyZoomEqual(const ComputedStyle& a, con st ComputedStyle& b)
209 {
210 return a.zoom() == b.zoom();
211 }
212
213 bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskBoxImageRepeatEqual(const C omputedStyle& a, const ComputedStyle& b)
214 {
215 return a.maskBoxImage().horizontalRule() == b.maskBoxImage().horizontalRule( )
216 && a.maskBoxImage().verticalRule() == b.maskBoxImage().verticalRule();
217 }
218
219 bool CSSPropertyEqualityCustom::CSSPropertyBackgroundAttachmentEqual(const Compu tedStyle& a, const ComputedStyle& b)
220 {
221 return fillLayersEqual<CSSPropertyBackgroundAttachment>(a.backgroundLayers() , b.backgroundLayers());
222 }
223
224 bool CSSPropertyEqualityCustom::CSSPropertyBackgroundImageEqual(const ComputedSt yle& a, const ComputedStyle& b)
225 {
226 return fillLayersEqual<CSSPropertyBackgroundImage>(a.backgroundLayers(), b.b ackgroundLayers());
227 }
228
229 bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskClipEqual(const ComputedSty le& a, const ComputedStyle& b)
230 {
231 return fillLayersEqual<CSSPropertyWebkitMaskClip>(a.maskLayers(), b.maskLaye rs());
232 }
233
234 bool CSSPropertyEqualityCustom::CSSPropertyCounterResetEqual(const ComputedStyle & a, const ComputedStyle& b)
235 {
236 // TODO test
237 const CounterDirectiveMap* aMap = a.counterDirectives();
238 const CounterDirectiveMap* bMap = b.counterDirectives();
239
240 if (!aMap || !bMap)
241 return true;
242
243 if (!aMap) {
244 aMap = bMap;
245 bMap = nullptr;
246 }
247
248 for (const auto& aItem : *aMap) {
249 if (!aItem.value.isReset())
250 continue;
251
252 if (!bMap)
253 return false;
254
255 if (!bMap->contains(aItem.key))
256 return false;
257
258 const auto& bItem = bMap->get(aItem.key);
259 if (aItem.value.resetValue() != bItem.resetValue())
260 return false;
261 }
262
263 return true;
264 }
265
266 bool CSSPropertyEqualityCustom::CSSPropertyBorderImageSliceEqual(const ComputedS tyle& a, const ComputedStyle& b)
267 {
268 return a.borderImageSlices() == b.borderImageSlices();
269 }
270
271 bool CSSPropertyEqualityCustom::CSSPropertyAnimationIterationCountEqual(const Co mputedStyle& a, const ComputedStyle& b)
272 {
273 return a.animations() == b.animations()
274 || (a.animations() && b.animations() && a.animations()->iterationCountLi st() == b.animations()->iterationCountList());
275 }
276
277 bool CSSPropertyEqualityCustom::CSSPropertyTextIndentEqual(const ComputedStyle& a, const ComputedStyle& b)
278 {
279 return a.textIndent() == b.textIndent();
280 }
281
282 bool CSSPropertyEqualityCustom::CSSPropertyBorderImageOutsetEqual(const Computed Style& a, const ComputedStyle& b)
283 {
284 return a.borderImageOutset() == b.borderImageOutset();
285 }
286
287 bool CSSPropertyEqualityCustom::CSSPropertyBorderImageRepeatEqual(const Computed Style& a, const ComputedStyle& b)
288 {
289 return a.borderImage().horizontalRule() == b.borderImage().horizontalRule()
290 && a.borderImage().verticalRule() == b.borderImage().verticalRule();
291 }
292
293 bool CSSPropertyEqualityCustom::CSSPropertyTransitionTimingFunctionEqual(const C omputedStyle& a, const ComputedStyle& b)
294 {
295 return a.transitions() == b.transitions()
296 || (a.transitions() && b.transitions() && a.transitions()->timingFunctio nList() == b.transitions()->timingFunctionList());
297 }
298
299 bool CSSPropertyEqualityCustom::CSSPropertyColumnRuleColorEqual(const ComputedSt yle& a, const ComputedStyle& b)
300 {
301 return a.columnRuleColor() == b.columnRuleColor()
302 && a.visitedLinkColumnRuleColor() == b.visitedLinkColumnRuleColor();
303 }
304
305 bool CSSPropertyEqualityCustom::CSSPropertyGridTemplateColumnsEqual(const Comput edStyle& a, const ComputedStyle& b)
306 {
307 return a.gridTemplateColumns() == b.gridTemplateColumns();
308 }
309
310 bool CSSPropertyEqualityCustom::CSSPropertyColumnGapEqual(const ComputedStyle& a , const ComputedStyle& b)
311 {
312 return a.columnGap() == b.columnGap();
313 }
314
315 bool CSSPropertyEqualityCustom::CSSPropertyMaskSourceTypeEqual(const ComputedSty le& a, const ComputedStyle& b)
316 {
317 return fillLayersEqual<CSSPropertyMaskSourceType>(a.maskLayers(), b.maskLaye rs());
318 }
319
320 bool CSSPropertyEqualityCustom::CSSPropertySnapHeightEqual(const ComputedStyle& a, const ComputedStyle& b)
321 {
322 return a.snapHeightPosition() == b.snapHeightPosition() && a.snapHeightUnit( ) == b.snapHeightUnit();
323 }
324
325 bool CSSPropertyEqualityCustom::CSSPropertyBackgroundRepeatYEqual(const Computed Style& a, const ComputedStyle& b)
326 {
327 return fillLayersEqual<CSSPropertyBackgroundRepeatY>(a.backgroundLayers(), b .backgroundLayers());
328 }
329
330 bool CSSPropertyEqualityCustom::CSSPropertyTransitionDurationEqual(const Compute dStyle& a, const ComputedStyle& b)
331 {
332 return a.transitions() == b.transitions()
333 || (a.transitions() && b.transitions() && a.transitions()->durationList( ) == b.transitions()->durationList());
334 }
335
336 bool CSSPropertyEqualityCustom::CSSPropertyWebkitAppRegionEqual(const ComputedSt yle& a, const ComputedStyle& b)
337 {
338 return a.getDraggableRegionMode() == b.getDraggableRegionMode();
339 }
340
341 bool CSSPropertyEqualityCustom::CSSPropertyWebkitTextFillColorEqual(const Comput edStyle& a, const ComputedStyle& b)
342 {
343 return a.textFillColor() == b.textFillColor()
344 && a.visitedLinkTextFillColor() == b.visitedLinkTextFillColor();
345 }
346
347 bool CSSPropertyEqualityCustom::CSSPropertyBackgroundClipEqual(const ComputedSty le& a, const ComputedStyle& b)
348 {
349 return fillLayersEqual<CSSPropertyBackgroundClip>(a.backgroundLayers(), b.ba ckgroundLayers());
350 }
351
352 bool CSSPropertyEqualityCustom::CSSPropertyOutlineStyleEqual(const ComputedStyle & a, const ComputedStyle& b)
353 {
354 // TODO test
355 return a.outlineStyleIsAuto() == b.outlineStyleIsAuto()
356 && a.outlineStyle() == b.outlineStyle();
357 }
358
359 bool CSSPropertyEqualityCustom::CSSPropertyBorderRightColorEqual(const ComputedS tyle& a, const ComputedStyle& b)
360 {
361 return a.borderRightColor() == b.borderRightColor()
362 && a.visitedLinkBorderRightColor() == b.visitedLinkBorderRightColor();
363 }
364
365 bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskSizeEqual(const ComputedSty le& a, const ComputedStyle& b)
366 {
367 return fillLayersEqual<CSSPropertyWebkitMaskSize>(a.maskLayers(), b.maskLaye rs());
368 }
369
370 bool CSSPropertyEqualityCustom::CSSPropertyBorderImageWidthEqual(const ComputedS tyle& a, const ComputedStyle& b)
371 {
372 return a.borderImageWidth() == b.borderImageWidth();
373 }
374
375 bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskImageEqual(const ComputedSt yle& a, const ComputedStyle& b)
376 {
377 return dataEquivalent(a.maskImage(), b.maskImage());
378 }
379
380 bool CSSPropertyEqualityCustom::CSSPropertyAnimationTimingFunctionEqual(const Co mputedStyle& a, const ComputedStyle& b)
381 {
382 return a.animations() == b.animations()
383 || (a.animations() && b.animations() && a.animations()->timingFunctionLi st() == b.animations()->timingFunctionList());
384 }
385
386 bool CSSPropertyEqualityCustom::CSSPropertyGridTemplateAreasEqual(const Computed Style& a, const ComputedStyle& b)
387 {
388 // TODO test
389 return a.namedGridArea() == b.namedGridArea()
390 && a.namedGridAreaRowCount() == b.namedGridAreaRowCount()
391 && b.namedGridAreaColumnCount() == b.namedGridAreaColumnCount();
392 }
393
394 bool CSSPropertyEqualityCustom::CSSPropertyAnimationDirectionEqual(const Compute dStyle& a, const ComputedStyle& b)
395 {
396 return a.animations() == b.animations()
397 || (a.animations() && b.animations() && a.animations()->directionList() == b.animations()->directionList());
398 }
399
400 bool CSSPropertyEqualityCustom::CSSPropertyBackgroundSizeEqual(const ComputedSty le& a, const ComputedStyle& b)
401 {
402 return fillLayersEqual<CSSPropertyBackgroundSize>(a.backgroundLayers(), b.ba ckgroundLayers());
403 }
404
405 bool CSSPropertyEqualityCustom::CSSPropertyClipEqual(const ComputedStyle& a, con st ComputedStyle& b)
406 {
407 return a.clip() == b.clip();
408 }
409
410 bool CSSPropertyEqualityCustom::CSSPropertyAnimationFillModeEqual(const Computed Style& a, const ComputedStyle& b)
411 {
412 return a.animations() == b.animations()
413 || (a.animations() && b.animations() && a.animations()->fillModeList() = = b.animations()->fillModeList());
414 }
415
416 bool CSSPropertyEqualityCustom::CSSPropertyColorEqual(const ComputedStyle& a, co nst ComputedStyle& b)
417 {
418 return a.color() == b.color()
419 && a.visitedLinkColor() == b.visitedLinkColor();
420 }
421
422 bool CSSPropertyEqualityCustom::CSSPropertyBorderLeftColorEqual(const ComputedSt yle& a, const ComputedStyle& b)
423 {
424 return a.borderLeftColor() == b.borderLeftColor()
425 && a.visitedLinkBorderLeftColor() == b.visitedLinkBorderLeftColor();
426 }
427
428 bool CSSPropertyEqualityCustom::CSSPropertyStrokeEqual(const ComputedStyle& a, c onst ComputedStyle& b)
429 {
430 const SVGComputedStyle& aSVG = a.svgStyle();
431 const SVGComputedStyle& bSVG = b.svgStyle();
432 return aSVG.strokePaintType() == bSVG.strokePaintType()
433 && (aSVG.strokePaintType() != SVG_PAINTTYPE_RGBCOLOR || aSVG.strokePaint Color() == bSVG.strokePaintColor())
434 && aSVG.visitedLinkStrokePaintType() == bSVG.visitedLinkStrokePaintType( )
435 && (aSVG.visitedLinkStrokePaintType() != SVG_PAINTTYPE_RGBCOLOR || aSVG. visitedLinkStrokePaintColor() == bSVG.visitedLinkStrokePaintColor());
436 }
437
438 bool CSSPropertyEqualityCustom::CSSPropertyWillChangeEqual(const ComputedStyle& a, const ComputedStyle& b)
439 {
440 return a.willChangeProperties() == b.willChangeProperties();
441 }
442
443 bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskBoxImageSliceEqual(const Co mputedStyle& a, const ComputedStyle& b)
444 {
445 return a.maskBoxImageSlices() == b.maskBoxImageSlices();
446 }
447
448 bool CSSPropertyEqualityCustom::CSSPropertyBackgroundPositionYEqual(const Comput edStyle& a, const ComputedStyle& b)
449 {
450 return fillLayersEqual<CSSPropertyBackgroundPositionY>(a.backgroundLayers(), b.backgroundLayers());
451 }
452
453 bool CSSPropertyEqualityCustom::CSSPropertyBackgroundPositionXEqual(const Comput edStyle& a, const ComputedStyle& b)
454 {
455 return fillLayersEqual<CSSPropertyBackgroundPositionX>(a.backgroundLayers(), b.backgroundLayers());
456 }
457
458 bool CSSPropertyEqualityCustom::CSSPropertyBackgroundOriginEqual(const ComputedS tyle& a, const ComputedStyle& b)
459 {
460 return fillLayersEqual<CSSPropertyBackgroundOrigin>(a.backgroundLayers(), b. backgroundLayers());
461 }
462
463 bool CSSPropertyEqualityCustom::CSSPropertyColumnWidthEqual(const ComputedStyle& a, const ComputedStyle& b)
464 {
465 return a.columnWidth() == b.columnWidth();
466 }
467
468 bool CSSPropertyEqualityCustom::CSSPropertyCursorEqual(const ComputedStyle& a, c onst ComputedStyle& b)
469 {
470 // TODO test
471 return a.cursor() == b.cursor()
472 && (a.cursors() == b.cursors() || (a.cursors() && b.cursors() && *a.curs ors() == *b.cursors()));
473 }
474
475 bool CSSPropertyEqualityCustom::CSSPropertyCounterIncrementEqual(const ComputedS tyle& a, const ComputedStyle& b)
476 {
477 // TODO test
478 const CounterDirectiveMap* aMap = a.counterDirectives();
479 const CounterDirectiveMap* bMap = b.counterDirectives();
480
481 if (!aMap || !bMap)
482 return true;
483
484 if (!aMap) {
485 aMap = bMap;
486 bMap = nullptr;
487 }
488
489 for (const auto& aItem : *aMap) {
490 if (!aItem.value.isIncrement())
491 continue;
492
493 if (!bMap)
494 return false;
495
496 if (!bMap->contains(aItem.key))
497 return false;
498
499 const auto& bItem = bMap->get(aItem.key);
500 if (aItem.value.incrementValue() != bItem.incrementValue())
501 return false;
502 }
503
504 return true;
505 }
506
507 bool CSSPropertyEqualityCustom::CSSPropertyBackgroundBlendModeEqual(const Comput edStyle& a, const ComputedStyle& b)
508 {
509 return fillLayersEqual<CSSPropertyBackgroundBlendMode>(a.backgroundLayers(), b.backgroundLayers());
510 }
511
512 bool CSSPropertyEqualityCustom::CSSPropertyBackgroundRepeatXEqual(const Computed Style& a, const ComputedStyle& b)
513 {
514 return fillLayersEqual<CSSPropertyBackgroundRepeatX>(a.backgroundLayers(), b .backgroundLayers());
515 }
516
517 bool CSSPropertyEqualityCustom::CSSPropertyBorderTopColorEqual(const ComputedSty le& a, const ComputedStyle& b)
518 {
519 return a.borderTopColor() == b.borderTopColor()
520 && a.visitedLinkBorderTopColor() == b.visitedLinkBorderTopColor();
521 }
522
523 bool CSSPropertyEqualityCustom::CSSPropertyBackgroundColorEqual(const ComputedSt yle& a, const ComputedStyle& b)
524 {
525 return a.backgroundColor() == b.backgroundColor()
526 && a.visitedLinkBackgroundColor() == b.visitedLinkBackgroundColor();
527 }
528
529 bool CSSPropertyEqualityCustom::CSSPropertyWebkitTextEmphasisColorEqual(const Co mputedStyle& a, const ComputedStyle& b)
530 {
531 return a.textEmphasisColor() == b.textEmphasisColor()
532 && a.visitedLinkTextEmphasisColor() == b.visitedLinkTextEmphasisColor();
533 }
534
535 bool CSSPropertyEqualityCustom::CSSPropertyZIndexEqual(const ComputedStyle& a, c onst ComputedStyle& b)
536 {
537 return a.hasAutoZIndex() == b.hasAutoZIndex() && (a.hasAutoZIndex() || a.zIn dex() == b.zIndex());
538 }
539
540 bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskRepeatYEqual(const Computed Style& a, const ComputedStyle& b)
541 {
542 return fillLayersEqual<CSSPropertyWebkitMaskRepeatY>(a.maskLayers(), b.maskL ayers());
543 }
544
545 bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskRepeatXEqual(const Computed Style& a, const ComputedStyle& b)
546 {
547 return fillLayersEqual<CSSPropertyWebkitMaskRepeatX>(a.maskLayers(), b.maskL ayers());
548 }
549
550 bool CSSPropertyEqualityCustom::CSSPropertyBorderBottomColorEqual(const Computed Style& a, const ComputedStyle& b)
551 {
552 return a.borderBottomColor() == b.borderBottomColor()
553 && a.visitedLinkBorderBottomColor() == b.visitedLinkBorderBottomColor();
554 }
555
556 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSPropertyEquality.h ('k') | third_party/WebKit/Source/core/style/ComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698