<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>45277</bug_id>
          
          <creation_ts>2010-09-06 15:41:03 -0700</creation_ts>
          <short_desc>Canvas api: c.createPattern(img,...) does not work if image is SVG</short_desc>
          <delta_ts>2024-05-22 09:32:45 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>UNCONFIRMED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc>https://jsfiddle.net/Lp1uvqoe/</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Thaddee Tyl">thaddee.tyl</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>james</cc>
    
    <cc>karlcow</cc>
    
    <cc>knuts763</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>274794</commentid>
    <comment_count>0</comment_count>
      <attachid>66671</attachid>
    <who name="Thaddee Tyl">thaddee.tyl</who>
    <bug_when>2010-09-06 15:41:03 -0700</bug_when>
    <thetext>Created attachment 66671
Canvas with an SVG image drawn as a pattern

Reproducibility: always.

Steps:
1. Go to a page that invokes c.createPattern(img, &quot;repeat&quot;); with an SVG image and draws the pattern onto a canvas.
2. Consider the fact that it does not appear.

Notes:
* c.fill() do not work.
* c.stroke() do not work.
* It is not an image loading issue.
* It is not linked to the &quot;repeat&quot; part -- &quot;no-repeat&quot;, &quot;repeat-x&quot;, &quot;repeat-y&quot;, &quot;&quot;, and null, all yield the same result.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1087351</commentid>
    <comment_count>1</comment_count>
    <who name="stml">james</who>
    <bug_when>2015-04-22 04:56:30 -0700</bug_when>
    <thetext>I have also independently encountered this bug, with comparable results.

var img = new Image();
img.onload = function() {
    var pattern = badge.createPattern(img, &apos;repeat&apos;);
    badge.fillStyle = pattern;
    // draw &apos;badge&apos; shape
    badge.fill();
    };  
img.src = &apos;../flags/iso/&apos;+country+&apos;.svg&apos;;

This works as expected in Firefox and Chrome, but in Safari (7.0.3) the background is blank (white). Using a png or jpg for the pattern works as expected in Safari et al - it&apos;s only SVGs that render incorrectly. DrawImage also works in Safari for SVGs - it&apos;s only createPattern that fails.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1753590</commentid>
    <comment_count>2</comment_count>
    <who name="">knuts763</who>
    <bug_when>2021-04-23 08:18:01 -0700</bug_when>
    <thetext>Looks like this is still broken</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2037036</commentid>
    <comment_count>3</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-05-22 09:32:45 -0700</bug_when>
    <thetext>Changed above and only changed from SRC to newer placeholder SVG - https://jsfiddle.net/Lp1uvqoe/

All browsers (Safari 17.5, Chrome Canary 127 and Firefox Nightly 128) looks same here.

@Karl - any input?</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>66671</attachid>
            <date>2010-09-06 15:41:03 -0700</date>
            <delta_ts>2010-09-06 15:41:03 -0700</delta_ts>
            <desc>Canvas with an SVG image drawn as a pattern</desc>
            <filename>bugCan.html</filename>
            <type>text/html</type>
            <size>546</size>
            <attacher name="Thaddee Tyl">thaddee.tyl</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+Cjx0aXRsZT5Vbml2ZXJzYWwgY2FudmFzIGJ1ZzwvdGl0bGU+CjxjYW52
YXM+PC9jYW52YXM+CjxzY3JpcHQ+CnZhciBjYW4gPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFn
TmFtZSgnY2FudmFzJylbMF07CnZhciBjID0gY2FuLmdldENvbnRleHQoJzJkJyk7CnZhciBpbWcg
PSBuZXcgSW1hZ2UoKTsKaW1nLnNyYyA9ICdodHRwOi8vY3JvY3ppbGxhLmNvbS9iaXRzX2FuZF9w
aWVjZXMvc3ZnL3NhbXBsZXMvbGlvbi9saW9uLnN2Zyc7Ci8vaW1nLnNyYyA9ICd0aXJzLnBuZyc7
CmltZy5vbmxvYWQgPSBmdW5jdGlvbigpIHsKIHZhciBwYXQgPSBjLmNyZWF0ZVBhdHRlcm4oaW1n
LCJyZXBlYXQiKTsKIGMuZmlsbFN0eWxlID0gcGF0OwogYy5maWxsUmVjdCgwLDAsYy5jYW52YXMu
d2lkdGgsYy5jYW52YXMuaGVpZ2h0KTsKfQo8L3NjcmlwdD4KPHA+V2hhdCBzaG91bGQgYXBwZWFy
IGFib3ZlIGlzOjxicj4KPGltZyBzcmM9Imh0dHA6Ly9jcm9jemlsbGEuY29tL2JpdHNfYW5kX3Bp
ZWNlcy9zdmcvc2FtcGxlcy9saW9uL2xpb24uc3ZnIj4K
</data>

          </attachment>
      

    </bug>

</bugzilla>