<?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>244966</bug_id>
          
          <creation_ts>2022-09-09 03:34:31 -0700</creation_ts>
          <short_desc>[LBSE] Outermost &lt;svg&gt; elements are not device-pixel aligned</short_desc>
          <delta_ts>2022-09-16 08:47:05 -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 Local Build</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>
          
          <blocked>90738</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Nikolas Zimmermann">zimmermann</reporter>
          <assigned_to name="Nikolas Zimmermann">zimmermann</assigned_to>
          <cc>rbuis</cc>
    
    <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>1897200</commentid>
    <comment_count>0</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2022-09-09 03:34:31 -0700</bug_when>
    <thetext>Whenever a SVG document fragment is placed in an enclosing HTML/CSS context, it receives its position per CSS rules (depending on &apos;display&apos;, &apos;position&apos;, etc.).
These are potentially sub-pixel positions, such as x=8, y=79.8456.

For HTML/CSS renderers the final position (in local coordinates) is pixel snapped, to enforce device-pixel alignment (no off-device-pixel painting).
In WebCore &quot;adjustedPaintOffset&quot; (== paintOffset [external] + location() [intrinsic]) is the quantity that&apos;s pixel snapped within the Render*::paint() methods.

The SVG render tree does not pixel snap any coordinates/lengths, except for the outermost &lt;svg&gt; renderer. There should be no visual difference between a HTML
document drawing a box with a green background, and an equivalent SVG document that does the same using a &lt;rect&gt; element. Therefore the legacy SVG engine always
rounded the &apos;adjustedPaintOffset&apos; to the nearest integer, simulating the effect in the HTML/CSS rendering tree (not correct in all deviceScaleFactor configurations though!).

In LBSE, pixel-snapping or rounding the &apos;adjustedPaintOffset&apos; in RenderSVGRoot won&apos;t have the same affect as in the legacy engine: LBSE uses self-painting layers
to paint the SVG document -- therefore any transformation needs to be applied on layer-level to affect the descendant renderers (that themselves use self-painting layers!).

RenderLayer::paintLayerByApplingTransform() already contains all the code necessary to place outer &lt;svg&gt; elements on device-pixel aligned boundaries. The subpixelOffset
is applied as transformation once for the outermost &lt;svg&gt;, and ignored (set to zero) for any other descendant SVG renderer. Pixel snapping is only relevant from RenderView
downwards to the (and including) RenderSVGRoot -- the rest of the SVG subtree is not using pixel snapping / device pixel alignment.

This will allow us to enable testing the few hundred tests in svg/dynamic-updates, that are currently skipped in LBSE (because they all fail).
All of them showed subtle rendering differences caused by the currently _missing_ device pixel alignment for RenderSVGRoot.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1897202</commentid>
    <comment_count>1</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2022-09-09 03:56:55 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/4158</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1898942</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-09-16 03:35:17 -0700</bug_when>
    <thetext>&lt;rdar://problem/100019924&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1898981</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-09-16 08:47:03 -0700</bug_when>
    <thetext>Committed 254558@main (de2323d7e2c8): &lt;https://commits.webkit.org/254558@main&gt;

Reviewed commits have been landed. Closing PR #4158 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>