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

Unified Diff: cc/trees/layer_tree_impl.cc

Issue 615953005: Move page scale animation from LayerTreeHostImpl to LayerTreeImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added CC_EXPORT to PageScaleAnimation Created 6 years, 2 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/trees/layer_tree_impl.h ('k') | content/renderer/input/input_handler_proxy_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_impl.cc
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index ab6aa8151d4ca549742aa108e81c805f63d3f2f1..948c2bae3204342669eec1748c24ff0e0bdabd5f 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -17,6 +17,7 @@
#include "cc/base/util.h"
#include "cc/debug/devtools_instrumentation.h"
#include "cc/debug/traced_value.h"
+#include "cc/input/page_scale_animation.h"
#include "cc/layers/heads_up_display_layer_impl.h"
#include "cc/layers/layer.h"
#include "cc/layers/layer_iterator.h"
@@ -219,6 +220,8 @@ void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) {
target_tree->page_scale_delta() / target_tree->sent_page_scale_delta());
target_tree->set_sent_page_scale_delta(1);
+ target_tree->page_scale_animation_ = page_scale_animation_.Pass();
+
if (page_scale_layer_ && inner_viewport_scroll_layer_) {
target_tree->SetViewportLayersFromIds(
page_scale_layer_->id(),
@@ -1458,4 +1461,45 @@ BlockingTaskRunner* LayerTreeImpl::BlockingMainThreadTaskRunner() const {
return proxy()->blocking_main_thread_task_runner();
}
+void LayerTreeImpl::SetPageScaleAnimation(
+ const gfx::Vector2d& target_offset,
+ bool anchor_point,
+ float page_scale,
+ base::TimeDelta duration) {
+ if (!InnerViewportScrollLayer())
+ return;
+
+ gfx::ScrollOffset scroll_total = TotalScrollOffset();
+ gfx::SizeF scaled_scrollable_size = ScrollableSize();
+ gfx::SizeF viewport_size = InnerViewportContainerLayer()->bounds();
+
+ // Easing constants experimentally determined.
+ scoped_ptr<TimingFunction> timing_function =
+ CubicBezierTimingFunction::Create(.8, 0, .3, .9);
+
+ // TODO(miletus) : Pass in ScrollOffset.
+ page_scale_animation_ =
+ PageScaleAnimation::Create(ScrollOffsetToVector2dF(scroll_total),
+ total_page_scale_factor(),
+ viewport_size,
+ scaled_scrollable_size,
+ timing_function.Pass());
+
+ if (anchor_point) {
+ gfx::Vector2dF anchor(target_offset);
+ page_scale_animation_->ZoomWithAnchor(anchor,
+ page_scale,
+ duration.InSecondsF());
+ } else {
+ gfx::Vector2dF scaled_target_offset = target_offset;
+ page_scale_animation_->ZoomTo(scaled_target_offset,
+ page_scale,
+ duration.InSecondsF());
+ }
+}
+
+scoped_ptr<PageScaleAnimation> LayerTreeImpl::TakePageScaleAnimation() {
+ return page_scale_animation_.Pass();
+}
+
} // namespace cc
« no previous file with comments | « cc/trees/layer_tree_impl.h ('k') | content/renderer/input/input_handler_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698