| Index: cc/layers/layer_impl.h
|
| diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h
|
| index f52b5de77ce21807418f2b26e0d19c41b6f03449..f46c16e15b8988ff9a7055769ab93d3a0551a506 100644
|
| --- a/cc/layers/layer_impl.h
|
| +++ b/cc/layers/layer_impl.h
|
| @@ -19,6 +19,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/debug/frame_timing_request.h"
|
| #include "cc/input/input_handler.h"
|
| #include "cc/input/scrollbar.h"
|
| @@ -81,18 +82,26 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
|
| // of the layer.
|
| class ScrollOffsetDelegate {
|
| public:
|
| - virtual void SetTotalScrollOffset(const gfx::ScrollOffset& new_value) = 0;
|
| - virtual gfx::ScrollOffset GetTotalScrollOffset() = 0;
|
| + virtual void SetCurrentScrollOffset(const gfx::ScrollOffset& new_value) = 0;
|
| + virtual gfx::ScrollOffset GetCurrentScrollOffset() = 0;
|
| virtual bool IsExternalFlingActive() const = 0;
|
| 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,
|
| + scoped_refptr<SyncedScrollOffset> scroll_offset) {
|
| + return make_scoped_ptr(new LayerImpl(tree_impl, id, scroll_offset));
|
| + }
|
| +
|
| static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) {
|
| return make_scoped_ptr(new LayerImpl(tree_impl, id));
|
| }
|
| @@ -385,26 +394,29 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
|
| void SetContentsScale(float contents_scale_x, float contents_scale_y);
|
|
|
| void SetScrollOffsetDelegate(ScrollOffsetDelegate* scroll_offset_delegate);
|
| - void DidScroll();
|
| + void RefreshFromScrollDelegate();
|
| 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 SetCurrentScrollOffset(const gfx::ScrollOffset& scroll_offset);
|
| + void PushScrollOffsetFromMainThread(const gfx::ScrollOffset& scroll_offset);
|
| + gfx::ScrollOffset PullDeltaForMainThread();
|
| + gfx::ScrollOffset CurrentScrollOffset() const;
|
| + gfx::ScrollOffset BaseScrollOffset() const;
|
| + gfx::Vector2dF ScrollDelta() const;
|
| + void SetScrollDelta(const gfx::Vector2dF& delta);
|
|
|
| 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_; }
|
| + void SetScrollCompensationAdjustment(const gfx::Vector2dF& scroll_offset) {
|
| + scroll_compensation_adjustment_ = scroll_offset;
|
| + }
|
| + gfx::Vector2dF ScrollCompensationAdjustment() const {
|
| + return scroll_compensation_adjustment_;
|
| + }
|
|
|
| // Returns the delta of the scroll that was outside of the bounds of the
|
| // initial scroll
|
| @@ -428,7 +440,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;
|
| @@ -574,7 +585,12 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
|
| return frame_timing_requests_;
|
| }
|
|
|
| + SyncedScrollOffset* synced_scroll_offset() { return scroll_offset_.get(); }
|
| +
|
| 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.
|
| @@ -598,6 +614,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;
|
| @@ -626,11 +644,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;
|
| @@ -671,9 +691,7 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
|
|
|
| LayerPositionConstraint position_constraint_;
|
|
|
| - gfx::Vector2dF scroll_delta_;
|
| - gfx::Vector2dF sent_scroll_delta_;
|
| - gfx::ScrollOffset last_scroll_offset_;
|
| + gfx::Vector2dF scroll_compensation_adjustment_;
|
|
|
| int num_descendants_that_draw_content_;
|
|
|
|
|