<?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>257615</bug_id>
          
          <creation_ts>2023-06-01 12:33:09 -0700</creation_ts>
          <short_desc>Fix getBBox() returning (0,0) bug when width or height is zero</short_desc>
          <delta_ts>2023-06-08 12:34:15 -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>SVG</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=93290</see_also>
          <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="Ahmad Saleem">ahmad.saleem792</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>karlcow</cc>
    
    <cc>sabouhallawa</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1959396</commentid>
    <comment_count>0</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-06-01 12:33:09 -0700</bug_when>
    <thetext>Hi Team,

While going through Blink commit, I came across another failing test case:

Test Case: https://bug-93290-attachments.webkit.org/attachment.cgi?id=156745

^ From our own bug 93290.

*** Safari Technology Preview 171 &amp; Firefox Nightly 115 ***

bbox size is: 0 by 0

*** Chrome Canary 116 ***

bbox size is: 0 by 100

___________________


Although, we fixed it in bug 93290 but the code is not today as was changed in the bug. (Might be reverted).

Blink Commit: https://src.chromium.org/viewvc/blink?view=revision&amp;revision=170097

^ I did local testing and now we match &apos;Chrome&apos;.

___________________

FAIL - https://jsfiddle.net/9wdL6xjf/show &amp; https://jsfiddle.net/f2m7kh69/show etc.

_____________________

Bounding Box Spec: https://svgwg.org/svg2-draft/coords.html#BoundingBoxes &amp; https://svgwg.org/svg2-draft/types.html#__svg__SVGGraphicsElement__getBBox

________________________

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1959578</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2023-06-02 10:54:32 -0700</bug_when>
    <thetext>git log for tests added with that fix shows an explanation from Said, see https://commits.webkit.org/217223@main:

    These tests were added in r169522. They succeed in Safari and Chrome but
    they fail in FireFox. The issue of calculating getBBox was discussed in:
    https://lists.w3.org/Archives/Public/www-svg/2012Aug/0014.html. But no
    resolution was reached.

So looks like we&apos;ve intentionally undone this change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1959805</commentid>
    <comment_count>2</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2023-06-04 22:16:18 -0700</bug_when>
    <thetext>In addition to what Alex mentioned
there are a number of issues around
https://wpt.fyi/results/svg/types/scripted?label=master&amp;label=experimental&amp;aligned&amp;q=getbbox

Also 
https://bugs.webkit.org/buglist.cgi?quicksearch=getbbox

Probably it would be worth to open an issue on 
https://github.com/w3c/svgwg/issues?q=is%3Aissue+is%3Aopen+getbbox

with a pointer to the thread Alex found.
https://lists.w3.org/Archives/Public/www-svg/2012Aug/thread.html#msg14

Gecko/WebKit at the time were aligned on ignoring the shape and consider it as a display: none.

The state of implementations was described in 
https://lists.w3.org/Archives/Public/www-svg/2012Aug/0043.html


On SVG 2 current Editor Draft
https://svgwg.org/svg2-draft/types.html#__svg__SVGGraphicsElement__getBBox


&gt; The getBBox method is used to compute the bounding box of 
&gt; the current element. When the getBBox(options) method is 
&gt; called, the bounding box algorithm is invoked for the 
&gt; current element, with fill, stroke, markers and clipped 
&gt; members of the options dictionary argument used to control 
&gt; which parts of the element are included in the bounding 
&gt; box, using the element&apos;s user coordinate system as the 
&gt; coordinate system to return the bounding box in. A newly 
&gt; created DOMRect object that defines the computed bounding 
&gt; box is returned. 

And the paragraph ends with:

&gt; If getBBox gets called on a non-rendered element, and 
&gt; the UA is not able to compute the geometry of the element, 
&gt; then throw an InvalidStateError.

So at least it should throw an InvalidStateError.


(If I understood correctly.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1960599</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-06-08 12:34:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/110480937&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>