<?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>200423</bug_id>
          
          <creation_ts>2019-08-03 18:41:43 -0700</creation_ts>
          <short_desc>Wrong SVG intrinsic width when removing the height attribute and setting the viewBox attribute</short_desc>
          <delta_ts>2025-11-12 13:46:11 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>SVG</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>200143</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Said Abou-Hallawa">sabouhallawa</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>karlcow</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1558327</commentid>
    <comment_count>0</comment_count>
      <attachid>375493</attachid>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2019-08-03 18:41:43 -0700</bug_when>
    <thetext>Created attachment 375493
test case

Open the attached test case.

Expected: No alert messages and child &lt;rect&gt; element fills the whole SVG client rect.
Result: An alert message is invoked and the intrinsic with of the SVG is wrong.

Related WPT test is: https://wpt.fyi/results/svg/coordinate-systems/outer-svg-intrinsic-size-001.html?label=master&amp;label=experimental</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1558328</commentid>
    <comment_count>1</comment_count>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2019-08-03 18:47:55 -0700</bug_when>
    <thetext>Similarly, the SVG intrinsic height is not calculated correctly if the width attribute is removed and the viewBox attribute is set.

Related WPT test is: https://wpt.fyi/results/svg/coordinate-systems/outer-svg-intrinsic-size-002.html?label=master&amp;label=experimental</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2136444</commentid>
    <comment_count>2</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2025-08-14 01:07:53 -0700</bug_when>
    <thetext>With:
&lt;svg id=&quot;mySVG&quot; viewBox=&quot;0 0 40 30&quot; height=&quot;60&quot;&gt;

let svgElem = document.getElementById(&quot;mySVG&quot;);

svgElem.getBoundingClientRect().width: 80
svgElem.getBoundingClientRect().height: 60 

Then 

svgElem.setAttribute(&quot;viewBox&quot;, &quot;0 0 100 120&quot;);

so it becomes
&lt;svg id=&quot;mySVG&quot; style=&quot;background-color:gold;&quot; viewBox=&quot;0 0 100 120&quot; height=&quot;60&quot;&gt;&lt;/svg&gt;


svgElem.getBoundingClientRect().width: 80   &lt;-- WRONG
svgElem.getBoundingClientRect().height: 60 

instead of 

svgElem.getBoundingClientRect().width: 50
svgElem.getBoundingClientRect().height: 60</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2136446</commentid>
    <comment_count>3</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2025-08-14 01:15:25 -0700</bug_when>
    <thetext>This is failing in both Legacy and LBSE.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2136447</commentid>
    <comment_count>4</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2025-08-14 01:18:30 -0700</bug_when>
    <thetext>Maybe to fix in https://searchfox.org/wubkat/source/Source/WebCore/svg/SVGSVGElement.cpp</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2158330</commentid>
    <comment_count>5</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2025-11-12 13:46:11 -0800</bug_when>
    <thetext>It seems to pass now on Safari 26.2 Beta and matches with Chrome Canary 144.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>375493</attachid>
            <date>2019-08-03 18:41:43 -0700</date>
            <delta_ts>2019-08-03 18:41:43 -0700</delta_ts>
            <desc>test case</desc>
            <filename>set-viewbox-attribute.html</filename>
            <type>text/html</type>
            <size>1028</size>
            <attacher name="Said Abou-Hallawa">sabouhallawa</attacher>
            
              <data encoding="base64">PHN0eWxlPgogICN3cmFwcGVyIHsKICAgICAgd2lkdGg6IDUwMHB4OwogIH0KICAjbXlTVkcgewog
ICAgYm9yZGVyOiAxcHggcmVkIHNvbGlkOwogIH0KPC9zdHlsZT4KPGJvZHk+CiAgPGRpdiBpZD0i
d3JhcHBlciI+CiAgICA8c3ZnIGlkPSJteVNWRyI+CiAgICAgIDxyZWN0ICB3aWR0aD0iMTAwJSIg
aGVpZ2h0PSIxMDAlIiBmaWxsPSJncmVlbiIvPgogICAgPC9zdmc+CiAgPC9kaXY+CiAgPHNjcmlw
dD4KICAgIGxldCBzdmdFbGVtID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoIm15U1ZHIik7CiAg
ICBmdW5jdGlvbiBleHBlY3Rfc3ZnX3dpZHRoX2FuZF9oZWlnaHQod2lkdGgsIGhlaWdodCkgewog
ICAgICAgIGxldCByZWN0ID0gc3ZnRWxlbS5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTsKICAgICAg
ICBpZiAocmVjdC53aWR0aCAhPSB3aWR0aCkKICAgICAgICAgIGFsZXJ0KCJjaGVja2luZyB3aWR0
aDogcmVjdC53aWR0aCA9ICIgKyByZWN0LndpZHRoICsgIiwgZXhwZWN0ZWQgd2lkdGggPSAiICsg
d2lkdGgpOwogICAgICAgIGlmIChyZWN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