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

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

Issue 2911463002: Unify the calculation of main thread offset of sticky element (Closed)
Patch Set: Bug fix Created 3 years, 6 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 #include "cc/layers/layer.h" 7 #include "cc/layers/layer.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
(...skipping 14 matching lines...) Expand all
25 const LayerStickyPositionConstraint& other) 25 const LayerStickyPositionConstraint& other)
26 : is_sticky(other.is_sticky), 26 : is_sticky(other.is_sticky),
27 is_anchored_left(other.is_anchored_left), 27 is_anchored_left(other.is_anchored_left),
28 is_anchored_right(other.is_anchored_right), 28 is_anchored_right(other.is_anchored_right),
29 is_anchored_top(other.is_anchored_top), 29 is_anchored_top(other.is_anchored_top),
30 is_anchored_bottom(other.is_anchored_bottom), 30 is_anchored_bottom(other.is_anchored_bottom),
31 left_offset(other.left_offset), 31 left_offset(other.left_offset),
32 right_offset(other.right_offset), 32 right_offset(other.right_offset),
33 top_offset(other.top_offset), 33 top_offset(other.top_offset),
34 bottom_offset(other.bottom_offset), 34 bottom_offset(other.bottom_offset),
35 parent_relative_sticky_box_offset(
36 other.parent_relative_sticky_box_offset),
37 scroll_container_relative_sticky_box_rect( 35 scroll_container_relative_sticky_box_rect(
38 other.scroll_container_relative_sticky_box_rect), 36 other.scroll_container_relative_sticky_box_rect),
39 scroll_container_relative_containing_block_rect( 37 scroll_container_relative_containing_block_rect(
40 other.scroll_container_relative_containing_block_rect), 38 other.scroll_container_relative_containing_block_rect),
41 nearest_layer_shifting_sticky_box( 39 nearest_layer_shifting_sticky_box(
42 other.nearest_layer_shifting_sticky_box), 40 other.nearest_layer_shifting_sticky_box),
43 nearest_layer_shifting_containing_block( 41 nearest_layer_shifting_containing_block(
44 other.nearest_layer_shifting_containing_block) {} 42 other.nearest_layer_shifting_containing_block) {}
45 43
46 bool LayerStickyPositionConstraint::operator==( 44 bool LayerStickyPositionConstraint::operator==(
47 const LayerStickyPositionConstraint& other) const { 45 const LayerStickyPositionConstraint& other) const {
48 if (!is_sticky && !other.is_sticky) 46 if (!is_sticky && !other.is_sticky)
49 return true; 47 return true;
50 return is_sticky == other.is_sticky && 48 return is_sticky == other.is_sticky &&
51 is_anchored_left == other.is_anchored_left && 49 is_anchored_left == other.is_anchored_left &&
52 is_anchored_right == other.is_anchored_right && 50 is_anchored_right == other.is_anchored_right &&
53 is_anchored_top == other.is_anchored_top && 51 is_anchored_top == other.is_anchored_top &&
54 is_anchored_bottom == other.is_anchored_bottom && 52 is_anchored_bottom == other.is_anchored_bottom &&
55 left_offset == other.left_offset && 53 left_offset == other.left_offset &&
56 right_offset == other.right_offset && top_offset == other.top_offset && 54 right_offset == other.right_offset && top_offset == other.top_offset &&
57 bottom_offset == other.bottom_offset && 55 bottom_offset == other.bottom_offset &&
58 parent_relative_sticky_box_offset ==
59 other.parent_relative_sticky_box_offset &&
60 scroll_container_relative_sticky_box_rect == 56 scroll_container_relative_sticky_box_rect ==
61 other.scroll_container_relative_sticky_box_rect && 57 other.scroll_container_relative_sticky_box_rect &&
62 scroll_container_relative_containing_block_rect == 58 scroll_container_relative_containing_block_rect ==
63 other.scroll_container_relative_containing_block_rect && 59 other.scroll_container_relative_containing_block_rect &&
64 nearest_layer_shifting_sticky_box == 60 nearest_layer_shifting_sticky_box ==
65 other.nearest_layer_shifting_sticky_box && 61 other.nearest_layer_shifting_sticky_box &&
66 nearest_layer_shifting_containing_block == 62 nearest_layer_shifting_containing_block ==
67 other.nearest_layer_shifting_containing_block; 63 other.nearest_layer_shifting_containing_block;
68 } 64 }
69 65
70 bool LayerStickyPositionConstraint::operator!=( 66 bool LayerStickyPositionConstraint::operator!=(
71 const LayerStickyPositionConstraint& other) const { 67 const LayerStickyPositionConstraint& other) const {
72 return !(*this == other); 68 return !(*this == other);
73 } 69 }
74 70
75 int LayerStickyPositionConstraint::NearestStickyAncestor() { 71 int LayerStickyPositionConstraint::NearestStickyAncestor() {
76 return (nearest_layer_shifting_sticky_box != Layer::INVALID_ID) 72 return (nearest_layer_shifting_sticky_box != Layer::INVALID_ID)
77 ? nearest_layer_shifting_sticky_box 73 ? nearest_layer_shifting_sticky_box
78 : nearest_layer_shifting_containing_block; 74 : nearest_layer_shifting_containing_block;
79 } 75 }
80 76
81 } // namespace cc 77 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_sticky_position_constraint.h ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698