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

Unified Diff: cc/layers/layer.cc

Issue 135183016: Revert of Pinch/Zoom Infrastructure & Plumbing CL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index c2c4041c4d356b8902ba1165a3a9c2f5901ced6f..f5850067c415af5bc11f9495d2933533904a32e7 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -16,13 +16,11 @@
#include "cc/animation/layer_animation_controller.h"
#include "cc/layers/layer_client.h"
#include "cc/layers/layer_impl.h"
-#include "cc/layers/scrollbar_layer_interface.h"
#include "cc/output/copy_output_request.h"
#include "cc/output/copy_output_result.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/layer_tree_impl.h"
#include "third_party/skia/include/core/SkImageFilter.h"
-#include "ui/gfx/geometry/vector2d_conversions.h"
#include "ui/gfx/rect_conversions.h"
namespace cc {
@@ -41,7 +39,7 @@
ignore_set_needs_commit_(false),
parent_(NULL),
layer_tree_host_(NULL),
- scroll_clip_layer_(NULL),
+ scrollable_(false),
should_scroll_on_main_thread_(false),
have_wheel_event_handlers_(false),
user_scrollable_horizontal_(true),
@@ -681,12 +679,6 @@
void Layer::SetScrollOffset(gfx::Vector2d scroll_offset) {
DCHECK(IsPropertyChangeAllowed());
-
- if (layer_tree_host()) {
- scroll_offset = layer_tree_host()->DistributeScrollOffsetToViewports(
- scroll_offset, this);
- }
-
if (scroll_offset_ == scroll_offset)
return;
scroll_offset_ = scroll_offset;
@@ -708,44 +700,19 @@
// "this" may have been destroyed during the process.
}
-// TODO(wjmaclean) We should template this and put it into LayerTreeHostCommon
-// so that both Layer and LayerImpl are using the same code. In order
-// to template it we should avoid calling layer_tree_host() by giving
-// Layer/LayerImpl local accessors for page_scale_layer() and
-// page_scale_factor().
-gfx::Vector2d Layer::MaxScrollOffset() const {
- if (!scroll_clip_layer_)
- return gfx::Vector2d();
-
- gfx::Size scaled_scroll_bounds(bounds());
- Layer const* current_layer = this;
- Layer const* page_scale_layer = layer_tree_host()->page_scale_layer();
- float scale_factor = 1.f;
- do {
- if (current_layer == page_scale_layer) {
- scale_factor = layer_tree_host()->page_scale_factor();
- scaled_scroll_bounds.SetSize(
- scale_factor * scaled_scroll_bounds.width(),
- scale_factor * scaled_scroll_bounds.height());
- }
- current_layer = current_layer->parent();
- } while (current_layer && current_layer != scroll_clip_layer_);
- DCHECK(current_layer == scroll_clip_layer_);
-
- gfx::Vector2dF max_offset(
- scaled_scroll_bounds.width() - scroll_clip_layer_->bounds().width(),
- scaled_scroll_bounds.height() - scroll_clip_layer_->bounds().height());
- // We need the final scroll offset to be in CSS coords.
- max_offset.Scale(1.f / scale_factor);
- max_offset.SetToMax(gfx::Vector2dF());
- return gfx::ToFlooredVector2d(max_offset);
-}
-
-void Layer::SetScrollClipLayer(Layer* clip_layer) {
- DCHECK(IsPropertyChangeAllowed());
- if (scroll_clip_layer_ == clip_layer)
- return;
- scroll_clip_layer_ = clip_layer;
+void Layer::SetMaxScrollOffset(gfx::Vector2d max_scroll_offset) {
+ DCHECK(IsPropertyChangeAllowed());
+ if (max_scroll_offset_ == max_scroll_offset)
+ return;
+ max_scroll_offset_ = max_scroll_offset;
+ SetNeedsCommit();
+}
+
+void Layer::SetScrollable(bool scrollable) {
+ DCHECK(IsPropertyChangeAllowed());
+ if (scrollable_ == scrollable)
+ return;
+ scrollable_ = scrollable;
SetNeedsCommit();
}
@@ -944,10 +911,10 @@
layer->SetTransform(transform_);
DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly()));
- layer->SetScrollClipLayer(scroll_clip_layer_ ? scroll_clip_layer_->id()
- : Layer::INVALID_ID);
+ layer->SetScrollable(scrollable_);
layer->set_user_scrollable_horizontal(user_scrollable_horizontal_);
layer->set_user_scrollable_vertical(user_scrollable_vertical_);
+ layer->SetMaxScrollOffset(max_scroll_offset_);
LayerImpl* scroll_parent = NULL;
if (scroll_parent_)
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698