Bug 240096

Summary: Add check if referenced element is SVG for clip-path
Product: WebKit Reporter: Nikos Mouchtaris <nmouchtaris>
Component: New BugsAssignee: Nikos Mouchtaris <nmouchtaris>
Status: RESOLVED FIXED    
Severity: Normal CC: changseok, esprehn+autocc, ews-watchlist, glenn, kondapallykalyan, ntim, pdr, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 240190    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

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.