| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/trace_event/trace_event_argument.h" | 5 #include "base/trace_event/trace_event_argument.h" |
| 6 #include "cc/base/math_util.h" | 6 #include "cc/base/math_util.h" |
| 7 #include "cc/input/main_thread_scrolling_reason.h" | 7 #include "cc/input/main_thread_scrolling_reason.h" |
| 8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
| 9 #include "cc/trees/element_id.h" | 9 #include "cc/trees/element_id.h" |
| 10 #include "cc/trees/property_tree.h" | 10 #include "cc/trees/property_tree.h" |
| 11 #include "cc/trees/scroll_node.h" | 11 #include "cc/trees/scroll_node.h" |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 | 14 |
| 15 ScrollNode::ScrollNode() | 15 ScrollNode::ScrollNode() |
| 16 : id(ScrollTree::kInvalidNodeId), | 16 : id(ScrollTree::kInvalidNodeId), |
| 17 parent_id(ScrollTree::kInvalidNodeId), | 17 parent_id(ScrollTree::kInvalidNodeId), |
| 18 main_thread_scrolling_reasons( | 18 main_thread_scrolling_reasons( |
| 19 MainThreadScrollingReason::kNotScrollingOnMain), | 19 MainThreadScrollingReason::kNotScrollingOnMain), |
| 20 scrollable(false), | 20 scrollable(false), |
| 21 max_scroll_offset_affected_by_page_scale(false), | 21 max_scroll_offset_affected_by_page_scale(false), |
| 22 scrolls_inner_viewport(false), | 22 scrolls_inner_viewport(false), |
| 23 scrolls_outer_viewport(false), | 23 scrolls_outer_viewport(false), |
| 24 should_flatten(false), | 24 should_flatten(false), |
| 25 user_scrollable_horizontal(false), | 25 user_scrollable_horizontal(false), |
| 26 user_scrollable_vertical(false), | 26 user_scrollable_vertical(false), |
| 27 transform_id(0) {} | 27 transform_id(0), |
| 28 scroll_boundary_behavior( |
| 29 ScrollBoundaryBehavior::kScrollBoundaryBehaviorTypeAuto) {} |
| 28 | 30 |
| 29 ScrollNode::ScrollNode(const ScrollNode& other) = default; | 31 ScrollNode::ScrollNode(const ScrollNode& other) = default; |
| 30 | 32 |
| 31 bool ScrollNode::operator==(const ScrollNode& other) const { | 33 bool ScrollNode::operator==(const ScrollNode& other) const { |
| 32 return id == other.id && parent_id == other.parent_id && | 34 return id == other.id && parent_id == other.parent_id && |
| 33 scrollable == other.scrollable && | 35 scrollable == other.scrollable && |
| 34 main_thread_scrolling_reasons == other.main_thread_scrolling_reasons && | 36 main_thread_scrolling_reasons == other.main_thread_scrolling_reasons && |
| 35 non_fast_scrollable_region == other.non_fast_scrollable_region && | 37 non_fast_scrollable_region == other.non_fast_scrollable_region && |
| 36 container_bounds == other.container_bounds && bounds == other.bounds && | 38 container_bounds == other.container_bounds && bounds == other.bounds && |
| 37 max_scroll_offset_affected_by_page_scale == | 39 max_scroll_offset_affected_by_page_scale == |
| 38 other.max_scroll_offset_affected_by_page_scale && | 40 other.max_scroll_offset_affected_by_page_scale && |
| 39 scrolls_inner_viewport == other.scrolls_inner_viewport && | 41 scrolls_inner_viewport == other.scrolls_inner_viewport && |
| 40 scrolls_outer_viewport == other.scrolls_outer_viewport && | 42 scrolls_outer_viewport == other.scrolls_outer_viewport && |
| 41 offset_to_transform_parent == other.offset_to_transform_parent && | 43 offset_to_transform_parent == other.offset_to_transform_parent && |
| 42 should_flatten == other.should_flatten && | 44 should_flatten == other.should_flatten && |
| 43 user_scrollable_horizontal == other.user_scrollable_horizontal && | 45 user_scrollable_horizontal == other.user_scrollable_horizontal && |
| 44 user_scrollable_vertical == other.user_scrollable_vertical && | 46 user_scrollable_vertical == other.user_scrollable_vertical && |
| 45 element_id == other.element_id && transform_id == other.transform_id; | 47 element_id == other.element_id && transform_id == other.transform_id && |
| 48 scroll_boundary_behavior == other.scroll_boundary_behavior; |
| 46 } | 49 } |
| 47 | 50 |
| 48 void ScrollNode::AsValueInto(base::trace_event::TracedValue* value) const { | 51 void ScrollNode::AsValueInto(base::trace_event::TracedValue* value) const { |
| 49 value->SetInteger("id", id); | 52 value->SetInteger("id", id); |
| 50 value->SetInteger("parent_id", parent_id); | 53 value->SetInteger("parent_id", parent_id); |
| 51 value->SetBoolean("scrollable", scrollable); | 54 value->SetBoolean("scrollable", scrollable); |
| 52 MathUtil::AddToTracedValue("container_bounds", container_bounds, value); | 55 MathUtil::AddToTracedValue("container_bounds", container_bounds, value); |
| 53 MathUtil::AddToTracedValue("bounds", bounds, value); | 56 MathUtil::AddToTracedValue("bounds", bounds, value); |
| 54 MathUtil::AddToTracedValue("offset_to_transform_parent", | 57 MathUtil::AddToTracedValue("offset_to_transform_parent", |
| 55 offset_to_transform_parent, value); | 58 offset_to_transform_parent, value); |
| 56 value->SetBoolean("should_flatten", should_flatten); | 59 value->SetBoolean("should_flatten", should_flatten); |
| 57 value->SetBoolean("user_scrollable_horizontal", user_scrollable_horizontal); | 60 value->SetBoolean("user_scrollable_horizontal", user_scrollable_horizontal); |
| 58 value->SetBoolean("user_scrollable_vertical", user_scrollable_vertical); | 61 value->SetBoolean("user_scrollable_vertical", user_scrollable_vertical); |
| 59 | 62 |
| 60 element_id.AddToTracedValue(value); | 63 element_id.AddToTracedValue(value); |
| 61 value->SetInteger("transform_id", transform_id); | 64 value->SetInteger("transform_id", transform_id); |
| 65 value->SetInteger("scroll_boundary_behavior_x", scroll_boundary_behavior.x); |
| 66 value->SetInteger("scroll_boundary_behavior_y", scroll_boundary_behavior.y); |
| 62 } | 67 } |
| 63 | 68 |
| 64 } // namespace cc | 69 } // namespace cc |
| OLD | NEW |