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 "CCLayerTreeHostImpl.h" | 7 #include "CCLayerTreeHostImpl.h" |
8 | 8 |
9 #include "CCAppendQuadsData.h" | 9 #include "CCAppendQuadsData.h" |
10 #include "CCDamageTracker.h" | 10 #include "CCDamageTracker.h" |
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
930 if (status == ScrollStarted && !potentiallyScrollingLayerImpl) | 930 if (status == ScrollStarted && !potentiallyScrollingLayerImpl) |
931 potentiallyScrollingLayerImpl = scrollLayerImpl; | 931 potentiallyScrollingLayerImpl = scrollLayerImpl; |
932 } | 932 } |
933 | 933 |
934 if (potentiallyScrollingLayerImpl) { | 934 if (potentiallyScrollingLayerImpl) { |
935 m_currentlyScrollingLayerImpl = potentiallyScrollingLayerImpl; | 935 m_currentlyScrollingLayerImpl = potentiallyScrollingLayerImpl; |
936 // Gesture events need to be transformed from screen coordinates to loca l layer coordinates | 936 // Gesture events need to be transformed from screen coordinates to loca l layer coordinates |
937 // so that the scrolling contents exactly follow the user's finger. In c ontrast, wheel | 937 // so that the scrolling contents exactly follow the user's finger. In c ontrast, wheel |
938 // events are already in local layer coordinates so we can just apply th em directly. | 938 // events are already in local layer coordinates so we can just apply th em directly. |
939 m_scrollDeltaIsInScreenSpace = (type == Gesture); | 939 m_scrollDeltaIsInScreenSpace = (type == Gesture); |
940 m_didImplThreadScroll = true; | |
940 return ScrollStarted; | 941 return ScrollStarted; |
941 } | 942 } |
942 return ScrollIgnored; | 943 return ScrollIgnored; |
943 } | 944 } |
944 | 945 |
945 static FloatSize scrollLayerWithScreenSpaceDelta(CCLayerImpl& layerImpl, const F loatPoint& screenSpacePoint, const FloatSize& screenSpaceDelta) | 946 static FloatSize scrollLayerWithScreenSpaceDelta(CCLayerImpl& layerImpl, const F loatPoint& screenSpacePoint, const FloatSize& screenSpaceDelta) |
946 { | 947 { |
947 // Layers with non-invertible screen space transforms should not have passed the scroll hit | 948 // Layers with non-invertible screen space transforms should not have passed the scroll hit |
948 // test in the first place. | 949 // test in the first place. |
949 ASSERT(layerImpl.screenSpaceTransform().isInvertible()); | 950 ASSERT(layerImpl.screenSpaceTransform().isInvertible()); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1027 if (!scrollDelta.isZero() && flooredIntSize(pendingDelta).isEmpty()) { | 1028 if (!scrollDelta.isZero() && flooredIntSize(pendingDelta).isEmpty()) { |
1028 m_client->setNeedsCommitOnImplThread(); | 1029 m_client->setNeedsCommitOnImplThread(); |
1029 m_client->setNeedsRedrawOnImplThread(); | 1030 m_client->setNeedsRedrawOnImplThread(); |
1030 } | 1031 } |
1031 } | 1032 } |
1032 | 1033 |
1033 void CCLayerTreeHostImpl::clearCurrentlyScrollingLayer() | 1034 void CCLayerTreeHostImpl::clearCurrentlyScrollingLayer() |
1034 { | 1035 { |
1035 m_currentlyScrollingLayerImpl = 0; | 1036 m_currentlyScrollingLayerImpl = 0; |
1036 m_scrollingLayerIdFromPreviousTree = -1; | 1037 m_scrollingLayerIdFromPreviousTree = -1; |
1038 m_didImplThreadScroll = false; | |
enne (OOO)
2012/09/28 18:54:29
This seems a little weird to me. If a scroll gest
tdanderson
2012/10/01 19:38:12
Thanks for the feedback. Instead of using a boolea
| |
1037 } | 1039 } |
1038 | 1040 |
1039 void CCLayerTreeHostImpl::scrollEnd() | 1041 void CCLayerTreeHostImpl::scrollEnd() |
1040 { | 1042 { |
1041 clearCurrentlyScrollingLayer(); | 1043 clearCurrentlyScrollingLayer(); |
1042 } | 1044 } |
1043 | 1045 |
1044 void CCLayerTreeHostImpl::pinchGestureBegin() | 1046 void CCLayerTreeHostImpl::pinchGestureBegin() |
1045 { | 1047 { |
1046 m_pinchGestureActive = true; | 1048 m_pinchGestureActive = true; |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1281 | 1283 |
1282 int CCLayerTreeHostImpl::sourceAnimationFrameNumber() const | 1284 int CCLayerTreeHostImpl::sourceAnimationFrameNumber() const |
1283 { | 1285 { |
1284 return fpsCounter()->currentFrameNumber(); | 1286 return fpsCounter()->currentFrameNumber(); |
1285 } | 1287 } |
1286 | 1288 |
1287 void CCLayerTreeHostImpl::renderingStats(CCRenderingStats* stats) const | 1289 void CCLayerTreeHostImpl::renderingStats(CCRenderingStats* stats) const |
1288 { | 1290 { |
1289 stats->numFramesSentToScreen = fpsCounter()->currentFrameNumber(); | 1291 stats->numFramesSentToScreen = fpsCounter()->currentFrameNumber(); |
1290 stats->droppedFrameCount = fpsCounter()->droppedFrameCount(); | 1292 stats->droppedFrameCount = fpsCounter()->droppedFrameCount(); |
1293 stats->didImplThreadScroll = m_didImplThreadScroll; | |
1291 } | 1294 } |
1292 | 1295 |
1293 void CCLayerTreeHostImpl::animateScrollbars(double monotonicTime) | 1296 void CCLayerTreeHostImpl::animateScrollbars(double monotonicTime) |
1294 { | 1297 { |
1295 animateScrollbarsRecursive(m_rootLayerImpl.get(), monotonicTime); | 1298 animateScrollbarsRecursive(m_rootLayerImpl.get(), monotonicTime); |
1296 } | 1299 } |
1297 | 1300 |
1298 void CCLayerTreeHostImpl::animateScrollbarsRecursive(CCLayerImpl* layer, double monotonicTime) | 1301 void CCLayerTreeHostImpl::animateScrollbarsRecursive(CCLayerImpl* layer, double monotonicTime) |
1299 { | 1302 { |
1300 if (!layer) | 1303 if (!layer) |
1301 return; | 1304 return; |
1302 | 1305 |
1303 CCScrollbarAnimationController* scrollbarController = layer->scrollbarAnimat ionController(); | 1306 CCScrollbarAnimationController* scrollbarController = layer->scrollbarAnimat ionController(); |
1304 if (scrollbarController && scrollbarController->animate(monotonicTime)) | 1307 if (scrollbarController && scrollbarController->animate(monotonicTime)) |
1305 m_client->setNeedsRedrawOnImplThread(); | 1308 m_client->setNeedsRedrawOnImplThread(); |
1306 | 1309 |
1307 for (size_t i = 0; i < layer->children().size(); ++i) | 1310 for (size_t i = 0; i < layer->children().size(); ++i) |
1308 animateScrollbarsRecursive(layer->children()[i], monotonicTime); | 1311 animateScrollbarsRecursive(layer->children()[i], monotonicTime); |
1309 } | 1312 } |
1310 | 1313 |
1311 } // namespace cc | 1314 } // namespace cc |
OLD | NEW |