<?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>248357</bug_id>
          
          <creation_ts>2022-11-26 02:33:00 -0800</creation_ts>
          <short_desc>SVG text selection has bugs with collapsed whitespace</short_desc>
          <delta_ts>2024-08-29 07:23:08 -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>Safari Technology Preview</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=248356</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=184748</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>sabouhallawa</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1914750</commentid>
    <comment_count>0</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-11-26 02:33:00 -0800</bug_when>
    <thetext>Hi Team,

While going through Chromium Monorail, I come across another failing test case in Safari:

Link -  https://jsfiddle.net/progers/g1z286fL/

While trying to select text from world to next line &quot;hello&quot;, it does not paint the selection properly and jump it to first top line while it works fine in Chrome Canary 110.

It is broken in Safari Technology Preview 158 and 16.1 both, it was fixed with this commit:

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

It had some pre-requisite fixes for &quot;SelectionTestCase.js&quot; script, which I will land first so this can be looked into as potential blink merge.

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1916427</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-12-03 02:33:38 -0800</bug_when>
    <thetext>&lt;rdar://problem/102933142&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1931995</commentid>
    <comment_count>2</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-02-08 06:01:18 -0800</bug_when>
    <thetext>I tried this in following PR:

https://github.com/WebKit/WebKit/pull/9749

At least selection works in local testing but it does not pass the test and also regresses other, so there might be some pre-requisite to it or some other underlying difference.

NOTE - GTK does not regress the test cases, which got regressed on Mac-OS, which seems to indicate some vendor specific bits.

I am closing my PR for time being and going to test more locally.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1975367</commentid>
    <comment_count>3</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-09-04 07:07:02 -0700</bug_when>
    <thetext>Instead of &apos;squaredDistanceToClosestPoint&apos; from Chromium patch, merge this as well: https://chromium.googlesource.com/chromium/src.git/+/ec9931b6a84f86605970d9aab571d2ca429df2fa

(Implement) - https://chromium.googlesource.com/chromium/src.git/+/ac7237a24b28daa6f1c5292f32e940cc63fba39d</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1975423</commentid>
    <comment_count>4</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-09-04 15:53:27 -0700</bug_when>
    <thetext>Only got this failure locally: svg/text/select-textLength-spacingAndGlyphs-squeeze-3.svg

This would make it pass:

&lt;svg version=&quot;1.1&quot; baseProfile=&quot;basic&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; viewBox=&quot;0 0 160 120&quot;&gt;
&lt;g id=&quot;container&quot;/&gt;

&lt;!-- &quot;Squ&quot; should be selected, char 8-10 --&gt;
&lt;text id=&quot;test&quot; x=&quot;10&quot; y=&quot;10&quot; font-family=&quot;Arial&quot; font-size=&quot;10&quot; textLength=&quot;50&quot; lengthAdjust=&quot;spacingAndGlyphs&quot;&gt;Text to Squeeze&lt;/text&gt;

&lt;script xlink:href=&quot;resources/SelectionTestCase.js&quot;/&gt;
&lt;script&gt;selectRange(&quot;test&quot;, 8, 10, &quot;o &quot;);&lt;/script&gt;
&lt;/svg&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1981742</commentid>
    <comment_count>5</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-10-02 07:06:39 -0700</bug_when>
    <thetext>float FloatRect::squaredDistanceTo(const FloatPoint&amp; point) const
{
    FloatPoint closestPoint;
    closestPoint.setX(clampTo&lt;float&gt;(point.x(), x(), maxX()));
    closestPoint.setY(clampTo&lt;float&gt;(point.y(), y(), maxY()));
    return (point - closestPoint).diagonalLengthSquared();
}

^ In FloatRect.cpp

float squaredDistanceTo(const FloatPoint&amp;) const;

^ In FloatRect.h

____

Just wanted to update.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2056248</commentid>
    <comment_count>6</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-08-29 07:23:08 -0700</bug_when>
    <thetext>SVN is gone - https://github.com/chromium/chromium/commit/1bf89d746933e56ce69d972b77304102102d86c1</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>