Make BlendMode an enum class
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Aug 2018 18:19:43 +0000 (18:19 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Aug 2018 18:19:43 +0000 (18:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188325

Patch by Alex Christensen <achristensen@webkit.org> on 2018-08-06
Reviewed by Darin Adler.

Source/WebCore:

No change in behavior.

* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator BlendMode const):
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::parseAttribute):
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::State::State):
(WebCore::CanvasRenderingContext2DBase::setGlobalCompositeOperation):
(WebCore::CanvasRenderingContext2DBase::drawImageFromRect):
* platform/graphics/BitmapImage.h:
* platform/graphics/GraphicsContext.h:
(WebCore::ImagePaintingOptions::ImagePaintingOptions):
* platform/graphics/GraphicsContextImpl.h:
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::dumpProperties const):
* platform/graphics/GraphicsLayer.h:
* platform/graphics/GraphicsTypes.cpp:
(WebCore::parseBlendMode):
(WebCore::parseCompositeAndBlendOperator):
(WebCore::compositeOperatorName):
(WebCore::blendModeName):
(WebCore::operator<<):
* platform/graphics/GraphicsTypes.h:
* platform/graphics/Image.cpp:
(WebCore::Image::drawTiled):
* platform/graphics/Image.h:
* platform/graphics/ImageBuffer.h:
* platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
(PlatformCAFilters::setBlendingFiltersOnLayer):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::selectCGBlendMode):
* platform/graphics/cpu/arm/filters/FEBlendNEON.h:
(WebCore::FEBlend::platformApplyNEON):
* platform/graphics/displaylists/DisplayListItems.h:
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/filters/FEBlend.cpp:
(WebCore::FEBlend::externalRepresentation const):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::paintFillLayers):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::paintIntoRect):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):
(WebCore::RenderLayer::updateBlendMode):
(WebCore::RenderLayer::beginTransparencyLayers):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateBlendMode):
* rendering/style/FillLayer.cpp:
(WebCore::FillLayer::FillLayer):
(WebCore::FillLayer::hasOpaqueImage const):
* rendering/style/FillLayer.h:
(WebCore::FillLayer::initialFillBlendMode):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setBlendMode):
(WebCore::RenderStyle::hasBlendMode const):
(WebCore::RenderStyle::blendMode const):
(WebCore::RenderStyle::initialBlendMode):
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
* rendering/svg/SVGRenderingContext.cpp:
(WebCore::SVGRenderingContext::prepareToRenderSVGContent):
* svg/SVGAnimatedEnumeration.cpp:
(WebCore::enumerationValueForTargetAttribute):
* svg/SVGFEBlendElement.cpp:
(WebCore::SVGFEBlendElement::SVGFEBlendElement):
(WebCore::SVGFEBlendElement::parseAttribute):
* svg/SVGFEBlendElement.h:
(WebCore::SVGPropertyTraits<BlendMode>::highestEnumValue):
(WebCore::SVGPropertyTraits<BlendMode>::toString):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::nativeImageForCurrentFrame):
(WebCore::SVGImage::nativeImage):
(WebCore::SVGImage::drawPatternForContainer):
(WebCore::SVGImage::draw):

Source/WebKit:

* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234610 268f45cc-cd09-0410-ab3c-d52691b4dbfc

46 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/html/HTMLImageElement.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp
Source/WebCore/platform/graphics/BitmapImage.h
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/GraphicsContextImpl.h
Source/WebCore/platform/graphics/GraphicsLayer.cpp
Source/WebCore/platform/graphics/GraphicsLayer.h
Source/WebCore/platform/graphics/GraphicsTypes.cpp
Source/WebCore/platform/graphics/GraphicsTypes.h
Source/WebCore/platform/graphics/Image.cpp
Source/WebCore/platform/graphics/Image.h
Source/WebCore/platform/graphics/ImageBuffer.h
Source/WebCore/platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm
Source/WebCore/platform/graphics/cairo/CairoOperations.cpp
Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp
Source/WebCore/platform/graphics/cairo/CairoUtilities.h
Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp
Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.h
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
Source/WebCore/platform/graphics/cpu/arm/filters/FEBlendNEON.h
Source/WebCore/platform/graphics/displaylists/DisplayListItems.h
Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h
Source/WebCore/platform/graphics/filters/FEBlend.cpp
Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp
Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h
Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp
Source/WebCore/platform/graphics/win/ImageCGWin.cpp
Source/WebCore/platform/graphics/win/ImageCairoWin.cpp
Source/WebCore/platform/graphics/win/ImageDirect2D.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/style/FillLayer.cpp
Source/WebCore/rendering/style/FillLayer.h
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
Source/WebCore/rendering/svg/SVGRenderingContext.cpp
Source/WebCore/svg/SVGAnimatedEnumeration.cpp
Source/WebCore/svg/SVGFEBlendElement.cpp
Source/WebCore/svg/SVGFEBlendElement.h
Source/WebCore/svg/graphics/SVGImage.cpp
Source/WebKit/ChangeLog
Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm

index b9cd873..aeef070 100644 (file)
@@ -1,3 +1,87 @@
+2018-08-06  Alex Christensen  <achristensen@webkit.org>
+
+        Make BlendMode an enum class
+        https://bugs.webkit.org/show_bug.cgi?id=188325
+
+        Reviewed by Darin Adler.
+
+        No change in behavior.
+
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator BlendMode const):
+        * html/HTMLImageElement.cpp:
+        (WebCore::HTMLImageElement::parseAttribute):
+        * html/canvas/CanvasRenderingContext2DBase.cpp:
+        (WebCore::CanvasRenderingContext2DBase::State::State):
+        (WebCore::CanvasRenderingContext2DBase::setGlobalCompositeOperation):
+        (WebCore::CanvasRenderingContext2DBase::drawImageFromRect):
+        * platform/graphics/BitmapImage.h:
+        * platform/graphics/GraphicsContext.h:
+        (WebCore::ImagePaintingOptions::ImagePaintingOptions):
+        * platform/graphics/GraphicsContextImpl.h:
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::dumpProperties const):
+        * platform/graphics/GraphicsLayer.h:
+        * platform/graphics/GraphicsTypes.cpp:
+        (WebCore::parseBlendMode):
+        (WebCore::parseCompositeAndBlendOperator):
+        (WebCore::compositeOperatorName):
+        (WebCore::blendModeName):
+        (WebCore::operator<<):
+        * platform/graphics/GraphicsTypes.h:
+        * platform/graphics/Image.cpp:
+        (WebCore::Image::drawTiled):
+        * platform/graphics/Image.h:
+        * platform/graphics/ImageBuffer.h:
+        * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
+        (PlatformCAFilters::setBlendingFiltersOnLayer):
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::selectCGBlendMode):
+        * platform/graphics/cpu/arm/filters/FEBlendNEON.h:
+        (WebCore::FEBlend::platformApplyNEON):
+        * platform/graphics/displaylists/DisplayListItems.h:
+        * platform/graphics/displaylists/DisplayListRecorder.h:
+        * platform/graphics/filters/FEBlend.cpp:
+        (WebCore::FEBlend::externalRepresentation const):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::paintFillLayers):
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::paintIntoRect):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::RenderLayer):
+        (WebCore::RenderLayer::updateBlendMode):
+        (WebCore::RenderLayer::beginTransparencyLayers):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateBlendMode):
+        * rendering/style/FillLayer.cpp:
+        (WebCore::FillLayer::FillLayer):
+        (WebCore::FillLayer::hasOpaqueImage const):
+        * rendering/style/FillLayer.h:
+        (WebCore::FillLayer::initialFillBlendMode):
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::setBlendMode):
+        (WebCore::RenderStyle::hasBlendMode const):
+        (WebCore::RenderStyle::blendMode const):
+        (WebCore::RenderStyle::initialBlendMode):
+        * rendering/style/StyleRareNonInheritedData.cpp:
+        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
+        * rendering/svg/SVGRenderingContext.cpp:
+        (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
+        * svg/SVGAnimatedEnumeration.cpp:
+        (WebCore::enumerationValueForTargetAttribute):
+        * svg/SVGFEBlendElement.cpp:
+        (WebCore::SVGFEBlendElement::SVGFEBlendElement):
+        (WebCore::SVGFEBlendElement::parseAttribute):
+        * svg/SVGFEBlendElement.h:
+        (WebCore::SVGPropertyTraits<BlendMode>::highestEnumValue):
+        (WebCore::SVGPropertyTraits<BlendMode>::toString):
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::nativeImageForCurrentFrame):
+        (WebCore::SVGImage::nativeImage):
+        (WebCore::SVGImage::drawPatternForContainer):
+        (WebCore::SVGImage::draw):
+
 2018-08-06  Aditya Keerthi  <akeerthi@apple.com>
 
         [iOS] Indeterminate checkboxes appear unchecked
index d14a451..5ec5127 100644 (file)
@@ -3903,58 +3903,58 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BlendMode blendMode)
 {
     m_primitiveUnitType = CSS_VALUE_ID;
     switch (blendMode) {
-    case BlendModeNormal:
+    case BlendMode::Normal:
         m_value.valueID = CSSValueNormal;
         break;
-    case BlendModeMultiply:
+    case BlendMode::Multiply:
         m_value.valueID = CSSValueMultiply;
         break;
-    case BlendModeScreen:
+    case BlendMode::Screen:
         m_value.valueID = CSSValueScreen;
         break;
-    case BlendModeOverlay:
+    case BlendMode::Overlay:
         m_value.valueID = CSSValueOverlay;
         break;
-    case BlendModeDarken:
+    case BlendMode::Darken:
         m_value.valueID = CSSValueDarken;
         break;
-    case BlendModeLighten:
+    case BlendMode::Lighten:
         m_value.valueID = CSSValueLighten;
         break;
-    case BlendModeColorDodge:
+    case BlendMode::ColorDodge:
         m_value.valueID = CSSValueColorDodge;
         break;
-    case BlendModeColorBurn:
+    case BlendMode::ColorBurn:
         m_value.valueID = CSSValueColorBurn;
         break;
-    case BlendModeHardLight:
+    case BlendMode::HardLight:
         m_value.valueID = CSSValueHardLight;
         break;
-    case BlendModeSoftLight:
+    case BlendMode::SoftLight:
         m_value.valueID = CSSValueSoftLight;
         break;
-    case BlendModeDifference:
+    case BlendMode::Difference:
         m_value.valueID = CSSValueDifference;
         break;
-    case BlendModeExclusion:
+    case BlendMode::Exclusion:
         m_value.valueID = CSSValueExclusion;
         break;
-    case BlendModeHue:
+    case BlendMode::Hue:
         m_value.valueID = CSSValueHue;
         break;
-    case BlendModeSaturation:
+    case BlendMode::Saturation:
         m_value.valueID = CSSValueSaturation;
         break;
-    case BlendModeColor:
+    case BlendMode::Color:
         m_value.valueID = CSSValueColor;
         break;
-    case BlendModeLuminosity:
+    case BlendMode::Luminosity:
         m_value.valueID = CSSValueLuminosity;
         break;
-    case BlendModePlusDarker:
+    case BlendMode::PlusDarker:
         m_value.valueID = CSSValuePlusDarker;
         break;
-    case BlendModePlusLighter:
+    case BlendMode::PlusLighter:
         m_value.valueID = CSSValuePlusLighter;
         break;
     }
@@ -3966,47 +3966,47 @@ template<> inline CSSPrimitiveValue::operator BlendMode() const
 
     switch (m_value.valueID) {
     case CSSValueNormal:
-        return BlendModeNormal;
+        return BlendMode::Normal;
     case CSSValueMultiply:
-        return BlendModeMultiply;
+        return BlendMode::Multiply;
     case CSSValueScreen:
-        return BlendModeScreen;
+        return BlendMode::Screen;
     case CSSValueOverlay:
-        return BlendModeOverlay;
+        return BlendMode::Overlay;
     case CSSValueDarken:
-        return BlendModeDarken;
+        return BlendMode::Darken;
     case CSSValueLighten:
-        return BlendModeLighten;
+        return BlendMode::Lighten;
     case CSSValueColorDodge:
-        return BlendModeColorDodge;
+        return BlendMode::ColorDodge;
     case CSSValueColorBurn:
-        return BlendModeColorBurn;
+        return BlendMode::ColorBurn;
     case CSSValueHardLight:
-        return BlendModeHardLight;
+        return BlendMode::HardLight;
     case CSSValueSoftLight:
-        return BlendModeSoftLight;
+        return BlendMode::SoftLight;
     case CSSValueDifference:
-        return BlendModeDifference;
+        return BlendMode::Difference;
     case CSSValueExclusion:
-        return BlendModeExclusion;
+        return BlendMode::Exclusion;
     case CSSValueHue:
-        return BlendModeHue;
+        return BlendMode::Hue;
     case CSSValueSaturation:
-        return BlendModeSaturation;
+        return BlendMode::Saturation;
     case CSSValueColor:
-        return BlendModeColor;
+        return BlendMode::Color;
     case CSSValueLuminosity:
-        return BlendModeLuminosity;
+        return BlendMode::Luminosity;
     case CSSValuePlusDarker:
-        return BlendModePlusDarker;
+        return BlendMode::PlusDarker;
     case CSSValuePlusLighter:
-        return BlendModePlusLighter;
+        return BlendMode::PlusLighter;
     default:
         break;
     }
 
     ASSERT_NOT_REACHED();
-    return BlendModeNormal;
+    return BlendMode::Normal;
 }
 
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Isolation isolation)
index 128f907..ed6cbd2 100644 (file)
@@ -221,7 +221,7 @@ void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr
             treeScope().addImageElementByUsemap(*m_parsedUsemap.impl(), *this);
     } else if (name == compositeAttr) {
         // FIXME: images don't support blend modes in their compositing attribute.
-        BlendMode blendOp = BlendModeNormal;
+        BlendMode blendOp = BlendMode::Normal;
         if (!parseCompositeAndBlendOperator(value, m_compositeOperator, blendOp))
             m_compositeOperator = CompositeSourceOver;
 #if ENABLE(SERVICE_CONTROLS)
index 6202ea5..6d71cbe 100644 (file)
@@ -199,7 +199,7 @@ CanvasRenderingContext2DBase::State::State()
     , shadowColor(Color::transparent)
     , globalAlpha(1)
     , globalComposite(CompositeSourceOver)
-    , globalBlend(BlendModeNormal)
+    , globalBlend(BlendMode::Normal)
     , hasInvertibleTransform(true)
     , lineDashOffset(0)
     , imageSmoothingEnabled(true)
@@ -774,7 +774,7 @@ String CanvasRenderingContext2DBase::globalCompositeOperation() const
 void CanvasRenderingContext2DBase::setGlobalCompositeOperation(const String& operation)
 {
     CompositeOperator op = CompositeSourceOver;
-    BlendMode blendMode = BlendModeNormal;
+    BlendMode blendMode = BlendMode::Normal;
     if (!parseCompositeAndBlendOperator(operation, op, blendMode))
         return;
     if ((state().globalComposite == op) && (state().globalBlend == blendMode))
@@ -1714,10 +1714,10 @@ ExceptionOr<void> CanvasRenderingContext2DBase::drawImage(ImageBitmap& imageBitm
 void CanvasRenderingContext2DBase::drawImageFromRect(HTMLImageElement& imageElement, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, const String& compositeOperation)
 {
     CompositeOperator op;
-    auto blendOp = BlendModeNormal;
-    if (!parseCompositeAndBlendOperator(compositeOperation, op, blendOp) || blendOp != BlendModeNormal)
+    auto blendOp = BlendMode::Normal;
+    if (!parseCompositeAndBlendOperator(compositeOperation, op, blendOp) || blendOp != BlendMode::Normal)
         op = CompositeSourceOver;
-    drawImage(imageElement, FloatRect { sx, sy, sw, sh }, FloatRect { dx, dy, dw, dh }, op, BlendModeNormal);
+    drawImage(imageElement, FloatRect { sx, sy, sw, sh }, FloatRect { dx, dy, dw, dh }, op, BlendMode::Normal);
 }
 
 void CanvasRenderingContext2DBase::clearCanvas()
index 5a6c3d9..729d57d 100644 (file)
@@ -162,7 +162,7 @@ protected:
     void destroyDecodedDataIfNecessary(bool destroyAll = true);
 
     ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientationDescription) override;
-    void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendModeNormal) override;
+    void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendMode::Normal) override;
 #if PLATFORM(WIN)
     void drawFrameMatchingSourceSize(GraphicsContext&, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator) override;
 #endif
index ccc2d03..57b3bf4 100644 (file)
@@ -184,7 +184,7 @@ struct GraphicsContextState {
 
     float alpha { 1 };
     CompositeOperator compositeOperator { CompositeSourceOver };
-    BlendMode blendMode { BlendModeNormal };
+    BlendMode blendMode { BlendMode::Normal };
     InterpolationQuality imageInterpolationQuality { InterpolationDefault };
 
     bool shouldAntialias : 1;
@@ -198,7 +198,7 @@ struct GraphicsContextState {
 };
 
 struct ImagePaintingOptions {
-    ImagePaintingOptions(CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal, DecodingMode decodingMode = DecodingMode::Synchronous, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), InterpolationQuality interpolationQuality = InterpolationDefault)
+    ImagePaintingOptions(CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendMode::Normal, DecodingMode decodingMode = DecodingMode::Synchronous, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), InterpolationQuality interpolationQuality = InterpolationDefault)
         : m_compositeOperator(compositeOperator)
         , m_blendMode(blendMode)
         , m_decodingMode(decodingMode)
@@ -207,7 +207,7 @@ struct ImagePaintingOptions {
     {
     }
 
-    ImagePaintingOptions(ImageOrientationDescription orientationDescription, InterpolationQuality interpolationQuality = InterpolationDefault, CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal, DecodingMode decodingMode = DecodingMode::Synchronous)
+    ImagePaintingOptions(ImageOrientationDescription orientationDescription, InterpolationQuality interpolationQuality = InterpolationDefault, CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendMode::Normal, DecodingMode decodingMode = DecodingMode::Synchronous)
         : m_compositeOperator(compositeOperator)
         , m_blendMode(blendMode)
         , m_decodingMode(decodingMode)
@@ -216,7 +216,7 @@ struct ImagePaintingOptions {
     {
     }
 
-    ImagePaintingOptions(InterpolationQuality interpolationQuality, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal, DecodingMode decodingMode = DecodingMode::Synchronous)
+    ImagePaintingOptions(InterpolationQuality interpolationQuality, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendMode::Normal, DecodingMode decodingMode = DecodingMode::Synchronous)
         : m_compositeOperator(compositeOperator)
         , m_blendMode(blendMode)
         , m_decodingMode(decodingMode)
@@ -326,7 +326,7 @@ public:
     const GraphicsContextState& state() const { return m_state; }
 
 #if USE(CG) || USE(DIRECT2D) || USE(CAIRO)
-    WEBCORE_EXPORT void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, ImageOrientation = ImageOrientation());
+    WEBCORE_EXPORT void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, BlendMode = BlendMode::Normal, ImageOrientation = ImageOrientation());
 #endif
 
 #if USE(CG) || USE(DIRECT2D)
@@ -364,8 +364,8 @@ public:
     WEBCORE_EXPORT void fillRect(const FloatRect&);
     WEBCORE_EXPORT void fillRect(const FloatRect&, const Color&);
     void fillRect(const FloatRect&, Gradient&);
-    void fillRect(const FloatRect&, const Color&, CompositeOperator, BlendMode = BlendModeNormal);
-    void fillRoundedRect(const FloatRoundedRect&, const Color&, BlendMode = BlendModeNormal);
+    void fillRect(const FloatRect&, const Color&, CompositeOperator, BlendMode = BlendMode::Normal);
+    void fillRoundedRect(const FloatRoundedRect&, const Color&, BlendMode = BlendMode::Normal);
     void fillRectWithRoundedHole(const FloatRect&, const FloatRoundedRect& roundedHoleRect, const Color&);
 
     WEBCORE_EXPORT void clearRect(const FloatRect&);
@@ -384,7 +384,7 @@ public:
     void drawImageBuffer(ImageBuffer&, const FloatRect& destination, const ImagePaintingOptions& = ImagePaintingOptions());
     void drawImageBuffer(ImageBuffer&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = ImagePaintingOptions());
 
-    void drawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendModeNormal);
+    void drawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendMode::Normal);
 
     WEBCORE_EXPORT void drawConsumingImageBuffer(std::unique_ptr<ImageBuffer>, const FloatPoint& destination, const ImagePaintingOptions& = ImagePaintingOptions());
     void drawConsumingImageBuffer(std::unique_ptr<ImageBuffer>, const FloatRect& destination, const ImagePaintingOptions& = ImagePaintingOptions());
@@ -456,7 +456,7 @@ public:
     void setAlpha(float);
     float alpha() const { return m_state.alpha; }
 
-    WEBCORE_EXPORT void setCompositeOperation(CompositeOperator, BlendMode = BlendModeNormal);
+    WEBCORE_EXPORT void setCompositeOperation(CompositeOperator, BlendMode = BlendMode::Normal);
     CompositeOperator compositeOperation() const { return m_state.compositeOperator; }
     BlendMode blendModeOperation() const { return m_state.blendMode; }
 
@@ -614,7 +614,7 @@ private:
     void clearPlatformShadow();
 
     void setPlatformAlpha(float);
-    void setPlatformCompositeOperation(CompositeOperator, BlendMode = BlendModeNormal);
+    void setPlatformCompositeOperation(CompositeOperator, BlendMode = BlendMode::Normal);
 
     void beginPlatformTransparencyLayer(float opacity);
     void endPlatformTransparencyLayer();
index 6bcf768..47fb4a4 100644 (file)
@@ -74,7 +74,7 @@ public:
 #if USE(CG) || USE(CAIRO)
     virtual void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator, BlendMode, ImageOrientation) = 0;
 #endif
-    virtual void drawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendModeNormal) = 0;
+    virtual void drawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendMode::Normal) = 0;
 
     virtual void drawRect(const FloatRect&, float borderThickness) = 0;
     virtual void drawLine(const FloatPoint&, const FloatPoint&) = 0;
index 20be98b..4ed3609 100644 (file)
@@ -761,7 +761,7 @@ void GraphicsLayer::dumpProperties(TextStream& ts, LayerTreeAsTextBehavior behav
         ts << indent << "(opacity " << m_opacity << ")\n";
 
 #if ENABLE(CSS_COMPOSITING)
-    if (m_blendMode != BlendModeNormal)
+    if (m_blendMode != BlendMode::Normal)
         ts << indent << "(blendMode " << compositeOperatorName(CompositeSourceOver, m_blendMode) << ")\n";
 #endif
 
index 4e9433f..202409b 100644 (file)
@@ -648,7 +648,7 @@ protected:
     FilterOperations m_backdropFilters;
 
 #if ENABLE(CSS_COMPOSITING)
-    BlendMode m_blendMode { BlendModeNormal };
+    BlendMode m_blendMode { BlendMode::Normal };
 #endif
 
     const Type m_type;
index 5ff1542..39978c4 100644 (file)
@@ -72,13 +72,13 @@ static const char* const blendOperatorNames[] = {
     "plus-lighter"
 };
 const int numCompositeOperatorNames = WTF_ARRAY_LENGTH(compositeOperatorNames);
-const int numBlendOperatorNames = WTF_ARRAY_LENGTH(blendOperatorNames);
+const unsigned numBlendOperatorNames = WTF_ARRAY_LENGTH(blendOperatorNames);
 
 bool parseBlendMode(const String& s, BlendMode& blendMode)
 {
-    for (int i = 0; i < numBlendOperatorNames; i++) {
+    for (unsigned i = 0; i < numBlendOperatorNames; i++) {
         if (s == blendOperatorNames[i]) {
-            blendMode = static_cast<BlendMode>(i + BlendModeNormal);
+            blendMode = static_cast<BlendMode>(i + static_cast<unsigned>(BlendMode::Normal));
             return true;
         }
     }
@@ -91,7 +91,7 @@ bool parseCompositeAndBlendOperator(const String& s, CompositeOperator& op, Blen
     for (int i = 0; i < numCompositeOperatorNames; i++) {
         if (s == compositeOperatorNames[i]) {
             op = static_cast<CompositeOperator>(i);
-            blendOp = BlendModeNormal;
+            blendOp = BlendMode::Normal;
             return true;
         }
     }
@@ -111,23 +111,23 @@ String compositeOperatorName(CompositeOperator op, BlendMode blendOp)
 {
     ASSERT(op >= 0);
     ASSERT(op < numCompositeOperatorNames);
-    ASSERT(blendOp >= BlendModeNormal);
-    ASSERT(blendOp <= numBlendOperatorNames);
-    if (blendOp > BlendModeNormal)
-        return blendOperatorNames[blendOp - BlendModeNormal];
+    ASSERT(blendOp >= BlendMode::Normal);
+    ASSERT(static_cast<unsigned>(blendOp) <= numBlendOperatorNames);
+    if (blendOp > BlendMode::Normal)
+        return blendOperatorNames[static_cast<unsigned>(blendOp) - static_cast<unsigned>(BlendMode::Normal)];
     return compositeOperatorNames[op];
 }
 
 String blendModeName(BlendMode blendOp)
 {
-    ASSERT(blendOp >= BlendModeNormal);
-    ASSERT(blendOp <= BlendModePlusLighter);
-    return blendOperatorNames[blendOp - BlendModeNormal];
+    ASSERT(blendOp >= BlendMode::Normal);
+    ASSERT(blendOp <= BlendMode::PlusLighter);
+    return blendOperatorNames[static_cast<unsigned>(blendOp) - static_cast<unsigned>(BlendMode::Normal)];
 }
 
 TextStream& operator<<(TextStream& ts, CompositeOperator op)
 {
-    return ts << compositeOperatorName(op, BlendModeNormal);
+    return ts << compositeOperatorName(op, BlendMode::Normal);
 }
 
 TextStream& operator<<(TextStream& ts, BlendMode blendMode)
index 9f76cd9..6e1afee 100644 (file)
@@ -51,25 +51,25 @@ enum CompositeOperator {
     CompositeDifference
 };
 
-enum BlendMode {
-    BlendModeNormal = 1, // Start with 1 to match SVG's blendmode enumeration.
-    BlendModeMultiply,
-    BlendModeScreen,
-    BlendModeDarken,
-    BlendModeLighten,
-    BlendModeOverlay,
-    BlendModeColorDodge,
-    BlendModeColorBurn,
-    BlendModeHardLight,
-    BlendModeSoftLight,
-    BlendModeDifference,
-    BlendModeExclusion,
-    BlendModeHue,
-    BlendModeSaturation,
-    BlendModeColor,
-    BlendModeLuminosity,
-    BlendModePlusDarker,
-    BlendModePlusLighter
+enum class BlendMode {
+    Normal = 1, // Start with 1 to match SVG's blendmode enumeration.
+    Multiply,
+    Screen,
+    Darken,
+    Lighten,
+    Overlay,
+    ColorDodge,
+    ColorBurn,
+    HardLight,
+    SoftLight,
+    Difference,
+    Exclusion,
+    Hue,
+    Saturation,
+    Color,
+    Luminosity,
+    PlusDarker,
+    PlusLighter
 };
 
 enum GradientSpreadMethod {
index 97ed869..d6b0c65 100644 (file)
@@ -196,7 +196,7 @@ ImageDrawResult Image::drawTiled(GraphicsContext& ctxt, const FloatRect& destRec
             visibleSrcRect.setY((destRect.y() - oneTileRect.y()) / scale.height());
             visibleSrcRect.setWidth(1);
             visibleSrcRect.setHeight(destRect.height() / scale.height());
-            return draw(ctxt, destRect, visibleSrcRect, op, BlendModeNormal, decodingMode, ImageOrientationDescription());
+            return draw(ctxt, destRect, visibleSrcRect, op, BlendMode::Normal, decodingMode, ImageOrientationDescription());
         }
         if (size().height() == 1 && intersection(oneTileRect, destRect).width() == destRect.width()) {
             FloatRect visibleSrcRect;
@@ -204,7 +204,7 @@ ImageDrawResult Image::drawTiled(GraphicsContext& ctxt, const FloatRect& destRec
             visibleSrcRect.setY(0);
             visibleSrcRect.setWidth(destRect.width() / scale.width());
             visibleSrcRect.setHeight(1);
-            return draw(ctxt, destRect, visibleSrcRect, op, BlendModeNormal, decodingMode, ImageOrientationDescription());
+            return draw(ctxt, destRect, visibleSrcRect, op, BlendMode::Normal, decodingMode, ImageOrientationDescription());
         }
     }
 #endif
@@ -236,7 +236,7 @@ ImageDrawResult Image::drawTiled(GraphicsContext& ctxt, const FloatRect& destRec
                 FloatRect fromRect(toFloatPoint(currentTileRect.location() - oneTileRect.location()), currentTileRect.size());
                 fromRect.scale(1 / scale.width(), 1 / scale.height());
 
-                result = draw(ctxt, toRect, fromRect, op, BlendModeNormal, decodingMode, ImageOrientationDescription());
+                result = draw(ctxt, toRect, fromRect, op, BlendMode::Normal, decodingMode, ImageOrientationDescription());
                 if (result == ImageDrawResult::DidRequestDecoding)
                     return result;
                 toX += currentTileRect.width();
index eaaac52..5f220be 100644 (file)
@@ -174,7 +174,7 @@ public:
 #endif
 
     virtual void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform,
-        const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendModeNormal);
+        const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendMode::Normal);
 
 #if !ASSERT_DISABLED
     virtual bool notSolidColor() { return true; }
index 987580e..6c66629 100644 (file)
@@ -144,10 +144,10 @@ private:
     void flushContext() const;
 #endif
     
-    void draw(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal);
-    void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendModeNormal);
+    void draw(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendMode::Normal);
+    void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendMode::Normal);
 
-    static void drawConsuming(std::unique_ptr<ImageBuffer>, GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal);
+    static void drawConsuming(std::unique_ptr<ImageBuffer>, GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendMode::Normal);
 
     inline void genericConvertToLuminanceMask();
 
index 890d65e..0b5f6fb 100644 (file)
@@ -556,52 +556,52 @@ void PlatformCAFilters::setBlendingFiltersOnLayer(PlatformLayer* layer, const Bl
     CAFilter* filter = nil;
 
     switch (blendMode) {
-    case BlendModeNormal:
+    case BlendMode::Normal:
         // No need to set an actual filter object in this case.
         break;
-    case BlendModeOverlay:
+    case BlendMode::Overlay:
         filter = [CAFilter filterWithType:kCAFilterOverlayBlendMode];
         break;
-    case BlendModeColorDodge:
+    case BlendMode::ColorDodge:
         filter = [CAFilter filterWithType:kCAFilterColorDodgeBlendMode];
         break;
-    case BlendModeColorBurn:
+    case BlendMode::ColorBurn:
         filter = [CAFilter filterWithType:kCAFilterColorBurnBlendMode];
         break;
-    case BlendModeDarken:
+    case BlendMode::Darken:
         filter = [CAFilter filterWithType:kCAFilterDarkenBlendMode];
         break;
-    case BlendModeDifference:
+    case BlendMode::Difference:
         filter = [CAFilter filterWithType:kCAFilterDifferenceBlendMode];
         break;
-    case BlendModeExclusion:
+    case BlendMode::Exclusion:
         filter = [CAFilter filterWithType:kCAFilterExclusionBlendMode];
         break;
-    case BlendModeHardLight:
+    case BlendMode::HardLight:
         filter = [CAFilter filterWithType:kCAFilterHardLightBlendMode];
         break;
-    case BlendModeMultiply:
+    case BlendMode::Multiply:
         filter = [CAFilter filterWithType:kCAFilterMultiplyBlendMode];
         break;
-    case BlendModeLighten:
+    case BlendMode::Lighten:
         filter = [CAFilter filterWithType:kCAFilterLightenBlendMode];
         break;
-    case BlendModeSoftLight:
+    case BlendMode::SoftLight:
         filter = [CAFilter filterWithType:kCAFilterSoftLightBlendMode];
         break;
-    case BlendModeScreen:
+    case BlendMode::Screen:
         filter = [CAFilter filterWithType:kCAFilterScreenBlendMode];
         break;
-    case BlendModePlusDarker:
+    case BlendMode::PlusDarker:
         filter = [CAFilter filterWithType:kCAFilterPlusD];
         break;
-    case BlendModePlusLighter:
+    case BlendMode::PlusLighter:
         filter = [CAFilter filterWithType:kCAFilterPlusL];
         break;
-    case BlendModeHue:
-    case BlendModeSaturation:
-    case BlendModeColor:
-    case BlendModeLuminosity:
+    case BlendMode::Hue:
+    case BlendMode::Saturation:
+    case BlendMode::Color:
+    case BlendMode::Luminosity:
         // FIXME: CA does't support non-separable blend modes on compositing filters.
         break;
     default:
index c4ecd91..7073a76 100644 (file)
@@ -178,8 +178,7 @@ static void drawShadowLayerBuffer(PlatformContextCairo& platformContext, ImageBu
         return;
 
     if (auto surface = image->nativeImageForCurrentFrame()) {
-        drawNativeImage(platformContext, surface.get(), FloatRect(roundedIntPoint(layerOrigin), layerSize), FloatRect(FloatPoint(), layerSize),
-            shadowState.globalCompositeOperator, BlendModeNormal, ImageOrientation(),
+        drawNativeImage(platformContext, surface.get(), FloatRect(roundedIntPoint(layerOrigin), layerSize), FloatRect(FloatPoint(), layerSize), shadowState.globalCompositeOperator, BlendMode::Normal, ImageOrientation(),
             InterpolationDefault, shadowState.globalAlpha, ShadowState());
     }
 }
@@ -837,8 +836,8 @@ void drawNativeImage(PlatformContextCairo& platformContext, cairo_surface_t* sur
     platformContext.save();
 
     // Set the compositing operation.
-    if (compositeOperator == CompositeSourceOver && blendMode == BlendModeNormal && !cairoSurfaceHasAlpha(surface))
-        Cairo::State::setCompositeOperation(platformContext, CompositeCopy, BlendModeNormal);
+    if (compositeOperator == CompositeSourceOver && blendMode == BlendMode::Normal && !cairoSurfaceHasAlpha(surface))
+        Cairo::State::setCompositeOperation(platformContext, CompositeCopy, BlendMode::Normal);
     else
         Cairo::State::setCompositeOperation(platformContext, compositeOperator, blendMode);
 
index 04d682f..3e7c5de 100644 (file)
@@ -164,37 +164,37 @@ static cairo_operator_t toCairoCompositeOperator(CompositeOperator op)
 cairo_operator_t toCairoOperator(CompositeOperator op, BlendMode blendOp)
 {
     switch (blendOp) {
-    case BlendModeNormal:
+    case BlendMode::Normal:
         return toCairoCompositeOperator(op);
-    case BlendModeMultiply:
+    case BlendMode::Multiply:
         return CAIRO_OPERATOR_MULTIPLY;
-    case BlendModeScreen:
+    case BlendMode::Screen:
         return CAIRO_OPERATOR_SCREEN;
-    case BlendModeOverlay:
+    case BlendMode::Overlay:
         return CAIRO_OPERATOR_OVERLAY;
-    case BlendModeDarken:
+    case BlendMode::Darken:
         return CAIRO_OPERATOR_DARKEN;
-    case BlendModeLighten:
+    case BlendMode::Lighten:
         return CAIRO_OPERATOR_LIGHTEN;
-    case BlendModeColorDodge:
+    case BlendMode::ColorDodge:
         return CAIRO_OPERATOR_COLOR_DODGE;
-    case BlendModeColorBurn:
+    case BlendMode::ColorBurn:
         return CAIRO_OPERATOR_COLOR_BURN;
-    case BlendModeHardLight:
+    case BlendMode::HardLight:
         return CAIRO_OPERATOR_HARD_LIGHT;
-    case BlendModeSoftLight:
+    case BlendMode::SoftLight:
         return CAIRO_OPERATOR_SOFT_LIGHT;
-    case BlendModeDifference:
+    case BlendMode::Difference:
         return CAIRO_OPERATOR_DIFFERENCE;
-    case BlendModeExclusion:
+    case BlendMode::Exclusion:
         return CAIRO_OPERATOR_EXCLUSION;
-    case BlendModeHue:
+    case BlendMode::Hue:
         return CAIRO_OPERATOR_HSL_HUE;
-    case BlendModeSaturation:
+    case BlendMode::Saturation:
         return CAIRO_OPERATOR_HSL_SATURATION;
-    case BlendModeColor:
+    case BlendMode::Color:
         return CAIRO_OPERATOR_HSL_COLOR;
-    case BlendModeLuminosity:
+    case BlendMode::Luminosity:
         return CAIRO_OPERATOR_HSL_LUMINOSITY;
     default:
         return CAIRO_OPERATOR_OVER;
index 381d3c8..1f13e5e 100644 (file)
@@ -80,7 +80,7 @@ void appendPathToCairoContext(cairo_t* to, cairo_t* from);
 void setPathOnCairoContext(cairo_t* to, cairo_t* from);
 void appendWebCorePathToCairoContext(cairo_t* context, const Path& path);
 void appendRegionToCairoContext(cairo_t*, const cairo_region_t*);
-cairo_operator_t toCairoOperator(CompositeOperator, BlendMode = BlendModeNormal);
+cairo_operator_t toCairoOperator(CompositeOperator, BlendMode = BlendMode::Normal);
 void drawPatternToCairoContext(cairo_t* cr, cairo_surface_t* image, const IntSize& imageSize, const FloatRect& tileRect,
                                const AffineTransform& patternTransform, const FloatPoint& phase, cairo_operator_t op, const FloatRect& destRect);
 RefPtr<cairo_surface_t> copyCairoImageSurface(cairo_surface_t*);
index e06e403..627fd57 100644 (file)
@@ -164,7 +164,7 @@ void GraphicsContextImplCairo::fillRect(const FloatRect& rect, const Color& colo
 
     Cairo::State::setCompositeOperation(m_platformContext, compositeOperator, blendMode);
     Cairo::fillRect(m_platformContext, rect, color, Cairo::ShadowState(state));
-    Cairo::State::setCompositeOperation(m_platformContext, previousOperator, BlendModeNormal);
+    Cairo::State::setCompositeOperation(m_platformContext, previousOperator, BlendMode::Normal);
 }
 
 void GraphicsContextImplCairo::fillRoundedRect(const FloatRoundedRect& rect, const Color& color, BlendMode blendMode)
@@ -180,7 +180,7 @@ void GraphicsContextImplCairo::fillRoundedRect(const FloatRoundedRect& rect, con
     else
         Cairo::fillRect(m_platformContext, rect.rect(), color, shadowState);
 
-    Cairo::State::setCompositeOperation(m_platformContext, previousOperator, BlendModeNormal);
+    Cairo::State::setCompositeOperation(m_platformContext, previousOperator, BlendMode::Normal);
 }
 
 void GraphicsContextImplCairo::fillRectWithRoundedHole(const FloatRect& rect, const FloatRoundedRect& roundedHoleRect, const Color&)
index 997cbdd..30d3ec6 100644 (file)
@@ -75,7 +75,7 @@ public:
     ImageDrawResult drawTiledImage(Image&, const FloatRect&, const FloatPoint&, const FloatSize&, const FloatSize&, const ImagePaintingOptions&) override;
     ImageDrawResult drawTiledImage(Image&, const FloatRect&, const FloatRect&, const FloatSize&, Image::TileRule, Image::TileRule, const ImagePaintingOptions&) override;
     void drawNativeImage(const NativeImagePtr&, const FloatSize&, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode, ImageOrientation) override;
-    void drawPattern(Image&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, const FloatSize&, CompositeOperator, BlendMode = BlendModeNormal) override;
+    void drawPattern(Image&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, const FloatSize&, CompositeOperator, BlendMode = BlendMode::Normal) override;
 
     void drawRect(const FloatRect&, float) override;
     void drawLine(const FloatPoint&, const FloatPoint&) override;
index d295071..bd2a73a 100644 (file)
@@ -158,7 +158,7 @@ static InterpolationQuality convertInterpolationQuality(CGInterpolationQuality q
 static CGBlendMode selectCGBlendMode(CompositeOperator compositeOperator, BlendMode blendMode)
 {
     switch (blendMode) {
-    case BlendModeNormal:
+    case BlendMode::Normal:
         switch (compositeOperator) {
         case CompositeClear:
             return kCGBlendModeClear;
@@ -190,39 +190,39 @@ static CGBlendMode selectCGBlendMode(CompositeOperator compositeOperator, BlendM
             return kCGBlendModeDifference;
         }
         break;
-    case BlendModeMultiply:
+    case BlendMode::Multiply:
         return kCGBlendModeMultiply;
-    case BlendModeScreen:
+    case BlendMode::Screen:
         return kCGBlendModeScreen;
-    case BlendModeOverlay:
+    case BlendMode::Overlay:
         return kCGBlendModeOverlay;
-    case BlendModeDarken:
+    case BlendMode::Darken:
         return kCGBlendModeDarken;
-    case BlendModeLighten:
+    case BlendMode::Lighten:
         return kCGBlendModeLighten;
-    case BlendModeColorDodge:
+    case BlendMode::ColorDodge:
         return kCGBlendModeColorDodge;
-    case BlendModeColorBurn:
+    case BlendMode::ColorBurn:
         return kCGBlendModeColorBurn;
-    case BlendModeHardLight:
+    case BlendMode::HardLight:
         return kCGBlendModeHardLight;
-    case BlendModeSoftLight:
+    case BlendMode::SoftLight:
         return kCGBlendModeSoftLight;
-    case BlendModeDifference:
+    case BlendMode::Difference:
         return kCGBlendModeDifference;
-    case BlendModeExclusion:
+    case BlendMode::Exclusion:
         return kCGBlendModeExclusion;
-    case BlendModeHue:
+    case BlendMode::Hue:
         return kCGBlendModeHue;
-    case BlendModeSaturation:
+    case BlendMode::Saturation:
         return kCGBlendModeSaturation;
-    case BlendModeColor:
+    case BlendMode::Color:
         return kCGBlendModeColor;
-    case BlendModeLuminosity:
+    case BlendMode::Luminosity:
         return kCGBlendModeLuminosity;
-    case BlendModePlusDarker:
+    case BlendMode::PlusDarker:
         return kCGBlendModePlusDarker;
-    case BlendModePlusLighter:
+    case BlendMode::PlusLighter:
         return kCGBlendModePlusLighter;
     }
 
index a561df6..fd8e5e8 100644 (file)
@@ -163,19 +163,19 @@ void FEBlend::platformApplyNEON(unsigned char* srcPixelArrayA, unsigned char* sr
 
         uint16x8_t result;
         switch (m_mode) {
-        case BlendModeNormal:
+        case BlendMode::Normal:
             result = FEBlendUtilitiesNEON::normal(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne);
             break;
-        case BlendModeMultiply:
+        case BlendMode::Multiply:
             result = FEBlendUtilitiesNEON::multiply(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne);
             break;
-        case BlendModeScreen:
+        case BlendMode::Screen:
             result = FEBlendUtilitiesNEON::screen(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne);
             break;
-        case BlendModeDarken:
+        case BlendMode::Darken:
             result = FEBlendUtilitiesNEON::darken(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne);
             break;
-        case BlendModeLighten:
+        case BlendMode::Lighten:
             result = FEBlendUtilitiesNEON::lighten(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne);
             break;
         default:
index f00ea7e..872e30d 100644 (file)
@@ -685,7 +685,7 @@ public:
     FloatSize spacing() const { return m_spacing; }
 
 private:
-    DrawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendModeNormal);
+    DrawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendMode::Normal);
 
     void apply(GraphicsContext&) const override;
 
index c5ac709..5c1c066 100644 (file)
@@ -93,7 +93,7 @@ private:
 #if USE(CG) || USE(CAIRO)
     void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator, BlendMode, ImageOrientation) override;
 #endif
-    void drawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendModeNormal) override;
+    void drawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendMode::Normal) override;
 
     void drawRect(const FloatRect&, float borderThickness) override;
     void drawLine(const FloatPoint&, const FloatPoint&) override;
index 535f00a..bef3ad9 100644 (file)
@@ -78,7 +78,7 @@ TextStream& FEBlend::externalRepresentation(TextStream& ts, RepresentationType r
 {
     ts << indent << "[feBlend";
     FilterEffect::externalRepresentation(ts, representation);
-    ts << " mode=\"" << (m_mode == BlendModeNormal ? "normal" : compositeOperatorName(CompositeSourceOver, m_mode)) << "\"]\n";
+    ts << " mode=\"" << (m_mode == BlendMode::Normal ? "normal" : compositeOperatorName(CompositeSourceOver, m_mode)) << "\"]\n";
 
     TextStream::IndentScope indentScope(ts);
     inputEffect(0)->externalRepresentation(ts, representation);
index 9a954e2..85d3ec3 100644 (file)
@@ -305,7 +305,7 @@ void CairoOperationRecorder::fillRect(const FloatRect& rect, const Color& color,
 
             Cairo::State::setCompositeOperation(platformContext, arg<2>(), arg<3>());
             Cairo::fillRect(platformContext, arg<0>(), arg<1>(), arg<4>());
-            Cairo::State::setCompositeOperation(platformContext, arg<5>(), BlendModeNormal);
+            Cairo::State::setCompositeOperation(platformContext, arg<5>(), BlendMode::Normal);
         }
 
         void dump(TextStream& ts) override
@@ -335,7 +335,7 @@ void CairoOperationRecorder::fillRoundedRect(const FloatRoundedRect& roundedRect
             else
                 Cairo::fillRect(platformContext, rect.rect(), arg<1>(), arg<4>());
 
-            Cairo::State::setCompositeOperation(platformContext, arg<2>(), BlendModeNormal);
+            Cairo::State::setCompositeOperation(platformContext, arg<2>(), BlendMode::Normal);
         }
 
         void dump(TextStream& ts) override
index dc4849e..009eb22 100644 (file)
@@ -68,7 +68,7 @@ private:
     WebCore::ImageDrawResult drawTiledImage(WebCore::Image&, const WebCore::FloatRect&, const WebCore::FloatPoint&, const WebCore::FloatSize&, const WebCore::FloatSize&, const WebCore::ImagePaintingOptions&) override;
     WebCore::ImageDrawResult drawTiledImage(WebCore::Image&, const WebCore::FloatRect&, const WebCore::FloatRect&, const WebCore::FloatSize&, WebCore::Image::TileRule, WebCore::Image::TileRule, const WebCore::ImagePaintingOptions&) override;
     void drawNativeImage(const WebCore::NativeImagePtr&, const WebCore::FloatSize&, const WebCore::FloatRect&, const WebCore::FloatRect&, WebCore::CompositeOperator, WebCore::BlendMode, WebCore::ImageOrientation) override;
-    void drawPattern(WebCore::Image&, const WebCore::FloatRect&, const WebCore::FloatRect&, const WebCore::AffineTransform&, const WebCore::FloatPoint&, const WebCore::FloatSize&, WebCore::CompositeOperator, WebCore::BlendMode = WebCore::BlendModeNormal) override;
+    void drawPattern(WebCore::Image&, const WebCore::FloatRect&, const WebCore::FloatRect&, const WebCore::AffineTransform&, const WebCore::FloatPoint&, const WebCore::FloatSize&, WebCore::CompositeOperator, WebCore::BlendMode = WebCore::BlendMode::Normal) override;
 
     void drawRect(const WebCore::FloatRect&, float) override;
     void drawLine(const WebCore::FloatPoint&, const WebCore::FloatPoint&) override;
index 029d079..2f82161 100644 (file)
@@ -1881,57 +1881,57 @@ void GraphicsContext::setPlatformCompositeOperation(CompositeOperator mode, Blen
     D2D1_BLEND_MODE targetBlendMode = D2D1_BLEND_MODE_SCREEN;
     D2D1_COMPOSITE_MODE targetCompositeMode = D2D1_COMPOSITE_MODE_SOURCE_ATOP; // ???
 
-    if (blendMode != BlendModeNormal) {
+    if (blendMode != BlendMode::Normal) {
         switch (blendMode) {
-        case BlendModeMultiply:
+        case BlendMode::Multiply:
             targetBlendMode = D2D1_BLEND_MODE_MULTIPLY;
             break;
-        case BlendModeScreen:
+        case BlendMode::Screen:
             targetBlendMode = D2D1_BLEND_MODE_SCREEN;
             break;
-        case BlendModeOverlay:
+        case BlendMode::Overlay:
             targetBlendMode = D2D1_BLEND_MODE_OVERLAY;
             break;
-        case BlendModeDarken:
+        case BlendMode::Darken:
             targetBlendMode = D2D1_BLEND_MODE_DARKEN;
             break;
-        case BlendModeLighten:
+        case BlendMode::Lighten:
             targetBlendMode = D2D1_BLEND_MODE_LIGHTEN;
             break;
-        case BlendModeColorDodge:
+        case BlendMode::ColorDodge:
             targetBlendMode = D2D1_BLEND_MODE_COLOR_DODGE;
             break;
-        case BlendModeColorBurn:
+        case BlendMode::ColorBurn:
             targetBlendMode = D2D1_BLEND_MODE_COLOR_BURN;
             break;
-        case BlendModeHardLight:
+        case BlendMode::HardLight:
             targetBlendMode = D2D1_BLEND_MODE_HARD_LIGHT;
             break;
-        case BlendModeSoftLight:
+        case BlendMode::SoftLight:
             targetBlendMode = D2D1_BLEND_MODE_SOFT_LIGHT;
             break;
-        case BlendModeDifference:
+        case BlendMode::Difference:
             targetBlendMode = D2D1_BLEND_MODE_DIFFERENCE;
             break;
-        case BlendModeExclusion:
+        case BlendMode::Exclusion:
             targetBlendMode = D2D1_BLEND_MODE_EXCLUSION;
             break;
-        case BlendModeHue:
+        case BlendMode::Hue:
             targetBlendMode = D2D1_BLEND_MODE_HUE;
             break;
-        case BlendModeSaturation:
+        case BlendMode::Saturation:
             targetBlendMode = D2D1_BLEND_MODE_SATURATION;
             break;
-        case BlendModeColor:
+        case BlendMode::Color:
             targetBlendMode = D2D1_BLEND_MODE_COLOR;
             break;
-        case BlendModeLuminosity:
+        case BlendMode::Luminosity:
             targetBlendMode = D2D1_BLEND_MODE_LUMINOSITY;
             break;
-        case BlendModePlusDarker:
+        case BlendMode::PlusDarker:
             targetBlendMode = D2D1_BLEND_MODE_DARKER_COLOR;
             break;
-        case BlendModePlusLighter:
+        case BlendMode::PlusLighter:
             targetBlendMode = D2D1_BLEND_MODE_LIGHTER_COLOR;
             break;
         default:
index 06dc83a..c6ff663 100644 (file)
@@ -79,7 +79,7 @@ bool BitmapImage::getHBITMAPOfSize(HBITMAP bmp, const IntSize* size)
     if (size)
         drawFrameMatchingSourceSize(gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), *size, CompositeCopy);
     else
-        draw(gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), CompositeCopy, BlendModeNormal, DecodingMode::Synchronous, ImageOrientationDescription());
+        draw(gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), CompositeCopy, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
 
     // Do cleanup
     CGContextRelease(cgContext);
@@ -95,7 +95,7 @@ void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext& ctxt, const Float
         if (image && CGImageGetHeight(image) == static_cast<size_t>(srcSize.height()) && CGImageGetWidth(image) == static_cast<size_t>(srcSize.width())) {
             size_t currentFrame = m_currentFrame;
             m_currentFrame = i;
-            draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), compositeOp, BlendModeNormal, DecodingMode::Synchronous, ImageOrientationDescription());
+            draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
             m_currentFrame = currentFrame;
             return;
         }
@@ -103,7 +103,7 @@ void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext& ctxt, const Float
 
     // No image of the correct size was found, fallback to drawing the current frame
     FloatSize imageSize = BitmapImage::size();
-    draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), compositeOp, BlendModeNormal, DecodingMode::Synchronous, ImageOrientationDescription());
+    draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
 }
 
 } // namespace WebCore
index e927e10..3029540 100644 (file)
@@ -81,7 +81,7 @@ bool BitmapImage::getHBITMAPOfSize(HBITMAP bmp, const IntSize* size)
     if (size)
         drawFrameMatchingSourceSize(gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), *size, CompositeCopy);
     else
-        draw(gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), CompositeCopy, BlendModeNormal, DecodingMode::Synchronous, ImageOrientationDescription());
+        draw(gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), CompositeCopy, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
 
     // Do cleanup
     cairo_destroy(targetRef);
@@ -100,7 +100,7 @@ void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext& ctxt, const Float
         if (cairo_image_surface_get_height(surface.get()) == static_cast<size_t>(srcSize.height()) && cairo_image_surface_get_width(surface.get()) == static_cast<size_t>(srcSize.width())) {
             size_t currentFrame = m_currentFrame;
             m_currentFrame = i;
-            draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), compositeOp, BlendModeNormal, DecodingMode::Synchronous, ImageOrientationDescription());
+            draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
             m_currentFrame = currentFrame;
             return;
         }
@@ -108,7 +108,7 @@ void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext& ctxt, const Float
 
     // No image of the correct size was found, fallback to drawing the current frame
     FloatSize imageSize = BitmapImage::size();
-    draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), compositeOp, BlendModeNormal, DecodingMode::Synchronous, ImageOrientationDescription());
+    draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
 }
 
 } // namespace WebCore
index a98fa73..6eb437d 100644 (file)
@@ -81,7 +81,7 @@ void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext& ctxt, const Float
         if (image && clampTo<size_t>(imageSize.height) == static_cast<size_t>(srcSize.height()) && clampTo<size_t>(imageSize.width) == static_cast<size_t>(srcSize.width())) {
             size_t currentFrame = m_currentFrame;
             m_currentFrame = i;
-            draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), compositeOp, BlendModeNormal, ImageOrientationDescription());
+            draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), compositeOp, BlendMode::Normal, ImageOrientationDescription());
             m_currentFrame = currentFrame;
             return;
         }
@@ -89,7 +89,7 @@ void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext& ctxt, const Float
 
     // No image of the correct size was found, fallback to drawing the current frame
     FloatSize imageSize = BitmapImage::size();
-    draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), compositeOp, BlendModeNormal, ImageOrientationDescription());
+    draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), compositeOp, BlendMode::Normal, ImageOrientationDescription());
 }
 
 } // namespace WebCore
index b661f38..a05e656 100644 (file)
@@ -1581,7 +1581,7 @@ void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& color,
     for (auto* layer = &fillLayer; layer; layer = layer->next()) {
         layers.append(layer);
 
-        if (layer->blendMode() != BlendModeNormal)
+        if (layer->blendMode() != BlendMode::Normal)
             shouldDrawBackgroundInSeparateBuffer = true;
 
         // Stop traversal when an opaque layer is encountered.
@@ -1593,7 +1593,7 @@ void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& color,
         // and pass it down.
 
         // The clipOccludesNextLayers condition must be evaluated first to avoid short-circuiting.
-        if (layer->clipOccludesNextLayers(layer == &fillLayer) && layer->hasOpaqueImage(*this) && layer->image()->canRender(this, style().effectiveZoom()) && layer->hasRepeatXY() && layer->blendMode() == BlendModeNormal)
+        if (layer->clipOccludesNextLayers(layer == &fillLayer) && layer->hasOpaqueImage(*this) && layer->image()->canRender(this, style().effectiveZoom()) && layer->hasRepeatXY() && layer->blendMode() == BlendMode::Normal)
             break;
     }
 
index 6c093a4..080de93 100644 (file)
@@ -617,7 +617,7 @@ ImageDrawResult RenderImage::paintIntoRect(PaintInfo& paintInfo, const FloatRect
 
     ImageOrientationDescription orientationDescription(shouldRespectImageOrientation(), style().imageOrientation());
     auto decodingMode = decodingModeForImageDraw(*image, paintInfo);
-    auto drawResult = paintInfo.context().drawImage(*img, rect, ImagePaintingOptions(compositeOperator, BlendModeNormal, decodingMode, orientationDescription, interpolation));
+    auto drawResult = paintInfo.context().drawImage(*img, rect, ImagePaintingOptions(compositeOperator, BlendMode::Normal, decodingMode, orientationDescription, interpolation));
     if (drawResult == ImageDrawResult::DidRequestDecoding)
         imageResource().cachedImage()->addClientWaitingForAsyncDecoding(*this);
 
index d6cfd6a..aed968c 100644 (file)
@@ -313,7 +313,7 @@ RenderLayer::RenderLayer(RenderLayerModelObject& rendererLayerModelObject)
 #endif
     , m_hasFilterInfo(false)
 #if ENABLE(CSS_COMPOSITING)
-    , m_blendMode(BlendModeNormal)
+    , m_blendMode(static_cast<unsigned>(BlendMode::Normal))
     , m_hasNotIsolatedCompositedBlendingDescendants(false)
     , m_hasNotIsolatedBlendingDescendants(false)
     , m_hasNotIsolatedBlendingDescendantsStatusDirty(false)
@@ -926,7 +926,7 @@ void RenderLayer::positionNewlyCreatedOverflowControls()
 
 void RenderLayer::updateBlendMode()
 {
-    bool hadBlendMode = m_blendMode != BlendModeNormal;
+    bool hadBlendMode = static_cast<BlendMode>(m_blendMode) != BlendMode::Normal;
     if (parent() && hadBlendMode != hasBlendMode()) {
         if (hasBlendMode())
             parent()->updateAncestorChainHasBlendingDescendants();
@@ -935,8 +935,8 @@ void RenderLayer::updateBlendMode()
     }
 
     BlendMode newBlendMode = renderer().style().blendMode();
-    if (newBlendMode != m_blendMode)
-        m_blendMode = newBlendMode;
+    if (newBlendMode != static_cast<BlendMode>(m_blendMode))
+        m_blendMode = static_cast<unsigned>(newBlendMode);
 }
 
 void RenderLayer::updateAncestorChainHasBlendingDescendants()
@@ -1827,7 +1827,7 @@ void RenderLayer::beginTransparencyLayers(GraphicsContext& context, const LayerP
 
 #if ENABLE(CSS_COMPOSITING)
         if (usesCompositeOperation)
-            context.setCompositeOperation(context.compositeOperation(), BlendModeNormal);
+            context.setCompositeOperation(context.compositeOperation(), BlendMode::Normal);
 #endif
 
 #ifdef REVEAL_TRANSPARENCY_LAYERS
index f92a20c..da536a9 100644 (file)
@@ -540,7 +540,7 @@ void RenderLayerBacking::updateBlendMode(const RenderStyle& style)
     // FIXME: where is the blend mode updated when m_ancestorClippingLayers come and go?
     if (m_ancestorClippingLayer) {
         m_ancestorClippingLayer->setBlendMode(style.blendMode());
-        m_graphicsLayer->setBlendMode(BlendModeNormal);
+        m_graphicsLayer->setBlendMode(BlendMode::Normal);
     } else
         m_graphicsLayer->setBlendMode(style.blendMode());
 }
index 63c058c..f3d91dc 100644 (file)
@@ -54,7 +54,7 @@ FillLayer::FillLayer(FillLayerType type)
     , m_repeatY(static_cast<unsigned>(FillLayer::initialFillRepeatY(type)))
     , m_composite(FillLayer::initialFillComposite(type))
     , m_sizeType(static_cast<unsigned>(FillSizeType::None))
-    , m_blendMode(FillLayer::initialFillBlendMode(type))
+    , m_blendMode(static_cast<unsigned>(FillLayer::initialFillBlendMode(type)))
     , m_maskSourceType(static_cast<unsigned>(FillLayer::initialFillMaskSourceType(type)))
     , m_imageSet(false)
     , m_attachmentSet(false)
@@ -357,7 +357,7 @@ bool FillLayer::hasOpaqueImage(const RenderElement& renderer) const
     if (m_composite == CompositeClear || m_composite == CompositeCopy)
         return true;
 
-    return m_blendMode == BlendModeNormal && m_composite == CompositeSourceOver && m_image->knownToBeOpaque(&renderer);
+    return static_cast<BlendMode>(m_blendMode) == BlendMode::Normal && m_composite == CompositeSourceOver && m_image->knownToBeOpaque(&renderer);
 }
 
 bool FillLayer::hasRepeatXY() const
index 3f56f7a..e2be958 100644 (file)
@@ -162,7 +162,7 @@ public:
     static FillRepeat initialFillRepeatX(FillLayerType) { return FillRepeat::Repeat; }
     static FillRepeat initialFillRepeatY(FillLayerType) { return FillRepeat::Repeat; }
     static CompositeOperator initialFillComposite(FillLayerType) { return CompositeSourceOver; }
-    static BlendMode initialFillBlendMode(FillLayerType) { return BlendModeNormal; }
+    static BlendMode initialFillBlendMode(FillLayerType) { return BlendMode::Normal; }
     static FillSize initialFillSize(FillLayerType) { return { }; }
     static Length initialFillXPosition(FillLayerType) { return Length(0.0f, Percent); }
     static Length initialFillYPosition(FillLayerType) { return Length(0.0f, Percent); }
index 327dd2b..996f20c 100644 (file)
@@ -766,14 +766,14 @@ public:
 
 #if ENABLE(CSS_COMPOSITING)
     BlendMode blendMode() const { return static_cast<BlendMode>(m_rareNonInheritedData->effectiveBlendMode); }
-    void setBlendMode(BlendMode mode) { SET_VAR(m_rareNonInheritedData, effectiveBlendMode, mode); }
-    bool hasBlendMode() const { return static_cast<BlendMode>(m_rareNonInheritedData->effectiveBlendMode) != BlendModeNormal; }
+    void setBlendMode(BlendMode mode) { SET_VAR(m_rareNonInheritedData, effectiveBlendMode, static_cast<unsigned>(mode)); }
+    bool hasBlendMode() const { return static_cast<BlendMode>(m_rareNonInheritedData->effectiveBlendMode) != BlendMode::Normal; }
 
     Isolation isolation() const { return static_cast<Isolation>(m_rareNonInheritedData->isolation); }
     void setIsolation(Isolation isolation) { SET_VAR(m_rareNonInheritedData, isolation, static_cast<unsigned>(isolation)); }
     bool hasIsolation() const { return isolation() != Isolation::Auto; }
 #else
-    BlendMode blendMode() const { return BlendModeNormal; }
+    BlendMode blendMode() const { return BlendMode::Normal; }
     bool hasBlendMode() const { return false; }
 
     Isolation isolation() const { return Isolation::Auto; }
@@ -1671,7 +1671,7 @@ public:
 #endif
 
 #if ENABLE(CSS_COMPOSITING)
-    static BlendMode initialBlendMode() { return BlendModeNormal; }
+    static BlendMode initialBlendMode() { return BlendMode::Normal; }
     static Isolation initialIsolation() { return Isolation::Auto; }
 #endif
 
index d925fc6..0aeac97 100644 (file)
@@ -91,7 +91,7 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
     , textDecorationStyle(static_cast<unsigned>(RenderStyle::initialTextDecorationStyle()))
     , aspectRatioType(static_cast<unsigned>(RenderStyle::initialAspectRatioType()))
 #if ENABLE(CSS_COMPOSITING)
-    , effectiveBlendMode(RenderStyle::initialBlendMode())
+    , effectiveBlendMode(static_cast<unsigned>(RenderStyle::initialBlendMode()))
     , isolation(static_cast<unsigned>(RenderStyle::initialIsolation()))
 #endif
 #if ENABLE(APPLE_PAY)
index 2baa2f1..a0f21c2 100644 (file)
@@ -122,7 +122,7 @@ void SVGRenderingContext::prepareToRenderSVGContent(RenderElement& renderer, Pai
             m_paintInfo->context().beginTransparencyLayer(opacity);
 
             if (hasBlendMode)
-                m_paintInfo->context().setCompositeOperation(m_paintInfo->context().compositeOperation(), BlendModeNormal);
+                m_paintInfo->context().setCompositeOperation(m_paintInfo->context().compositeOperation(), BlendMode::Normal);
 
             m_renderingFlags |= EndOpacityLayer;
         }
index 1b61594..34b4ca2 100644 (file)
@@ -87,9 +87,9 @@ static inline unsigned enumerationValueForTargetAttribute(SVGElement* targetElem
     }
 
     if (attrName == SVGNames::modeAttr) {
-        BlendMode mode = BlendModeNormal;
+        BlendMode mode = BlendMode::Normal;
         parseBlendMode(value, mode);
-        return mode;
+        return static_cast<unsigned>(mode);
     }
     if (attrName == SVGNames::stitchTilesAttr)
         return SVGPropertyTraits<SVGStitchOptions>::fromString(value);
index 3b4a110..a7eba08 100644 (file)
@@ -46,7 +46,7 @@ END_REGISTER_ANIMATED_PROPERTIES
 
 inline SVGFEBlendElement::SVGFEBlendElement(const QualifiedName& tagName, Document& document)
     : SVGFilterPrimitiveStandardAttributes(tagName, document)
-    , m_mode(BlendModeNormal)
+    , m_mode(BlendMode::Normal)
 {
     ASSERT(hasTagName(SVGNames::feBlendTag));
     registerAnimatedPropertiesForSVGFEBlendElement();
@@ -60,7 +60,7 @@ Ref<SVGFEBlendElement> SVGFEBlendElement::create(const QualifiedName& tagName, D
 void SVGFEBlendElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
     if (name == SVGNames::modeAttr) {
-        BlendMode mode = BlendModeNormal;
+        BlendMode mode = BlendMode::Normal;
         if (parseBlendMode(value, mode))
             setModeBaseValue(mode);
         return;
index 8f86f1e..339ca65 100644 (file)
@@ -29,11 +29,11 @@ namespace WebCore {
 
 template<>
 struct SVGPropertyTraits<BlendMode> {
-    static unsigned highestEnumValue() { return BlendModeLuminosity; }
+    static unsigned highestEnumValue() { return static_cast<unsigned>(BlendMode::Luminosity); }
 
     static String toString(BlendMode type)
     {
-        if (type < BlendModePlusDarker)
+        if (type < BlendMode::PlusDarker)
             return blendModeName(type);
 
         return emptyString();
index bd1f632..e70ea8c 100644 (file)
@@ -216,7 +216,7 @@ NativeImagePtr SVGImage::nativeImageForCurrentFrame(const GraphicsContext*)
     if (!buffer) // failed to allocate image
         return nullptr;
 
-    draw(buffer->context(), rect(), rect(), CompositeSourceOver, BlendModeNormal, DecodingMode::Synchronous, ImageOrientationDescription());
+    draw(buffer->context(), rect(), rect(), CompositeSourceOver, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
 
     // FIXME: WK(Bug 113657): We should use DontCopyBackingStore here.
     return buffer->copyImage(CopyBackingStore)->nativeImageForCurrentFrame();
@@ -240,7 +240,7 @@ NativeImagePtr SVGImage::nativeImage(const GraphicsContext* targetContext)
 
     GraphicsContext localContext(nativeImageTarget.get());
 
-    draw(localContext, rect(), rect(), CompositeSourceOver, BlendModeNormal, DecodingMode::Synchronous, ImageOrientationDescription());
+    draw(localContext, rect(), rect(), CompositeSourceOver, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
 
     COMPtr<ID2D1Bitmap> nativeImage;
     hr = nativeImageTarget->GetBitmap(&nativeImage);
@@ -268,7 +268,7 @@ void SVGImage::drawPatternForContainer(GraphicsContext& context, const FloatSize
     std::unique_ptr<ImageBuffer> buffer = ImageBuffer::createCompatibleBuffer(expandedIntSize(imageBufferSize.size()), 1, ColorSpaceSRGB, context);
     if (!buffer) // Failed to allocate buffer.
         return;
-    drawForContainer(buffer->context(), containerSize, containerZoom, initialFragmentURL, imageBufferSize, zoomedContainerRect, CompositeSourceOver, BlendModeNormal);
+    drawForContainer(buffer->context(), containerSize, containerZoom, initialFragmentURL, imageBufferSize, zoomedContainerRect, CompositeSourceOver, BlendMode::Normal);
     if (context.drawLuminanceMask())
         buffer->convertToLuminanceMask();
 
@@ -299,10 +299,10 @@ ImageDrawResult SVGImage::draw(GraphicsContext& context, const FloatRect& dstRec
     context.clip(enclosingIntRect(dstRect));
 
     float alpha = context.alpha();
-    bool compositingRequiresTransparencyLayer = compositeOp != CompositeSourceOver || blendMode != BlendModeNormal || alpha < 1;
+    bool compositingRequiresTransparencyLayer = compositeOp != CompositeSourceOver || blendMode != BlendMode::Normal || alpha < 1;
     if (compositingRequiresTransparencyLayer) {
         context.beginTransparencyLayer(alpha);
-        context.setCompositeOperation(CompositeSourceOver, BlendModeNormal);
+        context.setCompositeOperation(CompositeSourceOver, BlendMode::Normal);
     }
 
     FloatSize scale(dstRect.size() / srcRect.size());
index 4df3209..81b457a 100644 (file)
@@ -1,3 +1,13 @@
+2018-08-06  Alex Christensen  <achristensen@webkit.org>
+
+        Make BlendMode an enum class
+        https://bugs.webkit.org/show_bug.cgi?id=188325
+
+        Reviewed by Darin Adler.
+
+        * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
+
 2018-08-06  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iOS] Caret disappears after resigning and becoming first responder if active focus state is retained
index c97d5e7..4b8d59d 100644 (file)
@@ -93,7 +93,7 @@ RemoteLayerTreeTransaction::LayerProperties::LayerProperties()
     , customAppearance(GraphicsLayer::CustomAppearance::None)
     , minificationFilter(PlatformCALayer::FilterType::Linear)
     , magnificationFilter(PlatformCALayer::FilterType::Linear)
-    , blendMode(BlendModeNormal)
+    , blendMode(BlendMode::Normal)
     , windRule(WindRule::NonZero)
     , hidden(false)
     , backingStoreAttached(true)