Bug 240096 - Add check if referenced element is SVG for clip-path
Summary: Add check if referenced element is SVG for clip-path
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nikos Mouchtaris
URL:
Keywords: InRadar
Depends on: 240190
Blocks:
  Show dependency treegraph
 
Reported: 2022-05-04 16:37 PDT by Nikos Mouchtaris
Modified: 2022-05-06 15:43 PDT (History)
9 users (show)

See Also:


Attachments
Patch (1.94 KB, patch)
2022-05-04 16:43 PDT, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (1.94 KB, patch)
2022-05-04 16:48 PDT, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (3.63 KB, patch)
2022-05-04 20:51 PDT, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (3.64 KB, patch)
2022-05-05 11:35 PDT, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (3.09 KB, patch)
2022-05-05 11:43 PDT, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikos Mouchtaris 2022-05-04 16:37:37 PDT
Add check if referenced element is SVG for clip-path
Comment 1 Nikos Mouchtaris 2022-05-04 16:43:58 PDT
Created attachment 458834 [details]
Patch
Comment 2 Nikos Mouchtaris 2022-05-04 16:48:51 PDT
Created attachment 458835 [details]
Patch
Comment 3 Nikos Mouchtaris 2022-05-04 20:51:24 PDT
Created attachment 458847 [details]
Patch
Comment 4 Nikos Mouchtaris 2022-05-05 11:35:16 PDT
Created attachment 458898 [details]
Patch
Comment 5 Simon Fraser (smfr) 2022-05-05 11:39:33 PDT
Comment on attachment 458898 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=458898&action=review

> Source/WebCore/rendering/PathOperation.cpp:51
> +    if (!m_element)
> +        return nullptr;
>      return m_element.get();

This doesn't do anything. m_element.get() will already return null.
Comment 6 Nikos Mouchtaris 2022-05-05 11:43:30 PDT
Created attachment 458901 [details]
Patch
Comment 7 Nikos Mouchtaris 2022-05-05 11:44:30 PDT
(In reply to Simon Fraser (smfr) from comment #5)
> Comment on attachment 458898 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=458898&action=review
> 
> > Source/WebCore/rendering/PathOperation.cpp:51
> > +    if (!m_element)
> > +        return nullptr;
> >      return m_element.get();
> 
> This doesn't do anything. m_element.get() will already return null.

Fixed.
Comment 8 EWS 2022-05-05 16:51:26 PDT
Committed r293870 (250331@main): <https://commits.webkit.org/250331@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 458901 [details].
Comment 9 Radar WebKit Bug Importer 2022-05-05 16:52:13 PDT
<rdar://problem/92828539>
Comment 10 Tim Nguyen (:ntim) 2022-05-06 06:46:09 PDT
Comment on attachment 458901 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=458901&action=review

> Source/WebCore/style/StyleBuilderConverter.h:632
> +            if (is<SVGElement>(target.element.get()))
> +                return ReferencePathOperation::create(cssURLValue, fragment, downcast<SVGElement>(target.element.get()));
> +            return ReferencePathOperation::create(cssURLValue, fragment, nullptr);

This seems like a good usecase for dynamicDowncast:

return ReferencePathOperation::create(cssURLValue, fragment, dynamicDowncast<SVGElement>(target.element.get()));

It will be null if it's not a SVGElement.
Comment 11 Tim Nguyen (:ntim) 2022-05-06 15:43:04 PDT
Comment on attachment 458901 [details]
Patch

Sorry, accidentally obsoleted by putting the wrong bug number in commit message.