Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/CSSPropertyEqualityCustom.cpp |
| diff --git a/third_party/WebKit/Source/core/css/CSSPropertyEqualityCustom.cpp b/third_party/WebKit/Source/core/css/CSSPropertyEqualityCustom.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ff14162b1886ac8ab8b56d7ea20fb52cbdfb711e |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/css/CSSPropertyEqualityCustom.cpp |
| @@ -0,0 +1,556 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "core/CSSPropertyEqualityCustom.h" |
| + |
| +#include "core/CSSPropertyNames.h" |
| +#include "core/css/CSSPropertyEquality.h" |
| +#include "core/style/ComputedStyle.h" |
| +#include "core/style/DataEquivalency.h" |
| +#include "core/style/FillLayer.h" |
| + |
| +namespace blink { |
| + |
| +namespace { |
| + |
| +template <CSSPropertyID property> |
| +bool fillLayersEqual(const FillLayer& aLayers, const FillLayer& bLayers) |
| +{ |
| + const FillLayer* aLayer = &aLayers; |
| + const FillLayer* bLayer = &bLayers; |
| + while (aLayer && bLayer) { |
| + switch (property) { |
| + case CSSPropertyBackgroundPositionX: |
| + case CSSPropertyWebkitMaskPositionX: |
| + if (aLayer->xPosition() != bLayer->xPosition()) |
| + return false; |
| + break; |
| + case CSSPropertyBackgroundPositionY: |
| + case CSSPropertyWebkitMaskPositionY: |
| + if (aLayer->yPosition() != bLayer->yPosition()) |
| + return false; |
| + break; |
| + case CSSPropertyBackgroundSize: |
| + case CSSPropertyWebkitMaskSize: |
| + if (!(aLayer->sizeLength() == bLayer->sizeLength())) |
| + return false; |
| + break; |
| + case CSSPropertyBackgroundImage: |
| + if (!dataEquivalent(aLayer->image(), bLayer->image())) |
| + return false; |
| + break; |
| + case CSSPropertyWebkitMaskComposite: |
| + if (aLayer->composite() != bLayer->composite()) |
| + return false; |
| + case CSSPropertyBackgroundOrigin: |
| + case CSSPropertyWebkitMaskOrigin: |
| + if (aLayer->origin() != bLayer->origin()) |
| + return false; |
| + case CSSPropertyBackgroundBlendMode: |
| + if (aLayer->blendMode() != bLayer->blendMode()) |
| + return false; |
| + case CSSPropertyBackgroundAttachment: |
| + if (aLayer->attachment() != bLayer->attachment()) |
| + return false; |
| + case CSSPropertyBackgroundRepeatX: |
| + case CSSPropertyWebkitMaskRepeatX: |
| + if (aLayer->repeatX() != bLayer->repeatX()) |
| + return false; |
| + case CSSPropertyBackgroundRepeatY: |
| + case CSSPropertyWebkitMaskRepeatY: |
| + if (aLayer->repeatY() != bLayer->repeatY()) |
| + return false; |
| + case CSSPropertyBackgroundClip: |
| + case CSSPropertyWebkitMaskClip: |
| + if (aLayer->clip() != bLayer->clip()) |
| + return false; |
| + case CSSPropertyMaskSourceType: |
| + if (aLayer->maskSourceType() != bLayer->maskSourceType()) |
| + return false; |
| + default: |
| + ASSERT_NOT_REACHED(); |
| + return true; |
| + } |
| + |
| + aLayer = aLayer->next(); |
| + bLayer = bLayer->next(); |
| + } |
| + |
| + // FIXME: Shouldn't this be return !aLayer && !bLayer; ? |
| + return true; |
| +} |
| + |
| +} // namespace |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskBoxImageWidthEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.maskBoxImageWidth() == b.maskBoxImageWidth(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertySizeEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + // 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.
|
| + return a.pageSize() == b.pageSize() && a.getPageSizeType() == b.getPageSizeType(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyTransitionDelayEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + 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
|
| + || (a.transitions() && b.transitions() && a.transitions()->delayList() == b.transitions()->delayList()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyTextDecorationColorEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.textDecorationColor() == b.textDecorationColor() |
|
ikilpatrick
2016/04/27 00:32:17
Ditto colors, a special flag for color properties,
|
| + && a.visitedLinkTextDecorationColor() == b.visitedLinkTextDecorationColor(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyAnimationNameEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.animations() == b.animations() |
| + || (a.animations() && b.animations() && a.animations()->nameList() == b.animations()->nameList()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyAnimationDurationEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.animations() == b.animations() |
| + || (a.animations() && b.animations() && a.animations()->durationList() == b.animations()->durationList()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyAnimationPlayStateEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.animations() == b.animations() |
| + || (a.animations() && b.animations() && a.animations()->playStateList() == b.animations()->playStateList()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskCompositeEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyWebkitMaskComposite>(a.maskLayers(), b.maskLayers()); |
|
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.
|
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskPositionYEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyWebkitMaskPositionY>(a.maskLayers(), b.maskLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskPositionXEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyWebkitMaskPositionX>(a.maskLayers(), b.maskLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyContentEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.contentDataEquivalent(&b); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyOutlineColorEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.outlineColor() == b.outlineColor() |
| + && a.visitedLinkOutlineColor() == b.visitedLinkOutlineColor(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitTextEmphasisStyleEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + // TODO why isn't this getting picked up as a shorthand? |
| + return CSSPropertyEquality::propertiesEqual(CSSPropertyWebkitTextEmphasisColor, a, b) |
| + && CSSPropertyEquality::propertiesEqual(CSSPropertyWebkitTextEmphasisStyle, a, b); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyAnimationDelayEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.animations() == b.animations() |
| + || (a.animations() && b.animations() && a.animations()->delayList() == b.animations()->delayList()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitTextStrokeColorEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.textStrokeColor() == b.textStrokeColor() |
| + && a.visitedLinkTextStrokeColor() == b.visitedLinkTextStrokeColor(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskBoxImageOutsetEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.maskBoxImageOutset() == b.maskBoxImageOutset(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyTransitionPropertyEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.transitions() == b.transitions() |
| + || (a.transitions() && b.transitions() && a.transitions()->transitionsMatchForStyleRecalc(*b.transitions())); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyColumnCountEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.columnCount() == b.columnCount(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyGridTemplateRowsEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.gridTemplateRows() == b.gridTemplateRows(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskOriginEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyWebkitMaskOrigin>(a.maskLayers(), b.maskLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyFillEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + const SVGComputedStyle& aSVG = a.svgStyle(); |
| + const SVGComputedStyle& bSVG = b.svgStyle(); |
| + return aSVG.fillPaintType() == bSVG.fillPaintType() |
| + && (aSVG.fillPaintType() != SVG_PAINTTYPE_RGBCOLOR || aSVG.fillPaintColor() == bSVG.fillPaintColor()) |
| + && aSVG.visitedLinkFillPaintType() == bSVG.visitedLinkFillPaintType() |
| + && (aSVG.visitedLinkFillPaintType() != SVG_PAINTTYPE_RGBCOLOR || aSVG.visitedLinkFillPaintColor() == bSVG.visitedLinkFillPaintColor()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyZoomEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.zoom() == b.zoom(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskBoxImageRepeatEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.maskBoxImage().horizontalRule() == b.maskBoxImage().horizontalRule() |
| + && a.maskBoxImage().verticalRule() == b.maskBoxImage().verticalRule(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBackgroundAttachmentEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyBackgroundAttachment>(a.backgroundLayers(), b.backgroundLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBackgroundImageEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyBackgroundImage>(a.backgroundLayers(), b.backgroundLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskClipEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyWebkitMaskClip>(a.maskLayers(), b.maskLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyCounterResetEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + // TODO test |
| + const CounterDirectiveMap* aMap = a.counterDirectives(); |
| + const CounterDirectiveMap* bMap = b.counterDirectives(); |
| + |
| + if (!aMap || !bMap) |
| + return true; |
| + |
| + if (!aMap) { |
| + aMap = bMap; |
| + bMap = nullptr; |
| + } |
| + |
| + for (const auto& aItem : *aMap) { |
| + if (!aItem.value.isReset()) |
| + continue; |
| + |
| + if (!bMap) |
| + return false; |
| + |
| + if (!bMap->contains(aItem.key)) |
| + return false; |
| + |
| + const auto& bItem = bMap->get(aItem.key); |
| + if (aItem.value.resetValue() != bItem.resetValue()) |
| + return false; |
| + } |
| + |
| + return true; |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBorderImageSliceEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.borderImageSlices() == b.borderImageSlices(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyAnimationIterationCountEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.animations() == b.animations() |
| + || (a.animations() && b.animations() && a.animations()->iterationCountList() == b.animations()->iterationCountList()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyTextIndentEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.textIndent() == b.textIndent(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBorderImageOutsetEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.borderImageOutset() == b.borderImageOutset(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBorderImageRepeatEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.borderImage().horizontalRule() == b.borderImage().horizontalRule() |
| + && a.borderImage().verticalRule() == b.borderImage().verticalRule(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyTransitionTimingFunctionEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.transitions() == b.transitions() |
| + || (a.transitions() && b.transitions() && a.transitions()->timingFunctionList() == b.transitions()->timingFunctionList()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyColumnRuleColorEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.columnRuleColor() == b.columnRuleColor() |
| + && a.visitedLinkColumnRuleColor() == b.visitedLinkColumnRuleColor(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyGridTemplateColumnsEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.gridTemplateColumns() == b.gridTemplateColumns(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyColumnGapEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.columnGap() == b.columnGap(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyMaskSourceTypeEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyMaskSourceType>(a.maskLayers(), b.maskLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertySnapHeightEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.snapHeightPosition() == b.snapHeightPosition() && a.snapHeightUnit() == b.snapHeightUnit(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBackgroundRepeatYEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyBackgroundRepeatY>(a.backgroundLayers(), b.backgroundLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyTransitionDurationEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.transitions() == b.transitions() |
| + || (a.transitions() && b.transitions() && a.transitions()->durationList() == b.transitions()->durationList()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitAppRegionEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.getDraggableRegionMode() == b.getDraggableRegionMode(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitTextFillColorEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.textFillColor() == b.textFillColor() |
| + && a.visitedLinkTextFillColor() == b.visitedLinkTextFillColor(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBackgroundClipEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyBackgroundClip>(a.backgroundLayers(), b.backgroundLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyOutlineStyleEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + // TODO test |
| + return a.outlineStyleIsAuto() == b.outlineStyleIsAuto() |
| + && a.outlineStyle() == b.outlineStyle(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBorderRightColorEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.borderRightColor() == b.borderRightColor() |
| + && a.visitedLinkBorderRightColor() == b.visitedLinkBorderRightColor(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskSizeEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyWebkitMaskSize>(a.maskLayers(), b.maskLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBorderImageWidthEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.borderImageWidth() == b.borderImageWidth(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskImageEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return dataEquivalent(a.maskImage(), b.maskImage()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyAnimationTimingFunctionEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.animations() == b.animations() |
| + || (a.animations() && b.animations() && a.animations()->timingFunctionList() == b.animations()->timingFunctionList()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyGridTemplateAreasEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + // TODO test |
| + return a.namedGridArea() == b.namedGridArea() |
| + && a.namedGridAreaRowCount() == b.namedGridAreaRowCount() |
| + && b.namedGridAreaColumnCount() == b.namedGridAreaColumnCount(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyAnimationDirectionEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.animations() == b.animations() |
| + || (a.animations() && b.animations() && a.animations()->directionList() == b.animations()->directionList()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBackgroundSizeEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyBackgroundSize>(a.backgroundLayers(), b.backgroundLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyClipEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.clip() == b.clip(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyAnimationFillModeEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.animations() == b.animations() |
| + || (a.animations() && b.animations() && a.animations()->fillModeList() == b.animations()->fillModeList()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyColorEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.color() == b.color() |
| + && a.visitedLinkColor() == b.visitedLinkColor(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBorderLeftColorEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.borderLeftColor() == b.borderLeftColor() |
| + && a.visitedLinkBorderLeftColor() == b.visitedLinkBorderLeftColor(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyStrokeEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + const SVGComputedStyle& aSVG = a.svgStyle(); |
| + const SVGComputedStyle& bSVG = b.svgStyle(); |
| + return aSVG.strokePaintType() == bSVG.strokePaintType() |
| + && (aSVG.strokePaintType() != SVG_PAINTTYPE_RGBCOLOR || aSVG.strokePaintColor() == bSVG.strokePaintColor()) |
| + && aSVG.visitedLinkStrokePaintType() == bSVG.visitedLinkStrokePaintType() |
| + && (aSVG.visitedLinkStrokePaintType() != SVG_PAINTTYPE_RGBCOLOR || aSVG.visitedLinkStrokePaintColor() == bSVG.visitedLinkStrokePaintColor()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWillChangeEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.willChangeProperties() == b.willChangeProperties(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskBoxImageSliceEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.maskBoxImageSlices() == b.maskBoxImageSlices(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBackgroundPositionYEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyBackgroundPositionY>(a.backgroundLayers(), b.backgroundLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBackgroundPositionXEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyBackgroundPositionX>(a.backgroundLayers(), b.backgroundLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBackgroundOriginEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyBackgroundOrigin>(a.backgroundLayers(), b.backgroundLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyColumnWidthEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.columnWidth() == b.columnWidth(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyCursorEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + // TODO test |
| + return a.cursor() == b.cursor() |
| + && (a.cursors() == b.cursors() || (a.cursors() && b.cursors() && *a.cursors() == *b.cursors())); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyCounterIncrementEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + // TODO test |
| + const CounterDirectiveMap* aMap = a.counterDirectives(); |
| + const CounterDirectiveMap* bMap = b.counterDirectives(); |
| + |
| + if (!aMap || !bMap) |
| + return true; |
| + |
| + if (!aMap) { |
| + aMap = bMap; |
| + bMap = nullptr; |
| + } |
| + |
| + for (const auto& aItem : *aMap) { |
| + if (!aItem.value.isIncrement()) |
| + continue; |
| + |
| + if (!bMap) |
| + return false; |
| + |
| + if (!bMap->contains(aItem.key)) |
| + return false; |
| + |
| + const auto& bItem = bMap->get(aItem.key); |
| + if (aItem.value.incrementValue() != bItem.incrementValue()) |
| + return false; |
| + } |
| + |
| + return true; |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBackgroundBlendModeEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyBackgroundBlendMode>(a.backgroundLayers(), b.backgroundLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBackgroundRepeatXEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyBackgroundRepeatX>(a.backgroundLayers(), b.backgroundLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBorderTopColorEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.borderTopColor() == b.borderTopColor() |
| + && a.visitedLinkBorderTopColor() == b.visitedLinkBorderTopColor(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBackgroundColorEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.backgroundColor() == b.backgroundColor() |
| + && a.visitedLinkBackgroundColor() == b.visitedLinkBackgroundColor(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitTextEmphasisColorEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.textEmphasisColor() == b.textEmphasisColor() |
| + && a.visitedLinkTextEmphasisColor() == b.visitedLinkTextEmphasisColor(); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyZIndexEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.hasAutoZIndex() == b.hasAutoZIndex() && (a.hasAutoZIndex() || a.zIndex() == b.zIndex()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskRepeatYEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyWebkitMaskRepeatY>(a.maskLayers(), b.maskLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyWebkitMaskRepeatXEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return fillLayersEqual<CSSPropertyWebkitMaskRepeatX>(a.maskLayers(), b.maskLayers()); |
| +} |
| + |
| +bool CSSPropertyEqualityCustom::CSSPropertyBorderBottomColorEqual(const ComputedStyle& a, const ComputedStyle& b) |
| +{ |
| + return a.borderBottomColor() == b.borderBottomColor() |
| + && a.visitedLinkBorderBottomColor() == b.visitedLinkBorderBottomColor(); |
| +} |
| + |
| +} // namespace blink |