<?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>241983</bug_id>
          
          <creation_ts>2022-06-24 13:56:20 -0700</creation_ts>
          <short_desc>CSS Relative Position Resetting Flex Container Position on Zoomed View</short_desc>
          <delta_ts>2023-09-06 13:45: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>CSS</component>
          <version>Safari 15</version>
          <rep_platform>Mac (Apple Silicon)</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>23113</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Shein Lin Phyo">sheinlinphyo</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>sheinlinphyo</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1878258</commentid>
    <comment_count>0</comment_count>
    <who name="Shein Lin Phyo">sheinlinphyo</who>
    <bug_when>2022-06-24 13:56:20 -0700</bug_when>
    <thetext>Set position to relative or absolute to flex container. Flex container is positioned relative to viewport like fixed in zoomed view.
Sample with relative position (bug): https://raw.githubusercontent.com/Penguinlay/Penguinlay/29d8279978379b60405bd8d1d42f5468cdcf1312/data/images/metrics.svg
Sample with static position (for comparison): https://raw.githubusercontent.com/Penguinlay/Penguinlay/29d8279978379b60405bd8d1d42f5468cdcf1312/data/images/metrics.svg
For both samples above, try zoom in and out with command + and command -. You will see that the numbers badges are out of place in the buggy one. (Zooming using touchpad does not cause the bug.)

The bug could be in the implementation of CSS, CSS for SVG or with how the browser paints the DOM elements, I am not sure.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1878639</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-06-27 17:56:54 -0700</bug_when>
    <thetext>&lt;rdar://problem/96025793&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1878648</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2022-06-27 19:10:18 -0700</bug_when>
    <thetext>Both your links are the same, but when I zoom I see the bug.

Does this occur if it&apos;s not nested inside &lt;foreignobject&gt; in SVG?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1878666</commentid>
    <comment_count>3</comment_count>
    <who name="Shein Lin Phyo">sheinlinphyo</who>
    <bug_when>2022-06-27 20:45:34 -0700</bug_when>
    <thetext>(In reply to Simon Fraser (smfr) from comment #2)
&gt; Both your links are the same, but when I zoom I see the bug.
&gt; 
&gt; Does this occur if it&apos;s not nested inside &lt;foreignobject&gt; in SVG?

Oh, I am so sorry. Here is the working one.
https://raw.githubusercontent.com/Penguinlay/Penguinlay/9fbe1cb6fbc83125a69c3e86ccf2f505641dd64b/data/images/metrics.svg

The bug image (again) for reference.
https://raw.githubusercontent.com/Penguinlay/Penguinlay/29d8279978379b60405bd8d1d42f5468cdcf1312/data/images/metrics.svg

## Reproduction

I fixed the issue by resetting the position to static from relative.
https://github.com/Penguinlay/Penguinlay/commit/29d8279978379b60405bd8d1d42f5468cdcf1312

Side by side comparison before and after resetting the position to static:
https://github.com/Penguinlay/Penguinlay/commit/9fbe1cb6fbc83125a69c3e86ccf2f505641dd64b

## Bug
I am not sure if it is limited to being nested inside &lt;foreignobject&gt;. I am gonna test it out now and let you know. But, I got a couple of clues I observe. 
1. You will see via &quot;start element selection&quot; in inspect element menu that the selection highlight are at the correct place. Just the rendering is out of place. Hope this would be helpful in debugging.
2. This bug can be reproducible in WebView, mobile Safari and MacOS Safari regardless of the OS or iOS version (I tested with my sister&apos;s devices which are in latest stable while mine are in latest developer betas.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1878677</commentid>
    <comment_count>4</comment_count>
    <who name="Shein Lin Phyo">sheinlinphyo</who>
    <bug_when>2022-06-27 22:01:51 -0700</bug_when>
    <thetext>## TL;DR

The bug only happens inside &lt;foreignobject&gt;.

## Minimal Reproduction

```html
&lt;style&gt;
    .container {
        align-items: center;
        background-color: lightblue;
        display: flex;
        flex-direction: column;
        height: 80px;
        width: 80px;
    }

    .item {
        position: relative;
    }
&lt;/style&gt;

&lt;div&gt;
    &lt;div class=&quot;container&quot;&gt;
        &lt;div class=&quot;item&quot;&gt;9&lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
```
This works fine.

```svg
&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;100&quot; height=&quot;100&quot;&gt;
    &lt;foreignObject x=&quot;0&quot; y=&quot;0&quot; width=&quot;100%&quot; height=&quot;100%&quot;&gt;
        &lt;style&gt;
            .container {
                align-items: center;
                background-color: lightblue;
                display: flex;
                flex-direction: column;
                height: 80px;
                width: 80px;
            }

            .item {
                position: relative;
            }
        &lt;/style&gt;
        &lt;div xmlns=&quot;http://www.w3.org/2000/xhtml&quot; xmlns:xlink=&quot;http://www.w3.org/2000/xlink&quot;&gt;
            &lt;div class=&quot;container&quot;&gt;
                &lt;div class=&quot;item&quot;&gt;9&lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/foreignObject&gt;
&lt;/svg&gt;
```
The is buggy whether xmlns and xmlns:xlink of div are of the year 1999 or 2000.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1975902</commentid>
    <comment_count>5</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2023-09-06 13:45:15 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 23113 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>