Title: [293870] trunk/Source/WebCore
Revision
293870
Author
nmouchta...@apple.com
Date
2022-05-05 16:50:17 -0700 (Thu, 05 May 2022)

Log Message

Add check if referenced element is SVG for clip-path
https://bugs.webkit.org/show_bug.cgi?id=240096

Reviewed by Simon Fraser.

Add check when creating new ReferencePathOperation that it is referencing
an svg element.

* style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertPathOperation):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (293869 => 293870)


--- trunk/Source/WebCore/ChangeLog	2022-05-05 23:43:45 UTC (rev 293869)
+++ trunk/Source/WebCore/ChangeLog	2022-05-05 23:50:17 UTC (rev 293870)
@@ -1,3 +1,16 @@
+2022-05-05  Nikolaos Mouchtaris  <nmouchta...@apple.com>
+
+        Add check if referenced element is SVG for clip-path
+        https://bugs.webkit.org/show_bug.cgi?id=240096
+
+        Reviewed by Simon Fraser.
+
+        Add check when creating new ReferencePathOperation that it is referencing
+        an svg element.
+
+        * style/StyleBuilderConverter.h:
+        (WebCore::Style::BuilderConverter::convertPathOperation):
+
 2022-05-05  Cameron McCormack  <hey...@apple.com>
 
         Avoid using WebCore::Colors created with out-of-line components in DrawGlyphsRecorder

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (293869 => 293870)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2022-05-05 23:43:45 UTC (rev 293869)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2022-05-05 23:50:17 UTC (rev 293870)
@@ -1527,7 +1527,7 @@
     case PathOperation::Shape:
         return downcast<ShapePathOperation>(operation).pathForReferenceRect(box);
     case PathOperation::Reference:
-        if (!is<SVGPathElement>(downcast<ReferencePathOperation>(operation).element()) && !is<SVGGeometryElement>(downcast<ReferencePathOperation>(operation).element()))
+        if (!downcast<ReferencePathOperation>(operation).element() || (!is<SVGPathElement>(downcast<ReferencePathOperation>(operation).element()) && !is<SVGGeometryElement>(downcast<ReferencePathOperation>(operation).element())))
             return std::nullopt;
         return pathFromGraphicsElement(downcast<ReferencePathOperation>(operation).element());
     case PathOperation::Box:

Modified: trunk/Source/WebCore/style/StyleBuilderConverter.h (293869 => 293870)


--- trunk/Source/WebCore/style/StyleBuilderConverter.h	2022-05-05 23:43:45 UTC (rev 293869)
+++ trunk/Source/WebCore/style/StyleBuilderConverter.h	2022-05-05 23:50:17 UTC (rev 293870)
@@ -629,7 +629,9 @@
             auto fragment = SVGURIReference::fragmentIdentifierFromIRIString(cssURLValue, builderState.document());
             // FIXME: It doesn't work with external SVG references (see https://bugs.webkit.org/show_bug.cgi?id=126133)
             auto target = SVGURIReference::targetElementFromIRIString(cssURLValue, builderState.document());
-            return ReferencePathOperation::create(cssURLValue, fragment, downcast<SVGElement>(target.element.get()));
+            if (is<SVGElement>(target.element.get()))
+                return ReferencePathOperation::create(cssURLValue, fragment, downcast<SVGElement>(target.element.get()));
+            return ReferencePathOperation::create(cssURLValue, fragment, nullptr);
         }
         ASSERT(primitiveValue.valueID() == CSSValueNone);
         return nullptr;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to