summaryrefslogtreecommitdiffstats
path: root/chromium/cc/layers/layer.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/cc/layers/layer.h')
-rw-r--r--chromium/cc/layers/layer.h92
1 files changed, 48 insertions, 44 deletions
diff --git a/chromium/cc/layers/layer.h b/chromium/cc/layers/layer.h
index f0bca17f47c..ab897a8ac99 100644
--- a/chromium/cc/layers/layer.h
+++ b/chromium/cc/layers/layer.h
@@ -18,19 +18,18 @@
#include "cc/base/region.h"
#include "cc/base/scoped_ptr_vector.h"
#include "cc/debug/micro_benchmark.h"
-#include "cc/layers/compositing_reasons.h"
#include "cc/layers/draw_properties.h"
#include "cc/layers/layer_lists.h"
#include "cc/layers/layer_position_constraint.h"
#include "cc/layers/paint_properties.h"
#include "cc/layers/render_surface.h"
#include "cc/output/filter_operations.h"
-#include "cc/trees/occlusion_tracker.h"
#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkImageFilter.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "third_party/skia/include/core/SkXfermode.h"
+#include "ui/gfx/point3_f.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/rect_f.h"
#include "ui/gfx/transform.h"
@@ -62,6 +61,8 @@ class RenderingStatsInstrumentation;
class ResourceUpdateQueue;
class ScrollbarLayerInterface;
struct AnimationEvent;
+template <typename LayerType>
+class OcclusionTracker;
// Base class for composited layers. Special layer types are derived from
// this class.
@@ -103,12 +104,6 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
return !copy_requests_.empty();
}
- void SetAnchorPoint(gfx::PointF anchor_point);
- gfx::PointF anchor_point() const { return anchor_point_; }
-
- void SetAnchorPointZ(float anchor_point_z);
- float anchor_point_z() const { return anchor_point_z_; }
-
virtual void SetBackgroundColor(SkColor background_color);
SkColor background_color() const { return background_color_; }
// If contents_opaque(), return an opaque color else return a
@@ -117,7 +112,7 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
// A layer's bounds are in logical, non-page-scaled pixels (however, the
// root layer's bounds are in physical pixels).
- void SetBounds(gfx::Size bounds);
+ void SetBounds(const gfx::Size& bounds);
gfx::Size bounds() const { return bounds_; }
void SetMasksToBounds(bool masks_to_bounds);
@@ -166,7 +161,7 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
virtual void SetContentsOpaque(bool opaque);
bool contents_opaque() const { return contents_opaque_; }
- void SetPosition(gfx::PointF position);
+ void SetPosition(const gfx::PointF& position);
gfx::PointF position() const { return position_; }
void SetIsContainerForFixedPositionLayers(bool container);
@@ -177,14 +172,13 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
return position_constraint_;
}
- void SetSublayerTransform(const gfx::Transform& sublayer_transform);
- const gfx::Transform& sublayer_transform() const {
- return sublayer_transform_;
- }
-
void SetTransform(const gfx::Transform& transform);
const gfx::Transform& transform() const { return transform_; }
bool TransformIsAnimating() const;
+ bool transform_is_invertible() const { return transform_is_invertible_; }
+
+ void SetTransformOrigin(const gfx::Point3F&);
+ gfx::Point3F transform_origin() { return transform_origin_; }
void SetScrollParent(Layer* parent);
@@ -268,13 +262,10 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
void SetScrollOffset(gfx::Vector2d scroll_offset);
gfx::Vector2d scroll_offset() const { return scroll_offset_; }
- void SetScrollOffsetFromImplSide(gfx::Vector2d scroll_offset);
+ void SetScrollOffsetFromImplSide(const gfx::Vector2d& scroll_offset);
- void SetMaxScrollOffset(gfx::Vector2d max_scroll_offset);
- gfx::Vector2d max_scroll_offset() const { return max_scroll_offset_; }
-
- void SetScrollable(bool scrollable);
- bool scrollable() const { return scrollable_; }
+ void SetScrollClipLayerId(int clip_layer_id);
+ bool scrollable() const { return scroll_clip_layer_id_ != INVALID_ID; }
void SetUserScrollable(bool horizontal, bool vertical);
bool user_scrollable_horizontal() const {
@@ -290,6 +281,11 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
void SetHaveWheelEventHandlers(bool have_wheel_event_handlers);
bool have_wheel_event_handlers() const { return have_wheel_event_handlers_; }
+ void SetHaveScrollEventHandlers(bool have_scroll_event_handlers);
+ bool have_scroll_event_handlers() const {
+ return have_scroll_event_handlers_;
+ }
+
void SetNonFastScrollableRegion(const Region& non_fast_scrollable_region);
const Region& non_fast_scrollable_region() const {
return non_fast_scrollable_region_;
@@ -305,7 +301,7 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
}
void SetDrawCheckerboardForMissingTiles(bool checkerboard);
- bool DrawCheckerboardForMissingTiles() const {
+ bool draw_checkerboard_for_missing_tiles() const {
return draw_checkerboard_for_missing_tiles_;
}
@@ -321,8 +317,10 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
void SetDoubleSided(bool double_sided);
bool double_sided() const { return double_sided_; }
- void SetPreserves3d(bool preserves_3d) { preserves_3d_ = preserves_3d; }
- bool preserves_3d() const { return preserves_3d_; }
+ void SetShouldFlattenTransform(bool flatten);
+ bool should_flatten_transform() const { return should_flatten_transform_; }
+
+ bool Is3dSorted() const { return sorting_context_id_ != 0; }
void set_use_parent_backface_visibility(bool use) {
use_parent_backface_visibility_ = use;
@@ -357,23 +355,22 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
virtual void SavePaintProperties();
// Returns true iff any resources were updated that need to be committed.
virtual bool Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion);
+ const OcclusionTracker<Layer>* occlusion);
virtual bool NeedMoreUpdates();
virtual void SetIsMask(bool is_mask) {}
virtual void ReduceMemoryUsage() {}
virtual void OnOutputSurfaceCreated() {}
+ virtual bool IsSuitableForGpuRasterization() const;
- virtual std::string DebugName();
virtual scoped_refptr<base::debug::ConvertableToTraceFormat> TakeDebugInfo();
void SetLayerClient(LayerClient* client) { client_ = client; }
- void SetCompositingReasons(CompositingReasons reasons);
-
virtual void PushPropertiesTo(LayerImpl* layer);
void CreateRenderSurface();
void ClearRenderSurface();
+ void ClearRenderSurfaceLayerList();
// The contents scale converts from logical, non-page-scaled pixels to target
// pixels. The contents scale is 1 for the root layer as it is already in
@@ -386,6 +383,7 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
virtual void CalculateContentsScale(float ideal_contents_scale,
float device_scale_factor,
float page_scale_factor,
+ float maximum_animation_contents_scale,
bool animating_transform_to_screen,
float* contents_scale_x,
float* contents_scale_y,
@@ -401,10 +399,6 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
void PauseAnimation(int animation_id, double time_offset);
void RemoveAnimation(int animation_id);
- bool AnimatedBoundsForBox(const gfx::BoxF& box, gfx::BoxF* bounds) {
- return layer_animation_controller_->AnimatedBoundsForBox(box, bounds);
- }
-
LayerAnimationController* layer_animation_controller() {
return layer_animation_controller_.get();
}
@@ -452,13 +446,20 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
virtual bool SupportsLCDText() const;
+ void SetNeedsPushProperties();
bool needs_push_properties() const { return needs_push_properties_; }
bool descendant_needs_push_properties() const {
return num_dependents_need_push_properties_ > 0;
}
+ void reset_needs_push_properties_for_testing() {
+ needs_push_properties_ = false;
+ }
virtual void RunMicroBenchmark(MicroBenchmark* benchmark);
+ void Set3dSortingContextId(int id);
+ int sorting_context_id() const { return sorting_context_id_; }
+
protected:
friend class LayerImpl;
friend class TreeSynchronizer;
@@ -485,10 +486,6 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
// unused resources on the impl thread are returned before commit completes.
void SetNextCommitWaitsForActivation();
- // Called when the blend mode or filters have been changed.
- void SetNeedsFilterContextIfNeeded();
-
- void SetNeedsPushProperties();
void AddDependentNeedsPushProperties();
void RemoveDependentNeedsPushProperties();
bool parent_should_know_need_push_properties() const {
@@ -535,6 +532,11 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
// will be handled implicitly after the update completes.
bool ignore_set_needs_commit_;
+ // Layers that share a sorting context id will be sorted together in 3d
+ // space. 0 is a special value that means this layer will not be sorted and
+ // will be drawn in paint order.
+ int sorting_context_id_;
+
private:
friend class base::RefCounted<Layer>;
@@ -554,7 +556,8 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
virtual void OnFilterAnimated(const FilterOperations& filters) OVERRIDE;
virtual void OnOpacityAnimated(float opacity) OVERRIDE;
virtual void OnTransformAnimated(const gfx::Transform& transform) OVERRIDE;
- virtual void OnScrollOffsetAnimated(gfx::Vector2dF scroll_offset) OVERRIDE;
+ virtual void OnScrollOffsetAnimated(
+ const gfx::Vector2dF& scroll_offset) OVERRIDE;
virtual void OnAnimationWaitingForDeletion() OVERRIDE;
virtual bool IsActive() const OVERRIDE;
@@ -572,10 +575,13 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
gfx::Size bounds_;
gfx::Vector2d scroll_offset_;
- gfx::Vector2d max_scroll_offset_;
- bool scrollable_ : 1;
+ // This variable indicates which ancestor layer (if any) whose size,
+ // transformed relative to this layer, defines the maximum scroll offset for
+ // this layer.
+ int scroll_clip_layer_id_;
bool should_scroll_on_main_thread_ : 1;
bool have_wheel_event_handlers_ : 1;
+ bool have_scroll_event_handlers_ : 1;
bool user_scrollable_horizontal_ : 1;
bool user_scrollable_vertical_ : 1;
bool is_root_for_isolated_group_ : 1;
@@ -585,21 +591,19 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
bool masks_to_bounds_ : 1;
bool contents_opaque_ : 1;
bool double_sided_ : 1;
- bool preserves_3d_ : 1;
+ bool should_flatten_transform_ : 1;
bool use_parent_backface_visibility_ : 1;
bool draw_checkerboard_for_missing_tiles_ : 1;
bool force_render_surface_ : 1;
+ bool transform_is_invertible_ : 1;
Region non_fast_scrollable_region_;
Region touch_event_handler_region_;
gfx::PointF position_;
- gfx::PointF anchor_point_;
SkColor background_color_;
- CompositingReasons compositing_reasons_;
float opacity_;
SkXfermode::Mode blend_mode_;
FilterOperations filters_;
FilterOperations background_filters_;
- float anchor_point_z_;
LayerPositionConstraint position_constraint_;
Layer* scroll_parent_;
scoped_ptr<std::set<Layer*> > scroll_children_;
@@ -608,7 +612,7 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
scoped_ptr<std::set<Layer*> > clip_children_;
gfx::Transform transform_;
- gfx::Transform sublayer_transform_;
+ gfx::Point3F transform_origin_;
// Replica layer used for reflections.
scoped_refptr<Layer> replica_layer_;