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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp

Issue 2786743002: Enable position:sticky for <thead> and <tr> elements (Closed)
Patch Set: Tidier way of setting locationContainerForSticky Created 3 years, 9 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/LayoutBoxModelObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
index 33672ccc2d653469824876d32a0794e44c97fdf4..dd2c47d7dbe0e0167b23642b8f2edd94ef13e93d 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
@@ -33,6 +33,7 @@
#include "core/layout/LayoutFlexibleBox.h"
#include "core/layout/LayoutGeometryMap.h"
#include "core/layout/LayoutInline.h"
+#include "core/layout/LayoutTableCell.h"
#include "core/layout/LayoutView.h"
#include "core/layout/compositing/CompositedLayerMapping.h"
#include "core/layout/compositing/PaintLayerCompositor.h"
@@ -981,10 +982,18 @@ void LayoutBoxModelObject::updateStickyPositionConstraints() const {
// nested position:sticky elements between themselves and their
// containingBlock, and between the containingBlock and their scrollAncestor.
//
- // The respective search ranges are [container, containingBlock) and
+ // The respective search ranges are [locationContainer, containingBlock) and
// [containingBlock, scrollAncestor).
+
+ // Table cells are a special case; Blink ignores them for locationContainer()
+ // purposes, but their sticky offset does affect descendant sticky objects.
+ // TODO(smcgruer): Remove cell override once Blink supports the correct
+ // locationContainer for CSS 3.
+ LayoutObject* locationContainerForSticky =
smcgruer 2017/03/29 18:02:57 1. I'm not sure if we also want to do this for its
+ isTableCell() ? toLayoutTableCell(this)->row() : locationContainer;
+
constraints.setNearestStickyBoxShiftingStickyBox(
- findFirstStickyBetween(locationContainer, containingBlock));
+ findFirstStickyBetween(locationContainerForSticky, containingBlock));
// We cannot use |scrollAncestor| here as it disregards the root
// ancestorOverflowLayer(), which we should include.
constraints.setNearestStickyBoxShiftingContainingBlock(findFirstStickyBetween(

Powered by Google App Engine
This is Rietveld 408576698