Index: cc/layers/layer_impl.h |
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h |
index d1cf0530586d65e6566df624062c474671ff5626..2fb1bd08697af08fd95ce94e6c91c8e4942c6184 100644 |
--- a/cc/layers/layer_impl.h |
+++ b/cc/layers/layer_impl.h |
@@ -18,6 +18,7 @@ |
#include "cc/base/cc_export.h" |
#include "cc/base/region.h" |
#include "cc/base/scoped_ptr_vector.h" |
+#include "cc/base/synced_property.h" |
#include "cc/input/input_handler.h" |
#include "cc/input/scrollbar.h" |
#include "cc/layers/draw_properties.h" |
@@ -85,14 +86,18 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, |
virtual void Update() const = 0; |
}; |
+ typedef SyncedProperty<AdditionGroup<gfx::ScrollOffset>> SyncedScrollOffset; |
typedef LayerImplList RenderSurfaceListType; |
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)); |
+ static scoped_ptr<LayerImpl> Create( |
+ LayerTreeImpl* tree_impl, |
+ int id, |
+ scoped_refptr<SyncedScrollOffset> scroll_offset) { |
+ return make_scoped_ptr(new LayerImpl(tree_impl, id, scroll_offset)); |
} |
~LayerImpl() override; |
@@ -100,7 +105,7 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, |
int id() const { return layer_id_; } |
// LayerAnimationValueProvider implementation. |
- gfx::ScrollOffset ScrollOffsetForAnimation() const override; |
+ gfx::ScrollOffset ScrollOffsetForAnimation() override; |
// LayerAnimationValueObserver implementation. |
void OnFilterAnimated(const FilterOperations& filters) override; |
@@ -383,26 +388,25 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, |
void SetContentsScale(float contents_scale_x, float contents_scale_y); |
void SetScrollOffsetDelegate(ScrollOffsetDelegate* scroll_offset_delegate); |
- void DidScroll(); |
bool IsExternalFlingActive() const; |
- void SetScrollOffset(const gfx::ScrollOffset& scroll_offset); |
- void SetScrollOffsetAndDelta(const gfx::ScrollOffset& scroll_offset, |
- const gfx::Vector2dF& scroll_delta); |
- gfx::ScrollOffset scroll_offset() const { return scroll_offset_; } |
+ void SetScrollOffsetOnActiveTree(const gfx::ScrollOffset& scroll_offset); |
+ void PushScrollOffsetFromMainThread(const gfx::ScrollOffset& scroll_offset); |
+ gfx::ScrollOffset CurrentScrollOffset(); |
+ gfx::ScrollOffset ScrollDelta() const { return scroll_offset_->Delta(); } |
+ void RefreshScrollDelegate(); |
+ |
+ SyncedScrollOffset* scroll_offset() { return scroll_offset_.get(); } |
+ const SyncedScrollOffset* scroll_offset() const { |
+ return scroll_offset_.get(); |
+ } |
gfx::ScrollOffset MaxScrollOffset() const; |
+ gfx::ScrollOffset ClampScrollOffsetToLimits(gfx::ScrollOffset offset) const; |
gfx::Vector2dF ClampScrollToMaxScrollOffset(); |
void SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer, |
LayerImpl* scrollbar_clip_layer, |
bool on_resize) const; |
- void SetScrollDelta(const gfx::Vector2dF& scroll_delta); |
- gfx::Vector2dF ScrollDelta() const; |
- |
- gfx::ScrollOffset TotalScrollOffset() const; |
- |
- void SetSentScrollDelta(const gfx::Vector2dF& sent_scroll_delta); |
- gfx::Vector2dF sent_scroll_delta() const { return sent_scroll_delta_; } |
// Returns the delta of the scroll that was outside of the bounds of the |
// initial scroll |
@@ -426,7 +430,6 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, |
bool user_scrollable(ScrollbarOrientation orientation) const; |
void ApplySentScrollDeltasFromAbortedCommit(); |
- void ApplyScrollDeltasSinceBeginMainFrame(); |
void SetShouldScrollOnMainThread(bool should_scroll_on_main_thread) { |
should_scroll_on_main_thread_ = should_scroll_on_main_thread; |
@@ -567,6 +570,9 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, |
int sorting_context_id() { return sorting_context_id_; } |
protected: |
+ LayerImpl(LayerTreeImpl* layer_impl, |
+ int id, |
+ scoped_refptr<SyncedScrollOffset> scroll_offset); |
LayerImpl(LayerTreeImpl* layer_impl, int id); |
// Get the color and size of the layer's debug border. |
@@ -590,6 +596,8 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, |
void NoteLayerPropertyChangedForDescendants(); |
private: |
+ void PushScrollOffset(const gfx::ScrollOffset* scroll_offset); |
+ void DidUpdateScrollOffset(); |
void NoteLayerPropertyChangedForDescendantsInternal(); |
virtual const char* LayerTypeAsString() const; |
@@ -618,11 +626,13 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, |
int layer_id_; |
LayerTreeImpl* layer_tree_impl_; |
+ // Properties dynamically changeable on active tree. |
+ scoped_refptr<SyncedScrollOffset> scroll_offset_; |
+ gfx::Vector2dF bounds_delta_; |
+ |
// Properties synchronized from the associated Layer. |
gfx::Point3F transform_origin_; |
gfx::Size bounds_; |
- gfx::Vector2dF bounds_delta_; |
- gfx::ScrollOffset scroll_offset_; |
ScrollOffsetDelegate* scroll_offset_delegate_; |
LayerImpl* scroll_clip_layer_; |
bool scrollable_ : 1; |
@@ -663,10 +673,6 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, |
LayerPositionConstraint position_constraint_; |
- gfx::Vector2dF scroll_delta_; |
- gfx::Vector2dF sent_scroll_delta_; |
- gfx::ScrollOffset last_scroll_offset_; |
- |
int num_descendants_that_draw_content_; |
// The global depth value of the center of the layer. This value is used |