Index: cc/pinch_zoom_scrollbar_layer_impl.h |
diff --git a/cc/pinch_zoom_scrollbar_layer_impl.h b/cc/pinch_zoom_scrollbar_layer_impl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7b7d102c9ea387854459c90a9e6f83a11304412d |
--- /dev/null |
+++ b/cc/pinch_zoom_scrollbar_layer_impl.h |
@@ -0,0 +1,109 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef PINCH_ZOOM_SCROLLBAR_LAYER_IMPL_H_ |
+#define PINCH_ZOOM_SCROLLBAR_LAYER_IMPL_H_ |
+ |
+#include "cc/cc_export.h" |
+#include "cc/scoped_resource.h" |
+#include "cc/scrollbar_layer_impl_base.h" |
+#include "ui/gfx/rect.h" |
+ |
+namespace cc { |
+ |
+class PinchZoomViewport; |
+ |
+// PinchZoomScrollbarState exists to store the state associated with a |
+// PinchZoomScrollbarLayerImpl, so the latter can be treated as an inexpensive |
+// wrapper that can be cheaply created and discarded. |
Ian Vollick
2013/01/15 20:33:48
We should design a system that allows impl-only la
|
+class CC_EXPORT PinchZoomScrollbarState { |
+ public: |
+ PinchZoomScrollbarState(WebKit::WebScrollbar::Orientation, |
+ PinchZoomViewport* owner); |
+ ~PinchZoomScrollbarState(); |
+ |
+ WebKit::WebScrollbar::Orientation orientation() const { |
+ return orientation_; |
+ } |
+ |
+ scoped_ptr<ScopedResource>& thumb_texture() { |
+ return thumb_texture_; |
+ } |
+ |
+ gfx::Rect& thumb_rect() { |
+ return thumb_rect_; |
+ } |
+ |
+ float& thumb_position() { |
+ return thumb_position_; |
+ } |
+ |
+ int& track_length() { |
+ return track_length_; |
+ } |
+ |
+ int& maximum_position() { |
+ return maximum_position_; |
+ } |
+ |
+ gfx::SizeF layout_viewport_size() const; |
+ gfx::Vector2dF zoomed_viewport_offset() const; |
+ float total_page_scale_factor() const; |
+ float device_scale_factor() const; |
+ LayerImpl* root_scroll_layer(); |
+ |
+ // A separate function to trigger size & position changes while |
+ // *not* in willDraw(). |
+ void RefreshSizeAndPosition(LayerImpl*); |
+ bool ShouldDisplayPinchZoomScrollbars(); |
+ |
+ int track_width() const { |
+ return kTrackWidth; |
+ } |
+ |
+ private: |
+ static const int kTrackWidth = 10; |
+ PinchZoomViewport* owner_; |
+ |
+ WebKit::WebScrollbar::Orientation orientation_; |
+ |
+ scoped_ptr<ScopedResource> thumb_texture_; |
+ gfx::Rect thumb_rect_; |
+ float thumb_position_; |
+ int track_length_; |
+ int maximum_position_; |
+}; |
+ |
+class CC_EXPORT PinchZoomScrollbarLayerImpl : public ScrollbarLayerImplBase { |
+ public: |
+ static scoped_ptr<PinchZoomScrollbarLayerImpl> create( |
+ LayerTreeImpl* treeImpl, int id, PinchZoomScrollbarState* state); |
+ virtual ~PinchZoomScrollbarLayerImpl(); |
+ |
+ // ScrollbarLayerImplBase overrides. |
+ virtual float currentPos() const OVERRIDE; |
+ virtual int totalSize() const OVERRIDE; |
+ virtual int maximum() const OVERRIDE; |
+ |
+ virtual WebKit::WebScrollbar::Orientation orientation() const OVERRIDE; |
+ |
+ // LayerImpl overrides. |
+ virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; |
+ virtual void didLoseOutputSurface() OVERRIDE; |
+ virtual void willDraw(ResourceProvider*) OVERRIDE; |
+ // The pinch-zoom scrollbars should never have an implTransform applied to them. |
+ virtual void setImplTransform(const gfx::Transform& transform) OVERRIDE { } |
+ |
+ // Class-specific functions. |
+ |
+ private: |
+ PinchZoomScrollbarLayerImpl( |
+ LayerTreeImpl* treeImpl, int id, PinchZoomScrollbarState* state); |
+ |
+ PinchZoomScrollbarState* state_; |
+ |
+}; |
+ |
+} // namespace cc |
+#endif // PINCH_ZOOM_SCROLLBAR_LAYER_IMPL_H_ |