Title: [282920] trunk/Source/WebCore
Revision
282920
Author
wenson_hs...@apple.com
Date
2021-09-22 21:30:49 -0700 (Wed, 22 Sep 2021)

Log Message

Turn WebCore::LineCap and WebCore::LineJoin into 8-bit enum classes
https://bugs.webkit.org/show_bug.cgi?id=230642

Reviewed by Simon Fraser.

Make LineJoin and LineCap enum classes, backed by uint8_t. This makes it easier to send these enum types as IPC
arguments to the GPU process. Using strongly typed identifiers is also better for type safety.

No change in behavior.

* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator LineCap const):
(WebCore::CSSPrimitiveValue::operator LineJoin const):

Prefix individual enum values with `LineCap::` and `LineJoin::`, as needed.

* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::toCanvasLineCap):
(WebCore::fromCanvasLineCap):
(WebCore::toCanvasLineJoin):
(WebCore::fromCanvasLineJoin):
(WebCore::CanvasRenderingContext2DBase::State::State):
(WebCore::CanvasRenderingContext2DBase::inflateStrokeRect const):
* platform/adwaita/ThemeAdwaita.cpp:
(WebCore::ThemeAdwaita::paintFocus):
* platform/graphics/GraphicsTypes.cpp:
(WebCore::operator<<):
* platform/graphics/GraphicsTypes.h:

Additionally rename these enum values to just (Butt, Round, Square) and (Miter, Round, Bevel) for LineCap and
LineJoin, respectively.

* platform/graphics/cairo/CairoOperations.cpp:
(WebCore::Cairo::setLineCap):
(WebCore::Cairo::setLineJoin):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContextCG::setLineCap):
(WebCore::GraphicsContextCG::setLineJoin):
* platform/graphics/win/Direct2DOperations.cpp:
(WebCore::Direct2D::setLineCap):
(WebCore::Direct2D::setLineJoin):
* rendering/RenderEmbeddedObject.cpp:
(WebCore::drawReplacementArrow):
* rendering/TextPaintStyle.cpp:
(WebCore::updateGraphicsContext):
* rendering/TextPaintStyle.h:
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setCapStyle):
(WebCore::RenderStyle::initialCapStyle):
(WebCore::RenderStyle::setJoinStyle):
(WebCore::RenderStyle::initialJoinStyle):
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
* rendering/svg/RenderSVGPath.cpp:
(WebCore::RenderSVGPath::shapeDependentStrokeContains):
(WebCore::RenderSVGPath::shouldStrokeZeroLengthSubpath const):
(WebCore::RenderSVGPath::zeroLengthLinecapPath const):
* rendering/svg/SVGRenderSupport.cpp:
(WebCore::SVGRenderSupport::applyStrokeStyleToContext):
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeStyle):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (282919 => 282920)


--- trunk/Source/WebCore/ChangeLog	2021-09-23 04:30:24 UTC (rev 282919)
+++ trunk/Source/WebCore/ChangeLog	2021-09-23 04:30:49 UTC (rev 282920)
@@ -1,3 +1,68 @@
+2021-09-22  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Turn WebCore::LineCap and WebCore::LineJoin into 8-bit enum classes
+        https://bugs.webkit.org/show_bug.cgi?id=230642
+
+        Reviewed by Simon Fraser.
+
+        Make LineJoin and LineCap enum classes, backed by uint8_t. This makes it easier to send these enum types as IPC
+        arguments to the GPU process. Using strongly typed identifiers is also better for type safety.
+
+        No change in behavior.
+
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator LineCap const):
+        (WebCore::CSSPrimitiveValue::operator LineJoin const):
+
+        Prefix individual enum values with `LineCap::` and `LineJoin::`, as needed.
+
+        * html/canvas/CanvasRenderingContext2DBase.cpp:
+        (WebCore::toCanvasLineCap):
+        (WebCore::fromCanvasLineCap):
+        (WebCore::toCanvasLineJoin):
+        (WebCore::fromCanvasLineJoin):
+        (WebCore::CanvasRenderingContext2DBase::State::State):
+        (WebCore::CanvasRenderingContext2DBase::inflateStrokeRect const):
+        * platform/adwaita/ThemeAdwaita.cpp:
+        (WebCore::ThemeAdwaita::paintFocus):
+        * platform/graphics/GraphicsTypes.cpp:
+        (WebCore::operator<<):
+        * platform/graphics/GraphicsTypes.h:
+
+        Additionally rename these enum values to just (Butt, Round, Square) and (Miter, Round, Bevel) for LineCap and
+        LineJoin, respectively.
+
+        * platform/graphics/cairo/CairoOperations.cpp:
+        (WebCore::Cairo::setLineCap):
+        (WebCore::Cairo::setLineJoin):
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContextCG::setLineCap):
+        (WebCore::GraphicsContextCG::setLineJoin):
+        * platform/graphics/win/Direct2DOperations.cpp:
+        (WebCore::Direct2D::setLineCap):
+        (WebCore::Direct2D::setLineJoin):
+        * rendering/RenderEmbeddedObject.cpp:
+        (WebCore::drawReplacementArrow):
+        * rendering/TextPaintStyle.cpp:
+        (WebCore::updateGraphicsContext):
+        * rendering/TextPaintStyle.h:
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::setCapStyle):
+        (WebCore::RenderStyle::initialCapStyle):
+        (WebCore::RenderStyle::setJoinStyle):
+        (WebCore::RenderStyle::initialJoinStyle):
+        * rendering/style/StyleRareInheritedData.cpp:
+        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+        * rendering/svg/RenderSVGPath.cpp:
+        (WebCore::RenderSVGPath::shapeDependentStrokeContains):
+        (WebCore::RenderSVGPath::shouldStrokeZeroLengthSubpath const):
+        (WebCore::RenderSVGPath::zeroLengthLinecapPath const):
+        * rendering/svg/SVGRenderSupport.cpp:
+        (WebCore::SVGRenderSupport::applyStrokeStyleToContext):
+        * rendering/svg/SVGRenderTreeAsText.cpp:
+        (WebCore::writeStyle):
+
 2021-09-22  Takashi Komori  <takashi.kom...@sony.com>
 
         [Curl] Show TLS connection information in the inspector

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (282919 => 282920)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2021-09-23 04:30:24 UTC (rev 282919)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2021-09-23 04:30:49 UTC (rev 282920)
@@ -3917,13 +3917,13 @@
 {
     setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
-    case ButtCap:
+    case LineCap::Butt:
         m_value.valueID = CSSValueButt;
         break;
-    case RoundCap:
+    case LineCap::Round:
         m_value.valueID = CSSValueRound;
         break;
-    case SquareCap:
+    case LineCap::Square:
         m_value.valueID = CSSValueSquare;
         break;
     }
@@ -3935,17 +3935,17 @@
 
     switch (m_value.valueID) {
     case CSSValueButt:
-        return ButtCap;
+        return LineCap::Butt;
     case CSSValueRound:
-        return RoundCap;
+        return LineCap::Round;
     case CSSValueSquare:
-        return SquareCap;
+        return LineCap::Square;
     default:
         break;
     }
 
     ASSERT_NOT_REACHED();
-    return ButtCap;
+    return LineCap::Butt;
 }
 
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineJoin e)
@@ -3953,13 +3953,13 @@
 {
     setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
     switch (e) {
-    case MiterJoin:
+    case LineJoin::Miter:
         m_value.valueID = CSSValueMiter;
         break;
-    case RoundJoin:
+    case LineJoin::Round:
         m_value.valueID = CSSValueRound;
         break;
-    case BevelJoin:
+    case LineJoin::Bevel:
         m_value.valueID = CSSValueBevel;
         break;
     }
@@ -3971,17 +3971,17 @@
 
     switch (m_value.valueID) {
     case CSSValueMiter:
-        return MiterJoin;
+        return LineJoin::Miter;
     case CSSValueRound:
-        return RoundJoin;
+        return LineJoin::Round;
     case CSSValueBevel:
-        return BevelJoin;
+        return LineJoin::Bevel;
     default:
         break;
     }
 
     ASSERT_NOT_REACHED();
-    return MiterJoin;
+    return LineJoin::Miter;
 }
 
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WindRule e)

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp (282919 => 282920)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp	2021-09-23 04:30:24 UTC (rev 282919)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp	2021-09-23 04:30:49 UTC (rev 282920)
@@ -91,11 +91,11 @@
 static CanvasLineCap toCanvasLineCap(LineCap lineCap)
 {
     switch (lineCap) {
-    case ButtCap:
+    case LineCap::Butt:
         return CanvasLineCap::Butt;
-    case RoundCap:
+    case LineCap::Round:
         return CanvasLineCap::Round;
-    case SquareCap:
+    case LineCap::Square:
         return CanvasLineCap::Square;
     }
     ASSERT_NOT_REACHED();
@@ -106,24 +106,24 @@
 {
     switch (canvasLineCap) {
     case CanvasLineCap::Butt:
-        return ButtCap;
+        return LineCap::Butt;
     case CanvasLineCap::Round:
-        return RoundCap;
+        return LineCap::Round;
     case CanvasLineCap::Square:
-        return SquareCap;
+        return LineCap::Square;
     }
     ASSERT_NOT_REACHED();
-    return ButtCap;
+    return LineCap::Butt;
 }
 
 static CanvasLineJoin toCanvasLineJoin(LineJoin lineJoin)
 {
     switch (lineJoin) {
-    case RoundJoin:
+    case LineJoin::Round:
         return CanvasLineJoin::Round;
-    case BevelJoin:
+    case LineJoin::Bevel:
         return CanvasLineJoin::Bevel;
-    case MiterJoin:
+    case LineJoin::Miter:
         return CanvasLineJoin::Miter;
     }
     ASSERT_NOT_REACHED();
@@ -134,14 +134,14 @@
 {
     switch (canvasLineJoin) {
     case CanvasLineJoin::Round:
-        return RoundJoin;
+        return LineJoin::Round;
     case CanvasLineJoin::Bevel:
-        return BevelJoin;
+        return LineJoin::Bevel;
     case CanvasLineJoin::Miter:
-        return MiterJoin;
+        return LineJoin::Miter;
     }
     ASSERT_NOT_REACHED();
-    return RoundJoin;
+    return LineJoin::Round;
 }
 
 static CanvasTextAlign toCanvasTextAlign(TextAlign textAlign)
@@ -273,8 +273,8 @@
     : strokeStyle(Color::black)
     , fillStyle(Color::black)
     , lineWidth(1)
-    , lineCap(ButtCap)
-    , lineJoin(MiterJoin)
+    , lineCap(LineCap::Butt)
+    , lineJoin(LineJoin::Miter)
     , miterLimit(10)
     , shadowBlur(0)
     , shadowColor(Color::transparentBlack)
@@ -2266,9 +2266,9 @@
     // compared to Path::strokeBoundingRect().
     static const float root2 = sqrtf(2);
     float delta = state().lineWidth / 2;
-    if (state().lineJoin == MiterJoin)
+    if (state().lineJoin == LineJoin::Miter)
         delta *= state().miterLimit;
-    else if (state().lineCap == SquareCap)
+    else if (state().lineCap == LineCap::Square)
         delta *= root2;
     rect.inflate(delta);
 }

Modified: trunk/Source/WebCore/platform/adwaita/ThemeAdwaita.cpp (282919 => 282920)


--- trunk/Source/WebCore/platform/adwaita/ThemeAdwaita.cpp	2021-09-23 04:30:24 UTC (rev 282919)
+++ trunk/Source/WebCore/platform/adwaita/ThemeAdwaita.cpp	2021-09-23 04:30:49 UTC (rev 282920)
@@ -129,8 +129,8 @@
     graphicsContext.beginTransparencyLayer(color.alphaAsFloat());
     graphicsContext.setStrokeThickness(focusLineWidth);
     graphicsContext.setLineDash({ focusLineWidth, 2 * focusLineWidth }, 0);
-    graphicsContext.setLineCap(SquareCap);
-    graphicsContext.setLineJoin(MiterJoin);
+    graphicsContext.setLineCap(LineCap::Square);
+    graphicsContext.setLineJoin(LineJoin::Miter);
     graphicsContext.setStrokeColor(color.opaqueColor());
     graphicsContext.strokePath(path);
     graphicsContext.setFillRule(WindRule::NonZero);

Modified: trunk/Source/WebCore/platform/graphics/GraphicsTypes.cpp (282919 => 282920)


--- trunk/Source/WebCore/platform/graphics/GraphicsTypes.cpp	2021-09-23 04:30:24 UTC (rev 282919)
+++ trunk/Source/WebCore/platform/graphics/GraphicsTypes.cpp	2021-09-23 04:30:49 UTC (rev 282920)
@@ -153,13 +153,13 @@
 TextStream& operator<<(TextStream& ts, LineCap capStyle)
 {
     switch (capStyle) {
-    case ButtCap:
+    case LineCap::Butt:
         ts << "BUTT";
         break;
-    case RoundCap:
+    case LineCap::Round:
         ts << "ROUND";
         break;
-    case SquareCap:
+    case LineCap::Square:
         ts << "SQUARE";
         break;
     }
@@ -169,13 +169,13 @@
 TextStream& operator<<(TextStream& ts, LineJoin joinStyle)
 {
     switch (joinStyle) {
-    case MiterJoin:
+    case LineJoin::Miter:
         ts << "MITER";
         break;
-    case RoundJoin:
+    case LineJoin::Round:
         ts << "ROUND";
         break;
-    case BevelJoin:
+    case LineJoin::Bevel:
         ts << "BEVEL";
         break;
     }

Modified: trunk/Source/WebCore/platform/graphics/GraphicsTypes.h (282919 => 282920)


--- trunk/Source/WebCore/platform/graphics/GraphicsTypes.h	2021-09-23 04:30:24 UTC (rev 282919)
+++ trunk/Source/WebCore/platform/graphics/GraphicsTypes.h	2021-09-23 04:30:49 UTC (rev 282920)
@@ -87,16 +87,16 @@
     High
 };
 
-enum LineCap {
-    ButtCap,
-    RoundCap,
-    SquareCap
+enum class LineCap : uint8_t {
+    Butt,
+    Round,
+    Square
 };
 
-enum LineJoin {
-    MiterJoin,
-    RoundJoin,
-    BevelJoin
+enum class LineJoin : uint8_t {
+    Miter,
+    Round,
+    Bevel
 };
 
 enum HorizontalAlignment {
@@ -204,9 +204,9 @@
 template<> struct EnumTraits<WebCore::LineCap> {
     using values = EnumValues<
     WebCore::LineCap,
-    WebCore::LineCap::ButtCap,
-    WebCore::LineCap::RoundCap,
-    WebCore::LineCap::SquareCap
+    WebCore::LineCap::Butt,
+    WebCore::LineCap::Round,
+    WebCore::LineCap::Square
     >;
 };
 
@@ -213,9 +213,9 @@
 template<> struct EnumTraits<WebCore::LineJoin> {
     using values = EnumValues<
     WebCore::LineJoin,
-    WebCore::LineJoin::MiterJoin,
-    WebCore::LineJoin::RoundJoin,
-    WebCore::LineJoin::BevelJoin
+    WebCore::LineJoin::Miter,
+    WebCore::LineJoin::Round,
+    WebCore::LineJoin::Bevel
     >;
 };
 

Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp (282919 => 282920)


--- trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp	2021-09-23 04:30:24 UTC (rev 282919)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp	2021-09-23 04:30:49 UTC (rev 282920)
@@ -626,13 +626,13 @@
 {
     cairo_line_cap_t cairoCap { };
     switch (lineCap) {
-    case ButtCap:
+    case LineCap::Butt:
         cairoCap = CAIRO_LINE_CAP_BUTT;
         break;
-    case RoundCap:
+    case LineCap::Round:
         cairoCap = CAIRO_LINE_CAP_ROUND;
         break;
-    case SquareCap:
+    case LineCap::Square:
         cairoCap = CAIRO_LINE_CAP_SQUARE;
         break;
     }
@@ -651,13 +651,13 @@
 {
     cairo_line_join_t cairoJoin { };
     switch (lineJoin) {
-    case MiterJoin:
+    case LineJoin::Miter:
         cairoJoin = CAIRO_LINE_JOIN_MITER;
         break;
-    case RoundJoin:
+    case LineJoin::Round:
         cairoJoin = CAIRO_LINE_JOIN_ROUND;
         break;
-    case BevelJoin:
+    case LineJoin::Bevel:
         cairoJoin = CAIRO_LINE_JOIN_BEVEL;
         break;
     }

Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (282919 => 282920)


--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2021-09-23 04:30:24 UTC (rev 282919)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2021-09-23 04:30:49 UTC (rev 282920)
@@ -1184,13 +1184,13 @@
 void GraphicsContextCG::setLineCap(LineCap cap)
 {
     switch (cap) {
-    case ButtCap:
+    case LineCap::Butt:
         CGContextSetLineCap(platformContext(), kCGLineCapButt);
         break;
-    case RoundCap:
+    case LineCap::Round:
         CGContextSetLineCap(platformContext(), kCGLineCapRound);
         break;
-    case SquareCap:
+    case LineCap::Square:
         CGContextSetLineCap(platformContext(), kCGLineCapSquare);
         break;
     }
@@ -1211,13 +1211,13 @@
 void GraphicsContextCG::setLineJoin(LineJoin join)
 {
     switch (join) {
-    case MiterJoin:
+    case LineJoin::Miter:
         CGContextSetLineJoin(platformContext(), kCGLineJoinMiter);
         break;
-    case RoundJoin:
+    case LineJoin::Round:
         CGContextSetLineJoin(platformContext(), kCGLineJoinRound);
         break;
-    case BevelJoin:
+    case LineJoin::Bevel:
         CGContextSetLineJoin(platformContext(), kCGLineJoinBevel);
         break;
     }

Modified: trunk/Source/WebCore/platform/graphics/win/Direct2DOperations.cpp (282919 => 282920)


--- trunk/Source/WebCore/platform/graphics/win/Direct2DOperations.cpp	2021-09-23 04:30:24 UTC (rev 282919)
+++ trunk/Source/WebCore/platform/graphics/win/Direct2DOperations.cpp	2021-09-23 04:30:49 UTC (rev 282920)
@@ -361,13 +361,13 @@
 {
     D2D1_CAP_STYLE capStyle = D2D1_CAP_STYLE_FLAT;
     switch (lineCap) {
-    case RoundCap:
+    case LineCap::Round:
         capStyle = D2D1_CAP_STYLE_ROUND;
         break;
-    case SquareCap:
+    case LineCap::Square:
         capStyle = D2D1_CAP_STYLE_SQUARE;
         break;
-    case ButtCap:
+    case LineCap::Butt:
     default:
         capStyle = D2D1_CAP_STYLE_FLAT;
         break;
@@ -386,13 +386,13 @@
 {
     D2D1_LINE_JOIN joinStyle = D2D1_LINE_JOIN_MITER;
     switch (lineJoin) {
-    case RoundJoin:
+    case LineJoin::Round:
         joinStyle = D2D1_LINE_JOIN_ROUND;
         break;
-    case BevelJoin:
+    case LineJoin::Bevel:
         joinStyle = D2D1_LINE_JOIN_BEVEL;
         break;
-    case MiterJoin:
+    case LineJoin::Miter:
     default:
         joinStyle = D2D1_LINE_JOIN_MITER;
         break;

Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (282919 => 282920)


--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp	2021-09-23 04:30:24 UTC (rev 282919)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp	2021-09-23 04:30:49 UTC (rev 282920)
@@ -206,8 +206,8 @@
     FloatPoint arrowTip(rect.maxX(), center.y());
 
     context.setStrokeThickness(2);
-    context.setLineCap(RoundCap);
-    context.setLineJoin(RoundJoin);
+    context.setLineCap(LineCap::Round);
+    context.setLineJoin(LineJoin::Round);
 
     Path path;
     path.moveTo(FloatPoint(rect.x(), center.y()));

Modified: trunk/Source/WebCore/rendering/TextPaintStyle.cpp (282919 => 282920)


--- trunk/Source/WebCore/rendering/TextPaintStyle.cpp	2021-09-23 04:30:24 UTC (rev 282919)
+++ trunk/Source/WebCore/rendering/TextPaintStyle.cpp	2021-09-23 04:30:49 UTC (rev 282920)
@@ -195,7 +195,7 @@
             context.setStrokeThickness(paintStyle.strokeWidth);
         context.setLineJoin(paintStyle.lineJoin);
         context.setLineCap(paintStyle.lineCap);
-        if (paintStyle.lineJoin == MiterJoin)
+        if (paintStyle.lineJoin == LineJoin::Miter)
             context.setMiterLimit(paintStyle.miterLimit);
     }
 }

Modified: trunk/Source/WebCore/rendering/TextPaintStyle.h (282919 => 282920)


--- trunk/Source/WebCore/rendering/TextPaintStyle.h	2021-09-23 04:30:24 UTC (rev 282919)
+++ trunk/Source/WebCore/rendering/TextPaintStyle.h	2021-09-23 04:30:49 UTC (rev 282920)
@@ -53,8 +53,8 @@
     bool useDarkAppearance { false };
 #endif
     PaintOrder paintOrder { PaintOrder::Normal };
-    LineJoin lineJoin { MiterJoin };
-    LineCap lineCap { ButtCap };
+    LineJoin lineJoin { LineJoin::Miter };
+    LineCap lineCap { LineCap::Butt };
     float miterLimit { defaultMiterLimit };
 };
 

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (282919 => 282920)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2021-09-23 04:30:24 UTC (rev 282919)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2021-09-23 04:30:49 UTC (rev 282920)
@@ -1359,13 +1359,13 @@
     static PaintOrder initialPaintOrder() { return PaintOrder::Normal; }
     static Vector<PaintType, 3> paintTypesForPaintOrder(PaintOrder);
     
-    void setCapStyle(LineCap val) { SET_VAR(m_rareInheritedData, capStyle, val); }
+    void setCapStyle(LineCap val) { SET_VAR(m_rareInheritedData, capStyle, static_cast<unsigned>(val)); }
     LineCap capStyle() const { return static_cast<LineCap>(m_rareInheritedData->capStyle); }
-    static LineCap initialCapStyle() { return ButtCap; }
+    static LineCap initialCapStyle() { return LineCap::Butt; }
     
-    void setJoinStyle(LineJoin val) { SET_VAR(m_rareInheritedData, joinStyle, val); }
+    void setJoinStyle(LineJoin val) { SET_VAR(m_rareInheritedData, joinStyle, static_cast<unsigned>(val)); }
     LineJoin joinStyle() const { return static_cast<LineJoin>(m_rareInheritedData->joinStyle); }
-    static LineJoin initialJoinStyle() { return MiterJoin; }
+    static LineJoin initialJoinStyle() { return LineJoin::Miter; }
     
     const Length& strokeWidth() const { return m_rareInheritedData->strokeWidth; }
     void setStrokeWidth(Length&& w) { SET_VAR(m_rareInheritedData, strokeWidth, WTFMove(w)); }

Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (282919 => 282920)


--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2021-09-23 04:30:24 UTC (rev 282919)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2021-09-23 04:30:49 UTC (rev 282920)
@@ -128,8 +128,8 @@
 #endif
     , hangingPunctuation(RenderStyle::initialHangingPunctuation().toRaw())
     , paintOrder(static_cast<unsigned>(RenderStyle::initialPaintOrder()))
-    , capStyle(RenderStyle::initialCapStyle())
-    , joinStyle(RenderStyle::initialJoinStyle())
+    , capStyle(static_cast<unsigned>(RenderStyle::initialCapStyle()))
+    , joinStyle(static_cast<unsigned>(RenderStyle::initialJoinStyle()))
     , hasSetStrokeWidth(false)
     , hasSetStrokeColor(false)
     , mathStyle(static_cast<unsigned>(RenderStyle::initialMathStyle()))

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGPath.cpp (282919 => 282920)


--- trunk/Source/WebCore/rendering/svg/RenderSVGPath.cpp	2021-09-23 04:30:24 UTC (rev 282919)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGPath.cpp	2021-09-23 04:30:49 UTC (rev 282920)
@@ -110,11 +110,11 @@
     for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) {
         ASSERT(style().svgStyle().hasStroke());
         float strokeWidth = this->strokeWidth();
-        if (style().capStyle() == SquareCap) {
+        if (style().capStyle() == LineCap::Square) {
             if (zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWidth).contains(point))
                 return true;
         } else {
-            ASSERT(style().capStyle() == RoundCap);
+            ASSERT(style().capStyle() == LineCap::Round);
             FloatPoint radiusVector(point.x() - m_zeroLengthLinecapLocations[i].x(), point.y() -  m_zeroLengthLinecapLocations[i].y());
             if (radiusVector.lengthSquared() < strokeWidth * strokeWidth * .25f)
                 return true;
@@ -127,7 +127,7 @@
 {
     // Spec(11.4): Any zero length subpath shall not be stroked if the "stroke-linecap" property has a value of butt
     // but shall be stroked if the "stroke-linecap" property has a value of round or square
-    return style().svgStyle().hasStroke() && style().capStyle() != ButtCap;
+    return style().svgStyle().hasStroke() && style().capStyle() != LineCap::Butt;
 }
 
 Path* RenderSVGPath::zeroLengthLinecapPath(const FloatPoint& linecapPosition) const
@@ -135,7 +135,7 @@
     static NeverDestroyed<Path> tempPath;
 
     tempPath.get().clear();
-    if (style().capStyle() == SquareCap)
+    if (style().capStyle() == LineCap::Square)
         tempPath.get().addRect(zeroLengthSubpathRect(linecapPosition, this->strokeWidth()));
     else
         tempPath.get().addEllipse(zeroLengthSubpathRect(linecapPosition, this->strokeWidth()));

Modified: trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp (282919 => 282920)


--- trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp	2021-09-23 04:30:24 UTC (rev 282919)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp	2021-09-23 04:30:49 UTC (rev 282920)
@@ -461,7 +461,7 @@
     context.setStrokeThickness(lengthContext.valueForLength(style.strokeWidth()));
     context.setLineCap(style.capStyle());
     context.setLineJoin(style.joinStyle());
-    if (style.joinStyle() == MiterJoin)
+    if (style.joinStyle() == LineJoin::Miter)
         context.setMiterLimit(style.strokeMiterLimit());
 
     const Vector<SVGLengthValue>& dashes = svgStyle.strokeDashArray();

Modified: trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp (282919 => 282920)


--- trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp	2021-09-23 04:30:24 UTC (rev 282919)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp	2021-09-23 04:30:49 UTC (rev 282920)
@@ -197,8 +197,8 @@
             writeIfNotDefault(ts, "opacity", svgStyle.strokeOpacity(), 1.0f);
             writeIfNotDefault(ts, "stroke width", strokeWidth, 1.0);
             writeIfNotDefault(ts, "miter limit", style.strokeMiterLimit(), 4.0f);
-            writeIfNotDefault(ts, "line cap", style.capStyle(), ButtCap);
-            writeIfNotDefault(ts, "line join", style.joinStyle(), MiterJoin);
+            writeIfNotDefault(ts, "line cap", style.capStyle(), LineCap::Butt);
+            writeIfNotDefault(ts, "line join", style.joinStyle(), LineJoin::Miter);
             writeIfNotDefault(ts, "dash offset", dashOffset, 0.0);
             if (!dashArray.isEmpty())
                 writeNameValuePair(ts, "dash array", dashArray);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to