position:sticky - incorrect location of nested inline sticky elements when scroller is composited |
||||||
Issue descriptionRepro: http://output.jsbin.com/muticiy/quiet The compositor appears to offset the inner sticky inline element to the right. Note that when the scroller isnt composited, the cc-side sticky logic won't be running (since the scroll contents isn't a layer), so it's likely a direct bug in the cc-side sticky logic.
,
Mar 21 2017
Small update: this doesn't actually need nested sticky, the sticky element just needs to be the second inline element. See updated repro at http://output.jsbin.com/muticiy/quiet
,
Mar 21 2017
[1:1:0321/112540.030105:6126257109689:INFO:property_tree.cc(434)] 7: StickyPositionOffset: [12.000000 1.000000] - [-12.000000 1.000000] - [0.000000 0.000000] - [12 0] = [12.000000 0.000000] This is sticky_offset - layer_offset - node->source_to_parent - constraint.scroll_container_relative_sticky_box_rect.OffsetFromOrigin() I suspect the layer_offset is wrong (-12 seems wrong), but haven't thought about it for long yet.
,
Mar 21 2017
,
Mar 21 2017
[1:1:0321/150435.065508:6139392145118:INFO:property_tree_builder.cc(764)] 7: main_thread_offset = [12.000000 1.000000] - [24 0] [1:1:0321/150808.838570:6139605918174:INFO:CompositedLayerMapping.cpp(326)] "LayoutInline (sticky positioned) DIV class='inline sticky'": parentRelativeStickyBoxOffset init as "12,0" [1:1:0321/150808.838950:6139605918437:INFO:CompositedLayerMapping.cpp(334)] "LayoutInline (sticky positioned) DIV class='inline sticky'": enclosingLayerOffset init as "0,0" [1:1:0321/150808.839126:6139605918576:INFO:CompositedLayerMapping.cpp(337)] "LayoutInline (sticky positioned) DIV class='inline sticky'": enclosingLayerOffset += "0x0" [1:1:0321/150808.839248:6139605918692:INFO:CompositedLayerMapping.cpp(353)] "LayoutInline (sticky positioned) DIV class='inline sticky'": contentOffsetInCompositingLayer() is "-12x0" The parentRelativeStickyBoxOffset is [12,0] - [0,0] - [-12,0], so this ends up as [24,0]. contentOffsetInCompositingLayer() seems to be wrong from a first thought.
,
Mar 21 2017
[1:1:0321/151356.236570:6139953316118:INFO:CompositedLayerMapping.cpp(1736)] "LayoutInline (sticky positioned) DIV class='inline sticky'": updateContentsOffsetInCompositingLayer, setting m_contentOffsetInCompositingLayer to "0,1" - ("12,1" + "0,0")
Here we have:
snappedOffsetFromCompositedAncestor = [0, 1]
m_graphicsLayer->position() = [12, 1]
graphicsLayerParentLocation = [0, 0]
,
Mar 21 2017
It feels like snappedOffsetFromCompositedAncestor should be [12, 1] not [0, 1]. Having trouble spotting where that might actually have gone wrong though. So far: [1:1:0321/152509.263292:6140626342726:INFO:CompositedLayerMapping.cpp(1072)] "LayoutInline (sticky positioned) DIV class='inline sticky'": after computeBoundsOfOwningLayer, compositingContainer is "LayoutView #document", localCompositingBounds is "12,0 8x17", relativeCompositingBounds is "12,1 8x17", offsetFromCompositedAncestor is "0,1", snappedOffsetFromCompositedAncestor is "0,1" [1:1:0321/152509.263039:6140626342489:INFO:CompositedLayerMapping.cpp(890)] "LayoutInline (sticky positioned) DIV class='inline sticky'": localRawCompositingBounds is "12,0 8x17" [1:1:0321/152509.263178:6140626342617:INFO:CompositedLayerMapping.cpp(871)] "LayoutInline (sticky positioned) DIV class='inline sticky'": computeOffsetFromCompositedAncestor: offset is "12,1", subpixelAccum is "0x0", localRepresentativePointForFragmentation is "12,0" I wonder if convertToLayerCoords is expected to return [12,1] here (note that the initial [12,0] is passed into it though.)
,
Mar 22 2017
+chrishtr, +ajuma in the hope they may have some insight since they touched the code from #7 last (a long time ago admittedly). Chris, Ali: When http://output.jsbin.com/muticiy/quiet is composited (press the button), the sticky positioned element is being positioned incorrectly. The root cause appears to be that its 'snappedOffsetFromCompositedAncestor' is [0,1] which to me seems to be incorrect (its composited ancestor is the root document). Rough blame stack is: 1. contentOffsetInCompositingLayer() == [-12, 0] 2. updateContentsOffsetInCompositingLayer sets m_contentOffsetInCompositingLayer to [0,1] - ([12,1] + [0,0]) = [-12, 0] 3. snappedOffsetFromCompositedAncestor is set from computeBoundsOfOwningLayer, and turns out to be [0, 1]. I think it should be [12, 1]. Do either of you have any idea as to whether that code 'should' work for inline elements or not?
,
Mar 22 2017
Yes it's supposed to work. However, see https://codereview.chromium.org/2738943004 for an example of subtlety in this area that might help you. TL;DR is that I fixed a problem resulting from the fact that an inline PaintLayer has a boundingBoxForCompositing that does not start at 0,0 because it is positioned in the space of its containing block. Blocks OTOH start at 0,0 and have a location() that is the offset from its containing block. This same situation may be happening to you, not sure.
,
May 4 2017
,
Apr 25 2018
No current work is happening by me on sticky, dropping to Available.
,
Apr 25 2018
Thanks to chrishtr@ who pointed out to me that this no longer reproduces. (A lesson to me to check that when cleaning up bugs!) I ran a bisect: You are probably looking for a change made after 477877 (known bad), but no later than 477882 (first known good). CHANGELOG URL: https://chromium.googlesource.com/chromium/src/+log/cfa975069fd5856fdc4c494276a3a9af6be3da79..0867b7646e170b2685bb47ed938fb4562f55c0df This was likely fixed by yigu's change in https://chromium.googlesource.com/chromium/src/+/65784430dea11bf2e12e947c77dd08ce2c543c6f
,
Apr 25 2018
Cool |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by smcgruer@chromium.org
, Mar 17 2017