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

Side by Side Diff: third_party/WebKit/public/platform/WebLayerStickyPositionConstraint.h

Issue 2733633002: Handle nested position:sticky elements correctly (compositor) (Closed)
Patch Set: Use FindNodeIndexFromOwningLayerId 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the 11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution. 12 * documentation and/or other materials provided with the distribution.
13 * 13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef WebLayerStickyPositionConstraint_h 26 #ifndef WebLayerStickyPositionConstraint_h
27 #define WebLayerStickyPositionConstraint_h 27 #define WebLayerStickyPositionConstraint_h
28 28
29 #include "public/platform/WebPoint.h" 29 #include "public/platform/WebFloatPoint.h"
30 #include "public/platform/WebRect.h" 30 #include "public/platform/WebFloatRect.h"
31 #include "public/platform/WebLayer.h"
31 32
32 namespace blink { 33 namespace blink {
33 34
34 // TODO(flackr): Combine with WebLayerPositionConstraint. 35 // TODO(flackr): Combine with WebLayerPositionConstraint.
35 struct WebLayerStickyPositionConstraint { 36 struct WebLayerStickyPositionConstraint {
36 // True if the layer is sticky. 37 // True if the layer is sticky.
37 bool isSticky : 1; 38 bool isSticky : 1;
38 39
39 // For each edge, true if the layer should stick to that edge of its 40 // For each edge, true if the layer should stick to that edge of its
40 // ancestor scroller (or the viewport). 41 // ancestor scroller (or the viewport).
41 bool isAnchoredLeft : 1; 42 bool isAnchoredLeft : 1;
42 bool isAnchoredRight : 1; 43 bool isAnchoredRight : 1;
43 bool isAnchoredTop : 1; 44 bool isAnchoredTop : 1;
44 bool isAnchoredBottom : 1; 45 bool isAnchoredBottom : 1;
45 46
46 // For each edge, when the anchored bit above is set this gives the distance 47 // For each edge, when the anchored bit above is set this gives the distance
47 // to keep the element from that edge of the ancestor scroller or viewport. 48 // to keep the element from that edge of the ancestor scroller or viewport.
48 float leftOffset; 49 float leftOffset;
49 float rightOffset; 50 float rightOffset;
50 float topOffset; 51 float topOffset;
51 float bottomOffset; 52 float bottomOffset;
52 53
53 // This is the layout position of the sticky element before it has been 54 // This is the layout position of the sticky element before it has been
54 // shifted relative to the enclosing composited layer. 55 // shifted relative to the enclosing composited layer.
55 WebPoint parentRelativeStickyBoxOffset; 56 WebFloatPoint parentRelativeStickyBoxOffset;
chrishtr 2017/03/20 17:24:52 Are these now floating-point to account for adding
smcgruer 2017/03/21 13:54:55 This came about due to flackr's concerns about los
smcgruer 2017/03/21 16:01:25 Discussed with flackr. I overreached in my cleanup
smcgruer 2017/03/21 17:37:48 Done.
56 57
57 // The layout rectangle of the sticky element before it has been shifted 58 // The layout rectangle of the sticky element before it has been shifted
58 // to stick. 59 // to stick.
59 WebRect scrollContainerRelativeStickyBoxRect; 60 WebFloatRect scrollContainerRelativeStickyBoxRect;
60 61
61 // The layout rectangle of the containing block edges which this sticky 62 // The layout rectangle of the containing block edges which this sticky
62 // element should not be shifted beyond. 63 // element should not be shifted beyond.
63 WebRect scrollContainerRelativeContainingBlockRect; 64 WebFloatRect scrollContainerRelativeContainingBlockRect;
65
66 // The nearest ancestor sticky layers that affect the sticky box constraint
67 // rect and the containing block constraint rect respectively.
68 int nearestLayerShiftingStickyBox;
69 int nearestLayerShiftingContainingBlock;
64 70
65 WebLayerStickyPositionConstraint() 71 WebLayerStickyPositionConstraint()
66 : isSticky(false), 72 : isSticky(false),
67 isAnchoredLeft(false), 73 isAnchoredLeft(false),
68 isAnchoredRight(false), 74 isAnchoredRight(false),
69 isAnchoredTop(false), 75 isAnchoredTop(false),
70 isAnchoredBottom(false), 76 isAnchoredBottom(false),
71 leftOffset(0.f), 77 leftOffset(0.f),
72 rightOffset(0.f), 78 rightOffset(0.f),
73 topOffset(0.f), 79 topOffset(0.f),
74 bottomOffset(0.f) {} 80 bottomOffset(0.f),
81 nearestLayerShiftingStickyBox(WebLayer::kInvalidLayerId),
82 nearestLayerShiftingContainingBlock(WebLayer::kInvalidLayerId) {}
75 }; 83 };
76 84
77 } // namespace blink 85 } // namespace blink
78 86
79 #endif // WebLayerStickyPositionConstraint_h 87 #endif // WebLayerStickyPositionConstraint_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698