OLD | NEW |
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 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 // TODO(flackr): Combine with WebLayerPositionConstraint. | 34 // TODO(flackr): Combine with WebLayerPositionConstraint. |
35 struct WebLayerStickyPositionConstraint { | 35 struct WebLayerStickyPositionConstraint { |
36 // True if the layer is sticky. | 36 // True if the layer is sticky. |
37 bool isSticky : 1; | 37 bool isSticky : 1; |
38 | 38 |
39 // 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 |
40 // ancestor scroller (or the viewport). | 40 // ancestor scroller (or the viewport). |
41 bool isAnchoredLeft : 1; | 41 bool isAnchoredLeft : 1; |
42 bool isAnchoredRight : 1; | 42 bool isAnchoredRight : 1; |
43 bool isAnchoredTop : 1; | 43 bool isAnchoredTop : 1; |
44 bool isAnchoredBottom : 1; | 44 bool isAnchoredBottom : 1; |
45 | 45 |
46 // 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 |
47 // 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. |
48 float leftOffset; | 48 float leftOffset; |
49 float rightOffset; | 49 float rightOffset; |
50 float topOffset; | 50 float topOffset; |
51 float bottomOffset; | 51 float bottomOffset; |
52 | 52 |
53 // This is the layout position of the sticky element before it has been | 53 // This is the layout position of the sticky element before it has been |
54 // shifted relative to the enclosing composited layer. | 54 // shifted relative to the enclosing composited layer. |
55 WebPoint parentRelativeStickyBoxOffset; | 55 WebFloatPoint parentRelativeStickyBoxOffset; |
56 | 56 |
57 // 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 |
58 // to stick. | 58 // to stick. |
59 WebRect scrollContainerRelativeStickyBoxRect; | 59 WebFloatRect scrollContainerRelativeStickyBoxRect; |
60 | 60 |
61 // The layout rectangle of the containing block edges which this sticky | 61 // The layout rectangle of the containing block edges which this sticky |
62 // element should not be shifted beyond. | 62 // element should not be shifted beyond. |
63 WebRect scrollContainerRelativeContainingBlockRect; | 63 WebFloatRect scrollContainerRelativeContainingBlockRect; |
| 64 |
| 65 // The nearest ancestor sticky layers that affect the sticky box constraint |
| 66 // rect and the containing block constraint rect respectively. |
| 67 int nearestLayerShiftingStickyBox; |
| 68 int nearestLayerShiftingContainingBlock; |
64 | 69 |
65 WebLayerStickyPositionConstraint() | 70 WebLayerStickyPositionConstraint() |
66 : isSticky(false), | 71 : isSticky(false), |
67 isAnchoredLeft(false), | 72 isAnchoredLeft(false), |
68 isAnchoredRight(false), | 73 isAnchoredRight(false), |
69 isAnchoredTop(false), | 74 isAnchoredTop(false), |
70 isAnchoredBottom(false), | 75 isAnchoredBottom(false), |
71 leftOffset(0.f), | 76 leftOffset(0.f), |
72 rightOffset(0.f), | 77 rightOffset(0.f), |
73 topOffset(0.f), | 78 topOffset(0.f), |
74 bottomOffset(0.f) {} | 79 bottomOffset(0.f), |
| 80 nearestLayerShiftingStickyBox(-1), |
| 81 nearestLayerShiftingContainingBlock(-1) {} |
75 }; | 82 }; |
76 | 83 |
77 } // namespace blink | 84 } // namespace blink |
78 | 85 |
79 #endif // WebLayerStickyPositionConstraint_h | 86 #endif // WebLayerStickyPositionConstraint_h |
OLD | NEW |