| 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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 m_rootScrollLayerImpl->scrollbarAnimationController()->didPinchGestureBe
gin(); | 1234 m_rootScrollLayerImpl->scrollbarAnimationController()->didPinchGestureBe
gin(); |
| 1235 } | 1235 } |
| 1236 | 1236 |
| 1237 void LayerTreeHostImpl::pinchGestureUpdate(float magnifyDelta, gfx::Point anchor
) | 1237 void LayerTreeHostImpl::pinchGestureUpdate(float magnifyDelta, gfx::Point anchor
) |
| 1238 { | 1238 { |
| 1239 TRACE_EVENT0("cc", "LayerTreeHostImpl::pinchGestureUpdate"); | 1239 TRACE_EVENT0("cc", "LayerTreeHostImpl::pinchGestureUpdate"); |
| 1240 | 1240 |
| 1241 if (!m_rootScrollLayerImpl) | 1241 if (!m_rootScrollLayerImpl) |
| 1242 return; | 1242 return; |
| 1243 | 1243 |
| 1244 if (m_previousPinchAnchor == gfx::Point()) | |
| 1245 m_previousPinchAnchor = anchor; | |
| 1246 | |
| 1247 // Keep the center-of-pinch anchor specified by (x, y) in a stable | 1244 // Keep the center-of-pinch anchor specified by (x, y) in a stable |
| 1248 // position over the course of the magnify. | 1245 // position over the course of the magnify. |
| 1249 float pageScaleDelta = m_pinchZoomViewport.pageScaleDelta(); | 1246 float pageScaleDelta = m_pinchZoomViewport.pageScaleDelta(); |
| 1250 gfx::PointF previousScaleAnchor = gfx::ScalePoint(m_previousPinchAnchor, 1 /
pageScaleDelta); | 1247 gfx::PointF previousScaleAnchor = gfx::ScalePoint(anchor, 1 / pageScaleDelta
); |
| 1251 setPageScaleDelta(pageScaleDelta * magnifyDelta); | 1248 setPageScaleDelta(pageScaleDelta * magnifyDelta); |
| 1252 pageScaleDelta = m_pinchZoomViewport.pageScaleDelta(); | 1249 pageScaleDelta = m_pinchZoomViewport.pageScaleDelta(); |
| 1253 gfx::PointF newScaleAnchor = gfx::ScalePoint(anchor, 1 / pageScaleDelta); | 1250 gfx::PointF newScaleAnchor = gfx::ScalePoint(anchor, 1 / pageScaleDelta); |
| 1254 gfx::Vector2dF move = previousScaleAnchor - newScaleAnchor; | 1251 gfx::Vector2dF move = previousScaleAnchor - newScaleAnchor; |
| 1255 | 1252 |
| 1256 m_previousPinchAnchor = anchor; | 1253 m_previousPinchAnchor = anchor; |
| 1257 | 1254 |
| 1258 if (m_settings.pageScalePinchZoomEnabled) { | 1255 if (m_settings.pageScalePinchZoomEnabled) { |
| 1259 // Compute the application of the delta with respect to the current page
zoom of the page. | 1256 // Compute the application of the delta with respect to the current page
zoom of the page. |
| 1260 move.Scale(1 / (m_pinchZoomViewport.pageScaleFactor() * m_deviceScaleFac
tor)); | 1257 move.Scale(1 / (m_pinchZoomViewport.pageScaleFactor() * m_deviceScaleFac
tor)); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1509 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio
nController(); | 1506 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio
nController(); |
| 1510 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); | 1507 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); |
| 1511 if (scrollbarController && scrollbarController->animate(monotonicTime)) | 1508 if (scrollbarController && scrollbarController->animate(monotonicTime)) |
| 1512 m_client->setNeedsRedrawOnImplThread(); | 1509 m_client->setNeedsRedrawOnImplThread(); |
| 1513 | 1510 |
| 1514 for (size_t i = 0; i < layer->children().size(); ++i) | 1511 for (size_t i = 0; i < layer->children().size(); ++i) |
| 1515 animateScrollbarsRecursive(layer->children()[i], time); | 1512 animateScrollbarsRecursive(layer->children()[i], time); |
| 1516 } | 1513 } |
| 1517 | 1514 |
| 1518 } // namespace cc | 1515 } // namespace cc |
| OLD | NEW |