Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: cc/layers/scrollbar_layer_impl_base.h

Issue 18341009: Refactor cc scrollbar layers to separate solid-color vs desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address James R's comments. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/layers/scrollbar_layer_impl_base.h
diff --git a/cc/layers/scrollbar_layer_impl_base.h b/cc/layers/scrollbar_layer_impl_base.h
new file mode 100644
index 0000000000000000000000000000000000000000..0a9fe88b65ad2c1e88564a9cfc71131d00155a49
--- /dev/null
+++ b/cc/layers/scrollbar_layer_impl_base.h
@@ -0,0 +1,74 @@
+// Copyright 2012 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 CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_
+#define CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_
+
+#include "cc/base/cc_export.h"
+#include "cc/input/scrollbar.h"
+#include "cc/layers/layer.h"
+#include "cc/layers/layer_impl.h"
+
+namespace cc {
+
+class LayerTreeImpl;
+
+class CC_EXPORT ScrollbarLayerImplBase : public LayerImpl {
+ public:
+ int scroll_layer_id() const { return scroll_layer_id_; }
+ void set_scroll_layer_id(int id) { scroll_layer_id_ = id; }
+
+ float CurrentPos() const { return current_pos_; }
+ void SetCurrentPos(float pos) { current_pos_ = pos; }
+ int Maximum() const { return maximum_; }
+ void SetMaximum(int maximum) { maximum_ = maximum; }
+
+ void set_visible_to_total_length_ratio(float ratio) {
+ visible_to_total_length_ratio_ = ratio;
+ }
+
+ void set_vertical_adjust(float vertical_adjust) {
+ vertical_adjust_ = vertical_adjust;
+ }
+
+ ScrollbarOrientation Orientation() const { return orientation_; }
+
+ virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
+ virtual ScrollbarLayerImplBase* ToScrollbarLayerBase() OVERRIDE;
+
+ virtual gfx::Rect ComputeThumbQuadRect() const = 0;
+
+ protected:
+ ScrollbarLayerImplBase(LayerTreeImpl* tree_impl,
+ int id,
+ ScrollbarOrientation orientation)
+ : LayerImpl(tree_impl, id),
+ scroll_layer_id_(Layer::INVALID_ID),
+ current_pos_(0.f),
+ maximum_(0),
+ orientation_(orientation),
+ visible_to_total_length_ratio_(1.f),
+ vertical_adjust_(0.f) {}
+ virtual ~ScrollbarLayerImplBase() {}
+
+ gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const;
+ gfx::Rect ComputeThumbQuadRectInternal(int thumb_length,
+ float track_length,
+ int track_start,
+ int thumb_thickness) const;
+
+ int scroll_layer_id_;
+
+ float current_pos_;
+ int maximum_;
+ ScrollbarOrientation orientation_;
+
+ float visible_to_total_length_ratio_;
+ // Difference between the clip layer's height and the visible viewport
+ // height (which may differ in the presence of top-controls hiding).
+ float vertical_adjust_;
+};
+
+} // namespace cc
+#endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_

Powered by Google App Engine
This is Rietveld 408576698