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

Unified Diff: cc/layers/scrollbar_layer_impl_base.cc

Issue 23983047: Pinch/Zoom Infrastructure & Plumbing CL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to r248052. Created 6 years, 11 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
« no previous file with comments | « cc/layers/scrollbar_layer_impl_base.h ('k') | cc/layers/scrollbar_layer_interface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/scrollbar_layer_impl_base.cc
diff --git a/cc/layers/scrollbar_layer_impl_base.cc b/cc/layers/scrollbar_layer_impl_base.cc
index 55f46f51d846fe0fe074735abd315c6007dd49f7..978e8b8bb0e8eb5b81ba9432cca0d8969564ff4a 100644
--- a/cc/layers/scrollbar_layer_impl_base.cc
+++ b/cc/layers/scrollbar_layer_impl_base.cc
@@ -5,7 +5,7 @@
#include "cc/layers/scrollbar_layer_impl_base.h"
#include <algorithm>
-#include "cc/layers/layer.h"
+#include "cc/trees/layer_tree_impl.h"
#include "ui/gfx/rect_conversions.h"
namespace cc {
@@ -14,10 +14,12 @@ ScrollbarLayerImplBase::ScrollbarLayerImplBase(
LayerTreeImpl* tree_impl,
int id,
ScrollbarOrientation orientation,
- bool is_left_side_vertical_scrollbar)
+ bool is_left_side_vertical_scrollbar,
+ bool is_overlay)
: LayerImpl(tree_impl, id),
- scroll_layer_id_(Layer::INVALID_ID),
- is_overlay_scrollbar_(false),
+ scroll_layer_(NULL),
+ clip_layer_(NULL),
+ is_overlay_scrollbar_(is_overlay),
thumb_thickness_scale_factor_(1.f),
current_pos_(0.f),
maximum_(0),
@@ -26,14 +28,49 @@ ScrollbarLayerImplBase::ScrollbarLayerImplBase(
vertical_adjust_(0.f),
visible_to_total_length_ratio_(1.f) {}
+ScrollbarLayerImplBase::~ScrollbarLayerImplBase() {}
+
void ScrollbarLayerImplBase::PushPropertiesTo(LayerImpl* layer) {
LayerImpl::PushPropertiesTo(layer);
+ DCHECK(layer->ToScrollbarLayer());
+ layer->ToScrollbarLayer()->set_is_overlay_scrollbar(is_overlay_scrollbar_);
+ PushScrollClipPropertiesTo(layer);
+}
+
+void ScrollbarLayerImplBase::PushScrollClipPropertiesTo(LayerImpl* layer) {
+ DCHECK(layer->ToScrollbarLayer());
+ layer->ToScrollbarLayer()->SetScrollLayerById(ScrollLayerId());
+ layer->ToScrollbarLayer()->SetClipLayerById(ClipLayerId());
}
ScrollbarLayerImplBase* ScrollbarLayerImplBase::ToScrollbarLayer() {
return this;
}
+void ScrollbarLayerImplBase::SetScrollLayerById(int id) {
+ LayerImpl* scroll_layer = layer_tree_impl()->LayerById(id);
+ if (scroll_layer_ == scroll_layer)
+ return;
+
+ if (scroll_layer_)
+ scroll_layer_->RemoveScrollbar(this);
+ scroll_layer_ = scroll_layer;
+ if (scroll_layer_)
+ scroll_layer_->AddScrollbar(this);
+}
+
+void ScrollbarLayerImplBase::SetClipLayerById(int id) {
+ LayerImpl* clip_layer = layer_tree_impl()->LayerById(id);
+ if (clip_layer_ == clip_layer)
+ return;
+
+ if (clip_layer_)
+ clip_layer_->RemoveScrollbar(this);
+ clip_layer_ = clip_layer;
+ if (clip_layer_)
+ clip_layer_->AddScrollbar(this);
+}
+
gfx::Rect ScrollbarLayerImplBase::ScrollbarLayerRectToContentRect(
const gfx::RectF& layer_rect) const {
// Don't intersect with the bounds as in LayerRectToContentRect() because
@@ -177,4 +214,11 @@ gfx::Rect ScrollbarLayerImplBase::ComputeThumbQuadRect() const {
return ScrollbarLayerRectToContentRect(thumb_rect);
}
+void ScrollbarLayerImplBase::ScrollbarParametersDidChange() {
+ if (!clip_layer_ || !scroll_layer_)
+ return;
+
+ scroll_layer_->SetScrollbarPosition(this, clip_layer_);
+}
+
} // namespace cc
« no previous file with comments | « cc/layers/scrollbar_layer_impl_base.h ('k') | cc/layers/scrollbar_layer_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698