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

Side by Side Diff: cc/trees/transform_node.cc

Issue 2189583004: [not for review - epic CL] Adding Elastic+Momentum+Layered scrolling to views::ScrollView Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 2 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
« no previous file with comments | « cc/trees/transform_node.h ('k') | cc/trees/tree_synchronizer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 other.affected_by_inner_viewport_bounds_delta_y && 71 other.affected_by_inner_viewport_bounds_delta_y &&
72 affected_by_outer_viewport_bounds_delta_x == 72 affected_by_outer_viewport_bounds_delta_x ==
73 other.affected_by_outer_viewport_bounds_delta_x && 73 other.affected_by_outer_viewport_bounds_delta_x &&
74 affected_by_outer_viewport_bounds_delta_y == 74 affected_by_outer_viewport_bounds_delta_y ==
75 other.affected_by_outer_viewport_bounds_delta_y && 75 other.affected_by_outer_viewport_bounds_delta_y &&
76 in_subtree_of_page_scale_layer == 76 in_subtree_of_page_scale_layer ==
77 other.in_subtree_of_page_scale_layer && 77 other.in_subtree_of_page_scale_layer &&
78 transform_changed == other.transform_changed && 78 transform_changed == other.transform_changed &&
79 post_local_scale_factor == other.post_local_scale_factor && 79 post_local_scale_factor == other.post_local_scale_factor &&
80 surface_contents_scale == other.surface_contents_scale && 80 surface_contents_scale == other.surface_contents_scale &&
81 scroll_offset == other.scroll_offset && 81 scroll_offset_with_overscroll == other.scroll_offset_with_overscroll &&
82 scroll_snap == other.scroll_snap && 82 scroll_snap == other.scroll_snap &&
83 source_offset == other.source_offset && 83 source_offset == other.source_offset &&
84 source_to_parent == other.source_to_parent; 84 source_to_parent == other.source_to_parent;
85 } 85 }
86 86
87 void TransformNode::update_pre_local_transform( 87 void TransformNode::update_pre_local_transform(
88 const gfx::Point3F& transform_origin) { 88 const gfx::Point3F& transform_origin) {
89 pre_local.MakeIdentity(); 89 pre_local.MakeIdentity();
90 pre_local.Translate3d(-transform_origin.x(), -transform_origin.y(), 90 pre_local.Translate3d(-transform_origin.x(), -transform_origin.y(),
91 -transform_origin.z()); 91 -transform_origin.z());
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 affected_by_outer_viewport_bounds_delta_x); 149 affected_by_outer_viewport_bounds_delta_x);
150 data->set_affected_by_outer_viewport_bounds_delta_y( 150 data->set_affected_by_outer_viewport_bounds_delta_y(
151 affected_by_outer_viewport_bounds_delta_y); 151 affected_by_outer_viewport_bounds_delta_y);
152 152
153 data->set_in_subtree_of_page_scale_layer(in_subtree_of_page_scale_layer); 153 data->set_in_subtree_of_page_scale_layer(in_subtree_of_page_scale_layer);
154 data->set_transform_changed(transform_changed); 154 data->set_transform_changed(transform_changed);
155 data->set_post_local_scale_factor(post_local_scale_factor); 155 data->set_post_local_scale_factor(post_local_scale_factor);
156 156
157 Vector2dFToProto(surface_contents_scale, 157 Vector2dFToProto(surface_contents_scale,
158 data->mutable_surface_contents_scale()); 158 data->mutable_surface_contents_scale());
159 ScrollOffsetToProto(scroll_offset, data->mutable_scroll_offset()); 159 ScrollOffsetToProto(scroll_offset_with_overscroll,
160 data->mutable_scroll_offset());
160 Vector2dFToProto(scroll_snap, data->mutable_scroll_snap()); 161 Vector2dFToProto(scroll_snap, data->mutable_scroll_snap());
161 Vector2dFToProto(source_offset, data->mutable_source_offset()); 162 Vector2dFToProto(source_offset, data->mutable_source_offset());
162 Vector2dFToProto(source_to_parent, data->mutable_source_to_parent()); 163 Vector2dFToProto(source_to_parent, data->mutable_source_to_parent());
163 } 164 }
164 165
165 void TransformNode::FromProtobuf(const proto::TreeNode& proto) { 166 void TransformNode::FromProtobuf(const proto::TreeNode& proto) {
166 id = proto.id(); 167 id = proto.id();
167 parent_id = proto.parent_id(); 168 parent_id = proto.parent_id();
168 owner_id = proto.owner_id(); 169 owner_id = proto.owner_id();
169 170
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 affected_by_outer_viewport_bounds_delta_x = 208 affected_by_outer_viewport_bounds_delta_x =
208 data.affected_by_outer_viewport_bounds_delta_x(); 209 data.affected_by_outer_viewport_bounds_delta_x();
209 affected_by_outer_viewport_bounds_delta_y = 210 affected_by_outer_viewport_bounds_delta_y =
210 data.affected_by_outer_viewport_bounds_delta_y(); 211 data.affected_by_outer_viewport_bounds_delta_y();
211 212
212 in_subtree_of_page_scale_layer = data.in_subtree_of_page_scale_layer(); 213 in_subtree_of_page_scale_layer = data.in_subtree_of_page_scale_layer();
213 transform_changed = data.transform_changed(); 214 transform_changed = data.transform_changed();
214 post_local_scale_factor = data.post_local_scale_factor(); 215 post_local_scale_factor = data.post_local_scale_factor();
215 216
216 surface_contents_scale = ProtoToVector2dF(data.surface_contents_scale()); 217 surface_contents_scale = ProtoToVector2dF(data.surface_contents_scale());
217 scroll_offset = ProtoToScrollOffset(data.scroll_offset()); 218 scroll_offset_with_overscroll = ProtoToScrollOffset(data.scroll_offset());
218 scroll_snap = ProtoToVector2dF(data.scroll_snap()); 219 scroll_snap = ProtoToVector2dF(data.scroll_snap());
219 source_offset = ProtoToVector2dF(data.source_offset()); 220 source_offset = ProtoToVector2dF(data.source_offset());
220 source_to_parent = ProtoToVector2dF(data.source_to_parent()); 221 source_to_parent = ProtoToVector2dF(data.source_to_parent());
221 } 222 }
222 223
223 void TransformNode::AsValueInto(base::trace_event::TracedValue* value) const { 224 void TransformNode::AsValueInto(base::trace_event::TracedValue* value) const {
224 value->SetInteger("id", id); 225 value->SetInteger("id", id);
225 value->SetInteger("parent_id", parent_id); 226 value->SetInteger("parent_id", parent_id);
226 value->SetInteger("owner_id", owner_id); 227 value->SetInteger("owner_id", owner_id);
227 MathUtil::AddToTracedValue("pre_local", pre_local, value); 228 MathUtil::AddToTracedValue("pre_local", pre_local, value);
228 MathUtil::AddToTracedValue("local", local, value); 229 MathUtil::AddToTracedValue("local", local, value);
229 MathUtil::AddToTracedValue("post_local", post_local, value); 230 MathUtil::AddToTracedValue("post_local", post_local, value);
230 // TODO(sunxd): make frameviewer work without target_id 231 // TODO(sunxd): make frameviewer work without target_id
231 value->SetInteger("target_id", 0); 232 value->SetInteger("target_id", 0);
232 value->SetInteger("content_target_id", 0); 233 value->SetInteger("content_target_id", 0);
233 value->SetInteger("source_node_id", source_node_id); 234 value->SetInteger("source_node_id", source_node_id);
234 value->SetInteger("sorting_context_id", sorting_context_id); 235 value->SetInteger("sorting_context_id", sorting_context_id);
235 MathUtil::AddToTracedValue("scroll_offset", scroll_offset, value); 236 MathUtil::AddToTracedValue("scroll_offset_with_overscroll",
237 scroll_offset_with_overscroll, value);
236 MathUtil::AddToTracedValue("scroll_snap", scroll_snap, value); 238 MathUtil::AddToTracedValue("scroll_snap", scroll_snap, value);
237 } 239 }
238 240
239 TransformCachedNodeData::TransformCachedNodeData() 241 TransformCachedNodeData::TransformCachedNodeData()
240 : target_id(-1), content_target_id(-1) {} 242 : target_id(-1), content_target_id(-1) {}
241 243
242 TransformCachedNodeData::TransformCachedNodeData( 244 TransformCachedNodeData::TransformCachedNodeData(
243 const TransformCachedNodeData& other) = default; 245 const TransformCachedNodeData& other) = default;
244 246
245 TransformCachedNodeData::~TransformCachedNodeData() {} 247 TransformCachedNodeData::~TransformCachedNodeData() {}
(...skipping 20 matching lines...) Expand all
266 const proto::TransformCachedNodeData& proto) { 268 const proto::TransformCachedNodeData& proto) {
267 from_target = ProtoToTransform(proto.from_target()); 269 from_target = ProtoToTransform(proto.from_target());
268 to_target = ProtoToTransform(proto.to_target()); 270 to_target = ProtoToTransform(proto.to_target());
269 from_screen = ProtoToTransform(proto.from_screen()); 271 from_screen = ProtoToTransform(proto.from_screen());
270 to_screen = ProtoToTransform(proto.to_screen()); 272 to_screen = ProtoToTransform(proto.to_screen());
271 target_id = proto.target_id(); 273 target_id = proto.target_id();
272 content_target_id = proto.content_target_id(); 274 content_target_id = proto.content_target_id();
273 } 275 }
274 276
275 } // namespace cc 277 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/transform_node.h ('k') | cc/trees/tree_synchronizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698