| 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/proto/gfx_conversions.h" | 7 #include "cc/proto/gfx_conversions.h" |
| 8 #include "cc/proto/property_tree.pb.h" | 8 #include "cc/proto/property_tree.pb.h" |
| 9 #include "cc/trees/transform_node.h" | 9 #include "cc/trees/transform_node.h" |
| 10 #include "ui/gfx/geometry/point3_f.h" | 10 #include "ui/gfx/geometry/point3_f.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 is_invertible(true), | 23 is_invertible(true), |
| 24 ancestors_are_invertible(true), | 24 ancestors_are_invertible(true), |
| 25 has_potential_animation(false), | 25 has_potential_animation(false), |
| 26 is_currently_animating(false), | 26 is_currently_animating(false), |
| 27 to_screen_is_potentially_animated(false), | 27 to_screen_is_potentially_animated(false), |
| 28 has_only_translation_animations(true), | 28 has_only_translation_animations(true), |
| 29 flattens_inherited_transform(false), | 29 flattens_inherited_transform(false), |
| 30 node_and_ancestors_are_flat(true), | 30 node_and_ancestors_are_flat(true), |
| 31 node_and_ancestors_have_only_integer_translation(true), | 31 node_and_ancestors_have_only_integer_translation(true), |
| 32 scrolls(false), | 32 scrolls(false), |
| 33 should_be_snapped(false), |
| 33 affected_by_inner_viewport_bounds_delta_x(false), | 34 affected_by_inner_viewport_bounds_delta_x(false), |
| 34 affected_by_inner_viewport_bounds_delta_y(false), | 35 affected_by_inner_viewport_bounds_delta_y(false), |
| 35 affected_by_outer_viewport_bounds_delta_x(false), | 36 affected_by_outer_viewport_bounds_delta_x(false), |
| 36 affected_by_outer_viewport_bounds_delta_y(false), | 37 affected_by_outer_viewport_bounds_delta_y(false), |
| 37 in_subtree_of_page_scale_layer(false), | 38 in_subtree_of_page_scale_layer(false), |
| 38 transform_changed(false), | 39 transform_changed(false), |
| 39 post_local_scale_factor(1.0f) {} | 40 post_local_scale_factor(1.0f) {} |
| 40 | 41 |
| 41 TransformNode::TransformNode(const TransformNode&) = default; | 42 TransformNode::TransformNode(const TransformNode&) = default; |
| 42 | 43 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 56 is_currently_animating == other.is_currently_animating && | 57 is_currently_animating == other.is_currently_animating && |
| 57 to_screen_is_potentially_animated == | 58 to_screen_is_potentially_animated == |
| 58 other.to_screen_is_potentially_animated && | 59 other.to_screen_is_potentially_animated && |
| 59 has_only_translation_animations == | 60 has_only_translation_animations == |
| 60 other.has_only_translation_animations && | 61 other.has_only_translation_animations && |
| 61 flattens_inherited_transform == other.flattens_inherited_transform && | 62 flattens_inherited_transform == other.flattens_inherited_transform && |
| 62 node_and_ancestors_are_flat == other.node_and_ancestors_are_flat && | 63 node_and_ancestors_are_flat == other.node_and_ancestors_are_flat && |
| 63 node_and_ancestors_have_only_integer_translation == | 64 node_and_ancestors_have_only_integer_translation == |
| 64 other.node_and_ancestors_have_only_integer_translation && | 65 other.node_and_ancestors_have_only_integer_translation && |
| 65 scrolls == other.scrolls && | 66 scrolls == other.scrolls && |
| 67 should_be_snapped == other.should_be_snapped && |
| 66 affected_by_inner_viewport_bounds_delta_x == | 68 affected_by_inner_viewport_bounds_delta_x == |
| 67 other.affected_by_inner_viewport_bounds_delta_x && | 69 other.affected_by_inner_viewport_bounds_delta_x && |
| 68 affected_by_inner_viewport_bounds_delta_y == | 70 affected_by_inner_viewport_bounds_delta_y == |
| 69 other.affected_by_inner_viewport_bounds_delta_y && | 71 other.affected_by_inner_viewport_bounds_delta_y && |
| 70 affected_by_outer_viewport_bounds_delta_x == | 72 affected_by_outer_viewport_bounds_delta_x == |
| 71 other.affected_by_outer_viewport_bounds_delta_x && | 73 other.affected_by_outer_viewport_bounds_delta_x && |
| 72 affected_by_outer_viewport_bounds_delta_y == | 74 affected_by_outer_viewport_bounds_delta_y == |
| 73 other.affected_by_outer_viewport_bounds_delta_y && | 75 other.affected_by_outer_viewport_bounds_delta_y && |
| 74 in_subtree_of_page_scale_layer == | 76 in_subtree_of_page_scale_layer == |
| 75 other.in_subtree_of_page_scale_layer && | 77 other.in_subtree_of_page_scale_layer && |
| 76 transform_changed == other.transform_changed && | 78 transform_changed == other.transform_changed && |
| 77 post_local_scale_factor == other.post_local_scale_factor && | 79 post_local_scale_factor == other.post_local_scale_factor && |
| 78 scroll_offset == other.scroll_offset && | 80 scroll_offset == other.scroll_offset && |
| 79 scroll_snap == other.scroll_snap && | 81 snap_amount == other.snap_amount && |
| 80 source_offset == other.source_offset && | 82 source_offset == other.source_offset && |
| 81 source_to_parent == other.source_to_parent; | 83 source_to_parent == other.source_to_parent; |
| 82 } | 84 } |
| 83 | 85 |
| 84 void TransformNode::update_pre_local_transform( | 86 void TransformNode::update_pre_local_transform( |
| 85 const gfx::Point3F& transform_origin) { | 87 const gfx::Point3F& transform_origin) { |
| 86 pre_local.MakeIdentity(); | 88 pre_local.MakeIdentity(); |
| 87 pre_local.Translate3d(-transform_origin.x(), -transform_origin.y(), | 89 pre_local.Translate3d(-transform_origin.x(), -transform_origin.y(), |
| 88 -transform_origin.z()); | 90 -transform_origin.z()); |
| 89 } | 91 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 data->set_to_screen_is_potentially_animated( | 131 data->set_to_screen_is_potentially_animated( |
| 130 to_screen_is_potentially_animated); | 132 to_screen_is_potentially_animated); |
| 131 data->set_has_only_translation_animations(has_only_translation_animations); | 133 data->set_has_only_translation_animations(has_only_translation_animations); |
| 132 | 134 |
| 133 data->set_flattens_inherited_transform(flattens_inherited_transform); | 135 data->set_flattens_inherited_transform(flattens_inherited_transform); |
| 134 data->set_node_and_ancestors_are_flat(node_and_ancestors_are_flat); | 136 data->set_node_and_ancestors_are_flat(node_and_ancestors_are_flat); |
| 135 | 137 |
| 136 data->set_node_and_ancestors_have_only_integer_translation( | 138 data->set_node_and_ancestors_have_only_integer_translation( |
| 137 node_and_ancestors_have_only_integer_translation); | 139 node_and_ancestors_have_only_integer_translation); |
| 138 data->set_scrolls(scrolls); | 140 data->set_scrolls(scrolls); |
| 141 data->set_should_be_snapped(should_be_snapped); |
| 139 | 142 |
| 140 data->set_affected_by_inner_viewport_bounds_delta_x( | 143 data->set_affected_by_inner_viewport_bounds_delta_x( |
| 141 affected_by_inner_viewport_bounds_delta_x); | 144 affected_by_inner_viewport_bounds_delta_x); |
| 142 data->set_affected_by_inner_viewport_bounds_delta_y( | 145 data->set_affected_by_inner_viewport_bounds_delta_y( |
| 143 affected_by_inner_viewport_bounds_delta_y); | 146 affected_by_inner_viewport_bounds_delta_y); |
| 144 data->set_affected_by_outer_viewport_bounds_delta_x( | 147 data->set_affected_by_outer_viewport_bounds_delta_x( |
| 145 affected_by_outer_viewport_bounds_delta_x); | 148 affected_by_outer_viewport_bounds_delta_x); |
| 146 data->set_affected_by_outer_viewport_bounds_delta_y( | 149 data->set_affected_by_outer_viewport_bounds_delta_y( |
| 147 affected_by_outer_viewport_bounds_delta_y); | 150 affected_by_outer_viewport_bounds_delta_y); |
| 148 | 151 |
| 149 data->set_in_subtree_of_page_scale_layer(in_subtree_of_page_scale_layer); | 152 data->set_in_subtree_of_page_scale_layer(in_subtree_of_page_scale_layer); |
| 150 data->set_transform_changed(transform_changed); | 153 data->set_transform_changed(transform_changed); |
| 151 data->set_post_local_scale_factor(post_local_scale_factor); | 154 data->set_post_local_scale_factor(post_local_scale_factor); |
| 152 | 155 |
| 153 ScrollOffsetToProto(scroll_offset, data->mutable_scroll_offset()); | 156 ScrollOffsetToProto(scroll_offset, data->mutable_scroll_offset()); |
| 154 Vector2dFToProto(scroll_snap, data->mutable_scroll_snap()); | 157 Vector2dFToProto(snap_amount, data->mutable_snap_amount()); |
| 155 Vector2dFToProto(source_offset, data->mutable_source_offset()); | 158 Vector2dFToProto(source_offset, data->mutable_source_offset()); |
| 156 Vector2dFToProto(source_to_parent, data->mutable_source_to_parent()); | 159 Vector2dFToProto(source_to_parent, data->mutable_source_to_parent()); |
| 157 } | 160 } |
| 158 | 161 |
| 159 void TransformNode::FromProtobuf(const proto::TreeNode& proto) { | 162 void TransformNode::FromProtobuf(const proto::TreeNode& proto) { |
| 160 id = proto.id(); | 163 id = proto.id(); |
| 161 parent_id = proto.parent_id(); | 164 parent_id = proto.parent_id(); |
| 162 owner_id = proto.owner_id(); | 165 owner_id = proto.owner_id(); |
| 163 | 166 |
| 164 DCHECK(proto.has_transform_node_data()); | 167 DCHECK(proto.has_transform_node_data()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 185 is_currently_animating = data.is_currently_animating(); | 188 is_currently_animating = data.is_currently_animating(); |
| 186 to_screen_is_potentially_animated = data.to_screen_is_potentially_animated(); | 189 to_screen_is_potentially_animated = data.to_screen_is_potentially_animated(); |
| 187 has_only_translation_animations = data.has_only_translation_animations(); | 190 has_only_translation_animations = data.has_only_translation_animations(); |
| 188 | 191 |
| 189 flattens_inherited_transform = data.flattens_inherited_transform(); | 192 flattens_inherited_transform = data.flattens_inherited_transform(); |
| 190 node_and_ancestors_are_flat = data.node_and_ancestors_are_flat(); | 193 node_and_ancestors_are_flat = data.node_and_ancestors_are_flat(); |
| 191 | 194 |
| 192 node_and_ancestors_have_only_integer_translation = | 195 node_and_ancestors_have_only_integer_translation = |
| 193 data.node_and_ancestors_have_only_integer_translation(); | 196 data.node_and_ancestors_have_only_integer_translation(); |
| 194 scrolls = data.scrolls(); | 197 scrolls = data.scrolls(); |
| 198 should_be_snapped = data.should_be_snapped(); |
| 195 | 199 |
| 196 affected_by_inner_viewport_bounds_delta_x = | 200 affected_by_inner_viewport_bounds_delta_x = |
| 197 data.affected_by_inner_viewport_bounds_delta_x(); | 201 data.affected_by_inner_viewport_bounds_delta_x(); |
| 198 affected_by_inner_viewport_bounds_delta_y = | 202 affected_by_inner_viewport_bounds_delta_y = |
| 199 data.affected_by_inner_viewport_bounds_delta_y(); | 203 data.affected_by_inner_viewport_bounds_delta_y(); |
| 200 affected_by_outer_viewport_bounds_delta_x = | 204 affected_by_outer_viewport_bounds_delta_x = |
| 201 data.affected_by_outer_viewport_bounds_delta_x(); | 205 data.affected_by_outer_viewport_bounds_delta_x(); |
| 202 affected_by_outer_viewport_bounds_delta_y = | 206 affected_by_outer_viewport_bounds_delta_y = |
| 203 data.affected_by_outer_viewport_bounds_delta_y(); | 207 data.affected_by_outer_viewport_bounds_delta_y(); |
| 204 | 208 |
| 205 in_subtree_of_page_scale_layer = data.in_subtree_of_page_scale_layer(); | 209 in_subtree_of_page_scale_layer = data.in_subtree_of_page_scale_layer(); |
| 206 transform_changed = data.transform_changed(); | 210 transform_changed = data.transform_changed(); |
| 207 post_local_scale_factor = data.post_local_scale_factor(); | 211 post_local_scale_factor = data.post_local_scale_factor(); |
| 208 | 212 |
| 209 scroll_offset = ProtoToScrollOffset(data.scroll_offset()); | 213 scroll_offset = ProtoToScrollOffset(data.scroll_offset()); |
| 210 scroll_snap = ProtoToVector2dF(data.scroll_snap()); | 214 snap_amount = ProtoToVector2dF(data.snap_amount()); |
| 211 source_offset = ProtoToVector2dF(data.source_offset()); | 215 source_offset = ProtoToVector2dF(data.source_offset()); |
| 212 source_to_parent = ProtoToVector2dF(data.source_to_parent()); | 216 source_to_parent = ProtoToVector2dF(data.source_to_parent()); |
| 213 } | 217 } |
| 214 | 218 |
| 215 void TransformNode::AsValueInto(base::trace_event::TracedValue* value) const { | 219 void TransformNode::AsValueInto(base::trace_event::TracedValue* value) const { |
| 216 value->SetInteger("id", id); | 220 value->SetInteger("id", id); |
| 217 value->SetInteger("parent_id", parent_id); | 221 value->SetInteger("parent_id", parent_id); |
| 218 value->SetInteger("owner_id", owner_id); | 222 value->SetInteger("owner_id", owner_id); |
| 219 MathUtil::AddToTracedValue("pre_local", pre_local, value); | 223 MathUtil::AddToTracedValue("pre_local", pre_local, value); |
| 220 MathUtil::AddToTracedValue("local", local, value); | 224 MathUtil::AddToTracedValue("local", local, value); |
| 221 MathUtil::AddToTracedValue("post_local", post_local, value); | 225 MathUtil::AddToTracedValue("post_local", post_local, value); |
| 222 // TODO(sunxd): make frameviewer work without target_id | 226 // TODO(sunxd): make frameviewer work without target_id |
| 223 value->SetInteger("target_id", 0); | 227 value->SetInteger("target_id", 0); |
| 224 value->SetInteger("content_target_id", 0); | 228 value->SetInteger("content_target_id", 0); |
| 225 value->SetInteger("source_node_id", source_node_id); | 229 value->SetInteger("source_node_id", source_node_id); |
| 226 value->SetInteger("sorting_context_id", sorting_context_id); | 230 value->SetInteger("sorting_context_id", sorting_context_id); |
| 227 MathUtil::AddToTracedValue("scroll_offset", scroll_offset, value); | 231 MathUtil::AddToTracedValue("scroll_offset", scroll_offset, value); |
| 228 MathUtil::AddToTracedValue("scroll_snap", scroll_snap, value); | 232 MathUtil::AddToTracedValue("snap_amount", snap_amount, value); |
| 229 } | 233 } |
| 230 | 234 |
| 231 TransformCachedNodeData::TransformCachedNodeData() | 235 TransformCachedNodeData::TransformCachedNodeData() |
| 232 : target_id(-1), content_target_id(-1) {} | 236 : target_id(-1), content_target_id(-1) {} |
| 233 | 237 |
| 234 TransformCachedNodeData::TransformCachedNodeData( | 238 TransformCachedNodeData::TransformCachedNodeData( |
| 235 const TransformCachedNodeData& other) = default; | 239 const TransformCachedNodeData& other) = default; |
| 236 | 240 |
| 237 TransformCachedNodeData::~TransformCachedNodeData() {} | 241 TransformCachedNodeData::~TransformCachedNodeData() {} |
| 238 | 242 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 253 | 257 |
| 254 void TransformCachedNodeData::FromProtobuf( | 258 void TransformCachedNodeData::FromProtobuf( |
| 255 const proto::TransformCachedNodeData& proto) { | 259 const proto::TransformCachedNodeData& proto) { |
| 256 from_screen = ProtoToTransform(proto.from_screen()); | 260 from_screen = ProtoToTransform(proto.from_screen()); |
| 257 to_screen = ProtoToTransform(proto.to_screen()); | 261 to_screen = ProtoToTransform(proto.to_screen()); |
| 258 target_id = proto.target_id(); | 262 target_id = proto.target_id(); |
| 259 content_target_id = proto.content_target_id(); | 263 content_target_id = proto.content_target_id(); |
| 260 } | 264 } |
| 261 | 265 |
| 262 } // namespace cc | 266 } // namespace cc |
| OLD | NEW |