<?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>291045</bug_id>
          
          <creation_ts>2025-04-03 18:53:14 -0700</creation_ts>
          <short_desc>Convert url types to strongly typed CSS/Style values</short_desc>
          <delta_ts>2025-06-09 14:14:59 -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>CSS</component>
          <version>Safari 18</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sam Weinig">sam</reporter>
          <assigned_to name="Sam Weinig">sam</assigned_to>
          <cc>koivisto</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2108731</commentid>
    <comment_count>0</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2025-04-03 18:53:14 -0700</bug_when>
    <thetext>Convert url types to strongly typed CSS/Style values.

This will prepare us for adding url request modifiers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2108739</commentid>
    <comment_count>1</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2025-04-03 19:19:46 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/43613</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2109075</commentid>
    <comment_count>2</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-04-04 20:05:10 -0700</bug_when>
    <thetext>Committed 293295@main (0edc4f619186): &lt;https://commits.webkit.org/293295@main&gt;

Reviewed commits have been landed. Closing PR #43613 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2109132</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-04-05 11:39:51 -0700</bug_when>
    <thetext>&lt;rdar://problem/148665187&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2122433</commentid>
    <comment_count>4</comment_count>
    <who name="Wenson Hsieh">wenson_hsieh</who>
    <bug_when>2025-06-08 16:22:07 -0700</bug_when>
    <thetext>FWIW — this seems to have caused a subtle bug with regards to how CSS URLs are resolved in elements within templates. In this test case for example:

```
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width&quot;&gt;
&lt;head&gt;
&lt;style&gt;
.container {
    width: 400px;
    height: 400px;
    border: 1px solid lightgray;
    margin: 1em;
}

button {
    font-size: 18px;
    padding: 0.5em;
    margin: 1em;
}
&lt;/style&gt;
&lt;script&gt;
addEventListener(&quot;load&quot;, () =&gt; {
    const template = document.querySelector(&quot;template&quot;);
    document.body.appendChild(template.content.cloneNode(true));
    document.body.appendChild(template.content.children[0]);
    document.querySelector(&quot;button&quot;).addEventListener(&quot;click&quot;, () =&gt; {
        for (let container of [...document.querySelectorAll(&quot;.container&quot;)])
            container.style = container.getAttribute(&quot;style&quot;);
    });
});
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;template&gt;
        &lt;div class=&quot;container&quot; style=&quot;background-image: url(&apos;images/webkit.png&apos;);&quot;&gt;&lt;/div&gt;
    &lt;/template&gt;
    &lt;button&gt;Click to re-parse style&lt;/button&gt;
&lt;/body&gt;
&lt;/html&gt;
```

...where `images/webkit.png` is just some relative path to an image file, the `container` element&apos;s `background-image` style will first be *resolved* to `images/webkit.png` because the base URL in the template element is `about:blank`. After either (1) cloning the element and adding the clone to the document or (2) directly moving the element from the template to the document, the resolved URL remains `images/webkit.png` instead of being updated to reflect the document&apos;s base URL, which causes the resource request to fail.

Clicking the button (which just sets the inline style to itself on both containers) fixes the bug, since it forces a style to be rebuilt, this time resolving against the CSS parser context of the document, rather than the template.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2122596</commentid>
    <comment_count>5</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2025-06-09 14:14:59 -0700</bug_when>
    <thetext>I filed bug 294219 to track this.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>