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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 692213002: Create PageScaleAnimation after ImplTree is activated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index c4319ad9efb676c97debdfa2063deccbb99b0d64..876fed127adc74f88d3683280df9e09312f57fd5 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -414,6 +414,48 @@ void LayerTreeHostImpl::ManageTiles() {
client_->DidManageTiles();
}
+void LayerTreeHostImpl::StartPageScaleAnimation(
+ const gfx::Vector2d& target_offset,
+ bool anchor_point,
+ float page_scale,
+ base::TimeDelta duration) {
+ if (!InnerViewportScrollLayer())
+ return;
+
+ gfx::ScrollOffset scroll_total = active_tree_->TotalScrollOffset();
+ gfx::SizeF scaled_scrollable_size = active_tree_->ScrollableSize();
+ gfx::SizeF viewport_size =
+ active_tree_->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),
+ active_tree_->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());
+ }
+
+ SetNeedsAnimate();
+ client_->SetNeedsCommitOnImplThread();
+ client_->RenewTreePriority();
+}
+
bool LayerTreeHostImpl::IsCurrentlyScrollingLayerAt(
const gfx::Point& viewport_point,
InputHandler::ScrollInputType type) {
@@ -1808,13 +1850,14 @@ void LayerTreeHostImpl::ActivateSyncTree() {
stats.draw_duration.GetLastTimeDelta());
}
- scoped_ptr<PageScaleAnimation> page_scale_animation =
- active_tree_->TakePageScaleAnimation();
- if (page_scale_animation) {
- page_scale_animation_ = page_scale_animation.Pass();
- SetNeedsAnimate();
- client_->SetNeedsCommitOnImplThread();
- client_->RenewTreePriority();
+ scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation =
+ active_tree_->TakePendingPageScaleAnimation();
+ if (pending_page_scale_animation) {
+ StartPageScaleAnimation(
+ pending_page_scale_animation->target_offset,
+ pending_page_scale_animation->use_anchor,
+ pending_page_scale_animation->scale,
+ pending_page_scale_animation->duration);
}
}
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698