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

Side by Side Diff: cc/layers/layer_sticky_position_constraint.cc

Issue 2733633002: Handle nested position:sticky elements correctly (compositor) (Closed)
Patch Set: Add comment referencing crbug.com/702229 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/layer_sticky_position_constraint.h" 5 #include "cc/layers/layer_sticky_position_constraint.h"
6 6
7 namespace cc { 7 namespace cc {
8 8
9 LayerStickyPositionConstraint::LayerStickyPositionConstraint() 9 LayerStickyPositionConstraint::LayerStickyPositionConstraint()
10 : is_sticky(false), 10 : is_sticky(false),
11 is_anchored_left(false), 11 is_anchored_left(false),
12 is_anchored_right(false), 12 is_anchored_right(false),
13 is_anchored_top(false), 13 is_anchored_top(false),
14 is_anchored_bottom(false), 14 is_anchored_bottom(false),
15 left_offset(0.f), 15 left_offset(0.f),
16 right_offset(0.f), 16 right_offset(0.f),
17 top_offset(0.f), 17 top_offset(0.f),
18 bottom_offset(0.f) {} 18 bottom_offset(0.f),
19 nearest_layer_shifting_sticky_box(-1),
20 nearest_layer_shifting_containing_block(-1) {}
19 21
20 LayerStickyPositionConstraint::LayerStickyPositionConstraint( 22 LayerStickyPositionConstraint::LayerStickyPositionConstraint(
21 const LayerStickyPositionConstraint& other) 23 const LayerStickyPositionConstraint& other)
22 : is_sticky(other.is_sticky), 24 : is_sticky(other.is_sticky),
23 is_anchored_left(other.is_anchored_left), 25 is_anchored_left(other.is_anchored_left),
24 is_anchored_right(other.is_anchored_right), 26 is_anchored_right(other.is_anchored_right),
25 is_anchored_top(other.is_anchored_top), 27 is_anchored_top(other.is_anchored_top),
26 is_anchored_bottom(other.is_anchored_bottom), 28 is_anchored_bottom(other.is_anchored_bottom),
27 left_offset(other.left_offset), 29 left_offset(other.left_offset),
28 right_offset(other.right_offset), 30 right_offset(other.right_offset),
29 top_offset(other.top_offset), 31 top_offset(other.top_offset),
30 bottom_offset(other.bottom_offset), 32 bottom_offset(other.bottom_offset),
31 parent_relative_sticky_box_offset( 33 parent_relative_sticky_box_offset(
32 other.parent_relative_sticky_box_offset), 34 other.parent_relative_sticky_box_offset),
33 scroll_container_relative_sticky_box_rect( 35 scroll_container_relative_sticky_box_rect(
34 other.scroll_container_relative_sticky_box_rect), 36 other.scroll_container_relative_sticky_box_rect),
35 scroll_container_relative_containing_block_rect( 37 scroll_container_relative_containing_block_rect(
36 other.scroll_container_relative_containing_block_rect) {} 38 other.scroll_container_relative_containing_block_rect),
39 nearest_layer_shifting_sticky_box(
40 other.nearest_layer_shifting_sticky_box),
41 nearest_layer_shifting_containing_block(
42 other.nearest_layer_shifting_containing_block),
43 total_sticky_box_sticky_offset(other.total_sticky_box_sticky_offset),
44 total_containing_block_sticky_offset(
45 other.total_containing_block_sticky_offset) {}
37 46
38 bool LayerStickyPositionConstraint::operator==( 47 bool LayerStickyPositionConstraint::operator==(
39 const LayerStickyPositionConstraint& other) const { 48 const LayerStickyPositionConstraint& other) const {
40 if (!is_sticky && !other.is_sticky) 49 if (!is_sticky && !other.is_sticky)
41 return true; 50 return true;
42 return is_sticky == other.is_sticky && 51 return is_sticky == other.is_sticky &&
43 is_anchored_left == other.is_anchored_left && 52 is_anchored_left == other.is_anchored_left &&
44 is_anchored_right == other.is_anchored_right && 53 is_anchored_right == other.is_anchored_right &&
45 is_anchored_top == other.is_anchored_top && 54 is_anchored_top == other.is_anchored_top &&
46 is_anchored_bottom == other.is_anchored_bottom && 55 is_anchored_bottom == other.is_anchored_bottom &&
47 left_offset == other.left_offset && 56 left_offset == other.left_offset &&
48 right_offset == other.right_offset && top_offset == other.top_offset && 57 right_offset == other.right_offset && top_offset == other.top_offset &&
49 bottom_offset == other.bottom_offset && 58 bottom_offset == other.bottom_offset &&
50 parent_relative_sticky_box_offset == 59 parent_relative_sticky_box_offset ==
51 other.parent_relative_sticky_box_offset && 60 other.parent_relative_sticky_box_offset &&
52 scroll_container_relative_sticky_box_rect == 61 scroll_container_relative_sticky_box_rect ==
53 other.scroll_container_relative_sticky_box_rect && 62 other.scroll_container_relative_sticky_box_rect &&
54 scroll_container_relative_containing_block_rect == 63 scroll_container_relative_containing_block_rect ==
55 other.scroll_container_relative_containing_block_rect; 64 other.scroll_container_relative_containing_block_rect &&
65 nearest_layer_shifting_sticky_box ==
66 other.nearest_layer_shifting_sticky_box &&
67 nearest_layer_shifting_containing_block ==
68 other.nearest_layer_shifting_containing_block &&
69 total_sticky_box_sticky_offset ==
70 other.total_sticky_box_sticky_offset &&
71 total_containing_block_sticky_offset ==
72 other.total_containing_block_sticky_offset;
56 } 73 }
57 74
58 bool LayerStickyPositionConstraint::operator!=( 75 bool LayerStickyPositionConstraint::operator!=(
59 const LayerStickyPositionConstraint& other) const { 76 const LayerStickyPositionConstraint& other) const {
60 return !(*this == other); 77 return !(*this == other);
61 } 78 }
62 79
63 } // namespace cc 80 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698