typedef LayerImplList LayerListType;
typedef RenderSurfaceImpl RenderSurfaceType;
+ enum RenderingContextConstants { NO_RENDERING_CONTEXT = 0 };
+
static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) {
return make_scoped_ptr(new LayerImpl(tree_impl, id));
}
}
void PassCopyRequests(ScopedPtrVector<CopyOutputRequest>* requests);
+ // Can only be called when the layer has a copy request.
void TakeCopyRequestsAndTransformToTarget(
ScopedPtrVector<CopyOutputRequest>* request);
bool HasCopyRequest() const { return !copy_requests_.empty(); }
return is_container_for_fixed_position_layers_;
}
- void SetFixedContainerSizeDelta(const gfx::Vector2dF& delta) {
- fixed_container_size_delta_ = delta;
- }
- gfx::Vector2dF fixed_container_size_delta() const {
- return fixed_container_size_delta_;
- }
+ gfx::Vector2dF FixedContainerSizeDelta() const;
void SetPositionConstraint(const LayerPositionConstraint& constraint) {
position_constraint_ = constraint;
return position_constraint_;
}
- void SetPreserves3d(bool preserves_3d);
- bool preserves_3d() const { return preserves_3d_; }
+ void SetShouldFlattenTransform(bool flatten);
+ bool should_flatten_transform() const { return should_flatten_transform_; }
+
+ void SetIs3dSorted(bool sorted);
+ bool is_3d_sorted() const { return is_3d_sorted_; }
void SetUseParentBackfaceVisibility(bool use) {
use_parent_backface_visibility_ = use;
return use_parent_backface_visibility_;
}
- void SetSublayerTransform(const gfx::Transform& sublayer_transform);
- const gfx::Transform& sublayer_transform() const {
- return sublayer_transform_;
- }
-
bool ShowDebugBorders() const;
// These invalidate the host's render surface layer list. The caller
// contents scale to appropriate values. LayerImpl doesn't calculate any of
// them from the other values.
- void SetBounds(gfx::Size bounds);
- gfx::Size bounds() const { return bounds_; }
+ void SetBounds(const gfx::Size& bounds);
+ void SetTemporaryImplBounds(const gfx::SizeF& bounds);
+ gfx::Size bounds() const;
+ gfx::Vector2dF BoundsDelta() const {
+ return gfx::Vector2dF(temporary_impl_bounds_.width() - bounds_.width(),
+ temporary_impl_bounds_.height() - bounds_.height());
+ }
- void SetContentBounds(gfx::Size content_bounds);
+ void SetContentBounds(const gfx::Size& content_bounds);
gfx::Size content_bounds() const { return draw_properties_.content_bounds; }
float contents_scale_x() const { return draw_properties_.contents_scale_x; }
LayerScrollOffsetDelegate* scroll_offset_delegate);
bool IsExternalFlingActive() const;
- void SetScrollOffset(gfx::Vector2d scroll_offset);
- void SetScrollOffsetAndDelta(gfx::Vector2d scroll_offset,
+ void SetScrollOffset(const gfx::Vector2d& scroll_offset);
+ void SetScrollOffsetAndDelta(const gfx::Vector2d& scroll_offset,
const gfx::Vector2dF& scroll_delta);
gfx::Vector2d scroll_offset() const { return scroll_offset_; }
- void SetMaxScrollOffset(gfx::Vector2d max_scroll_offset);
- gfx::Vector2d max_scroll_offset() const { return max_scroll_offset_; }
-
+ gfx::Vector2d MaxScrollOffset() const;
+ gfx::Vector2dF ClampScrollToMaxScrollOffset();
+ void SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer,
+ LayerImpl* scrollbar_clip_layer) const;
void SetScrollDelta(const gfx::Vector2dF& scroll_delta);
gfx::Vector2dF ScrollDelta() const;
gfx::Vector2dF TotalScrollOffset() const;
- void SetSentScrollDelta(gfx::Vector2d sent_scroll_delta);
+ void SetSentScrollDelta(const gfx::Vector2d& sent_scroll_delta);
gfx::Vector2d sent_scroll_delta() const { return sent_scroll_delta_; }
// Returns the delta of the scroll that was outside of the bounds of the
// initial scroll
gfx::Vector2dF ScrollBy(const gfx::Vector2dF& scroll);
- void SetScrollable(bool scrollable) { scrollable_ = scrollable; }
- bool scrollable() const { return scrollable_; }
+ void SetScrollClipLayer(int scroll_clip_layer_id);
+ LayerImpl* scroll_clip_layer() const { return scroll_clip_layer_; }
+ bool scrollable() const { return !!scroll_clip_layer_; }
void set_user_scrollable_horizontal(bool scrollable) {
user_scrollable_horizontal_ = scrollable;
return scrollbar_animation_controller_.get();
}
- void SetHorizontalScrollbarLayer(ScrollbarLayerImplBase* scrollbar_layer);
- ScrollbarLayerImplBase* horizontal_scrollbar_layer() {
- return horizontal_scrollbar_layer_;
- }
-
- void SetVerticalScrollbarLayer(ScrollbarLayerImplBase* scrollbar_layer);
- ScrollbarLayerImplBase* vertical_scrollbar_layer() {
- return vertical_scrollbar_layer_;
+ typedef std::set<ScrollbarLayerImplBase*> ScrollbarSet;
+ ScrollbarSet* scrollbars() { return scrollbars_.get(); }
+ void ClearScrollbars();
+ void AddScrollbar(ScrollbarLayerImplBase* layer);
+ void RemoveScrollbar(ScrollbarLayerImplBase* layer);
+ bool HasScrollbar(ScrollbarOrientation orientation) const;
+ void ScrollbarParametersDidChange();
+ int clip_height() {
+ return scroll_clip_layer_ ? scroll_clip_layer_->bounds().height() : 0;
}
gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const;
private:
void NoteLayerPropertyChangedForDescendantsInternal();
- void UpdateScrollbarPositions();
-
virtual const char* LayerTypeAsString() const;
// Properties internal to LayerImpl
gfx::PointF anchor_point_;
float anchor_point_z_;
gfx::Size bounds_;
+ gfx::SizeF temporary_impl_bounds_;
gfx::Vector2d scroll_offset_;
LayerScrollOffsetDelegate* scroll_offset_delegate_;
+ LayerImpl* scroll_clip_layer_;
bool scrollable_ : 1;
bool should_scroll_on_main_thread_ : 1;
bool have_wheel_event_handlers_ : 1;
bool stacking_order_changed_ : 1;
// Whether the "back" of this layer should draw.
bool double_sided_ : 1;
+ bool should_flatten_transform_ : 1;
// Tracks if drawing-related properties have changed since last redraw.
bool layer_property_changed_ : 1;
bool masks_to_bounds_ : 1;
bool contents_opaque_ : 1;
bool is_root_for_isolated_group_ : 1;
- bool preserves_3d_ : 1;
bool use_parent_backface_visibility_ : 1;
bool draw_checkerboard_for_missing_tiles_ : 1;
bool draws_content_ : 1;
// Set for the layer that other layers are fixed to.
bool is_container_for_fixed_position_layers_ : 1;
+ bool is_3d_sorted_ : 1;
Region non_fast_scrollable_region_;
Region touch_event_handler_region_;
SkColor background_color_;
float opacity_;
SkXfermode::Mode blend_mode_;
gfx::PointF position_;
- gfx::Transform sublayer_transform_;
gfx::Transform transform_;
- // This property is effective when
- // is_container_for_fixed_position_layers_ == true,
- gfx::Vector2dF fixed_container_size_delta_;
-
LayerPositionConstraint position_constraint_;
gfx::Vector2dF scroll_delta_;
gfx::Vector2d sent_scroll_delta_;
- gfx::Vector2d max_scroll_offset_;
gfx::Vector2dF last_scroll_offset_;
// The global depth value of the center of the layer. This value is used
// Manages scrollbars for this layer
scoped_ptr<ScrollbarAnimationController> scrollbar_animation_controller_;
- // Weak pointers to this layer's scrollbars, if it has them. Updated during
- // tree synchronization.
- ScrollbarLayerImplBase* horizontal_scrollbar_layer_;
- ScrollbarLayerImplBase* vertical_scrollbar_layer_;
+ scoped_ptr<ScrollbarSet> scrollbars_;
ScopedPtrVector<CopyOutputRequest> copy_requests_;