Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Issue 2911463002: Unify the calculation of main thread offset of sticky element (Closed)

Created:
3 years, 7 months ago by yigu
Modified:
3 years, 6 months ago
CC:
blink-layers+watch_chromium.org, blink-reviews, blink-reviews-api_chromium.org, blink-reviews-layout_chromium.org, blink-reviews-platform-graphics_chromium.org, Rik, cc-bugs_chromium.org, chromium-reviews, dglazkov+blink, dshwang, drott+blinkwatch_chromium.org, krit, eae+blinkwatch, fmalita+watch_chromium.org, jchaffraix+rendering, Justin Novosad, kinuko+watch, leviw+renderwatch, pdr+graphicswatchlist_chromium.org, pdr+renderingwatchlist_chromium.org, rwlbuis, Stephen Chennney, szager+layoutwatch_chromium.org, zoltan1
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Unify the calculation of main thread offset of sticky element Currently we have different logic of calculating sticky postion offset on blink and cc which caused many unexpected offset related bugs. The usage of "source_to_parent" when updating sticky position offset on cc side makes the debug even harder. In addition we have to use another variable from transform node "source_offset" to make it work correctly which makes the logic even more complex. By passing main thread offset from blink to cc via Layer, we could unify the logic on both sides and get rid of the dependencies of those two variables from transform node. BUG=718188 TEST=compositing/overflow/ancestor-overflow-layer-of-sticky-child-of-compositing-container.html; CompositedLayerMappingTest.StickyPositionMainThreadOffset CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Review-Url: https://codereview.chromium.org/2911463002 Cr-Commit-Position: refs/heads/master@{#477881} Committed: https://chromium.googlesource.com/chromium/src/+/65784430dea11bf2e12e947c77dd08ce2c543c6f

Patch Set 1 #

Patch Set 2 : Remove parent_relative_sticky_box_offset related logic #

Total comments: 4

Patch Set 3 : Address comments #

Total comments: 8

Patch Set 4 : Address comments #

Total comments: 4

Patch Set 5 : Address comments #

Total comments: 2

Patch Set 6 : Use cached sticky position offsets to avoid unnecessary recomputation #

Total comments: 4

Patch Set 7 : Move sticky offset computation into method in StickyPositionScrollingConstraints #

Total comments: 6

Patch Set 8 : Pass in constraints_map instead of ancestor_overflow_layer && nit #

Total comments: 6

Patch Set 9 : Address comments #

Total comments: 4

Patch Set 10 : nit #

Total comments: 8

Patch Set 11 : Address comments #

Total comments: 6

Patch Set 12 : Renaming functions #

Patch Set 13 : Bug fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+199 lines, -374 lines) Patch
M cc/blink/web_layer_impl.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -0 lines 0 comments Download
M cc/blink/web_layer_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +8 lines, -4 lines 0 comments Download
M cc/layers/layer.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +6 lines, -0 lines 0 comments Download
M cc/layers/layer.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +25 lines, -12 lines 0 comments Download
M cc/layers/layer_impl_test_properties.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M cc/layers/layer_sticky_position_constraint.h View 1 1 chunk +0 lines, -5 lines 0 comments Download
M cc/layers/layer_sticky_position_constraint.cc View 1 2 chunks +0 lines, -4 lines 0 comments Download
M cc/trees/layer_tree_host_common_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 15 chunks +4 lines, -16 lines 0 comments Download
M cc/trees/property_tree.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -5 lines 0 comments Download
M cc/trees/property_tree.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +4 lines, -7 lines 0 comments Download
M cc/trees/property_tree_builder.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +11 lines, -8 lines 0 comments Download
M cc/trees/transform_node.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +5 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/compositing/overflow/ancestor-overflow-layer-of-sticky-child-of-compositing-container.html View 1 1 chunk +37 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/compositing/overflow/ancestor-overflow-layer-of-sticky-child-of-compositing-container-expected.html View 1 chunk +27 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +20 lines, -46 lines 0 comments Download
M third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +11 lines, -255 lines 0 comments Download
M third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +13 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.cpp View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +13 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/GraphicsLayer.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +0 lines, -4 lines 0 comments Download
M third_party/WebKit/public/platform/WebLayer.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +6 lines, -0 lines 0 comments Download
M third_party/WebKit/public/platform/WebLayerStickyPositionConstraint.h View 1 1 chunk +0 lines, -4 lines 0 comments Download

Messages

Total messages: 52 (17 generated)
yigu
Hello. I uploaded a new patch addressing this issue. PTAL. Thanks!
3 years, 7 months ago (2017-05-26 16:17:58 UTC) #7
smcgruer
https://codereview.chromium.org/2911463002/diff/20001/cc/layers/layer.cc File cc/layers/layer.cc (right): https://codereview.chromium.org/2911463002/diff/20001/cc/layers/layer.cc#newcode1104 cc/layers/layer.cc:1104: SetPropertyTreesNeedRebuild(); Do we definitely need to rebuild property trees ...
3 years, 7 months ago (2017-05-26 17:14:12 UTC) #9
yigu
https://codereview.chromium.org/2911463002/diff/20001/cc/layers/layer.cc File cc/layers/layer.cc (right): https://codereview.chromium.org/2911463002/diff/20001/cc/layers/layer.cc#newcode1104 cc/layers/layer.cc:1104: SetPropertyTreesNeedRebuild(); On 2017/05/26 17:14:12, smcgruer wrote: > Do we ...
3 years, 7 months ago (2017-05-26 18:04:21 UTC) #10
smcgruer
lgtm
3 years, 7 months ago (2017-05-26 19:19:08 UTC) #11
flackr
Thanks for doing this cleanup, this should fix all of our compositing only sticky bugs. ...
3 years, 6 months ago (2017-05-31 14:08:23 UTC) #12
yigu
Thanks! PTAL. https://codereview.chromium.org/2911463002/diff/40001/cc/trees/property_tree.cc File cc/trees/property_tree.cc (right): https://codereview.chromium.org/2911463002/diff/40001/cc/trees/property_tree.cc#newcode459 cc/trees/property_tree.cc:459: gfx::Vector2dF sticky_main_thread_offset( On 2017/05/31 14:08:22, flackr wrote: ...
3 years, 6 months ago (2017-06-01 15:15:19 UTC) #13
flackr
https://codereview.chromium.org/2911463002/diff/60001/cc/trees/transform_node.h File cc/trees/transform_node.h (right): https://codereview.chromium.org/2911463002/diff/60001/cc/trees/transform_node.h#newcode59 cc/trees/transform_node.h:59: // thread. It's used to calculate the actual sticky ...
3 years, 6 months ago (2017-06-01 19:01:48 UTC) #14
yigu
PTAL. Thanks! https://codereview.chromium.org/2911463002/diff/60001/cc/trees/transform_node.h File cc/trees/transform_node.h (right): https://codereview.chromium.org/2911463002/diff/60001/cc/trees/transform_node.h#newcode59 cc/trees/transform_node.h:59: // thread. It's used to calculate the ...
3 years, 6 months ago (2017-06-01 19:28:40 UTC) #15
flackr
https://codereview.chromium.org/2911463002/diff/80001/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp File third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp (right): https://codereview.chromium.org/2911463002/diff/80001/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp#newcode1139 third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp:1139: RoundedIntSize(GetLayoutObject().StickyPositionOffset())); Only if the element is sticky, otherwise this ...
3 years, 6 months ago (2017-06-01 19:47:49 UTC) #16
yigu
The cached values are used to avoid re-computation. PTAL. Thanks! https://codereview.chromium.org/2911463002/diff/80001/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp File third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp (right): https://codereview.chromium.org/2911463002/diff/80001/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp#newcode1139 ...
3 years, 6 months ago (2017-06-01 20:32:54 UTC) #17
flackr
https://codereview.chromium.org/2911463002/diff/100001/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp File third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp (right): https://codereview.chromium.org/2911463002/diff/100001/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp#newcode1146 third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp:1146: graphics_layer_->SetStickyMainThreadOffset(RoundedIntSize( What if the layer becomes no longer sticky? ...
3 years, 6 months ago (2017-06-01 22:09:09 UTC) #18
yigu
PTAL. Thanks! https://codereview.chromium.org/2911463002/diff/100001/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp File third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp (right): https://codereview.chromium.org/2911463002/diff/100001/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp#newcode1146 third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp:1146: graphics_layer_->SetStickyMainThreadOffset(RoundedIntSize( On 2017/06/01 22:09:09, flackr wrote: > ...
3 years, 6 months ago (2017-06-02 04:24:27 UTC) #19
flackr
LGTM with nits https://codereview.chromium.org/2911463002/diff/120001/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp File third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp (right): https://codereview.chromium.org/2911463002/diff/120001/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp#newcode1147 third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp:1147: *GetLayoutObject().Layer()->AncestorOverflowLayer()); This can just be owning_layer_.AncestorOverflowLayer(). ...
3 years, 6 months ago (2017-06-02 15:33:58 UTC) #20
yigu
Thanks Rob! Patch updated. https://codereview.chromium.org/2911463002/diff/120001/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp File third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp (right): https://codereview.chromium.org/2911463002/diff/120001/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp#newcode1147 third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp:1147: *GetLayoutObject().Layer()->AncestorOverflowLayer()); On 2017/06/02 15:33:58, flackr ...
3 years, 6 months ago (2017-06-02 17:59:56 UTC) #21
chrishtr
https://codereview.chromium.org/2911463002/diff/140001/cc/layers/layer.cc File cc/layers/layer.cc (right): https://codereview.chromium.org/2911463002/diff/140001/cc/layers/layer.cc#newcode1111 cc/layers/layer.cc:1111: property_trees->transform_tree.UpdateNodeFromOwningLayerId(id())) { Use element id -> node id map ...
3 years, 6 months ago (2017-06-05 15:23:27 UTC) #22
flackr
https://codereview.chromium.org/2911463002/diff/140001/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp File third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp (left): https://codereview.chromium.org/2911463002/diff/140001/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp#oldcode306 third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp:306: // Find the layout offset of the unshifted sticky ...
3 years, 6 months ago (2017-06-05 16:45:12 UTC) #23
chrishtr
https://codereview.chromium.org/2911463002/diff/140001/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h File third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h (right): https://codereview.chromium.org/2911463002/diff/140001/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h#newcode122 third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h:122: FloatSize GetLocalStickyOffset(const StickyConstraintsMap&) const; Document clearly what this returns. ...
3 years, 6 months ago (2017-06-05 17:17:34 UTC) #24
yigu
Thanks Chris! PTAL. https://codereview.chromium.org/2911463002/diff/140001/cc/layers/layer.cc File cc/layers/layer.cc (right): https://codereview.chromium.org/2911463002/diff/140001/cc/layers/layer.cc#newcode1111 cc/layers/layer.cc:1111: property_trees->transform_tree.UpdateNodeFromOwningLayerId(id())) { On 2017/06/05 15:23:27, chrishtr ...
3 years, 6 months ago (2017-06-05 18:16:34 UTC) #25
chrishtr
https://codereview.chromium.org/2911463002/diff/160001/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h File third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h (right): https://codereview.chromium.org/2911463002/diff/160001/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h#newcode125 third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h:125: // that it can figure out how much the ...
3 years, 6 months ago (2017-06-05 18:28:45 UTC) #26
yigu
Patch updated. PTAL. Thanks! https://codereview.chromium.org/2911463002/diff/160001/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h File third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h (right): https://codereview.chromium.org/2911463002/diff/160001/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h#newcode125 third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h:125: // that it can figure ...
3 years, 6 months ago (2017-06-05 18:35:08 UTC) #27
chrishtr
https://codereview.chromium.org/2911463002/diff/180001/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.cpp File third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.cpp (right): https://codereview.chromium.org/2911463002/diff/180001/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.cpp#newcode101 third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.cpp:101: return total_sticky_box_sticky_offset_ - Could you explain why this logic ...
3 years, 6 months ago (2017-06-05 18:58:33 UTC) #28
yigu
https://codereview.chromium.org/2911463002/diff/180001/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.cpp File third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.cpp (right): https://codereview.chromium.org/2911463002/diff/180001/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.cpp#newcode101 third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.cpp:101: return total_sticky_box_sticky_offset_ - On 2017/06/05 18:58:33, chrishtr wrote: > ...
3 years, 6 months ago (2017-06-05 21:03:49 UTC) #29
trchen
https://codereview.chromium.org/2911463002/diff/180001/cc/layers/layer.h File cc/layers/layer.h (right): https://codereview.chromium.org/2911463002/diff/180001/cc/layers/layer.h#newcode585 cc/layers/layer.h:585: gfx::Size sticky_main_thread_offset; I think we should document what this ...
3 years, 6 months ago (2017-06-05 22:43:11 UTC) #30
yigu
Thanks for the suggestion! PTAL. p.s. smcgruer@ has the documentation work in progress and I've ...
3 years, 6 months ago (2017-06-06 19:33:18 UTC) #31
trchen
lgtm, except I'd wish one more comment. The two extra questions I have are just ...
3 years, 6 months ago (2017-06-06 21:17:21 UTC) #32
yigu
Thanks trchen@ for the feedback! I'll work on the layer shifting in a follow up ...
3 years, 6 months ago (2017-06-07 15:52:33 UTC) #33
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2911463002/200001
3 years, 6 months ago (2017-06-07 15:53:35 UTC) #36
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/457900)
3 years, 6 months ago (2017-06-07 16:04:14 UTC) #38
chrishtr
https://codereview.chromium.org/2911463002/diff/200001/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h File third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h (right): https://codereview.chromium.org/2911463002/diff/200001/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h#newcode124 third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h:124: // Returns the relative position of the sticky box ...
3 years, 6 months ago (2017-06-07 19:28:38 UTC) #39
yigu
Thanks Chris! I've renamed the functions for clarification. PTAL. https://codereview.chromium.org/2911463002/diff/200001/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h File third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h (right): https://codereview.chromium.org/2911463002/diff/200001/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h#newcode124 third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h:124: ...
3 years, 6 months ago (2017-06-07 21:09:14 UTC) #40
chrishtr
lgtm
3 years, 6 months ago (2017-06-08 00:00:30 UTC) #41
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2911463002/220001
3 years, 6 months ago (2017-06-08 00:09:18 UTC) #44
commit-bot: I haz the power
Try jobs failed on following builders: linux_trusty_blink_rel on master.tryserver.blink (JOB_FAILED, http://build.chromium.org/p/tryserver.blink/builders/linux_trusty_blink_rel/builds/10561)
3 years, 6 months ago (2017-06-08 00:29:10 UTC) #46
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2911463002/240001
3 years, 6 months ago (2017-06-08 01:09:35 UTC) #49
commit-bot: I haz the power
3 years, 6 months ago (2017-06-08 04:09:23 UTC) #52
Message was sent while issue was closed.
Committed patchset #13 (id:240001) as
https://chromium.googlesource.com/chromium/src/+/65784430dea11bf2e12e947c77dd...

Powered by Google App Engine
This is Rietveld 408576698