Title: [212808] trunk
Revision
212808
Author
[email protected]
Date
2017-02-21 22:55:54 -0800 (Tue, 21 Feb 2017)

Log Message

Add support for CSS properties paint-order, stroke-linecap, and stroke-linejoin in text rendering.
https://bugs.webkit.org/show_bug.cgi?id=168601
Source/WebCore:

rdar://problem/30583872

Reviewed by Simon Fraser.

Text rendering should respect the CSS properties paint-order, stroke-linecap, and stroke-linejoin,
see https://drafts.fxtf.org/paint/. The text rendering changes are mainly in the TextPainter class,
where text is painted in three phases (fill, stroke, markers), where the order follows the
paint-order property. The linecap and linejoin properties are set on the graphics context before
rendering the text.

Tests: fast/css/paint-order.html
       fast/css/paint-order-shadow.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::paintOrder):
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertPaintOrder):
* rendering/TextPaintStyle.cpp:
(WebCore::computeTextPaintStyle):
(WebCore::updateGraphicsContext):
* rendering/TextPaintStyle.h:
* rendering/TextPainter.cpp:
(WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::paintTypesForPaintOrder):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setPaintOrder):
(WebCore::RenderStyle::initialPaintOrder):
* rendering/style/RenderStyleConstants.h:
* rendering/style/SVGRenderStyleDefs.h:
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
* rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::fillStrokeMarkers):
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::paint):

LayoutTests:


Reviewed by Simon Fraser.

* fast/css/paint-order-expected.html: Added.
* fast/css/paint-order-shadow-expected.html: Added.
* fast/css/paint-order-shadow.html: Added.
* fast/css/paint-order.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (212807 => 212808)


--- trunk/LayoutTests/ChangeLog	2017-02-22 06:51:07 UTC (rev 212807)
+++ trunk/LayoutTests/ChangeLog	2017-02-22 06:55:54 UTC (rev 212808)
@@ -1,3 +1,15 @@
+2017-02-21  Per Arne Vollan  <[email protected]>
+
+        Add support for CSS properties paint-order, stroke-linecap, and stroke-linejoin in text rendering.
+        https://bugs.webkit.org/show_bug.cgi?id=168601
+
+        Reviewed by Simon Fraser.
+
+        * fast/css/paint-order-expected.html: Added.
+        * fast/css/paint-order-shadow-expected.html: Added.
+        * fast/css/paint-order-shadow.html: Added.
+        * fast/css/paint-order.html: Added.
+
 2017-02-21  Joseph Pecoraro  <[email protected]>
 
         [User Timing] Throw a SyntaxError for performance.measure if mark name is not found

Added: trunk/LayoutTests/fast/css/paint-order-expected.html (0 => 212808)


--- trunk/LayoutTests/fast/css/paint-order-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/paint-order-expected.html	2017-02-22 06:55:54 UTC (rev 212808)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        div {
+            position: absolute;
+            font-size: 80px;
+            color: gray;
+        }
+
+        .test-stroke {
+            text-shadow: none;
+            -webkit-text-stroke: 25px red;
+            
+            /* Clip used to isolate the stroke */
+            -webkit-clip-path: inset(20px 55px 30px 15px);
+        }        
+
+        .fill-grey {
+            text-shadow: none;
+        
+            /* Clip used to isolate the stroke */
+            -webkit-clip-path: inset(20px 55px 30px 15px);
+        }
+
+    </style>
+</head>
+<body>
+
+<div class="test-stroke" style="paint-order: fill; top: 0px">&#x25fc;</div>
+<div class="test-stroke" style="paint-order: fill markers; top: 100px">&#x25fc;</div>
+<div class="fill-grey" style="paint-order: stroke; top: 200px">&#x25fc;</div>
+<div class="fill-grey" style="paint-order: stroke markers; top: 300px">&#x25fc;</div>
+<div class="test-stroke" style="paint-order: markers; top: 400px">&#x25fc;</div>
+<div class="fill-grey" style="paint-order: markers stroke; top: 500px">&#x25fc;</div>
+
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/paint-order-shadow-expected.html (0 => 212808)


--- trunk/LayoutTests/fast/css/paint-order-shadow-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/paint-order-shadow-expected.html	2017-02-22 06:55:54 UTC (rev 212808)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        div {
+            position: absolute;
+            font-size: 80px;
+            color: gray;
+            width: 200px;
+            left: 0px;
+        }
+
+        .bg-color-gray {
+            background-color: gray;
+
+            /* Clip used to isolate a part of the shadow */
+            -webkit-clip-path: inset(30px 75px 30px 115px);
+        }
+    </style>
+</head>
+<body>
+
+<div class="bg-color-gray" style="paint-order: fill; top: 0px">&#x25fc;</div>
+<div class="bg-color-gray" style="paint-order: fill markers; top: 100px">&#x25fc;</div>
+<div class="bg-color-gray" style="paint-order: stroke; top: 200px">&#x25fc;</div>
+<div class="bg-color-gray" style="paint-order: stroke markers; top: 300px">&#x25fc;</div>
+<div class="bg-color-gray" style="paint-order: markers; top: 400px">&#x25fc;</div>
+<div class="bg-color-gray" style="paint-order: markers stroke; top: 500px">&#x25fc;</div>
+
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/paint-order-shadow.html (0 => 212808)


--- trunk/LayoutTests/fast/css/paint-order-shadow.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/paint-order-shadow.html	2017-02-22 06:55:54 UTC (rev 212808)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        div {
+            position: absolute;
+            font-size: 80px;
+            color: gray;
+            width: 200px;
+            left: 0px;
+        }
+
+        .test-stroke {
+            text-shadow: 100px 0 0 rgba(0, 0, 0, 0.5);
+            -webkit-text-stroke: 25px red;
+
+            /* Clip used to isolate a part of the shadow */
+            -webkit-clip-path: inset(30px 75px 30px 115px);
+        }
+    </style>
+</head>
+<body>
+
+<div class="test-stroke" style="paint-order: fill; top: 0px">&#x25fc;</div>
+<div class="test-stroke" style="paint-order: fill markers; top: 100px">&#x25fc;</div>
+<div class="test-stroke" style="paint-order: stroke; top: 200px">&#x25fc;</div>
+<div class="test-stroke" style="paint-order: stroke markers; top: 300px">&#x25fc;</div>
+<div class="test-stroke" style="paint-order: markers; top: 400px">&#x25fc;</div>
+<div class="test-stroke" style="paint-order: markers stroke; top: 500px">&#x25fc;</div>
+
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/paint-order.html (0 => 212808)


--- trunk/LayoutTests/fast/css/paint-order.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/paint-order.html	2017-02-22 06:55:54 UTC (rev 212808)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        div {
+            position: absolute;
+            font-size: 80px;
+            color: gray;
+        }
+
+        .test-stroke {
+            text-shadow: none;
+            -webkit-text-stroke: 25px red;
+            
+            /* Clip used to isolate the stroke */
+            -webkit-clip-path: inset(20px 55px 30px 15px);
+        }
+    </style>
+</head>
+<body>
+
+<div class="test-stroke" style="paint-order: fill; top: 0px">&#x25fc;</div>
+<div class="test-stroke" style="paint-order: fill markers; top: 100px">&#x25fc;</div>
+<div class="test-stroke" style="paint-order: stroke; top: 200px">&#x25fc;</div>
+<div class="test-stroke" style="paint-order: stroke markers; top: 300px">&#x25fc;</div>
+<div class="test-stroke" style="paint-order: markers; top: 400px">&#x25fc;</div>
+<div class="test-stroke" style="paint-order: markers stroke; top: 500px">&#x25fc;</div>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (212807 => 212808)


--- trunk/Source/WebCore/ChangeLog	2017-02-22 06:51:07 UTC (rev 212807)
+++ trunk/Source/WebCore/ChangeLog	2017-02-22 06:55:54 UTC (rev 212808)
@@ -1,3 +1,44 @@
+2017-02-21  Per Arne Vollan  <[email protected]>
+
+        Add support for CSS properties paint-order, stroke-linecap, and stroke-linejoin in text rendering.
+        https://bugs.webkit.org/show_bug.cgi?id=168601
+        rdar://problem/30583872
+
+        Reviewed by Simon Fraser.
+
+        Text rendering should respect the CSS properties paint-order, stroke-linecap, and stroke-linejoin,
+        see https://drafts.fxtf.org/paint/. The text rendering changes are mainly in the TextPainter class,
+        where text is painted in three phases (fill, stroke, markers), where the order follows the
+        paint-order property. The linecap and linejoin properties are set on the graphics context before
+        rendering the text.
+
+        Tests: fast/css/paint-order.html
+               fast/css/paint-order-shadow.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::paintOrder):
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertPaintOrder):
+        * rendering/TextPaintStyle.cpp:
+        (WebCore::computeTextPaintStyle):
+        (WebCore::updateGraphicsContext):
+        * rendering/TextPaintStyle.h:
+        * rendering/TextPainter.cpp:
+        (WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::paintTypesForPaintOrder):
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::setPaintOrder):
+        (WebCore::RenderStyle::initialPaintOrder):
+        * rendering/style/RenderStyleConstants.h:
+        * rendering/style/SVGRenderStyleDefs.h:
+        * rendering/style/StyleRareInheritedData.cpp:
+        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+        * rendering/svg/RenderSVGShape.cpp:
+        (WebCore::RenderSVGShape::fillStrokeMarkers):
+        * rendering/svg/SVGInlineTextBox.cpp:
+        (WebCore::SVGInlineTextBox::paint):
+
 2017-02-21  Joseph Pecoraro  <[email protected]>
 
         [User Timing] Throw a SyntaxError for performance.measure if mark name is not found

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (212807 => 212808)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2017-02-22 06:51:07 UTC (rev 212807)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2017-02-22 06:55:54 UTC (rev 212808)
@@ -2465,32 +2465,32 @@
 
 static Ref<CSSValue> paintOrder(PaintOrder paintOrder)
 {
-    if (paintOrder == PaintOrderNormal)
+    if (paintOrder == PaintOrder::Normal)
         return CSSPrimitiveValue::createIdentifier(CSSValueNormal);
     
     auto paintOrderList = CSSValueList::createSpaceSeparated();
     switch (paintOrder) {
-    case PaintOrderNormal:
+    case PaintOrder::Normal:
         ASSERT_NOT_REACHED();
         break;
-    case PaintOrderFill:
+    case PaintOrder::Fill:
         paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
         break;
-    case PaintOrderFillMarkers:
+    case PaintOrder::FillMarkers:
         paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
         paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
         break;
-    case PaintOrderStroke:
+    case PaintOrder::Stroke:
         paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke));
         break;
-    case PaintOrderStrokeMarkers:
+    case PaintOrder::StrokeMarkers:
         paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke));
         paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
         break;
-    case PaintOrderMarkers:
+    case PaintOrder::Markers:
         paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
         break;
-    case PaintOrderMarkersStroke:
+    case PaintOrder::MarkersStroke:
         paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
         paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke));
         break;

Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (212807 => 212808)


--- trunk/Source/WebCore/css/StyleBuilderConverter.h	2017-02-22 06:51:07 UTC (rev 212807)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h	2017-02-22 06:55:54 UTC (rev 212808)
@@ -1222,20 +1222,20 @@
 {
     if (is<CSSPrimitiveValue>(value)) {
         ASSERT(downcast<CSSPrimitiveValue>(value).valueID() == CSSValueNormal);
-        return PaintOrderNormal;
+        return PaintOrder::Normal;
     }
 
     auto& orderTypeList = downcast<CSSValueList>(value);
     switch (downcast<CSSPrimitiveValue>(*orderTypeList.itemWithoutBoundsCheck(0)).valueID()) {
     case CSSValueFill:
-        return orderTypeList.length() > 1 ? PaintOrderFillMarkers : PaintOrderFill;
+        return orderTypeList.length() > 1 ? PaintOrder::FillMarkers : PaintOrder::Fill;
     case CSSValueStroke:
-        return orderTypeList.length() > 1 ? PaintOrderStrokeMarkers : PaintOrderStroke;
+        return orderTypeList.length() > 1 ? PaintOrder::StrokeMarkers : PaintOrder::Stroke;
     case CSSValueMarkers:
-        return orderTypeList.length() > 1 ? PaintOrderMarkersStroke : PaintOrderMarkers;
+        return orderTypeList.length() > 1 ? PaintOrder::MarkersStroke : PaintOrder::Markers;
     default:
         ASSERT_NOT_REACHED();
-        return PaintOrderNormal;
+        return PaintOrder::Normal;
     }
 }
 

Modified: trunk/Source/WebCore/rendering/TextPaintStyle.cpp (212807 => 212808)


--- trunk/Source/WebCore/rendering/TextPaintStyle.cpp	2017-02-22 06:51:07 UTC (rev 212807)
+++ trunk/Source/WebCore/rendering/TextPaintStyle.cpp	2017-02-22 06:55:54 UTC (rev 212808)
@@ -68,7 +68,10 @@
     paintStyle.useLetterpressEffect = lineStyle.textDecorationsInEffect() & TextDecorationLetterpress;
 #endif
     paintStyle.strokeWidth = lineStyle.textStrokeWidth();
-
+    paintStyle.paintOrder = lineStyle.paintOrder();
+    paintStyle.lineJoin = lineStyle.joinStyle();
+    paintStyle.lineCap = lineStyle.capStyle();
+    
     if (paintInfo.forceTextColor()) {
         paintStyle.fillColor = paintInfo.forcedTextColor();
         paintStyle.strokeColor = paintInfo.forcedTextColor();
@@ -192,6 +195,8 @@
             context.setStrokeColor(paintStyle.strokeColor);
         if (paintStyle.strokeWidth != context.strokeThickness())
             context.setStrokeThickness(paintStyle.strokeWidth);
+        context.setLineJoin(paintStyle.lineJoin);
+        context.setLineCap(paintStyle.lineCap);
     }
 }
 

Modified: trunk/Source/WebCore/rendering/TextPaintStyle.h (212807 => 212808)


--- trunk/Source/WebCore/rendering/TextPaintStyle.h	2017-02-22 06:51:07 UTC (rev 212807)
+++ trunk/Source/WebCore/rendering/TextPaintStyle.h	2017-02-22 06:55:54 UTC (rev 212808)
@@ -26,6 +26,8 @@
 #pragma once
 
 #include "Color.h"
+#include "GraphicsTypes.h"
+#include "RenderStyleConstants.h"
 
 namespace WebCore {
 
@@ -47,6 +49,9 @@
 #if ENABLE(LETTERPRESS)
     bool useLetterpressEffect { false };
 #endif
+    PaintOrder paintOrder { PaintOrder::Normal };
+    LineJoin lineJoin { MiterJoin };
+    LineCap lineCap { ButtCap };
 };
 
 TextPaintStyle computeTextPaintStyle(const Frame&, const RenderStyle&, const PaintInfo&);

Modified: trunk/Source/WebCore/rendering/TextPainter.cpp (212807 => 212808)


--- trunk/Source/WebCore/rendering/TextPainter.cpp	2017-02-22 06:51:07 UTC (rev 212807)
+++ trunk/Source/WebCore/rendering/TextPainter.cpp	2017-02-22 06:55:54 UTC (rev 212808)
@@ -123,9 +123,33 @@
 void TextPainter::paintTextAndEmphasisMarksIfNeeded(const TextRun& textRun, const FloatRect& boxRect, const FloatPoint& textOrigin, unsigned startOffset, unsigned endOffset,
     const TextPaintStyle& paintStyle, const ShadowData* shadow)
 {
-    // FIXME: Truncate right-to-left text correctly.
-    paintTextWithShadows(shadow, *m_font, textRun, boxRect, textOrigin, startOffset, endOffset, nullAtom, 0, paintStyle.strokeWidth > 0);
-
+    if (paintStyle.paintOrder == PaintOrder::Normal) {
+        // FIXME: Truncate right-to-left text correctly.
+        paintTextWithShadows(shadow, *m_font, textRun, boxRect, textOrigin, startOffset, endOffset, nullAtom, 0, paintStyle.strokeWidth > 0);
+    } else {
+        bool paintShadow = true;
+        auto textDrawingMode = m_context.textDrawingMode();
+        auto paintOrder = RenderStyle::paintTypesForPaintOrder(paintStyle.paintOrder);
+        for (auto order : paintOrder) {
+            switch (order) {
+            case PaintType::Fill:
+                m_context.setTextDrawingMode(textDrawingMode & ~TextModeStroke);
+                paintTextWithShadows(paintShadow ? shadow : nullptr, *m_font, textRun, boxRect, textOrigin, startOffset, endOffset, nullAtom, 0, false);
+                paintShadow = false;
+                m_context.setTextDrawingMode(textDrawingMode);
+                break;
+            case PaintType::Stroke:
+                m_context.setTextDrawingMode(textDrawingMode & ~TextModeFill);
+                paintTextWithShadows(paintShadow ? shadow : nullptr, *m_font, textRun, boxRect, textOrigin, startOffset, endOffset, nullAtom, 0, paintStyle.strokeWidth > 0);
+                paintShadow = false;
+                m_context.setTextDrawingMode(textDrawingMode);
+                break;
+            case PaintType::Markers:
+                continue;
+            }
+        }
+    }
+    
     if (m_emphasisMark.isEmpty())
         return;
 

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (212807 => 212808)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2017-02-22 06:51:07 UTC (rev 212807)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2017-02-22 06:55:54 UTC (rev 212808)
@@ -2217,41 +2217,41 @@
 
 #endif
 
-Vector<PaintType, 3> RenderStyle::paintTypesForPaintOrder() const
+Vector<PaintType, 3> RenderStyle::paintTypesForPaintOrder(PaintOrder order)
 {
     Vector<PaintType, 3> paintOrder;
-    switch (this->paintOrder()) {
-    case PaintOrderNormal:
+    switch (order) {
+    case PaintOrder::Normal:
         FALLTHROUGH;
-    case PaintOrderFill:
-        paintOrder.append(PaintTypeFill);
-        paintOrder.append(PaintTypeStroke);
-        paintOrder.append(PaintTypeMarkers);
+    case PaintOrder::Fill:
+        paintOrder.append(PaintType::Fill);
+        paintOrder.append(PaintType::Stroke);
+        paintOrder.append(PaintType::Markers);
         break;
-    case PaintOrderFillMarkers:
-        paintOrder.append(PaintTypeFill);
-        paintOrder.append(PaintTypeMarkers);
-        paintOrder.append(PaintTypeStroke);
+    case PaintOrder::FillMarkers:
+        paintOrder.append(PaintType::Fill);
+        paintOrder.append(PaintType::Markers);
+        paintOrder.append(PaintType::Stroke);
         break;
-    case PaintOrderStroke:
-        paintOrder.append(PaintTypeStroke);
-        paintOrder.append(PaintTypeFill);
-        paintOrder.append(PaintTypeMarkers);
+    case PaintOrder::Stroke:
+        paintOrder.append(PaintType::Stroke);
+        paintOrder.append(PaintType::Fill);
+        paintOrder.append(PaintType::Markers);
         break;
-    case PaintOrderStrokeMarkers:
-        paintOrder.append(PaintTypeStroke);
-        paintOrder.append(PaintTypeMarkers);
-        paintOrder.append(PaintTypeFill);
+    case PaintOrder::StrokeMarkers:
+        paintOrder.append(PaintType::Stroke);
+        paintOrder.append(PaintType::Markers);
+        paintOrder.append(PaintType::Fill);
         break;
-    case PaintOrderMarkers:
-        paintOrder.append(PaintTypeMarkers);
-        paintOrder.append(PaintTypeFill);
-        paintOrder.append(PaintTypeStroke);
+    case PaintOrder::Markers:
+        paintOrder.append(PaintType::Markers);
+        paintOrder.append(PaintType::Fill);
+        paintOrder.append(PaintType::Stroke);
         break;
-    case PaintOrderMarkersStroke:
-        paintOrder.append(PaintTypeMarkers);
-        paintOrder.append(PaintTypeStroke);
-        paintOrder.append(PaintTypeFill);
+    case PaintOrder::MarkersStroke:
+        paintOrder.append(PaintType::Markers);
+        paintOrder.append(PaintType::Stroke);
+        paintOrder.append(PaintType::Fill);
         break;
     };
     return paintOrder;

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (212807 => 212808)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2017-02-22 06:51:07 UTC (rev 212807)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2017-02-22 06:55:54 UTC (rev 212808)
@@ -1237,10 +1237,10 @@
 #endif
 
     // Support for paint-order, stroke-linecap, and stroke-linejoin from https://drafts.fxtf.org/paint/.
-    void setPaintOrder(PaintOrder order) { SET_VAR(m_rareInheritedData, paintOrder, order); }
+    void setPaintOrder(PaintOrder order) { SET_VAR(m_rareInheritedData, paintOrder, static_cast<unsigned>(order)); }
     PaintOrder paintOrder() const { return static_cast<PaintOrder>(m_rareInheritedData->paintOrder); }
-    static PaintOrder initialPaintOrder() { return PaintOrderNormal; }
-    Vector<PaintType, 3> paintTypesForPaintOrder() const;
+    static PaintOrder initialPaintOrder() { return PaintOrder::Normal; }
+    static Vector<PaintType, 3> paintTypesForPaintOrder(PaintOrder);
     
     void setCapStyle(LineCap val) { SET_VAR(m_rareInheritedData, capStyle, val); }
     LineCap capStyle() const { return static_cast<LineCap>(m_rareInheritedData->capStyle); }

Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (212807 => 212808)


--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2017-02-22 06:51:07 UTC (rev 212807)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2017-02-22 06:55:54 UTC (rev 212808)
@@ -726,4 +726,21 @@
 TextStream& operator<<(TextStream&, EMaskSourceType);
 TextStream& operator<<(TextStream&, Edge);
 
+// These are all minimized combinations of paint-order.
+enum class PaintOrder {
+    Normal,
+    Fill,
+    FillMarkers,
+    Stroke,
+    StrokeMarkers,
+    Markers,
+    MarkersStroke
+};
+
+enum class PaintType {
+    Fill,
+    Stroke,
+    Markers
+};
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.h (212807 => 212808)


--- trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.h	2017-02-22 06:51:07 UTC (rev 212807)
+++ trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.h	2017-02-22 06:55:54 UTC (rev 212808)
@@ -96,23 +96,6 @@
         MT_ALPHA
     };
 
-    // These are all minimized combinations of paint-order.
-    enum PaintOrder {
-        PaintOrderNormal = 0,
-        PaintOrderFill = 1,
-        PaintOrderFillMarkers = 2,
-        PaintOrderStroke = 3,
-        PaintOrderStrokeMarkers = 4,
-        PaintOrderMarkers = 5,
-        PaintOrderMarkersStroke = 6
-    };
-
-    enum PaintType {
-        PaintTypeFill,
-        PaintTypeStroke,
-        PaintTypeMarkers
-    };
-
     class CSSValue;
     class CSSValueList;
     class SVGPaint;

Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (212807 => 212808)


--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2017-02-22 06:51:07 UTC (rev 212807)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2017-02-22 06:55:54 UTC (rev 212808)
@@ -125,7 +125,7 @@
     , trailingWord(static_cast<unsigned>(RenderStyle::initialTrailingWord()))
 #endif
     , hangingPunctuation(RenderStyle::initialHangingPunctuation())
-    , paintOrder(RenderStyle::initialPaintOrder())
+    , paintOrder(static_cast<unsigned>(RenderStyle::initialPaintOrder()))
     , capStyle(RenderStyle::initialCapStyle())
     , joinStyle(RenderStyle::initialJoinStyle())
     , strokeWidth(RenderStyle::initialOneLength())

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp (212807 => 212808)


--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp	2017-02-22 06:51:07 UTC (rev 212807)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp	2017-02-22 06:55:54 UTC (rev 212808)
@@ -277,16 +277,16 @@
 
 void RenderSVGShape::fillStrokeMarkers(PaintInfo& childPaintInfo)
 {
-    auto paintOrder = style().paintTypesForPaintOrder();
+    auto paintOrder = RenderStyle::paintTypesForPaintOrder(style().paintOrder());
     for (unsigned i = 0; i < paintOrder.size(); ++i) {
         switch (paintOrder.at(i)) {
-        case PaintTypeFill:
+        case PaintType::Fill:
             fillShape(style(), childPaintInfo.context());
             break;
-        case PaintTypeStroke:
+        case PaintType::Stroke:
             strokeShape(childPaintInfo.context());
             break;
-        case PaintTypeMarkers:
+        case PaintType::Markers:
             if (!m_markerPositions.isEmpty())
                 drawMarkers(childPaintInfo);
             break;

Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (212807 => 212808)


--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2017-02-22 06:51:07 UTC (rev 212807)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2017-02-22 06:55:54 UTC (rev 212808)
@@ -299,10 +299,10 @@
         if (decorations & TextDecorationOverline)
             paintDecoration(paintInfo.context(), TextDecorationOverline, fragment);
 
-        auto paintOrder = style.paintTypesForPaintOrder();
+        auto paintOrder = RenderStyle::paintTypesForPaintOrder(style.paintOrder());
         for (unsigned i = 0; i < paintOrder.size(); ++i) {
             switch (paintOrder.at(i)) {
-            case PaintTypeFill:
+            case PaintType::Fill:
                 if (!hasFill)
                     continue;
                 m_paintingResourceMode = ApplyToFillMode | ApplyToTextMode;
@@ -309,7 +309,7 @@
                 ASSERT(selectionStyle);
                 paintText(paintInfo.context(), style, *selectionStyle, fragment, hasSelection, paintSelectedTextOnly);
                 break;
-            case PaintTypeStroke:
+            case PaintType::Stroke:
                 if (!hasVisibleStroke)
                     continue;
                 m_paintingResourceMode = ApplyToStrokeMode | ApplyToTextMode;
@@ -316,7 +316,7 @@
                 ASSERT(selectionStyle);
                 paintText(paintInfo.context(), style, *selectionStyle, fragment, hasSelection, paintSelectedTextOnly);
                 break;
-            case PaintTypeMarkers:
+            case PaintType::Markers:
                 continue;
             }
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to