OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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::Vector2dF ScrollDelta() const { return gfx::Vector2dF(); } |
313 gfx::Vector2dF TotalScrollOffset() const { | 314 gfx::ScrollOffset TotalScrollOffset() const { |
314 // Floating point to match the LayerImpl version. | 315 return ScrollOffsetWithDelta(scroll_offset(), ScrollDelta()); |
315 return scroll_offset() + ScrollDelta(); | |
316 } | 316 } |
317 | 317 |
318 void SetDoubleSided(bool double_sided); | 318 void SetDoubleSided(bool double_sided); |
319 bool double_sided() const { return double_sided_; } | 319 bool double_sided() const { return double_sided_; } |
320 | 320 |
321 void SetShouldFlattenTransform(bool flatten); | 321 void SetShouldFlattenTransform(bool flatten); |
322 bool should_flatten_transform() const { return should_flatten_transform_; } | 322 bool should_flatten_transform() const { return should_flatten_transform_; } |
323 | 323 |
324 bool Is3dSorted() const { return sorting_context_id_ != 0; } | 324 bool Is3dSorted() const { return sorting_context_id_ != 0; } |
325 | 325 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 void SetParent(Layer* layer); | 545 void SetParent(Layer* layer); |
546 bool DescendantIsFixedToContainerLayer() const; | 546 bool DescendantIsFixedToContainerLayer() const; |
547 | 547 |
548 // Returns the index of the child or -1 if not found. | 548 // Returns the index of the child or -1 if not found. |
549 int IndexOfChild(const Layer* reference); | 549 int IndexOfChild(const Layer* reference); |
550 | 550 |
551 // This should only be called from RemoveFromParent(). | 551 // This should only be called from RemoveFromParent(). |
552 void RemoveChildOrDependent(Layer* child); | 552 void RemoveChildOrDependent(Layer* child); |
553 | 553 |
554 // LayerAnimationValueProvider implementation. | 554 // LayerAnimationValueProvider implementation. |
555 virtual gfx::Vector2dF ScrollOffsetForAnimation() const OVERRIDE; | 555 virtual gfx::ScrollOffset ScrollOffsetForAnimation() const OVERRIDE; |
556 | 556 |
557 // LayerAnimationValueObserver implementation. | 557 // LayerAnimationValueObserver implementation. |
558 virtual void OnFilterAnimated(const FilterOperations& filters) OVERRIDE; | 558 virtual void OnFilterAnimated(const FilterOperations& filters) OVERRIDE; |
559 virtual void OnOpacityAnimated(float opacity) OVERRIDE; | 559 virtual void OnOpacityAnimated(float opacity) OVERRIDE; |
560 virtual void OnTransformAnimated(const gfx::Transform& transform) OVERRIDE; | 560 virtual void OnTransformAnimated(const gfx::Transform& transform) OVERRIDE; |
561 virtual void OnScrollOffsetAnimated( | 561 virtual void OnScrollOffsetAnimated( |
562 const gfx::Vector2dF& scroll_offset) OVERRIDE; | 562 const gfx::ScrollOffset& scroll_offset) OVERRIDE; |
563 virtual void OnAnimationWaitingForDeletion() OVERRIDE; | 563 virtual void OnAnimationWaitingForDeletion() OVERRIDE; |
564 virtual bool IsActive() const OVERRIDE; | 564 virtual bool IsActive() const OVERRIDE; |
565 | 565 |
566 // If this layer has a scroll parent, it removes |this| from its list of | 566 // If this layer has a scroll parent, it removes |this| from its list of |
567 // scroll children. | 567 // scroll children. |
568 void RemoveFromScrollTree(); | 568 void RemoveFromScrollTree(); |
569 | 569 |
570 // If this layer has a clip parent, it removes |this| from its list of clip | 570 // If this layer has a clip parent, it removes |this| from its list of clip |
571 // children. | 571 // children. |
572 void RemoveFromClipTree(); | 572 void RemoveFromClipTree(); |
573 | 573 |
574 LayerList children_; | 574 LayerList children_; |
575 Layer* parent_; | 575 Layer* parent_; |
576 | 576 |
577 // Layer instances have a weak pointer to their LayerTreeHost. | 577 // 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 | 578 // 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. | 579 // updated via SetLayerTreeHost() if a layer moves between trees. |
580 LayerTreeHost* layer_tree_host_; | 580 LayerTreeHost* layer_tree_host_; |
581 | 581 |
582 scoped_refptr<LayerAnimationController> layer_animation_controller_; | 582 scoped_refptr<LayerAnimationController> layer_animation_controller_; |
583 | 583 |
584 // Layer properties. | 584 // Layer properties. |
585 gfx::Size bounds_; | 585 gfx::Size bounds_; |
586 | 586 |
587 gfx::Vector2d scroll_offset_; | 587 gfx::ScrollOffset scroll_offset_; |
588 // This variable indicates which ancestor layer (if any) whose size, | 588 // This variable indicates which ancestor layer (if any) whose size, |
589 // transformed relative to this layer, defines the maximum scroll offset for | 589 // transformed relative to this layer, defines the maximum scroll offset for |
590 // this layer. | 590 // this layer. |
591 int scroll_clip_layer_id_; | 591 int scroll_clip_layer_id_; |
592 int num_descendants_that_draw_content_; | 592 int num_descendants_that_draw_content_; |
593 bool should_scroll_on_main_thread_ : 1; | 593 bool should_scroll_on_main_thread_ : 1; |
594 bool have_wheel_event_handlers_ : 1; | 594 bool have_wheel_event_handlers_ : 1; |
595 bool have_scroll_event_handlers_ : 1; | 595 bool have_scroll_event_handlers_ : 1; |
596 bool user_scrollable_horizontal_ : 1; | 596 bool user_scrollable_horizontal_ : 1; |
597 bool user_scrollable_vertical_ : 1; | 597 bool user_scrollable_vertical_ : 1; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 DrawProperties<Layer> draw_properties_; | 641 DrawProperties<Layer> draw_properties_; |
642 | 642 |
643 PaintProperties paint_properties_; | 643 PaintProperties paint_properties_; |
644 | 644 |
645 DISALLOW_COPY_AND_ASSIGN(Layer); | 645 DISALLOW_COPY_AND_ASSIGN(Layer); |
646 }; | 646 }; |
647 | 647 |
648 } // namespace cc | 648 } // namespace cc |
649 | 649 |
650 #endif // CC_LAYERS_LAYER_H_ | 650 #endif // CC_LAYERS_LAYER_H_ |
OLD | NEW |