Title: [278396] trunk
Revision
278396
Author
commit-qu...@webkit.org
Date
2021-06-02 23:26:55 -0700 (Wed, 02 Jun 2021)

Log Message

Split FillInlinePath/StrokeInlinePath
https://bugs.webkit.org/show_bug.cgi?id=225687

Patch by Rob Buis <rb...@igalia.com> on 2021-06-02
Reviewed by Wenson Hsieh.

Source/WebCore:

Use specialized display list item types instead of
a Variant for FillInlinePath/StrokeInlinePath.

* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::append):
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemHandle::apply):
(WebCore::DisplayList::ItemHandle::destroy):
(WebCore::DisplayList::ItemHandle::safeCopy const):
* platform/graphics/displaylists/DisplayListItemType.cpp:
(WebCore::DisplayList::sizeOfItemInBytes):
(WebCore::DisplayList::isDrawingItem):
(WebCore::DisplayList::isInlineItem):
* platform/graphics/displaylists/DisplayListItemType.h:
* platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::FillLine::apply const):
(WebCore::DisplayList::operator<<):
(WebCore::DisplayList::FillArc::apply const):
(WebCore::DisplayList::FillQuadCurve::apply const):
(WebCore::DisplayList::FillBezierCurve::apply const):
(WebCore::DisplayList::StrokeArc::localBounds const):
(WebCore::DisplayList::StrokeArc::apply const):
(WebCore::DisplayList::StrokeQuadCurve::localBounds const):
(WebCore::DisplayList::StrokeQuadCurve::apply const):
(WebCore::DisplayList::StrokeBezierCurve::localBounds const):
(WebCore::DisplayList::StrokeBezierCurve::apply const):
(WebCore::DisplayList::FillInlinePath::apply const): Deleted.
(WebCore::DisplayList::StrokeInlinePath::localBounds const): Deleted.
(WebCore::DisplayList::StrokeInlinePath::apply const): Deleted.
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::FillLine::FillLine):
(WebCore::DisplayList::FillLine::path const):
(WebCore::DisplayList::FillLine::globalBounds const):
(WebCore::DisplayList::FillLine::localBounds const):
(WebCore::DisplayList::FillArc::FillArc):
(WebCore::DisplayList::FillArc::path const):
(WebCore::DisplayList::FillArc::globalBounds const):
(WebCore::DisplayList::FillArc::localBounds const):
(WebCore::DisplayList::FillQuadCurve::FillQuadCurve):
(WebCore::DisplayList::FillQuadCurve::path const):
(WebCore::DisplayList::FillQuadCurve::globalBounds const):
(WebCore::DisplayList::FillQuadCurve::localBounds const):
(WebCore::DisplayList::FillBezierCurve::FillBezierCurve):
(WebCore::DisplayList::FillBezierCurve::path const):
(WebCore::DisplayList::StrokeLine::StrokeLine):
(WebCore::DisplayList::StrokeArc::StrokeArc):
(WebCore::DisplayList::StrokeArc::path const):
(WebCore::DisplayList::StrokeArc::globalBounds const):
(WebCore::DisplayList::StrokeQuadCurve::StrokeQuadCurve):
(WebCore::DisplayList::StrokeQuadCurve::path const):
(WebCore::DisplayList::StrokeQuadCurve::globalBounds const):
(WebCore::DisplayList::StrokeBezierCurve::StrokeBezierCurve):
(WebCore::DisplayList::StrokeBezierCurve::path const):
(WebCore::DisplayList::InlinePathDataStorage::InlinePathDataStorage): Deleted.
(WebCore::DisplayList::InlinePathDataStorage::isValid const): Deleted.
(WebCore::DisplayList::InlinePathDataStorage::path const): Deleted.
(WebCore::DisplayList::FillInlinePath::FillInlinePath): Deleted.
(WebCore::DisplayList::FillInlinePath::globalBounds const): Deleted.
(WebCore::DisplayList::FillInlinePath::localBounds const): Deleted.
(WebCore::DisplayList::StrokeInlinePath::StrokeInlinePath): Deleted.
(WebCore::DisplayList::StrokeInlinePath::globalBounds const): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::fillPath):
(WebCore::DisplayList::Recorder::strokePath):

Source/WebKit:

Adjust to new display list item types.

* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::decodeItem):

Tools:

Adjust to API new display list items.

* TestWebKitAPI/Tests/WebCore/DisplayListTests.cpp:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (278395 => 278396)


--- trunk/Source/WebCore/ChangeLog	2021-06-03 05:09:02 UTC (rev 278395)
+++ trunk/Source/WebCore/ChangeLog	2021-06-03 06:26:55 UTC (rev 278396)
@@ -1,3 +1,75 @@
+2021-06-02  Rob Buis  <rb...@igalia.com>
+
+        Split FillInlinePath/StrokeInlinePath
+        https://bugs.webkit.org/show_bug.cgi?id=225687
+
+        Reviewed by Wenson Hsieh.
+
+        Use specialized display list item types instead of
+        a Variant for FillInlinePath/StrokeInlinePath.
+
+        * platform/graphics/displaylists/DisplayList.cpp:
+        (WebCore::DisplayList::DisplayList::append):
+        * platform/graphics/displaylists/DisplayListItemBuffer.cpp:
+        (WebCore::DisplayList::ItemHandle::apply):
+        (WebCore::DisplayList::ItemHandle::destroy):
+        (WebCore::DisplayList::ItemHandle::safeCopy const):
+        * platform/graphics/displaylists/DisplayListItemType.cpp:
+        (WebCore::DisplayList::sizeOfItemInBytes):
+        (WebCore::DisplayList::isDrawingItem):
+        (WebCore::DisplayList::isInlineItem):
+        * platform/graphics/displaylists/DisplayListItemType.h:
+        * platform/graphics/displaylists/DisplayListItems.cpp:
+        (WebCore::DisplayList::FillLine::apply const):
+        (WebCore::DisplayList::operator<<):
+        (WebCore::DisplayList::FillArc::apply const):
+        (WebCore::DisplayList::FillQuadCurve::apply const):
+        (WebCore::DisplayList::FillBezierCurve::apply const):
+        (WebCore::DisplayList::StrokeArc::localBounds const):
+        (WebCore::DisplayList::StrokeArc::apply const):
+        (WebCore::DisplayList::StrokeQuadCurve::localBounds const):
+        (WebCore::DisplayList::StrokeQuadCurve::apply const):
+        (WebCore::DisplayList::StrokeBezierCurve::localBounds const):
+        (WebCore::DisplayList::StrokeBezierCurve::apply const):
+        (WebCore::DisplayList::FillInlinePath::apply const): Deleted.
+        (WebCore::DisplayList::StrokeInlinePath::localBounds const): Deleted.
+        (WebCore::DisplayList::StrokeInlinePath::apply const): Deleted.
+        * platform/graphics/displaylists/DisplayListItems.h:
+        (WebCore::DisplayList::FillLine::FillLine):
+        (WebCore::DisplayList::FillLine::path const):
+        (WebCore::DisplayList::FillLine::globalBounds const):
+        (WebCore::DisplayList::FillLine::localBounds const):
+        (WebCore::DisplayList::FillArc::FillArc):
+        (WebCore::DisplayList::FillArc::path const):
+        (WebCore::DisplayList::FillArc::globalBounds const):
+        (WebCore::DisplayList::FillArc::localBounds const):
+        (WebCore::DisplayList::FillQuadCurve::FillQuadCurve):
+        (WebCore::DisplayList::FillQuadCurve::path const):
+        (WebCore::DisplayList::FillQuadCurve::globalBounds const):
+        (WebCore::DisplayList::FillQuadCurve::localBounds const):
+        (WebCore::DisplayList::FillBezierCurve::FillBezierCurve):
+        (WebCore::DisplayList::FillBezierCurve::path const):
+        (WebCore::DisplayList::StrokeLine::StrokeLine):
+        (WebCore::DisplayList::StrokeArc::StrokeArc):
+        (WebCore::DisplayList::StrokeArc::path const):
+        (WebCore::DisplayList::StrokeArc::globalBounds const):
+        (WebCore::DisplayList::StrokeQuadCurve::StrokeQuadCurve):
+        (WebCore::DisplayList::StrokeQuadCurve::path const):
+        (WebCore::DisplayList::StrokeQuadCurve::globalBounds const):
+        (WebCore::DisplayList::StrokeBezierCurve::StrokeBezierCurve):
+        (WebCore::DisplayList::StrokeBezierCurve::path const):
+        (WebCore::DisplayList::InlinePathDataStorage::InlinePathDataStorage): Deleted.
+        (WebCore::DisplayList::InlinePathDataStorage::isValid const): Deleted.
+        (WebCore::DisplayList::InlinePathDataStorage::path const): Deleted.
+        (WebCore::DisplayList::FillInlinePath::FillInlinePath): Deleted.
+        (WebCore::DisplayList::FillInlinePath::globalBounds const): Deleted.
+        (WebCore::DisplayList::FillInlinePath::localBounds const): Deleted.
+        (WebCore::DisplayList::StrokeInlinePath::StrokeInlinePath): Deleted.
+        (WebCore::DisplayList::StrokeInlinePath::globalBounds const): Deleted.
+        * platform/graphics/displaylists/DisplayListRecorder.cpp:
+        (WebCore::DisplayList::Recorder::fillPath):
+        (WebCore::DisplayList::Recorder::strokePath):
+
 2021-06-02  Sihui Liu  <sihui_...@apple.com>
 
         Introduce a shared IDB serialization thread

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp (278395 => 278396)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp	2021-06-03 05:09:02 UTC (rev 278395)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp	2021-06-03 06:26:55 UTC (rev 278396)
@@ -285,8 +285,14 @@
     case ItemType::FillRectWithRoundedHole:
         return append<FillRectWithRoundedHole>(item.get<FillRectWithRoundedHole>());
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::FillInlinePath:
-        return append<FillInlinePath>(item.get<FillInlinePath>());
+    case ItemType::FillLine:
+        return append<FillLine>(item.get<FillLine>());
+    case ItemType::FillArc:
+        return append<FillArc>(item.get<FillArc>());
+    case ItemType::FillQuadCurve:
+        return append<FillQuadCurve>(item.get<FillQuadCurve>());
+    case ItemType::FillBezierCurve:
+        return append<FillBezierCurve>(item.get<FillBezierCurve>());
 #endif
     case ItemType::FillPath:
         return append<FillPath>(item.get<FillPath>());
@@ -311,8 +317,12 @@
     case ItemType::StrokeLine:
         return append<StrokeLine>(item.get<StrokeLine>());
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::StrokeInlinePath:
-        return append<StrokeInlinePath>(item.get<StrokeInlinePath>());
+    case ItemType::StrokeArc:
+        return append<StrokeArc>(item.get<StrokeArc>());
+    case ItemType::StrokeQuadCurve:
+        return append<StrokeQuadCurve>(item.get<StrokeQuadCurve>());
+    case ItemType::StrokeBezierCurve:
+        return append<StrokeBezierCurve>(item.get<StrokeBezierCurve>());
 #endif
     case ItemType::StrokePath:
         return append<StrokePath>(item.get<StrokePath>());

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp (278395 => 278396)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp	2021-06-03 05:09:02 UTC (rev 278395)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp	2021-06-03 06:26:55 UTC (rev 278396)
@@ -172,9 +172,18 @@
         get<FillRectWithRoundedHole>().apply(context);
         return;
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::FillInlinePath:
-        get<FillInlinePath>().apply(context);
+    case ItemType::FillLine:
+        get<FillLine>().apply(context);
         return;
+    case ItemType::FillArc:
+        get<FillArc>().apply(context);
+        return;
+    case ItemType::FillQuadCurve:
+        get<FillQuadCurve>().apply(context);
+        return;
+    case ItemType::FillBezierCurve:
+        get<FillBezierCurve>().apply(context);
+        return;
 #endif
     case ItemType::FillPath:
         get<FillPath>().apply(context);
@@ -205,9 +214,15 @@
         get<StrokeLine>().apply(context);
         return;
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::StrokeInlinePath:
-        get<StrokeInlinePath>().apply(context);
+    case ItemType::StrokeArc:
+        get<StrokeArc>().apply(context);
         return;
+    case ItemType::StrokeQuadCurve:
+        get<StrokeQuadCurve>().apply(context);
+        return;
+    case ItemType::StrokeBezierCurve:
+        get<StrokeBezierCurve>().apply(context);
+        return;
 #endif
     case ItemType::StrokePath:
         get<StrokePath>().apply(context);
@@ -361,9 +376,18 @@
         static_assert(std::is_trivially_destructible<FillEllipse>::value);
         return;
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::FillInlinePath:
-        static_assert(std::is_trivially_destructible<FillInlinePath>::value);
+    case ItemType::FillLine:
+        static_assert(std::is_trivially_destructible<FillLine>::value);
         return;
+    case ItemType::FillArc:
+        static_assert(std::is_trivially_destructible<FillArc>::value);
+        return;
+    case ItemType::FillQuadCurve:
+        static_assert(std::is_trivially_destructible<FillQuadCurve>::value);
+        return;
+    case ItemType::FillBezierCurve:
+        static_assert(std::is_trivially_destructible<FillBezierCurve>::value);
+        return;
 #endif
     case ItemType::FillRect:
         static_assert(std::is_trivially_destructible<FillRect>::value);
@@ -422,9 +446,15 @@
         static_assert(std::is_trivially_destructible<StrokeEllipse>::value);
         return;
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::StrokeInlinePath:
-        static_assert(std::is_trivially_destructible<StrokeInlinePath>::value);
+    case ItemType::StrokeArc:
+        static_assert(std::is_trivially_destructible<StrokeArc>::value);
         return;
+    case ItemType::StrokeQuadCurve:
+        static_assert(std::is_trivially_destructible<StrokeQuadCurve>::value);
+        return;
+    case ItemType::StrokeBezierCurve:
+        static_assert(std::is_trivially_destructible<StrokeBezierCurve>::value);
+        return;
 #endif
     case ItemType::StrokeRect:
         static_assert(std::is_trivially_destructible<StrokeRect>::value);
@@ -553,8 +583,14 @@
     case ItemType::FillEllipse:
         return copyInto<FillEllipse>(itemOffset, *this);
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::FillInlinePath:
-        return copyInto<FillInlinePath>(itemOffset, *this);
+    case ItemType::FillLine:
+        return copyInto<FillLine>(itemOffset, *this);
+    case ItemType::FillArc:
+        return copyInto<FillArc>(itemOffset, *this);
+    case ItemType::FillQuadCurve:
+        return copyInto<FillQuadCurve>(itemOffset, *this);
+    case ItemType::FillBezierCurve:
+        return copyInto<FillBezierCurve>(itemOffset, *this);
 #endif
     case ItemType::FillRect:
         return copyInto<FillRect>(itemOffset, *this);
@@ -595,8 +631,12 @@
     case ItemType::StrokeEllipse:
         return copyInto<StrokeEllipse>(itemOffset, *this);
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::StrokeInlinePath:
-        return copyInto<StrokeInlinePath>(itemOffset, *this);
+    case ItemType::StrokeArc:
+        return copyInto<StrokeArc>(itemOffset, *this);
+    case ItemType::StrokeQuadCurve:
+        return copyInto<StrokeQuadCurve>(itemOffset, *this);
+    case ItemType::StrokeBezierCurve:
+        return copyInto<StrokeBezierCurve>(itemOffset, *this);
 #endif
     case ItemType::StrokeRect:
         return copyInto<StrokeRect>(itemOffset, *this);

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp (278395 => 278396)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp	2021-06-03 05:09:02 UTC (rev 278395)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp	2021-06-03 06:26:55 UTC (rev 278396)
@@ -119,8 +119,14 @@
     case ItemType::FillRectWithRoundedHole:
         return sizeof(FillRectWithRoundedHole);
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::FillInlinePath:
-        return sizeof(FillInlinePath);
+    case ItemType::FillLine:
+        return sizeof(FillLine);
+    case ItemType::FillArc:
+        return sizeof(FillArc);
+    case ItemType::FillQuadCurve:
+        return sizeof(FillQuadCurve);
+    case ItemType::FillBezierCurve:
+        return sizeof(FillBezierCurve);
 #endif
     case ItemType::FillPath:
         return sizeof(FillPath);
@@ -145,8 +151,12 @@
     case ItemType::StrokeLine:
         return sizeof(StrokeLine);
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::StrokeInlinePath:
-        return sizeof(StrokeInlinePath);
+    case ItemType::StrokeArc:
+        return sizeof(StrokeArc);
+    case ItemType::StrokeQuadCurve:
+        return sizeof(StrokeQuadCurve);
+    case ItemType::StrokeBezierCurve:
+        return sizeof(StrokeBezierCurve);
 #endif
     case ItemType::StrokePath:
         return sizeof(StrokePath);
@@ -229,7 +239,10 @@
     case ItemType::FillCompositedRect:
     case ItemType::FillEllipse:
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::FillInlinePath:
+    case ItemType::FillLine:
+    case ItemType::FillArc:
+    case ItemType::FillQuadCurve:
+    case ItemType::FillBezierCurve:
 #endif
     case ItemType::FillPath:
     case ItemType::FillRect:
@@ -243,7 +256,9 @@
     case ItemType::PutPixelBuffer:
     case ItemType::StrokeEllipse:
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::StrokeInlinePath:
+    case ItemType::StrokeArc:
+    case ItemType::StrokeQuadCurve:
+    case ItemType::StrokeBezierCurve:
 #endif
     case ItemType::StrokePath:
     case ItemType::StrokeRect:
@@ -324,7 +339,10 @@
     case ItemType::EndTransparencyLayer:
     case ItemType::FillEllipse:
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::FillInlinePath:
+    case ItemType::FillLine:
+    case ItemType::FillArc:
+    case ItemType::FillQuadCurve:
+    case ItemType::FillBezierCurve:
 #endif
     case ItemType::FillRect:
     case ItemType::FlushContext:
@@ -347,7 +365,9 @@
     case ItemType::SetStrokeThickness:
     case ItemType::StrokeEllipse:
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::StrokeInlinePath:
+    case ItemType::StrokeArc:
+    case ItemType::StrokeQuadCurve:
+    case ItemType::StrokeBezierCurve:
 #endif
     case ItemType::StrokeRect:
     case ItemType::StrokeLine:

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h (278395 => 278396)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h	2021-06-03 05:09:02 UTC (rev 278395)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h	2021-06-03 06:26:55 UTC (rev 278396)
@@ -72,7 +72,10 @@
     FillRoundedRect,
     FillRectWithRoundedHole,
 #if ENABLE(INLINE_PATH_DATA)
-    FillInlinePath,
+    FillLine,
+    FillArc,
+    FillQuadCurve,
+    FillBezierCurve,
 #endif
     FillPath,
     FillEllipse,
@@ -87,7 +90,9 @@
     StrokeRect,
     StrokeLine,
 #if ENABLE(INLINE_PATH_DATA)
-    StrokeInlinePath,
+    StrokeArc,
+    StrokeQuadCurve,
+    StrokeBezierCurve,
 #endif
     StrokePath,
     StrokeEllipse,

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp (278395 => 278396)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp	2021-06-03 05:09:02 UTC (rev 278395)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp	2021-06-03 06:26:55 UTC (rev 278396)
@@ -749,17 +749,50 @@
 
 #if ENABLE(INLINE_PATH_DATA)
 
-void FillInlinePath::apply(GraphicsContext& context) const
+void FillLine::apply(GraphicsContext& context) const
 {
     context.fillPath(path());
 }
 
-static TextStream& operator<<(TextStream& ts, const FillInlinePath& item)
+static TextStream& operator<<(TextStream& ts, const FillLine& item)
 {
     ts.dumpProperty("path", item.path());
     return ts;
 }
 
+void FillArc::apply(GraphicsContext& context) const
+{
+    context.fillPath(path());
+}
+
+static TextStream& operator<<(TextStream& ts, const FillArc& item)
+{
+    ts.dumpProperty("path", item.path());
+    return ts;
+}
+
+void FillQuadCurve::apply(GraphicsContext& context) const
+{
+    context.fillPath(path());
+}
+
+static TextStream& operator<<(TextStream& ts, const FillQuadCurve& item)
+{
+    ts.dumpProperty("path", item.path());
+    return ts;
+}
+
+void FillBezierCurve::apply(GraphicsContext& context) const
+{
+    context.fillPath(path());
+}
+
+static TextStream& operator<<(TextStream& ts, const FillBezierCurve& item)
+{
+    ts.dumpProperty("path", item.path());
+    return ts;
+}
+
 #endif // ENABLE(INLINE_PATH_DATA)
 
 void FillPath::apply(GraphicsContext& context) const
@@ -950,27 +983,69 @@
 
 #if ENABLE(INLINE_PATH_DATA)
 
-std::optional<FloatRect> StrokeInlinePath::localBounds(const GraphicsContext& context) const
+std::optional<FloatRect> StrokeArc::localBounds(const GraphicsContext& context) const
 {
     // FIXME: Need to take stroke thickness into account correctly, via CGPathByStrokingPath().
     float strokeThickness = context.strokeThickness();
 
-    FloatRect bounds = path().fastBoundingRect();
+    auto bounds = path().fastBoundingRect();
     bounds.expand(strokeThickness, strokeThickness);
     return bounds;
 }
 
-void StrokeInlinePath::apply(GraphicsContext& context) const
+void StrokeArc::apply(GraphicsContext& context) const
 {
     context.strokePath(path());
 }
 
-static TextStream& operator<<(TextStream& ts, const StrokeInlinePath& item)
+static TextStream& operator<<(TextStream& ts, const StrokeArc& item)
 {
     ts.dumpProperty("path", item.path());
     return ts;
 }
 
+std::optional<FloatRect> StrokeQuadCurve::localBounds(const GraphicsContext& context) const
+{
+    // FIXME: Need to take stroke thickness into account correctly, via CGPathByStrokingPath().
+    float strokeThickness = context.strokeThickness();
+
+    auto bounds = path().fastBoundingRect();
+    bounds.expand(strokeThickness, strokeThickness);
+    return bounds;
+}
+
+void StrokeQuadCurve::apply(GraphicsContext& context) const
+{
+    context.strokePath(path());
+}
+
+static TextStream& operator<<(TextStream& ts, const StrokeQuadCurve& item)
+{
+    ts.dumpProperty("path", item.path());
+    return ts;
+}
+
+std::optional<FloatRect> StrokeBezierCurve::localBounds(const GraphicsContext& context) const
+{
+    // FIXME: Need to take stroke thickness into account correctly, via CGPathByStrokingPath().
+    float strokeThickness = context.strokeThickness();
+
+    auto bounds = path().fastBoundingRect();
+    bounds.expand(strokeThickness, strokeThickness);
+    return bounds;
+}
+
+void StrokeBezierCurve::apply(GraphicsContext& context) const
+{
+    context.strokePath(path());
+}
+
+static TextStream& operator<<(TextStream& ts, const StrokeBezierCurve& item)
+{
+    ts.dumpProperty("path", item.path());
+    return ts;
+}
+
 #endif // ENABLE(INLINE_PATH_DATA)
 
 void ClearRect::apply(GraphicsContext& context) const
@@ -1092,7 +1167,10 @@
     case ItemType::FillRoundedRect: ts << "fill-rounded-rect"; break;
     case ItemType::FillRectWithRoundedHole: ts << "fill-rect-with-rounded-hole"; break;
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::FillInlinePath: ts << "fill-inline-path"; break;
+    case ItemType::FillLine: ts << "fill-line"; break;
+    case ItemType::FillArc: ts << "fill-arc"; break;
+    case ItemType::FillQuadCurve: ts << "fill-quad-curve"; break;
+    case ItemType::FillBezierCurve: ts << "fill-bezier-curve"; break;
 #endif
     case ItemType::FillPath: ts << "fill-path"; break;
     case ItemType::FillEllipse: ts << "fill-ellipse"; break;
@@ -1107,7 +1185,9 @@
     case ItemType::StrokeRect: ts << "stroke-rect"; break;
     case ItemType::StrokeLine: ts << "stroke-line"; break;
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::StrokeInlinePath: ts << "stroke-inline-path"; break;
+    case ItemType::StrokeArc: ts << "stroke-arc"; break;
+    case ItemType::StrokeQuadCurve: ts << "stroke-quad-curve"; break;
+    case ItemType::StrokeBezierCurve: ts << "stroke-bezier-curve"; break;
 #endif
     case ItemType::StrokePath: ts << "stroke-path"; break;
     case ItemType::StrokeEllipse: ts << "stroke-ellipse"; break;
@@ -1247,9 +1327,18 @@
         ts << item.get<FillRectWithRoundedHole>();
         break;
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::FillInlinePath:
-        ts << item.get<FillInlinePath>();
+    case ItemType::FillLine:
+        ts << item.get<FillLine>();
         break;
+    case ItemType::FillArc:
+        ts << item.get<FillArc>();
+        break;
+    case ItemType::FillQuadCurve:
+        ts << item.get<FillQuadCurve>();
+        break;
+    case ItemType::FillBezierCurve:
+        ts << item.get<FillBezierCurve>();
+        break;
 #endif
     case ItemType::FillPath:
         ts << item.get<FillPath>();
@@ -1284,9 +1373,15 @@
         ts << item.get<StrokeLine>();
         break;
 #if ENABLE(INLINE_PATH_DATA)
-    case ItemType::StrokeInlinePath:
-        ts << item.get<StrokeInlinePath>();
+    case ItemType::StrokeArc:
+        ts << item.get<StrokeArc>();
         break;
+    case ItemType::StrokeQuadCurve:
+        ts << item.get<StrokeQuadCurve>();
+        break;
+    case ItemType::StrokeBezierCurve:
+        ts << item.get<StrokeBezierCurve>();
+        break;
 #endif
     case ItemType::StrokePath:
         ts << item.get<StrokePath>();

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h (278395 => 278396)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h	2021-06-03 05:09:02 UTC (rev 278395)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h	2021-06-03 06:26:55 UTC (rev 278396)
@@ -1846,45 +1846,84 @@
 
 #if ENABLE(INLINE_PATH_DATA)
 
-class InlinePathDataStorage {
+class FillLine {
 public:
-    InlinePathDataStorage(const InlinePathData& pathData)
+    static constexpr ItemType itemType = ItemType::FillLine;
+    static constexpr bool isInlineItem = true;
+    static constexpr bool isDrawingItem = true;
+
+    FillLine(const LineData& lineData)
+        : m_lineData(lineData)
     {
-        if (pathData.index() >= 0 && static_cast<size_t>(pathData.index()) < WTF::variant_size<InlinePathData>::value)
-            m_pathData = pathData;
-        else {
-            auto moved = WTFMove(m_pathData);
-            UNUSED_VARIABLE(moved);
-        }
     }
 
-    bool isValid() const { return !m_pathData.valueless_by_exception(); }
+    Path path() const { return Path::from({m_lineData}); }
+    void apply(GraphicsContext&) const;
+    std::optional<FloatRect> globalBounds() const { return std::nullopt; }
+    std::optional<FloatRect> localBounds(const GraphicsContext&) const { return path().fastBoundingRect(); }
 
-    Path path() const { return Path::from(m_pathData); }
+private:
+    LineData m_lineData;
+};
 
-protected:
-    InlinePathData m_pathData;
+class FillArc {
+public:
+    static constexpr ItemType itemType = ItemType::FillArc;
+    static constexpr bool isInlineItem = true;
+    static constexpr bool isDrawingItem = true;
+
+    FillArc(const ArcData& arcData)
+        : m_arcData(arcData)
+    {
+    }
+
+    Path path() const { return Path::from({m_arcData}); }
+    void apply(GraphicsContext&) const;
+    std::optional<FloatRect> globalBounds() const { return std::nullopt; }
+    std::optional<FloatRect> localBounds(const GraphicsContext&) const { return path().fastBoundingRect(); }
+
+private:
+    ArcData m_arcData;
 };
 
-class FillInlinePath : public InlinePathDataStorage {
+class FillQuadCurve {
 public:
-    static constexpr ItemType itemType = ItemType::FillInlinePath;
+    static constexpr ItemType itemType = ItemType::FillQuadCurve;
     static constexpr bool isInlineItem = true;
     static constexpr bool isDrawingItem = true;
 
-    FillInlinePath(const FillInlinePath& other)
-        : InlinePathDataStorage(other.m_pathData)
+    FillQuadCurve(const QuadCurveData& quadCurveData)
+        : m_quadCurveData(quadCurveData)
     {
     }
-    FillInlinePath(const InlinePathData& pathData)
-        : InlinePathDataStorage(pathData)
+
+    Path path() const { return Path::from({m_quadCurveData}); }
+    void apply(GraphicsContext&) const;
+    std::optional<FloatRect> globalBounds() const { return std::nullopt; }
+    std::optional<FloatRect> localBounds(const GraphicsContext&) const { return path().fastBoundingRect(); }
+
+private:
+    QuadCurveData m_quadCurveData;
+};
+
+class FillBezierCurve {
+public:
+    static constexpr ItemType itemType = ItemType::FillBezierCurve;
+    static constexpr bool isInlineItem = true;
+    static constexpr bool isDrawingItem = true;
+
+    FillBezierCurve(const BezierCurveData& bezierCurveData)
+        : m_bezierCurveData(bezierCurveData)
     {
     }
 
+    Path path() const { return Path::from({m_bezierCurveData}); }
     void apply(GraphicsContext&) const;
-
     std::optional<FloatRect> globalBounds() const { return std::nullopt; }
     std::optional<FloatRect> localBounds(const GraphicsContext&) const { return path().fastBoundingRect(); }
+
+private:
+    BezierCurveData m_bezierCurveData;
 };
 
 #endif // ENABLE(INLINE_PATH_DATA)
@@ -2135,6 +2174,13 @@
     static constexpr bool isInlineItem = true;
     static constexpr bool isDrawingItem = true;
 
+#if ENABLE(INLINE_PATH_DATA)
+    StrokeLine(const LineData& lineData)
+        : m_start(lineData.start)
+        , m_end(lineData.end)
+    {
+    }
+#endif
     StrokeLine(const FloatPoint& start, const FloatPoint& end)
         : m_start(start)
         , m_end(end)
@@ -2156,26 +2202,64 @@
 
 #if ENABLE(INLINE_PATH_DATA)
 
-class StrokeInlinePath : public InlinePathDataStorage {
+class StrokeArc {
 public:
-    static constexpr ItemType itemType = ItemType::StrokeInlinePath;
+    static constexpr ItemType itemType = ItemType::StrokeArc;
     static constexpr bool isInlineItem = true;
     static constexpr bool isDrawingItem = true;
 
-    StrokeInlinePath(const StrokeInlinePath& other)
-        : InlinePathDataStorage(other.m_pathData)
+    StrokeArc(const ArcData& arcData)
+        : m_arcData(arcData)
     {
     }
 
-    StrokeInlinePath(const InlinePathData& pathData)
-        : InlinePathDataStorage(pathData)
+    Path path() const { return Path::from({m_arcData}); }
+    void apply(GraphicsContext&) const;
+    std::optional<FloatRect> globalBounds() const { return std::nullopt; }
+    std::optional<FloatRect> localBounds(const GraphicsContext&) const;
+
+private:
+    ArcData m_arcData;
+};
+
+class StrokeQuadCurve {
+public:
+    static constexpr ItemType itemType = ItemType::StrokeQuadCurve;
+    static constexpr bool isInlineItem = true;
+    static constexpr bool isDrawingItem = true;
+
+    StrokeQuadCurve(const QuadCurveData& quadCurveData)
+        : m_quadCurveData(quadCurveData)
     {
     }
 
+    Path path() const { return Path::from({m_quadCurveData}); }
     void apply(GraphicsContext&) const;
+    std::optional<FloatRect> globalBounds() const { return std::nullopt; }
+    std::optional<FloatRect> localBounds(const GraphicsContext&) const;
 
+private:
+    QuadCurveData m_quadCurveData;
+};
+
+class StrokeBezierCurve {
+public:
+    static constexpr ItemType itemType = ItemType::StrokeBezierCurve;
+    static constexpr bool isInlineItem = true;
+    static constexpr bool isDrawingItem = true;
+
+    StrokeBezierCurve(const BezierCurveData& bezierCurveData)
+        : m_bezierCurveData(bezierCurveData)
+    {
+    }
+
+    Path path() const { return Path::from({m_bezierCurveData}); }
+    void apply(GraphicsContext&) const;
     std::optional<FloatRect> globalBounds() const { return std::nullopt; }
     std::optional<FloatRect> localBounds(const GraphicsContext&) const;
+
+private:
+    BezierCurveData m_bezierCurveData;
 };
 
 #endif // ENABLE(INLINE_PATH_DATA)
@@ -2430,8 +2514,13 @@
     , Translate
 
 #if ENABLE(INLINE_PATH_DATA)
-    , FillInlinePath
-    , StrokeInlinePath
+    , FillLine
+    , FillArc
+    , FillQuadCurve
+    , FillBezierCurve
+    , StrokeArc
+    , StrokeQuadCurve
+    , StrokeBezierCurve
 #endif
 
 #if ENABLE(VIDEO)
@@ -2500,7 +2589,10 @@
     WebCore::DisplayList::ItemType::FillRoundedRect,
     WebCore::DisplayList::ItemType::FillRectWithRoundedHole,
 #if ENABLE(INLINE_PATH_DATA)
-    WebCore::DisplayList::ItemType::FillInlinePath,
+    WebCore::DisplayList::ItemType::FillLine,
+    WebCore::DisplayList::ItemType::FillArc,
+    WebCore::DisplayList::ItemType::FillQuadCurve,
+    WebCore::DisplayList::ItemType::FillBezierCurve,
 #endif
     WebCore::DisplayList::ItemType::FillPath,
     WebCore::DisplayList::ItemType::FillEllipse,
@@ -2515,7 +2607,9 @@
     WebCore::DisplayList::ItemType::StrokeRect,
     WebCore::DisplayList::ItemType::StrokeLine,
 #if ENABLE(INLINE_PATH_DATA)
-    WebCore::DisplayList::ItemType::StrokeInlinePath,
+    WebCore::DisplayList::ItemType::StrokeArc,
+    WebCore::DisplayList::ItemType::StrokeQuadCurve,
+    WebCore::DisplayList::ItemType::StrokeBezierCurve,
 #endif
     WebCore::DisplayList::ItemType::StrokePath,
     WebCore::DisplayList::ItemType::StrokeEllipse,

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp (278395 => 278396)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2021-06-03 05:09:02 UTC (rev 278395)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2021-06-03 06:26:55 UTC (rev 278396)
@@ -372,7 +372,14 @@
 {
 #if ENABLE(INLINE_PATH_DATA)
     if (path.hasInlineData()) {
-        append<FillInlinePath>(path.inlineData());
+        if (path.hasInlineData<LineData>())
+            append<FillLine>(path.inlineData<LineData>());
+        else if (path.hasInlineData<ArcData>())
+            append<FillArc>(path.inlineData<ArcData>());
+        else if (path.hasInlineData<QuadCurveData>())
+            append<FillQuadCurve>(path.inlineData<QuadCurveData>());
+        else if (path.hasInlineData<BezierCurveData>())
+            append<FillBezierCurve>(path.inlineData<BezierCurveData>());
         return;
     }
 #endif
@@ -392,14 +399,15 @@
 void Recorder::strokePath(const Path& path)
 {
 #if ENABLE(INLINE_PATH_DATA)
-    if (path.hasInlineData<LineData>()) {
-        auto& lineData = path.inlineData<LineData>();
-        append<StrokeLine>(lineData.start, lineData.end);
-        return;
-    }
-
     if (path.hasInlineData()) {
-        append<StrokeInlinePath>(path.inlineData());
+        if (path.hasInlineData<LineData>())
+            append<StrokeLine>(path.inlineData<LineData>());
+        else if (path.hasInlineData<ArcData>())
+            append<StrokeArc>(path.inlineData<ArcData>());
+        else if (path.hasInlineData<QuadCurveData>())
+            append<StrokeQuadCurve>(path.inlineData<QuadCurveData>());
+        else if (path.hasInlineData<BezierCurveData>())
+            append<StrokeBezierCurve>(path.inlineData<BezierCurveData>());
         return;
     }
 #endif

Modified: trunk/Source/WebKit/ChangeLog (278395 => 278396)


--- trunk/Source/WebKit/ChangeLog	2021-06-03 05:09:02 UTC (rev 278395)
+++ trunk/Source/WebKit/ChangeLog	2021-06-03 06:26:55 UTC (rev 278396)
@@ -1,3 +1,15 @@
+2021-06-02  Rob Buis  <rb...@igalia.com>
+
+        Split FillInlinePath/StrokeInlinePath
+        https://bugs.webkit.org/show_bug.cgi?id=225687
+
+        Reviewed by Wenson Hsieh.
+
+        Adjust to new display list item types.
+
+        * GPUProcess/graphics/RemoteRenderingBackend.cpp:
+        (WebKit::RemoteRenderingBackend::decodeItem):
+
 2021-06-02  Chris Dumez  <cdu...@apple.com>
 
         Stop using a RefPtr<IPC::Connection> as HashMap key in DisplayLink

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp (278395 => 278396)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp	2021-06-03 05:09:02 UTC (rev 278395)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp	2021-06-03 06:26:55 UTC (rev 278396)
@@ -576,7 +576,10 @@
     case DisplayList::ItemType::EndTransparencyLayer:
     case DisplayList::ItemType::FillEllipse:
 #if ENABLE(INLINE_PATH_DATA)
-    case DisplayList::ItemType::FillInlinePath:
+    case DisplayList::ItemType::FillLine:
+    case DisplayList::ItemType::FillArc:
+    case DisplayList::ItemType::FillQuadCurve:
+    case DisplayList::ItemType::FillBezierCurve:
 #endif
     case DisplayList::ItemType::FillRect:
     case DisplayList::ItemType::FlushContext:
@@ -599,7 +602,9 @@
     case DisplayList::ItemType::SetStrokeThickness:
     case DisplayList::ItemType::StrokeEllipse:
 #if ENABLE(INLINE_PATH_DATA)
-    case DisplayList::ItemType::StrokeInlinePath:
+    case DisplayList::ItemType::StrokeArc:
+    case DisplayList::ItemType::StrokeQuadCurve:
+    case DisplayList::ItemType::StrokeBezierCurve:
 #endif
     case DisplayList::ItemType::StrokeRect:
     case DisplayList::ItemType::StrokeLine:

Modified: trunk/Tools/ChangeLog (278395 => 278396)


--- trunk/Tools/ChangeLog	2021-06-03 05:09:02 UTC (rev 278395)
+++ trunk/Tools/ChangeLog	2021-06-03 06:26:55 UTC (rev 278396)
@@ -1,3 +1,15 @@
+2021-06-02  Rob Buis  <rb...@igalia.com>
+
+        Split FillInlinePath/StrokeInlinePath
+        https://bugs.webkit.org/show_bug.cgi?id=225687
+
+        Reviewed by Wenson Hsieh.
+
+        Adjust to API new display list items.
+
+        * TestWebKitAPI/Tests/WebCore/DisplayListTests.cpp:
+        (TestWebKitAPI::TEST):
+
 2021-06-02  Jonathan Bedard  <jbed...@apple.com>
 
         [webkitcorepy] TaskPool shouldn't fork when 1 process is needed

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/DisplayListTests.cpp (278395 => 278396)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/DisplayListTests.cpp	2021-06-03 05:09:02 UTC (rev 278395)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/DisplayListTests.cpp	2021-06-03 06:26:55 UTC (rev 278396)
@@ -73,7 +73,7 @@
         list.append<FillRectWithGradient>(FloatRect { 1., 1., 10., 10. }, gradient);
         list.append<SetInlineFillColor>(Color::red);
 #if ENABLE(INLINE_PATH_DATA)
-        list.append<StrokeInlinePath>(InlinePathData { LineData {{ 0., 0. }, { 10., 15. }}});
+        list.append<StrokeLine>(LineData {{ 0., 0. }, { 10., 15. }});
 #endif
     }
 
@@ -113,14 +113,12 @@
             break;
         }
 #if ENABLE(INLINE_PATH_DATA)
-        case ItemType::StrokeInlinePath: {
+        case ItemType::StrokeLine: {
             EXPECT_TRUE(handle.isDrawingItem());
-            EXPECT_TRUE(handle.is<StrokeInlinePath>());
-            auto& item = handle.get<StrokeInlinePath>();
-            const auto path = item.path();
-            auto& line = path.inlineData<LineData>();
-            EXPECT_EQ(line.start, FloatPoint(0, 0));
-            EXPECT_EQ(line.end, FloatPoint(10., 15.));
+            EXPECT_TRUE(handle.is<StrokeLine>());
+            auto& item = handle.get<StrokeLine>();
+            EXPECT_EQ(item.start(), FloatPoint(0, 0));
+            EXPECT_EQ(item.end(), FloatPoint(10., 15.));
             break;
         }
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to