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

Side by Side 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, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 15 matching lines...) Expand all
26 #include "core/layout/LayoutBoxModelObject.h" 26 #include "core/layout/LayoutBoxModelObject.h"
27 27
28 #include "core/frame/FrameView.h" 28 #include "core/frame/FrameView.h"
29 #include "core/frame/LocalFrame.h" 29 #include "core/frame/LocalFrame.h"
30 #include "core/html/HTMLBodyElement.h" 30 #include "core/html/HTMLBodyElement.h"
31 #include "core/layout/ImageQualityController.h" 31 #include "core/layout/ImageQualityController.h"
32 #include "core/layout/LayoutBlock.h" 32 #include "core/layout/LayoutBlock.h"
33 #include "core/layout/LayoutFlexibleBox.h" 33 #include "core/layout/LayoutFlexibleBox.h"
34 #include "core/layout/LayoutGeometryMap.h" 34 #include "core/layout/LayoutGeometryMap.h"
35 #include "core/layout/LayoutInline.h" 35 #include "core/layout/LayoutInline.h"
36 #include "core/layout/LayoutTableCell.h"
36 #include "core/layout/LayoutView.h" 37 #include "core/layout/LayoutView.h"
37 #include "core/layout/compositing/CompositedLayerMapping.h" 38 #include "core/layout/compositing/CompositedLayerMapping.h"
38 #include "core/layout/compositing/PaintLayerCompositor.h" 39 #include "core/layout/compositing/PaintLayerCompositor.h"
39 #include "core/paint/ObjectPaintInvalidator.h" 40 #include "core/paint/ObjectPaintInvalidator.h"
40 #include "core/paint/PaintLayer.h" 41 #include "core/paint/PaintLayer.h"
41 #include "core/style/ShadowList.h" 42 #include "core/style/ShadowList.h"
42 #include "platform/LengthFunctions.h" 43 #include "platform/LengthFunctions.h"
43 #include "platform/geometry/TransformState.h" 44 #include "platform/geometry/TransformState.h"
44 #include "platform/scroll/MainThreadScrollingReason.h" 45 #include "platform/scroll/MainThreadScrollingReason.h"
45 #include "wtf/PtrUtil.h" 46 #include "wtf/PtrUtil.h"
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 stickyLocation -= containerBorderOffset; 975 stickyLocation -= containerBorderOffset;
975 constraints.setScrollContainerRelativeStickyBoxRect( 976 constraints.setScrollContainerRelativeStickyBoxRect(
976 FloatRect(scrollContainerRelativePaddingBoxRect.location() + 977 FloatRect(scrollContainerRelativePaddingBoxRect.location() +
977 toFloatSize(stickyLocation), 978 toFloatSize(stickyLocation),
978 flippedStickyBoxRect.size())); 979 flippedStickyBoxRect.size()));
979 980
980 // To correctly compute the offsets, the constraints need to know about any 981 // To correctly compute the offsets, the constraints need to know about any
981 // nested position:sticky elements between themselves and their 982 // nested position:sticky elements between themselves and their
982 // containingBlock, and between the containingBlock and their scrollAncestor. 983 // containingBlock, and between the containingBlock and their scrollAncestor.
983 // 984 //
984 // The respective search ranges are [container, containingBlock) and 985 // The respective search ranges are [locationContainer, containingBlock) and
985 // [containingBlock, scrollAncestor). 986 // [containingBlock, scrollAncestor).
987
988 // Table cells are a special case; Blink ignores them for locationContainer()
989 // purposes, but their sticky offset does affect descendant sticky objects.
990 // TODO(smcgruer): Remove cell override once Blink supports the correct
991 // locationContainer for CSS 3.
992 LayoutObject* locationContainerForSticky =
smcgruer 2017/03/29 18:02:57 1. I'm not sure if we also want to do this for its
993 isTableCell() ? toLayoutTableCell(this)->row() : locationContainer;
994
986 constraints.setNearestStickyBoxShiftingStickyBox( 995 constraints.setNearestStickyBoxShiftingStickyBox(
987 findFirstStickyBetween(locationContainer, containingBlock)); 996 findFirstStickyBetween(locationContainerForSticky, containingBlock));
988 // We cannot use |scrollAncestor| here as it disregards the root 997 // We cannot use |scrollAncestor| here as it disregards the root
989 // ancestorOverflowLayer(), which we should include. 998 // ancestorOverflowLayer(), which we should include.
990 constraints.setNearestStickyBoxShiftingContainingBlock(findFirstStickyBetween( 999 constraints.setNearestStickyBoxShiftingContainingBlock(findFirstStickyBetween(
991 containingBlock, &layer()->ancestorOverflowLayer()->layoutObject())); 1000 containingBlock, &layer()->ancestorOverflowLayer()->layoutObject()));
992 1001
993 // We skip the right or top sticky offset if there is not enough space to 1002 // We skip the right or top sticky offset if there is not enough space to
994 // honor both the left/right or top/bottom offsets. 1003 // honor both the left/right or top/bottom offsets.
995 LayoutUnit horizontalOffsets = 1004 LayoutUnit horizontalOffsets =
996 minimumValueForLength(style()->right(), 1005 minimumValueForLength(style()->right(),
997 LayoutUnit(constrainingSize.width())) + 1006 LayoutUnit(constrainingSize.width())) +
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 if (rootElementStyle->hasBackground()) 1477 if (rootElementStyle->hasBackground())
1469 return false; 1478 return false;
1470 1479
1471 if (node() != document().firstBodyElement()) 1480 if (node() != document().firstBodyElement())
1472 return false; 1481 return false;
1473 1482
1474 return true; 1483 return true;
1475 } 1484 }
1476 1485
1477 } // namespace blink 1486 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698