| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/layer_tree_host_impl.h" | 5 #include "cc/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 return m_context.get(); | 281 return m_context.get(); |
| 282 } | 282 } |
| 283 | 283 |
| 284 void LayerTreeHostImpl::animate(base::TimeTicks monotonicTime, base::Time wallCl
ockTime) | 284 void LayerTreeHostImpl::animate(base::TimeTicks monotonicTime, base::Time wallCl
ockTime) |
| 285 { | 285 { |
| 286 animatePageScale(monotonicTime); | 286 animatePageScale(monotonicTime); |
| 287 animateLayers(monotonicTime, wallClockTime); | 287 animateLayers(monotonicTime, wallClockTime); |
| 288 animateScrollbars(monotonicTime); | 288 animateScrollbars(monotonicTime); |
| 289 } | 289 } |
| 290 | 290 |
| 291 void LayerTreeHostImpl::startPageScaleAnimation(gfx::Vector2d targetPosition, bo
ol anchorPoint, float pageScale, base::TimeTicks startTime, base::TimeDelta dura
tion) | 291 void LayerTreeHostImpl::startPageScaleAnimation(gfx::Vector2d targetOffset, bool
anchorPoint, float pageScale, base::TimeTicks startTime, base::TimeDelta durati
on) |
| 292 { | 292 { |
| 293 if (!m_rootScrollLayerImpl) | 293 if (!m_rootScrollLayerImpl) |
| 294 return; | 294 return; |
| 295 | 295 |
| 296 gfx::Vector2dF scrollTotal = m_rootScrollLayerImpl->scrollOffset() + m_rootS
crollLayerImpl->scrollDelta(); | 296 gfx::Vector2dF scrollTotal = m_rootScrollLayerImpl->scrollOffset() + m_rootS
crollLayerImpl->scrollDelta(); |
| 297 gfx::SizeF scaledContentSize = contentSize(); | 297 gfx::SizeF scaledContentSize = contentSize(); |
| 298 if (!Settings::pageScalePinchZoomEnabled()) { | 298 if (!Settings::pageScalePinchZoomEnabled()) { |
| 299 scrollTotal.Scale(1 / m_pinchZoomViewport.pageScaleFactor()); | 299 scrollTotal.Scale(1 / m_pinchZoomViewport.pageScaleFactor()); |
| 300 scaledContentSize.Scale(1 / m_pinchZoomViewport.pageScaleFactor()); | 300 scaledContentSize.Scale(1 / m_pinchZoomViewport.pageScaleFactor()); |
| 301 } | 301 } |
| 302 gfx::SizeF viewportSize = gfx::ScaleSize(m_deviceViewportSize, 1 / m_deviceS
caleFactor); | 302 gfx::SizeF viewportSize = gfx::ScaleSize(m_deviceViewportSize, 1 / m_deviceS
caleFactor); |
| 303 | 303 |
| 304 double startTimeSeconds = (startTime - base::TimeTicks()).InSecondsF(); | 304 double startTimeSeconds = (startTime - base::TimeTicks()).InSecondsF(); |
| 305 m_pageScaleAnimation = PageScaleAnimation::create(scrollTotal, m_pinchZoomVi
ewport.totalPageScaleFactor(), viewportSize, scaledContentSize, startTimeSeconds
); | 305 m_pageScaleAnimation = PageScaleAnimation::create(scrollTotal, m_pinchZoomVi
ewport.totalPageScaleFactor(), viewportSize, scaledContentSize, startTimeSeconds
); |
| 306 | 306 |
| 307 if (anchorPoint) { | 307 if (anchorPoint) { |
| 308 gfx::Vector2dF anchor(targetPosition); | 308 gfx::Vector2dF anchor(targetOffset); |
| 309 if (!Settings::pageScalePinchZoomEnabled()) | 309 if (!Settings::pageScalePinchZoomEnabled()) |
| 310 anchor.Scale(1 / pageScale); | 310 anchor.Scale(1 / pageScale); |
| 311 m_pageScaleAnimation->zoomWithAnchor(anchor, pageScale, duration.InSecon
dsF()); | 311 m_pageScaleAnimation->zoomWithAnchor(anchor, pageScale, duration.InSecon
dsF()); |
| 312 } else { | 312 } else { |
| 313 gfx::Vector2dF scaledTargetPosition = targetPosition; | 313 gfx::Vector2dF scaledTargetOffset = targetOffset; |
| 314 if (!Settings::pageScalePinchZoomEnabled()) | 314 if (!Settings::pageScalePinchZoomEnabled()) |
| 315 scaledTargetPosition.Scale(1 / pageScale); | 315 scaledTargetOffset.Scale(1 / pageScale); |
| 316 m_pageScaleAnimation->zoomTo(scaledTargetPosition, pageScale, duration.I
nSecondsF()); | 316 m_pageScaleAnimation->zoomTo(scaledTargetOffset, pageScale, duration.InS
econdsF()); |
| 317 } | 317 } |
| 318 | 318 |
| 319 m_client->setNeedsRedrawOnImplThread(); | 319 m_client->setNeedsRedrawOnImplThread(); |
| 320 m_client->setNeedsCommitOnImplThread(); | 320 m_client->setNeedsCommitOnImplThread(); |
| 321 } | 321 } |
| 322 | 322 |
| 323 void LayerTreeHostImpl::scheduleAnimation() | 323 void LayerTreeHostImpl::scheduleAnimation() |
| 324 { | 324 { |
| 325 m_client->setNeedsRedrawOnImplThread(); | 325 m_client->setNeedsRedrawOnImplThread(); |
| 326 } | 326 } |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1488 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio
nController(); | 1488 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio
nController(); |
| 1489 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); | 1489 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); |
| 1490 if (scrollbarController && scrollbarController->animate(monotonicTime)) | 1490 if (scrollbarController && scrollbarController->animate(monotonicTime)) |
| 1491 m_client->setNeedsRedrawOnImplThread(); | 1491 m_client->setNeedsRedrawOnImplThread(); |
| 1492 | 1492 |
| 1493 for (size_t i = 0; i < layer->children().size(); ++i) | 1493 for (size_t i = 0; i < layer->children().size(); ++i) |
| 1494 animateScrollbarsRecursive(layer->children()[i], time); | 1494 animateScrollbarsRecursive(layer->children()[i], time); |
| 1495 } | 1495 } |
| 1496 | 1496 |
| 1497 } // namespace cc | 1497 } // namespace cc |
| OLD | NEW |