<?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>264954</bug_id>
          
          <creation_ts>2023-11-16 07:55:48 -0800</creation_ts>
          <short_desc>Controlling layer size through scaling contexts is inconsistent when there are child layers.</short_desc>
          <delta_ts>2023-11-23 07:56:12 -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>Compositing</component>
          <version>Safari 15</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=27684</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="Onne Gorter">onne</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1993114</commentid>
    <comment_count>0</comment_count>
      <attachid>468619</attachid>
    <who name="Onne Gorter">onne</who>
    <bug_when>2023-11-16 07:55:48 -0800</bug_when>
    <thetext>Created attachment 468619
Small testcase. Zoom with +/-. Toggle content layer with spacebar.

We use a zooming setup, and to keep things sharp, do:
1. a global transform to zoom in or out (adding will-change: transform)
2. zoom content layers to match the size they are displayed at (adding will-change: transform)
3. zoom an inner layer back down to not distort actual content (no will-change)
4. actual content

Which works great normally. Element 1 becomes a transformation layer, element 2 becomes a layer backed by the appropriate amount of pixels. As users zoom, we sometimes switch the size and scale of that layer.

Until the content contains layers itself (backdrop filters, or simply will-change: transform set), then element 3 becomes a layer on its own, and it&apos;s amount of backing pixels is insufficient, making everything blurry.

This is unexpected and inconsistent. This setup works in all other browsers. (It works also in Firefox, though it doesn&apos;t use layers like this.)


I suspect that in Safari 14 this setup works, but I cannot test this, it used to work. In Safari 15.6  and Safari 16 that element 3 becoming a layer is unavoidable.

One workaround is to use `zoom: X` instead of `transform: scale(X)` for 3, except that texts don&apos;t behave the same at all zoom levels.

See the attachment for a minimal setup. If you turn on &quot;Show Compositing Borders&quot; in the inspector layer panel, you can see what is happening.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1993236</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2023-11-16 13:51:20 -0800</bug_when>
    <thetext>I think this is bug 27684 ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1993367</commentid>
    <comment_count>2</comment_count>
    <who name="Onne Gorter">onne</who>
    <bug_when>2023-11-17 00:54:58 -0800</bug_when>
    <thetext>It could be that any fix to https://bugs.webkit.org/show_bug.cgi?id=27684 fixes our situation as well.


Basically, you&apos;d expect a layer from this:

  &lt;div style=&quot;transform: translateZ(0.1px) scale(4); transform-origin: 0 0;&quot;&gt;Blurry&lt;/div&gt;

To get a backing buffer that is 4 * width x 4 * height, which it does on Chrome, but not on Safari.


But the case for this report is different. There is a correctly sized and scaled layer with backing buffer. But the moment a child layer appears, an implicit layer is created. While:
- That implicit layer is not necessary, as it can merge with the layer of its direct parent. Instead, now it turns that parent layer from one with a backing buffer, to one that is just a transformation layer.
- And, to add insult to injury, that implicit layer has a badly sized backing buffer. Likely because of that scale bug, though, technically, we scale that layer down, so maybe, despite that bug, it does get the right size, just not a suitable size.


Note that because of this, for our editor at http://framer.com, can only be used for &quot;simpler&quot; documents. The moment clients use things with layers, zooming in makes everything look blurry and unusable. I cannot test older version of Safari, but I strongly suspect the problem was introduced in Safari 15.6.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1994549</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-11-23 07:56:12 -0800</bug_when>
    <thetext>&lt;rdar://problem/118748860&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>468619</attachid>
            <date>2023-11-16 07:55:48 -0800</date>
            <delta_ts>2023-11-16 07:55:48 -0800</delta_ts>
            <desc>Small testcase. Zoom with +/-. Toggle content layer with spacebar.</desc>
            <filename>index.html</filename>
            <type>text/html</type>
            <size>4992</size>
            <attacher name="Onne Gorter">onne</attacher>
            
              <data encoding="base64">PCEtLSBydW4gd2l0aCBgcGFyY2VsIGluZGV4Lmh0bWxgIGZvciBob3QgcmVsb2FkIHdoaWxlIGVk
aXRpbmcgLS0+CjxzdHlsZT4KICAgICNjb250YWluZXIgewogICAgICAgIHBvc2l0aW9uOiBhYnNv
bHV0ZTsKICAgICAgICBiYWNrZ3JvdW5kOiBsaWdodGdyYXk7CiAgICAgICAgaW5zZXQ6IDA7CiAg
ICAgICAgb3ZlcmZsb3c6IGhpZGRlbjsKICAgIH0KCiAgICAjY2FudmFzIHsKICAgICAgICBwb3Np
dGlvbjogYWJzb2x1dGU7CiAgICAgICAgdG9wOiAwOwogICAgICAgIGxlZnQ6IDA7CiAgICAgICAg
d2lkdGg6IDA7CiAgICAgICAgaGVpZ2h0OiAwOwogICAgICAgIHdpbGwtY2hhbmdlOiB0cmFuc2Zv
cm07CiAgICAgICAgdHJhbnNmb3JtLW9yaWdpbjogdG9wIGxlZnQ7CiAgICB9CgogICAgI3RpbGVX
cmFwcGVyIHsKICAgICAgICBwb3NpdGlvbjogYWJzb2x1dGU7CiAgICAgICAgd2lsbC1jaGFuZ2U6
IHRyYW5zZm9ybTsKICAgICAgICB0cmFuc2Zvcm0tb3JpZ2luOiB0b3AgbGVmdDsKICAgIH0KCiAg
ICAjdGlsZUlubmVyIHsKICAgICAgICB0cmFuc2Zvcm0tb3JpZ2luOiB0b3AgbGVmdDsKICAgIH0K
PC9zdHlsZT4KCjxkaXYgaWQ9ImNvbnRhaW5lciI+CiAgICA8ZGl2IGlkPSJjYW52YXMiPgogICAg
ICAgIDxkaXYgaWQ9InRpbGVXcmFwcGVyIj4KICAgICAgICAgICAgPGRpdiBpZD0idGlsZUlubmVy
IiBzdHlsZT0iYmFja2dyb3VuZDogd2hpdGUiPgogICAgICAgICAgICAgICAgQ09OVEVOVAogICAg
ICAgICAgICAgICAgPGJyIC8+bW92ZSB3aXRoIGN1cnNvciBrZXlzIDxiciAvPnpvb20gd2l0aCAr
Ly0sIG9yIDEvMgogICAgICAgICAgICAgICAgPGRpdgogICAgICAgICAgICAgICAgICAgIGlkPSJj
b250ZW50V2lsbENoYW5nZSIKICAgICAgICAgICAgICAgICAgICBzdHlsZT0iCiAgICAgICAgICAg
ICAgICAgICAgICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTsKICAgICAgICAgICAgICAgICAgICAgICAg
d2lkdGg6IDEyNXB4OwogICAgICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6IDc1cHg7CiAgICAg
ICAgICAgICAgICAgICAgICAgIHRvcDogNjBweDsKICAgICAgICAgICAgICAgICAgICAgICAgbGVm
dDogMjVweDsKICAgICAgICAgICAgICAgICAgICAgICAgYmFja2dyb3VuZDogbGlnaHR5ZWxsb3c7
CiAgICAgICAgICAgICAgICAgICAgICAgIHdpbGwtY2hhbmdlOiB0cmFuc2Zvcm07CiAgICAgICAg
ICAgICAgICAgICAgIgogICAgICAgICAgICAgICAgPgogICAgICAgICAgICAgICAgICAgIExBWUVS
CiAgICAgICAgICAgICAgICAgICAgPGJyIC8+dG9nZ2xlIGxheWVyIG9uL29mZiB3aXRoIHNwYWNl
YmFyCiAgICAgICAgICAgICAgICA8L2Rpdj4KICAgICAgICAgICAgPC9kaXY+CiAgICA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1cGRhdGVGcmFt
ZSgpCgogICAgZG9jdW1lbnQub25rZXlkb3duID0gKGV2ZW50KSA9PiB7CiAgICAgICAgY29uc29s
ZS5sb2coImV2ZW50LmtleSIsIGV2ZW50LmtleSkKICAgICAgICB1cGRhdGVGcmFtZSgpCiAgICAg
ICAgaWYgKGV2ZW50LmtleSA9PT0gIjEiKSB7CiAgICAgICAgICAgIHN0YXRlLnpvb20gPSAxCiAg
ICAgICAgfSBlbHNlIGlmIChldmVudC5rZXkgPT09ICIyIikgewogICAgICAgICAgICBzdGF0ZS56
b29tID0gNQogICAgICAgIH0gZWxzZSBpZiAoZXZlbnQua2V5ID09PSAiLSIpIHsKICAgICAgICAg
ICAgc3RhdGUuem9vbSAtPSAwLjI1CiAgICAgICAgICAgIGlmIChzdGF0ZS56b29tIDwgMC4yNSkg
c3RhdGUuem9vbSA9IDAuMjUKICAgICAgICB9IGVsc2UgaWYgKGV2ZW50LmtleSA9PT0gIj0iKSB7
CiAgICAgICAgICAgIHN0YXRlLnpvb20gKz0gMC4yNQogICAgICAgICAgICBpZiAoc3RhdGUuem9v
bSA+IDMyKSBzdGF0ZS56b29tID0gMzIKICAgICAgICB9IGVsc2UgaWYgKGV2ZW50LmtleSA9PSAi
QXJyb3dMZWZ0IikgewogICAgICAgICAgICBzdGF0ZS5vZmZzZXRYIC09IDEwCiAgICAgICAgfSBl
bHNlIGlmIChldmVudC5rZXkgPT0gIkFycm93UmlnaHQiKSB7CiAgICAgICAgICAgIHN0YXRlLm9m
ZnNldFggKz0gMTAKICAgICAgICB9IGVsc2UgaWYgKGV2ZW50LmtleSA9PSAiQXJyb3dVcCIpIHsK
ICAgICAgICAgICAgc3RhdGUub2Zmc2V0WSAtPSAxMAogICAgICAgIH0gZWxzZSBpZiAoZXZlbnQu
a2V5ID09ICJBcnJvd0Rvd24iKSB7CiAgICAgICAgICAgIHN0YXRlLm9mZnNldFkgKz0gMTAKICAg
ICAgICB9IGVsc2UgaWYgKGV2ZW50LmtleSA9PSAiICIpIHsKICAgICAgICAgICAgY29uc3QgY29u
dGVudFdpbGxDaGFuZ2UgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgiY29udGVudFdpbGxDaGFu
Z2UiKQogICAgICAgICAgICBpZiAoY29udGVudFdpbGxDaGFuZ2Uuc3R5bGUud2lsbENoYW5nZSA9
PSAidHJhbnNmb3JtIikgewogICAgICAgICAgICAgICAgY29udGVudFdpbGxDaGFuZ2Uuc3R5bGUu
d2lsbENoYW5nZSA9ICJ1bnNldCIKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAg
IGNvbnRlbnRXaWxsQ2hhbmdlLnN0eWxlLndpbGxDaGFuZ2UgPSAidHJhbnNmb3JtIgogICAgICAg
ICAgICB9CiAgICAgICAgfQogICAgfQo8L3NjcmlwdD4K
</data>

          </attachment>
      

    </bug>

</bugzilla>