8000 Make FilterOperation::OperationType an enum class · WebKit/WebKit@dffcbbe · GitHub
[go: up one dir, main page]

Skip to content

Commit dffcbbe

Browse files
committed
Make FilterOperation::OperationType an enum class
https://bugs.webkit.org/show_bug.cgi?id=250519 Reviewed by Alex Christensen. * Source/WebCore/animation/CSSPropertyAnimation.cpp: * Source/WebCore/css/ComputedStyleExtractor.cpp: (WebCore::ComputedStyleExtractor::valueForFilter): * Source/WebCore/editing/ReplaceSelectionCommand.cpp: (WebCore::fragmentNeedsColorTransformed): * Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::createFilterAnimationsFromKeyframes): (WebCore::GraphicsLayerCA::setFilterAnimationKeyframes): * Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h: * Source/WebCore/platform/graphics/ca/PlatformCAFilters.h: * Source/WebCore/platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm: (WebCore::PlatformCAFilters::setFiltersOnLayer): (WebCore::PlatformCAFilters::filterValueForOperation): (WebCore::PlatformCAFilters::colorMatrixValueForFilter): (WebCore::PlatformCAFilters::isAnimatedFilterProperty): (WebCore::PlatformCAFilters::animatedFilterPropertyName): * Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (WebCore::PlatformCALayerCocoa::filtersCanBeComposited): * Source/WebCore/platform/graphics/ca/win/PlatformCAFiltersWin.cpp: (PlatformCAFilters::isAnimatedFilterProperty): (PlatformCAFilters::animatedFilterPropertyName): * Source/WebCore/platform/graphics/filters/FilterOperation.cpp: (WebCore::DefaultFilterOperation::representedType const): (WebCore::ReferenceFilterOperation::ReferenceFilterOperation): (WebCore::FilterOperation::blendAmounts const): (WebCore::BasicColorMatrixFilterOperation::isIdentity const): (WebCore::BasicColorMatrixFilterOperation::transformColor const): (WebCore::BasicColorMatrixFilterOperation::passthroughAmount const): (WebCore::BasicComponentTransferFilterOperation::isIdentity const): (WebCore::BasicComponentTransferFilterOperation::transformColor const): (WebCore::BasicComponentTransferFilterOperation::passthroughAmount const): (WebCore::BasicComponentTransferFilterOperation::affectsOpacity const): (WebCore::operator<<): * Source/WebCore/platform/graphics/filters/FilterOperation.h: (WebCore::FilterOperation::type const): (WebCore::FilterOperation::isBasicColorMatrixFilterOperation const): (WebCore::FilterOperation::isBasicComponentTransferFilterOperation const): (WebCore::FilterOperation::FilterOperation): (WebCore::PassthroughFilterOperation::PassthroughFilterOperation): * Source/WebCore/platform/graphics/filters/FilterOperations.cpp: (WebCore::FilterOperations::hasReferenceFilter const): (WebCore::FilterOperations::outsets const): * Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp: (WebCore::getPassesRequiredForFilter): (WebCore::BitmapTextureGL::applyFilters): * Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: (WebCore::GraphicsLayerTextureMapper::filtersCanBeComposited const): * Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp: (WebCore::optionsForFilterType): (WebCore::prepareFilterProgram): * Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::filtersCanBeComposited const): (WebCore::CoordinatedGraphicsLayer::shouldHaveBackingStore const): * Source/WebCore/rendering/CSSFilter.cpp: (WebCore::CSSFilter::buildFilterFunctions): (WebCore::CSSFilter::isIdentity): (WebCore::CSSFilter::calculateOutsets): * Source/WebCore/rendering/ReferencedSVGResources.cpp: (WebCore::ReferencedSVGResources::referencedSVGResourceIDs): * Source/WebCore/rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::hasReferenceFilterOnly const): * Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeResources): * Source/WebCore/rendering/svg/SVGResources.cpp: (WebCore::SVGResources::buildCachedResources): * Source/WebCore/style/FilterOperationsBuilder.cpp: (WebCore::Style::filterOperationForType): (WebCore::Style::createFilterOperations): * Source/WebKit/Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<FilterOperation>::encode): (IPC::decodeFilterOperation): * Source/WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.cpp: (WebKit::filtersCanBeComposited): Canonical link: https://commits.webkit.org/258864@main
1 parent 8e9f9d3 commit dffcbbe

24 files changed

+319
-314
lines changed

Source/WebCore/animation/CSSPropertyAnimation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1493,7 +1493,7 @@ class PropertyWrapperFilter final : public PropertyWrapper<const FilterOperation
14931493

14941494
auto listContainsReference = [](auto& filterOperations) {
14951495
return filterOperations.operations().findIf([](auto& filterOperation) {
1496-
return filterOperation->type() == FilterOperation::OperationType::REFERENCE;
1496+
return filterOperation->type() == FilterOperation::Type::Reference;
14971497
}) != notFound;
14981498
};
14991499

Source/WebCore/css/ComputedStyleExtractor.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,62 +1026,62 @@ Ref<CSSValue> ComputedStyleExtractor::valueForFilter(const RenderStyle& style, c
10261026
for (Vector<RefPtr<FilterOperation>>::const_iterator it = filterOperations.operations().begin(); it != end; ++it) {
10271027
FilterOperation& filterOperation = **it;
10281028

1029-
if (filterOperation.type() == FilterOperation::REFERENCE) {
1029+
if (filterOperation.type() == FilterOperation::Type::Reference) {
10301030
ReferenceFilterOperation& referenceOperation = downcast<ReferenceFilterOperation>(filterOperation);
10311031
list->append(cssValuePool.createValue(referenceOperation.url(), CSSUnitType::CSS_URI));
10321032
} else {
10331033
RefPtr<CSSFunctionValue> filterValue;
10341034
switch (filterOperation.type()) {
1035-
case FilterOperation::GRAYSCALE: {
1035+
case FilterOperation::Type::Grayscale: {
10361036
filterValue = CSSFunctionValue::create(CSSValueGrayscale);
10371037
filterValue->append(cssValuePool.createValue(downcast<BasicColorMatrixFilterOperation>(filterOperation).amount(), CSSUnitType::CSS_NUMBER));
10381038
break;
10391039
}
1040-
case FilterOperation::SEPIA: {
1040+
case FilterOperation::Type::Sepia: {
10411041
filterValue = CSSFunctionValue::create(CSSValueSepia);
10421042
filterValue->append(cssValuePool.createValue(downcast<BasicColorMatrixFilterOperation>(filterOperation).amount(), CSSUnitType::CSS_NUMBER));
10431043
break;
10441044
}
1045-
case FilterOperation::SATURATE: {
1045+
case FilterOperation::Type::Saturate: {
10461046
filterValue = CSSFunctionValue::create(CSSValueSaturate);
10471047
filterValue->append(cssValuePool.createValue(downcast<BasicColorMatrixFilterOperation>(filterOperation).amount(), CSSUnitType::CSS_NUMBER));
10481048
break;
10491049
}
1050-
case FilterOperation::HUE_ROTATE: {
1050+
case FilterOperation::Type::HueRotate: {
10511051
filterValue = CSSFunctionValue::create(CSSValueHueRotate);
10521052
filterValue->append(cssValuePool.createValue(downcast<BasicColorMatrixFilterOperation>(filterOperation).amount(), CSSUnitType::CSS_DEG));
10531053
break;
10541054
}
1055-
case FilterOperation::INVERT: {
1055+
case FilterOperation::Type::Invert: {
10561056
filterValue = CSSFunctionValue::create(CSSValueInvert);
10571057
filterValue->append(cssValuePool.createValue(downcast<BasicComponentTransferFilterOperation>(filterOperation).amount(), CSSUnitType::CSS_NUMBER));
10581058
break;
10591059
}
1060-
case FilterOperation::APPLE_INVERT_LIGHTNESS: {
1060+
case FilterOperation::Type::AppleInvertLightness: {
10611061
filterValue = CSSFunctionValue::create(CSSValueAppleInvertLightness);
10621062
break;
10631063
}
1064-
case FilterOperation::OPACITY: {
1064+
case FilterOperation::Type::Opacity: {
10651065
filterValue = CSSFunctionValue::create(CSSValueOpacity);
10661066
filterValue->append(cssValuePool.createValue(downcast<BasicComponentTransferFilterOperation>(filterOperation).amount(), CSSUnitType::CSS_NUMBER));
10671067
break;
10681068
}
1069-
case FilterOperation::BRIGHTNESS: {
1069+
case FilterOperation::Type::Brightness: {
10701070
filterValue = CSSFunctionValue::create(CSSValueBrightness);
10711071
filterValue->append(cssValuePool.createValue(downcast<BasicComponentTransferFilterOperation>(filterOperation).amount(), CSSUnitType::CSS_NUMBER));
10721072
break;
10731073
}
1074-
case FilterOperation::CONTRAST: {
1074+
case FilterOperation::Type::Contrast: {
10751075
filterValue = CSSFunctionValue::create(CSSValueContrast);
10761076
filterValue->append(cssValuePool.createValue(downcast<BasicComponentTransferFilterOperation>(filterOperation).amount(), CSSUnitType::CSS_NUMBER));
10771077
break;
10781078
}
1079-
case FilterOperation::BLUR: {
1079+
case FilterOperation::Type::Blur: {
10801080
filterValue = CSSFunctionValue::create(CSSValueBlur);
10811081
filterValue->append(adjustLengthForZoom(downcast<BlurFilterOperation>(filterOperation).stdDeviation(), style, adjust));
10821082
break;
10831083
}
1084-
case FilterOperation::DROP_SHADOW: {
1084+
case FilterOperation::Type::DropShadow: {
10851085
DropShadowFilterOperation& dropShadowOperation = downcast<DropShadowFilterOperation>(filterOperation);
10861086
filterValue = CSSFunctionValue::create(CSSValueDropShadow);
10871087
// We want our computed style to look like that of a text shadow (has neither spread nor inset style).

Source/WebCore/editing/ReplaceSelectionCommand.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ static bool fragmentNeedsColorTransformed(ReplacementFragment& fragment, const P
570570

571571
const auto& colorFilter = editableRootRenderer->style().appleColorFilter();
572572
for (const auto& colorFilterOperation : colorFilter.operations()) {
573-
if (colorFilterOperation->type() != FilterOperation::APPLE_INVERT_LIGHTNESS)
573+
if (colorFilterOperation->type() != FilterOperation::Type::AppleInvertLightness)
574574
return false;
575575
}
576576
}

Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3585,7 +3585,7 @@ bool GraphicsLayerCA::createFilterAnimationsFromKeyframes(const KeyframeValueLis
35853585

35863586
// FIXME: We can't currently hardware animate shadows.
35873587
for (int i = 0; i < numAnimations; ++i) {
3588-
if (operations.at(i)->type() == FilterOperation::DROP_SHADOW)
3588+
if (operations.at(i)->type() == FilterOperation::Type::DropShadow)
35893589
return false;
35903590
}
35913591

@@ -3891,7 +3891,7 @@ bool GraphicsLayerCA::setFilterAnimationEndpoints(const KeyframeValueList& value
38913891
return true;
38923892
}
38933893

3894-
bool GraphicsLayerCA::setFilterAnimationKeyframes(const KeyframeValueList& valueList, const Animation* animation, PlatformCAAnimation* keyframeAnim, int functionIndex, FilterOperation::OperationType filterOp, bool keyframesShouldUseAnimationWideTimingFunction)
3894+
bool GraphicsLayerCA::setFilterAnimationKeyframes(const KeyframeValueList& valueList, const Animation* animation, PlatformCAAnimation* keyframeAnim, int functionIndex, FilterOperation::Type filterOp, bool keyframesShouldUseAnimationWideTimingFunction)
38953895
{
38963896
Vector<float> keyTimes;
38973897
Vector<RefPtr<FilterOperation>> values;

Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ class GraphicsLayerCA : public GraphicsLayer, public PlatformCALayerClient {
292292
bool setTransformAnimationKeyframes(const KeyframeValueList&, const Animation*, PlatformCAAnimation*, int functionIndex, TransformOperation::Type, bool isMatrixAnimation, const FloatSize& boxSize, bool keyframesShouldUseAnimationWideTimingFunction);
293293

294294
bool setFilterAnimationEndpoints(const KeyframeValueList&, const Animation*, PlatformCAAnimation*, int functionIndex);
295-
bool setFilterAnimationKeyframes(const KeyframeValueList&, const Animation*, PlatformCAAnimation*, int functionIndex, FilterOperation::OperationType, bool keyframesShouldUseAnimationWideTimingFunction);
295+
bool setFilterAnimationKeyframes(const KeyframeValueList&, const Animation*, PlatformCAAnimation*, int functionIndex, FilterOperation::Type, bool keyframesShouldUseAnimationWideTimingFunction);
296296

297297
bool isRunningTransformAnimation() const;
298298

Source/WebCore/platform/graphics/ca/PlatformCAFilters.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ class PlatformCAFilters {
4040
public:
4141
WEBCORE_EXPORT static void setFiltersOnLayer(PlatformLayer*, const FilterOperations&);
4242
WEBCORE_EXPORT static void setBlendingFiltersOnLayer(PlatformLayer*, const BlendMode);
43-
static bool isAnimatedFilterProperty(FilterOperation::OperationType);
44-
static const char* animatedFilterPropertyName(FilterOperation::OperationType);
43+
static bool isAnimatedFilterProperty(FilterOperation::Type);
44+
static const char* animatedFilterPropertyName(FilterOperation::Type);
4545

4646
WEBCORE_EXPORT static RetainPtr<NSValue> filterValueForOperation(const FilterOperation*);
4747

4848
// A null operation indicates that we should make a "no-op" filter of the given type.
49-
static RetainPtr<NSValue> colorMatrixValueForFilter(FilterOperation::OperationType, const FilterOperation*);
49+
static RetainPtr<NSValue> colorMatrixValueForFilter(FilterOperation::Type, const FilterOperation*);
5050
};
5151

5252
}

0 commit comments

Comments
 (0)
0