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

Side by Side Diff: cc/layers/layer.h

Issue 584503005: Make scroll offset type of float in cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use ScrollOffset instead of vector2dF for scroll offset Created 6 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
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 #ifndef CC_LAYERS_LAYER_H_ 5 #ifndef CC_LAYERS_LAYER_H_
6 #define CC_LAYERS_LAYER_H_ 6 #define CC_LAYERS_LAYER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 11 matching lines...) Expand all
22 #include "cc/layers/layer_lists.h" 22 #include "cc/layers/layer_lists.h"
23 #include "cc/layers/layer_position_constraint.h" 23 #include "cc/layers/layer_position_constraint.h"
24 #include "cc/layers/paint_properties.h" 24 #include "cc/layers/paint_properties.h"
25 #include "cc/layers/render_surface.h" 25 #include "cc/layers/render_surface.h"
26 #include "cc/output/filter_operations.h" 26 #include "cc/output/filter_operations.h"
27 #include "skia/ext/refptr.h" 27 #include "skia/ext/refptr.h"
28 #include "third_party/skia/include/core/SkColor.h" 28 #include "third_party/skia/include/core/SkColor.h"
29 #include "third_party/skia/include/core/SkImageFilter.h" 29 #include "third_party/skia/include/core/SkImageFilter.h"
30 #include "third_party/skia/include/core/SkPicture.h" 30 #include "third_party/skia/include/core/SkPicture.h"
31 #include "third_party/skia/include/core/SkXfermode.h" 31 #include "third_party/skia/include/core/SkXfermode.h"
32 #include "ui/gfx/geometry/scroll_offset.h"
32 #include "ui/gfx/point3_f.h" 33 #include "ui/gfx/point3_f.h"
33 #include "ui/gfx/rect.h" 34 #include "ui/gfx/rect.h"
34 #include "ui/gfx/rect_f.h" 35 #include "ui/gfx/rect_f.h"
35 #include "ui/gfx/transform.h" 36 #include "ui/gfx/transform.h"
36 37
37 namespace gfx { 38 namespace gfx {
38 class BoxF; 39 class BoxF;
39 } 40 }
40 41
41 namespace base { 42 namespace base {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 draw_properties_.render_target->render_surface()); 255 draw_properties_.render_target->render_surface());
255 return draw_properties_.render_target; 256 return draw_properties_.render_target;
256 } 257 }
257 RenderSurface* render_surface() const { 258 RenderSurface* render_surface() const {
258 return draw_properties_.render_surface.get(); 259 return draw_properties_.render_surface.get();
259 } 260 }
260 int num_unclipped_descendants() const { 261 int num_unclipped_descendants() const {
261 return draw_properties_.num_unclipped_descendants; 262 return draw_properties_.num_unclipped_descendants;
262 } 263 }
263 264
264 void SetScrollOffset(gfx::Vector2d scroll_offset); 265 void SetScrollOffset(const gfx::ScrollOffset& scroll_offset);
265 gfx::Vector2d scroll_offset() const { return scroll_offset_; } 266 gfx::ScrollOffset scroll_offset() const { return scroll_offset_; }
266 void SetScrollOffsetFromImplSide(const gfx::Vector2d& scroll_offset); 267 void SetScrollOffsetFromImplSide(const gfx::ScrollOffset& scroll_offset);
267 268
268 void SetScrollClipLayerId(int clip_layer_id); 269 void SetScrollClipLayerId(int clip_layer_id);
269 bool scrollable() const { return scroll_clip_layer_id_ != INVALID_ID; } 270 bool scrollable() const { return scroll_clip_layer_id_ != INVALID_ID; }
270 271
271 void SetUserScrollable(bool horizontal, bool vertical); 272 void SetUserScrollable(bool horizontal, bool vertical);
272 bool user_scrollable_horizontal() const { 273 bool user_scrollable_horizontal() const {
273 return user_scrollable_horizontal_; 274 return user_scrollable_horizontal_;
274 } 275 }
275 bool user_scrollable_vertical() const { return user_scrollable_vertical_; } 276 bool user_scrollable_vertical() const { return user_scrollable_vertical_; }
276 277
(...skipping 25 matching lines...) Expand all
302 } 303 }
303 304
304 void SetDrawCheckerboardForMissingTiles(bool checkerboard); 305 void SetDrawCheckerboardForMissingTiles(bool checkerboard);
305 bool draw_checkerboard_for_missing_tiles() const { 306 bool draw_checkerboard_for_missing_tiles() const {
306 return draw_checkerboard_for_missing_tiles_; 307 return draw_checkerboard_for_missing_tiles_;
307 } 308 }
308 309
309 void SetForceRenderSurface(bool force_render_surface); 310 void SetForceRenderSurface(bool force_render_surface);
310 bool force_render_surface() const { return force_render_surface_; } 311 bool force_render_surface() const { return force_render_surface_; }
311 312
312 gfx::Vector2d ScrollDelta() const { return gfx::Vector2d(); } 313 gfx::Vector2d ScrollDelta() const { return gfx::Vector2d(); }
danakj 2014/09/25 15:13:30 This is Vector2dF on the impl side, can you make t
Yufeng Shen (Slow to review) 2014/09/25 20:06:23 Done.
313 gfx::Vector2dF TotalScrollOffset() const { 314 gfx::Vector2dF TotalScrollOffset() const {
danakj 2014/09/25 15:13:30 TODO to change this return type to ScrollOffset?
Yufeng Shen (Slow to review) 2014/09/25 20:06:23 let me do this in this patch
314 // Floating point to match the LayerImpl version. 315 // Floating point to match the LayerImpl version.
315 return scroll_offset() + ScrollDelta(); 316 return gfx::ToVector2dF(scroll_offset()) + ScrollDelta();
316 } 317 }
317 318
318 void SetDoubleSided(bool double_sided); 319 void SetDoubleSided(bool double_sided);
319 bool double_sided() const { return double_sided_; } 320 bool double_sided() const { return double_sided_; }
320 321
321 void SetShouldFlattenTransform(bool flatten); 322 void SetShouldFlattenTransform(bool flatten);
322 bool should_flatten_transform() const { return should_flatten_transform_; } 323 bool should_flatten_transform() const { return should_flatten_transform_; }
323 324
324 bool Is3dSorted() const { return sorting_context_id_ != 0; } 325 bool Is3dSorted() const { return sorting_context_id_ != 0; }
325 326
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 // Layer instances have a weak pointer to their LayerTreeHost. 578 // Layer instances have a weak pointer to their LayerTreeHost.
578 // This pointer value is nil when a Layer is not in a tree and is 579 // This pointer value is nil when a Layer is not in a tree and is
579 // updated via SetLayerTreeHost() if a layer moves between trees. 580 // updated via SetLayerTreeHost() if a layer moves between trees.
580 LayerTreeHost* layer_tree_host_; 581 LayerTreeHost* layer_tree_host_;
581 582
582 scoped_refptr<LayerAnimationController> layer_animation_controller_; 583 scoped_refptr<LayerAnimationController> layer_animation_controller_;
583 584
584 // Layer properties. 585 // Layer properties.
585 gfx::Size bounds_; 586 gfx::Size bounds_;
586 587
587 gfx::Vector2d scroll_offset_; 588 gfx::ScrollOffset scroll_offset_;
588 // This variable indicates which ancestor layer (if any) whose size, 589 // This variable indicates which ancestor layer (if any) whose size,
589 // transformed relative to this layer, defines the maximum scroll offset for 590 // transformed relative to this layer, defines the maximum scroll offset for
590 // this layer. 591 // this layer.
591 int scroll_clip_layer_id_; 592 int scroll_clip_layer_id_;
592 int num_descendants_that_draw_content_; 593 int num_descendants_that_draw_content_;
593 bool should_scroll_on_main_thread_ : 1; 594 bool should_scroll_on_main_thread_ : 1;
594 bool have_wheel_event_handlers_ : 1; 595 bool have_wheel_event_handlers_ : 1;
595 bool have_scroll_event_handlers_ : 1; 596 bool have_scroll_event_handlers_ : 1;
596 bool user_scrollable_horizontal_ : 1; 597 bool user_scrollable_horizontal_ : 1;
597 bool user_scrollable_vertical_ : 1; 598 bool user_scrollable_vertical_ : 1;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 DrawProperties<Layer> draw_properties_; 642 DrawProperties<Layer> draw_properties_;
642 643
643 PaintProperties paint_properties_; 644 PaintProperties paint_properties_;
644 645
645 DISALLOW_COPY_AND_ASSIGN(Layer); 646 DISALLOW_COPY_AND_ASSIGN(Layer);
646 }; 647 };
647 648
648 } // namespace cc 649 } // namespace cc
649 650
650 #endif // CC_LAYERS_LAYER_H_ 651 #endif // CC_LAYERS_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698