<?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>164949</bug_id>
          
          <creation_ts>2016-11-18 13:27:19 -0800</creation_ts>
          <short_desc>-webkit-overflow-scrolling: touch completely breaks 3D perspective functionality</short_desc>
          <delta_ts>2020-06-26 07:36:42 -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 10</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>156435</dup_id>
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=83337</see_also>
          <bug_file_loc>https://drafts.csswg.org/css-transforms-2/#grouping-property-values</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="AliG">aghassemi+bugzilla</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ajuma</cc>
    
    <cc>fred.wang</cc>
    
    <cc>me</cc>
    
    <cc>rwlbuis</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1252809</commentid>
    <comment_count>0</comment_count>
    <who name="AliG">aghassemi+bugzilla</who>
    <bug_when>2016-11-18 13:27:19 -0800</bug_when>
    <thetext>CSS perspective and translateZ provide an efficient way of creating scroll parallax effect however in iOS Safari, adding -webkit-overflow-scrolling: touch; completely breaks all the 3D and perspective effects.

Please see http://codepen.io/aghassemi/pen/QGdKbZ for an example. The only difference between the two divs is the value of webkit-overflow-scrolling but notice how perspective is ignored on the second div.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1255372</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2016-12-01 12:42:09 -0800</bug_when>
    <thetext>&lt;rdar://problem/29464710&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1387183</commentid>
    <comment_count>2</comment_count>
    <who name="Jayden Seric">me</who>
    <bug_when>2018-01-09 03:03:47 -0800</bug_when>
    <thetext>Sad to see there has been no activity for over a year for such a visually disruptive bug without a decent workaround.

This is the best I could come up with for displaying a scrollable list of cards, stacked on an angle. It looks weird though because there is not a single perspective origin:

.container {
  perspective: 1000px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.child {
  transform: rotateY(45deg);
}

@supports (-webkit-overflow-scrolling: touch) {
  .container {
    perspective: none;
  }
  .child {
    transform: perspective(1000px) rotateY(45deg);
  }
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1426065</commentid>
    <comment_count>3</comment_count>
      <attachid>340960</attachid>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2018-05-22 01:02:41 -0700</bug_when>
    <thetext>Created attachment 340960
testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1426117</commentid>
    <comment_count>4</comment_count>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2018-05-22 05:43:45 -0700</bug_when>
    <thetext>Some preliminary debugging: When webkit-overflow-scrolling is absent RenderLayerCompositor::computeCompositingRequirements will execute

    if (!willBeComposited &amp;&amp; canBeComposited(layer)
        &amp;&amp; requiresCompositingForIndirectReason(layer.renderer(), childState.subtreeIsCompositing, anyDescendantHas3DTransform, indirectCompositingReason)) {
        layer.setIndirectCompositingReason(indirectCompositingReason);
        childState.compositingAncestor = &amp;layer;
        overlapMap.pushCompositingContainer();
        addToOverlapMapRecursive(overlapMap, layer);
        willBeComposited = true;
    }

where requiresCompositingForIndirectReason returns true because of the perspective property on the overflow node and the 3D transform on its descendants. If the overflow node has overflow-scrolling:touch, willBeComposited is however set to true at the top of the function so this conditional is never executed. I&apos;m not yet sure how/whether this is causing the bug, though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1426135</commentid>
    <comment_count>5</comment_count>
    <who name="Ali Juma">ajuma</who>
    <bug_when>2018-05-22 06:53:33 -0700</bug_when>
    <thetext>(In reply to Frédéric Wang (:fredw) from comment #4)
&gt; Some preliminary debugging: When webkit-overflow-scrolling is absent
&gt; RenderLayerCompositor::computeCompositingRequirements will execute
&gt; 
&gt;     if (!willBeComposited &amp;&amp; canBeComposited(layer)
&gt;         &amp;&amp; requiresCompositingForIndirectReason(layer.renderer(),
&gt; childState.subtreeIsCompositing, anyDescendantHas3DTransform,
&gt; indirectCompositingReason)) {
&gt;         layer.setIndirectCompositingReason(indirectCompositingReason);
&gt;         childState.compositingAncestor = &amp;layer;
&gt;         overlapMap.pushCompositingContainer();
&gt;         addToOverlapMapRecursive(overlapMap, layer);
&gt;         willBeComposited = true;
&gt;     }
&gt; 
&gt; where requiresCompositingForIndirectReason returns true because of the
&gt; perspective property on the overflow node and the 3D transform on its
&gt; descendants. If the overflow node has overflow-scrolling:touch,
&gt; willBeComposited is however set to true at the top of the function so this
&gt; conditional is never executed. I&apos;m not yet sure how/whether this is causing
&gt; the bug, though.

I&apos;d suggest looking at the corresponding RenderLayerBacking to see which GraphicsLayers are created, and which of these GraphicsLayers have preserves3D() true. Probably in the overflow-scrolling:touch case, there&apos;s a GraphicsLayer which ends up flattening the transform (because of preserves3D() being false), so the Z component ends up having no visual effect.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1426136</commentid>
    <comment_count>6</comment_count>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2018-05-22 06:56:26 -0700</bug_when>
    <thetext>(In reply to Ali Juma from comment #5)
&gt; I&apos;d suggest looking at the corresponding RenderLayerBacking to see which
&gt; GraphicsLayers are created, and which of these GraphicsLayers have
&gt; preserves3D() true. Probably in the overflow-scrolling:touch case, there&apos;s a
&gt; GraphicsLayer which ends up flattening the transform (because of
&gt; preserves3D() being false), so the Z component ends up having no visual
&gt; effect.

Thanks for the hint! Indeed I started to debug RenderLayerBacking this morning and the perspective / z-translate transform seemed to be correctly taken into account. I&apos;ll check preserves3D later...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1426163</commentid>
    <comment_count>7</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2018-05-22 08:30:51 -0700</bug_when>
    <thetext>I think this is because, in the WebKit 3D transforms implementation, overflow necessarily triggers flattening, turning off preserve-3D.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1426661</commentid>
    <comment_count>8</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2018-05-23 11:48:14 -0700</bug_when>
    <thetext>    if (style.preserves3D() &amp;&amp; (style.overflowX() != OVISIBLE
        || style.overflowY() != OVISIBLE
...
        style.setTransformStyle3D(TransformStyle3DFlat);</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1426677</commentid>
    <comment_count>9</comment_count>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2018-05-23 12:12:03 -0700</bug_when>
    <thetext>Thanks, this code was added a long time ago in bug 83337.

&quot;The CSS3 Transforms spec says that some properties should cause flattening of things with transform-style: preserve-3d.&quot;

Is it still valid? I can&apos;t find it in https://www.w3.org/TR/css-transforms/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1426688</commentid>
    <comment_count>10</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2018-05-23 12:32:01 -0700</bug_when>
    <thetext>https://drafts.csswg.org/css-transforms-2/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1428411</commentid>
    <comment_count>11</comment_count>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2018-05-30 07:21:21 -0700</bug_when>
    <thetext>(In reply to Simon Fraser (smfr) from comment #8)
&gt;     if (style.preserves3D() &amp;&amp; (style.overflowX() != OVISIBLE
&gt;         || style.overflowY() != OVISIBLE
&gt; ...
&gt;         style.setTransformStyle3D(TransformStyle3DFlat);

That code is only executed when the element has &quot;transform-style: preserve-3d;&quot; (which is not the case in the repro cases) so probably the flattening happens somewhere else.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1585199</commentid>
    <comment_count>12</comment_count>
    <who name="Jayden Seric">me</who>
    <bug_when>2019-10-29 18:05:03 -0700</bug_when>
    <thetext>(In reply to Jayden Seric from comment #2)
&gt; Sad to see there has been no activity for over a year for such a visually
&gt; disruptive bug without a decent workaround.
&gt; 
&gt; This is the best I could come up with for displaying a scrollable list of
&gt; cards, stacked on an angle. It looks weird though because there is not a
&gt; single perspective origin:
&gt; 
&gt; .container {
&gt;   perspective: 1000px;
&gt;   overflow: auto;
&gt;   -webkit-overflow-scrolling: touch;
&gt; }
&gt; 
&gt; .child {
&gt;   transform: rotateY(45deg);
&gt; }
&gt; 
&gt; @supports (-webkit-overflow-scrolling: touch) {
&gt;   .container {
&gt;     perspective: none;
&gt;   }
&gt;   .child {
&gt;     transform: perspective(1000px) rotateY(45deg);
&gt;   }
&gt; }

-webkit-overflow-scrolling: touch was deprecated in Safari 13 for iPad (but not iPhone):

https://developer.apple.com/documentation/safari_release_notes/safari_13_release_notes#3314667

This means @supports (-webkit-overflow-scrolling: touch) can&apos;t be used anymore for a workaround. The perspective for all the scrollable 3d cards on my live websites are now broken on iPad! Not sure the best way to deal with this, some dirty user agent sniffing?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1585205</commentid>
    <comment_count>13</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2019-10-29 18:25:27 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 156435 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1666426</commentid>
    <comment_count>14</comment_count>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2020-06-26 07:36:42 -0700</bug_when>
    <thetext>(In reply to Simon Fraser (smfr) from comment #13)
&gt; 
&gt; *** This bug has been marked as a duplicate of bug 156435 ***

Thanks Simon. The testcase seems to work in iOS 14 beta</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>340960</attachid>
            <date>2018-05-22 01:02:41 -0700</date>
            <delta_ts>2018-05-22 01:02:41 -0700</delta_ts>
            <desc>testcase</desc>
            <filename>bug164949.html</filename>
            <type>text/html</type>
            <size>547</size>
            <attacher name="Frédéric Wang Nélar">fred.wang</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgogIDxoZWFkPgogICAgPHRpdGxlPmJ1ZyAxNjQ5NDk8L3Rp
dGxlPgogICAgPG1ldGEgY2hhcnNldD0idXRmLTgiLz4KICAgIDxtZXRhIG5hbWU9InZpZXdwb3J0
IiBjb250ZW50PSJ3aWR0aD1kZXZpY2Utd2lkdGgiLz4KICAgIDxzdHlsZT4KICAgICAgLnNjcm9s
bGFibGUgewogICAgICAgIGJvcmRlcjogMXB4IHNvbGlkIHJlZDsKICAgICAgICBoZWlnaHQ6IDEw
MHB4OwogICAgICAgIG92ZXJmbG93LXk6IGF1dG87CiAgICAgICAgcGVyc3BlY3RpdmU6IDFweDsK
CS13ZWJraXQtb3ZlcmZsb3ctc2Nyb2xsaW5nOiB0b3VjaDsKICAgICAgfQogICAgPC9zdHlsZT4K
ICA8L2hlYWQ+CiAgPGJvZHk+CiAgICA8ZGl2IGNsYXNzPSJzY3JvbGxhYmxlIj4KICAgICAgPHNl
Y3Rpb24gc3R5bGU9InBvc2l0aW9uOiBhYnNvbHV0ZTsgaGVpZ2h0OiAxMDFweDsiPkJJRzwvc2Vj
dGlvbj4KICAgICAgPHAgc3R5bGU9InRyYW5zZm9ybTogdHJhbnNsYXRlWigtMXB4KTsiPlNNQUxM
PC9wPgogICAgPC9kaXY+CiAgPC9ib2R5Pgo8L2h0bWw+Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>