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

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

Issue 2733633002: Handle nested position:sticky elements correctly (compositor) (Closed)
Patch Set: Addressed the easier reviewer comments. 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(nullptr),
20 nearest_layer_shifting_containing_block(nullptr) {}
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),
46 local_sticky_offset(other.local_sticky_offset) {}
37 47
38 bool LayerStickyPositionConstraint::operator==( 48 bool LayerStickyPositionConstraint::operator==(
39 const LayerStickyPositionConstraint& other) const { 49 const LayerStickyPositionConstraint& other) const {
40 if (!is_sticky && !other.is_sticky) 50 if (!is_sticky && !other.is_sticky)
41 return true; 51 return true;
42 return is_sticky == other.is_sticky && 52 return is_sticky == other.is_sticky &&
43 is_anchored_left == other.is_anchored_left && 53 is_anchored_left == other.is_anchored_left &&
44 is_anchored_right == other.is_anchored_right && 54 is_anchored_right == other.is_anchored_right &&
45 is_anchored_top == other.is_anchored_top && 55 is_anchored_top == other.is_anchored_top &&
46 is_anchored_bottom == other.is_anchored_bottom && 56 is_anchored_bottom == other.is_anchored_bottom &&
47 left_offset == other.left_offset && 57 left_offset == other.left_offset &&
48 right_offset == other.right_offset && top_offset == other.top_offset && 58 right_offset == other.right_offset && top_offset == other.top_offset &&
49 bottom_offset == other.bottom_offset && 59 bottom_offset == other.bottom_offset &&
50 parent_relative_sticky_box_offset == 60 parent_relative_sticky_box_offset ==
51 other.parent_relative_sticky_box_offset && 61 other.parent_relative_sticky_box_offset &&
52 scroll_container_relative_sticky_box_rect == 62 scroll_container_relative_sticky_box_rect ==
53 other.scroll_container_relative_sticky_box_rect && 63 other.scroll_container_relative_sticky_box_rect &&
54 scroll_container_relative_containing_block_rect == 64 scroll_container_relative_containing_block_rect ==
55 other.scroll_container_relative_containing_block_rect; 65 other.scroll_container_relative_containing_block_rect &&
66 nearest_layer_shifting_sticky_box ==
67 other.nearest_layer_shifting_sticky_box &&
68 nearest_layer_shifting_containing_block ==
69 other.nearest_layer_shifting_containing_block &&
70 total_sticky_box_sticky_offset ==
71 other.total_sticky_box_sticky_offset &&
72 total_containing_block_sticky_offset ==
73 other.total_containing_block_sticky_offset &&
74 local_sticky_offset == other.local_sticky_offset;
56 } 75 }
57 76
58 bool LayerStickyPositionConstraint::operator!=( 77 bool LayerStickyPositionConstraint::operator!=(
59 const LayerStickyPositionConstraint& other) const { 78 const LayerStickyPositionConstraint& other) const {
60 return !(*this == other); 79 return !(*this == other);
61 } 80 }
62 81
63 } // namespace cc 82 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698