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

Unified Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2636253002: Handle nested position:sticky elements (Closed)
Patch Set: First attempt at compositing side, does NOT work properly yet Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
index 7a0159a8b36d08f32e2bcdd9fb541b1edf20374b..1947d01a4f762cbfabd0d76e17b456a5520e342e 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -286,6 +286,31 @@ void CompositedLayerMapping::updateBackdropFilters(const ComputedStyle& style) {
owningLayer().createCompositorFilterOperationsForBackdropFilter(style));
}
+namespace {
+WebLayer* webLayerFromLayoutBoxModelObject(LayoutBoxModelObject* obj) {
+ if (!obj) {
flackr 2017/02/02 18:18:11 nit: no curlies { } on single line if blocks.
smcgruer 2017/02/02 20:21:27 Done.
+ return nullptr;
+ }
+
+ PaintLayer* paintLayer = obj->layer();
+ if (!paintLayer) {
+ return nullptr;
+ }
+
+ CompositedLayerMapping* mapping = paintLayer->compositedLayerMapping();
+ if (!mapping) {
+ return nullptr;
+ }
+
+ GraphicsLayer* graphicsLayer = mapping->mainGraphicsLayer();
+ if (!graphicsLayer) {
+ return nullptr;
+ }
+
+ return graphicsLayer->platformLayer();
+}
+} // namespace
+
void CompositedLayerMapping::updateStickyConstraints(
const ComputedStyle& style) {
bool sticky = style.position() == EPosition::StickyPosition;
@@ -341,6 +366,12 @@ void CompositedLayerMapping::updateStickyConstraints(
enclosingIntRect(constraints.scrollContainerRelativeStickyBoxRect());
webConstraint.scrollContainerRelativeContainingBlockRect = enclosingIntRect(
constraints.scrollContainerRelativeContainingBlockRect());
+ webConstraint.nearestStickyElementShiftingStickyBox =
+ webLayerFromLayoutBoxModelObject(
+ constraints.nearestStickyElementShiftingStickyBox());
flackr 2017/02/02 18:18:11 If the nearest sticky element is not composited we
smcgruer 2017/02/02 20:21:27 I can have a go at implementing this behavior, but
flackr 2017/02/02 23:31:15 On low dpi this is as simple as <div id='outer' st
smcgruer 2017/02/07 19:05:26 Thanks for the repro case. Done except I think I n
+ webConstraint.nearestStickyElementShiftingContainingBlock =
+ webLayerFromLayoutBoxModelObject(
+ constraints.nearestStickyElementShiftingContainingBlock());
}
m_graphicsLayer->setStickyPositionConstraint(webConstraint);

Powered by Google App Engine
This is Rietveld 408576698