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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/layer_tree_host_impl.h" | 7 #include "cc/layer_tree_host_impl.h" |
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 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 FloatPoint localStartPoint = MathUtil::projectPoint(inverseScreenSpaceTransf
orm, screenSpacePoint, startClipped); | 1095 FloatPoint localStartPoint = MathUtil::projectPoint(inverseScreenSpaceTransf
orm, screenSpacePoint, startClipped); |
1096 FloatPoint localEndPoint = MathUtil::projectPoint(inverseScreenSpaceTransfor
m, screenSpaceEndPoint, endClipped); | 1096 FloatPoint localEndPoint = MathUtil::projectPoint(inverseScreenSpaceTransfor
m, screenSpaceEndPoint, endClipped); |
1097 | 1097 |
1098 // In general scroll point coordinates should not get clipped. | 1098 // In general scroll point coordinates should not get clipped. |
1099 DCHECK(!startClipped); | 1099 DCHECK(!startClipped); |
1100 DCHECK(!endClipped); | 1100 DCHECK(!endClipped); |
1101 if (startClipped || endClipped) | 1101 if (startClipped || endClipped) |
1102 return FloatSize(); | 1102 return FloatSize(); |
1103 | 1103 |
1104 // localStartPoint and localEndPoint are in content space but we want to mov
e them to layer space for scrolling. | 1104 // localStartPoint and localEndPoint are in content space but we want to mov
e them to layer space for scrolling. |
1105 float widthScale = 1; | 1105 float widthScale = 1.0 / layerImpl.contentsScaleX(); |
1106 float heightScale = 1; | 1106 float heightScale = 1.0 / layerImpl.contentsScaleY(); |
1107 if (!layerImpl.contentBounds().isEmpty() && !layerImpl.bounds().isEmpty()) { | |
1108 widthScale = layerImpl.bounds().width() / static_cast<float>(layerImpl.c
ontentBounds().width()); | |
1109 heightScale = layerImpl.bounds().height() / static_cast<float>(layerImpl
.contentBounds().height()); | |
1110 } | |
1111 localStartPoint.scale(widthScale, heightScale); | 1107 localStartPoint.scale(widthScale, heightScale); |
1112 localEndPoint.scale(widthScale, heightScale); | 1108 localEndPoint.scale(widthScale, heightScale); |
1113 | 1109 |
1114 // Apply the scroll delta. | 1110 // Apply the scroll delta. |
1115 FloatSize previousDelta(layerImpl.scrollDelta()); | 1111 FloatSize previousDelta(layerImpl.scrollDelta()); |
1116 FloatSize unscrolled = layerImpl.scrollBy(localEndPoint - localStartPoint); | 1112 FloatSize unscrolled = layerImpl.scrollBy(localEndPoint - localStartPoint); |
1117 | 1113 |
1118 if (viewport) | 1114 if (viewport) |
1119 viewport->applyScroll(unscrolled); | 1115 viewport->applyScroll(unscrolled); |
1120 | 1116 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio
nController(); | 1481 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio
nController(); |
1486 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); | 1482 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); |
1487 if (scrollbarController && scrollbarController->animate(monotonicTime)) | 1483 if (scrollbarController && scrollbarController->animate(monotonicTime)) |
1488 m_client->setNeedsRedrawOnImplThread(); | 1484 m_client->setNeedsRedrawOnImplThread(); |
1489 | 1485 |
1490 for (size_t i = 0; i < layer->children().size(); ++i) | 1486 for (size_t i = 0; i < layer->children().size(); ++i) |
1491 animateScrollbarsRecursive(layer->children()[i], time); | 1487 animateScrollbarsRecursive(layer->children()[i], time); |
1492 } | 1488 } |
1493 | 1489 |
1494 } // namespace cc | 1490 } // namespace cc |
OLD | NEW |