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

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

Issue 2401903002: Compute and include the offset of the sticky box to its enclosing composited layer. (Closed)
Patch Set: Merge with master and fix long line. Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/web/tests/data/sticky-position.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
30 #include "public/platform/WebRect.h"
31
29 namespace blink { 32 namespace blink {
30 33
31 // TODO(flackr): Combine with WebLayerPositionConstraint. 34 // TODO(flackr): Combine with WebLayerPositionConstraint.
32 struct WebLayerStickyPositionConstraint { 35 struct WebLayerStickyPositionConstraint {
33 // True if the layer is sticky. 36 // True if the layer is sticky.
34 bool isSticky : 1; 37 bool isSticky : 1;
35 38
36 // For each edge, true if the layer should stick to that edge of its 39 // For each edge, true if the layer should stick to that edge of its
37 // ancestor scroller (or the viewport). 40 // ancestor scroller (or the viewport).
38 bool isAnchoredLeft : 1; 41 bool isAnchoredLeft : 1;
39 bool isAnchoredRight : 1; 42 bool isAnchoredRight : 1;
40 bool isAnchoredTop : 1; 43 bool isAnchoredTop : 1;
41 bool isAnchoredBottom : 1; 44 bool isAnchoredBottom : 1;
42 45
43 // For each edge, when the anchored bit above is set this gives the distance 46 // For each edge, when the anchored bit above is set this gives the distance
44 // to keep the element from that edge of the ancestor scroller or viewport. 47 // to keep the element from that edge of the ancestor scroller or viewport.
45 float leftOffset; 48 float leftOffset;
46 float rightOffset; 49 float rightOffset;
47 float topOffset; 50 float topOffset;
48 float bottomOffset; 51 float bottomOffset;
49 52
53 // This is the layout position of the sticky element before it has been
54 // shifted relative to the enclosing composited layer.
55 WebPoint parentRelativeStickyBoxOffset;
56
50 // The layout rectangle of the sticky element before it has been shifted 57 // The layout rectangle of the sticky element before it has been shifted
51 // to stick. 58 // to stick.
52 WebRect scrollContainerRelativeStickyBoxRect; 59 WebRect scrollContainerRelativeStickyBoxRect;
53 60
54 // The layout rectangle of the containing block edges which this sticky 61 // The layout rectangle of the containing block edges which this sticky
55 // element should not be shifted beyond. 62 // element should not be shifted beyond.
56 WebRect scrollContainerRelativeContainingBlockRect; 63 WebRect scrollContainerRelativeContainingBlockRect;
57 64
58 WebLayerStickyPositionConstraint() 65 WebLayerStickyPositionConstraint()
59 : isSticky(false), 66 : isSticky(false),
60 isAnchoredLeft(false), 67 isAnchoredLeft(false),
61 isAnchoredRight(false), 68 isAnchoredRight(false),
62 isAnchoredTop(false), 69 isAnchoredTop(false),
63 isAnchoredBottom(false), 70 isAnchoredBottom(false),
64 leftOffset(0.f), 71 leftOffset(0.f),
65 rightOffset(0.f), 72 rightOffset(0.f),
66 topOffset(0.f), 73 topOffset(0.f),
67 bottomOffset(0.f) {} 74 bottomOffset(0.f) {}
68 }; 75 };
69 76
70 } // namespace blink 77 } // namespace blink
71 78
72 #endif // WebLayerStickyPositionConstraint_h 79 #endif // WebLayerStickyPositionConstraint_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/data/sticky-position.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698