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

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

Issue 2194833002: Overscroll and Elasticity for views::ScrollView Base URL: https://chromium.googlesource.com/chromium/src.git@20160728-MacViews-RouteThroughInputHandler
Patch Set: Restore functionality and fix bugs \o/ Created 4 years, 1 month 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 affected_by_inner_viewport_bounds_delta_y == 70 affected_by_inner_viewport_bounds_delta_y ==
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 scroll_offset == other.scroll_offset && 80 scroll_offset_with_overscroll == other.scroll_offset_with_overscroll &&
81 snap_amount == other.snap_amount && 81 snap_amount == other.snap_amount &&
82 source_offset == other.source_offset && 82 source_offset == other.source_offset &&
83 source_to_parent == other.source_to_parent; 83 source_to_parent == other.source_to_parent;
84 } 84 }
85 85
86 void TransformNode::update_pre_local_transform( 86 void TransformNode::update_pre_local_transform(
87 const gfx::Point3F& transform_origin) { 87 const gfx::Point3F& transform_origin) {
88 pre_local.MakeIdentity(); 88 pre_local.MakeIdentity();
89 pre_local.Translate3d(-transform_origin.x(), -transform_origin.y(), 89 pre_local.Translate3d(-transform_origin.x(), -transform_origin.y(),
90 -transform_origin.z()); 90 -transform_origin.z());
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 affected_by_inner_viewport_bounds_delta_y); 146 affected_by_inner_viewport_bounds_delta_y);
147 data->set_affected_by_outer_viewport_bounds_delta_x( 147 data->set_affected_by_outer_viewport_bounds_delta_x(
148 affected_by_outer_viewport_bounds_delta_x); 148 affected_by_outer_viewport_bounds_delta_x);
149 data->set_affected_by_outer_viewport_bounds_delta_y( 149 data->set_affected_by_outer_viewport_bounds_delta_y(
150 affected_by_outer_viewport_bounds_delta_y); 150 affected_by_outer_viewport_bounds_delta_y);
151 151
152 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);
153 data->set_transform_changed(transform_changed); 153 data->set_transform_changed(transform_changed);
154 data->set_post_local_scale_factor(post_local_scale_factor); 154 data->set_post_local_scale_factor(post_local_scale_factor);
155 155
156 ScrollOffsetToProto(scroll_offset, data->mutable_scroll_offset()); 156 ScrollOffsetToProto(scroll_offset_with_overscroll,
157 data->mutable_scroll_offset());
157 Vector2dFToProto(snap_amount, data->mutable_snap_amount()); 158 Vector2dFToProto(snap_amount, data->mutable_snap_amount());
158 Vector2dFToProto(source_offset, data->mutable_source_offset()); 159 Vector2dFToProto(source_offset, data->mutable_source_offset());
159 Vector2dFToProto(source_to_parent, data->mutable_source_to_parent()); 160 Vector2dFToProto(source_to_parent, data->mutable_source_to_parent());
160 } 161 }
161 162
162 void TransformNode::FromProtobuf(const proto::TreeNode& proto) { 163 void TransformNode::FromProtobuf(const proto::TreeNode& proto) {
163 id = proto.id(); 164 id = proto.id();
164 parent_id = proto.parent_id(); 165 parent_id = proto.parent_id();
165 owner_id = proto.owner_id(); 166 owner_id = proto.owner_id();
166 167
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 data.affected_by_inner_viewport_bounds_delta_y(); 204 data.affected_by_inner_viewport_bounds_delta_y();
204 affected_by_outer_viewport_bounds_delta_x = 205 affected_by_outer_viewport_bounds_delta_x =
205 data.affected_by_outer_viewport_bounds_delta_x(); 206 data.affected_by_outer_viewport_bounds_delta_x();
206 affected_by_outer_viewport_bounds_delta_y = 207 affected_by_outer_viewport_bounds_delta_y =
207 data.affected_by_outer_viewport_bounds_delta_y(); 208 data.affected_by_outer_viewport_bounds_delta_y();
208 209
209 in_subtree_of_page_scale_layer = data.in_subtree_of_page_scale_layer(); 210 in_subtree_of_page_scale_layer = data.in_subtree_of_page_scale_layer();
210 transform_changed = data.transform_changed(); 211 transform_changed = data.transform_changed();
211 post_local_scale_factor = data.post_local_scale_factor(); 212 post_local_scale_factor = data.post_local_scale_factor();
212 213
213 scroll_offset = ProtoToScrollOffset(data.scroll_offset()); 214 scroll_offset_with_overscroll = ProtoToScrollOffset(data.scroll_offset());
214 snap_amount = ProtoToVector2dF(data.snap_amount()); 215 snap_amount = ProtoToVector2dF(data.snap_amount());
215 source_offset = ProtoToVector2dF(data.source_offset()); 216 source_offset = ProtoToVector2dF(data.source_offset());
216 source_to_parent = ProtoToVector2dF(data.source_to_parent()); 217 source_to_parent = ProtoToVector2dF(data.source_to_parent());
217 } 218 }
218 219
219 void TransformNode::AsValueInto(base::trace_event::TracedValue* value) const { 220 void TransformNode::AsValueInto(base::trace_event::TracedValue* value) const {
220 value->SetInteger("id", id); 221 value->SetInteger("id", id);
221 value->SetInteger("parent_id", parent_id); 222 value->SetInteger("parent_id", parent_id);
222 value->SetInteger("owner_id", owner_id); 223 value->SetInteger("owner_id", owner_id);
223 MathUtil::AddToTracedValue("pre_local", pre_local, value); 224 MathUtil::AddToTracedValue("pre_local", pre_local, value);
224 MathUtil::AddToTracedValue("local", local, value); 225 MathUtil::AddToTracedValue("local", local, value);
225 MathUtil::AddToTracedValue("post_local", post_local, value); 226 MathUtil::AddToTracedValue("post_local", post_local, value);
226 // TODO(sunxd): make frameviewer work without target_id 227 // TODO(sunxd): make frameviewer work without target_id
227 value->SetInteger("target_id", 0); 228 value->SetInteger("target_id", 0);
228 value->SetInteger("content_target_id", 0); 229 value->SetInteger("content_target_id", 0);
229 value->SetInteger("source_node_id", source_node_id); 230 value->SetInteger("source_node_id", source_node_id);
230 value->SetInteger("sorting_context_id", sorting_context_id); 231 value->SetInteger("sorting_context_id", sorting_context_id);
231 MathUtil::AddToTracedValue("scroll_offset", scroll_offset, value); 232 MathUtil::AddToTracedValue("scroll_offset_with_overscroll",
233 scroll_offset_with_overscroll, value);
232 MathUtil::AddToTracedValue("snap_amount", snap_amount, value); 234 MathUtil::AddToTracedValue("snap_amount", snap_amount, value);
233 } 235 }
234 236
235 TransformCachedNodeData::TransformCachedNodeData() 237 TransformCachedNodeData::TransformCachedNodeData()
236 : target_id(-1), content_target_id(-1) {} 238 : target_id(-1), content_target_id(-1) {}
237 239
238 TransformCachedNodeData::TransformCachedNodeData( 240 TransformCachedNodeData::TransformCachedNodeData(
239 const TransformCachedNodeData& other) = default; 241 const TransformCachedNodeData& other) = default;
240 242
241 TransformCachedNodeData::~TransformCachedNodeData() {} 243 TransformCachedNodeData::~TransformCachedNodeData() {}
(...skipping 15 matching lines...) Expand all
257 259
258 void TransformCachedNodeData::FromProtobuf( 260 void TransformCachedNodeData::FromProtobuf(
259 const proto::TransformCachedNodeData& proto) { 261 const proto::TransformCachedNodeData& proto) {
260 from_screen = ProtoToTransform(proto.from_screen()); 262 from_screen = ProtoToTransform(proto.from_screen());
261 to_screen = ProtoToTransform(proto.to_screen()); 263 to_screen = ProtoToTransform(proto.to_screen());
262 target_id = proto.target_id(); 264 target_id = proto.target_id();
263 content_target_id = proto.content_target_id(); 265 content_target_id = proto.content_target_id();
264 } 266 }
265 267
266 } // namespace cc 268 } // 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