| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #include "platform/graphics/GraphicsLayer.h" | 26 #include "platform/graphics/GraphicsLayer.h" |
| 27 | 27 |
| 28 #include "SkImageFilter.h" | 28 #include "SkImageFilter.h" |
| 29 #include "SkMatrix44.h" | 29 #include "SkMatrix44.h" |
| 30 #include "base/trace_event/trace_event_argument.h" | 30 #include "base/trace_event/trace_event_argument.h" |
| 31 #include "cc/layers/layer.h" | 31 #include "cc/layers/layer.h" |
| 32 #include "platform/DragImage.h" | 32 #include "platform/DragImage.h" |
| 33 #include "platform/JSONValues.h" | 33 #include "platform/JSONValues.h" |
| 34 #include "platform/TraceEvent.h" | 34 #include "platform/TraceEvent.h" |
| 35 #include "platform/animation/CompositorAnimation.h" | |
| 36 #include "platform/geometry/FloatRect.h" | 35 #include "platform/geometry/FloatRect.h" |
| 37 #include "platform/geometry/LayoutRect.h" | 36 #include "platform/geometry/LayoutRect.h" |
| 38 #include "platform/graphics/BitmapImage.h" | 37 #include "platform/graphics/BitmapImage.h" |
| 39 #include "platform/graphics/CompositorFactory.h" | 38 #include "platform/graphics/CompositorFactory.h" |
| 40 #include "platform/graphics/CompositorFilterOperations.h" | 39 #include "platform/graphics/CompositorFilterOperations.h" |
| 41 #include "platform/graphics/FirstPaintInvalidationTracking.h" | 40 #include "platform/graphics/FirstPaintInvalidationTracking.h" |
| 42 #include "platform/graphics/GraphicsContext.h" | 41 #include "platform/graphics/GraphicsContext.h" |
| 43 #include "platform/graphics/GraphicsLayerFactory.h" | 42 #include "platform/graphics/GraphicsLayerFactory.h" |
| 44 #include "platform/graphics/Image.h" | 43 #include "platform/graphics/Image.h" |
| 45 #include "platform/graphics/LinkHighlight.h" | 44 #include "platform/graphics/LinkHighlight.h" |
| (...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 } else { | 1114 } else { |
| 1116 if (m_imageLayer) { | 1115 if (m_imageLayer) { |
| 1117 unregisterContentsLayer(m_imageLayer->layer()); | 1116 unregisterContentsLayer(m_imageLayer->layer()); |
| 1118 m_imageLayer.clear(); | 1117 m_imageLayer.clear(); |
| 1119 } | 1118 } |
| 1120 } | 1119 } |
| 1121 | 1120 |
| 1122 setContentsTo(m_imageLayer ? m_imageLayer->layer() : 0); | 1121 setContentsTo(m_imageLayer ? m_imageLayer->layer() : 0); |
| 1123 } | 1122 } |
| 1124 | 1123 |
| 1125 bool GraphicsLayer::addAnimation(PassOwnPtr<CompositorAnimation> animation) | |
| 1126 { | |
| 1127 ASSERT(animation); | |
| 1128 platformLayer()->setAnimationDelegate(this); | |
| 1129 return platformLayer()->addAnimation(animation->releaseCCAnimation()); | |
| 1130 } | |
| 1131 | |
| 1132 void GraphicsLayer::pauseAnimation(int animationId, double timeOffset) | |
| 1133 { | |
| 1134 platformLayer()->pauseAnimation(animationId, timeOffset); | |
| 1135 } | |
| 1136 | |
| 1137 void GraphicsLayer::removeAnimation(int animationId) | |
| 1138 { | |
| 1139 platformLayer()->removeAnimation(animationId); | |
| 1140 } | |
| 1141 | |
| 1142 void GraphicsLayer::abortAnimation(int animationId) | |
| 1143 { | |
| 1144 platformLayer()->abortAnimation(animationId); | |
| 1145 } | |
| 1146 | |
| 1147 WebLayer* GraphicsLayer::platformLayer() const | 1124 WebLayer* GraphicsLayer::platformLayer() const |
| 1148 { | 1125 { |
| 1149 return m_layer->layer(); | 1126 return m_layer->layer(); |
| 1150 } | 1127 } |
| 1151 | 1128 |
| 1152 void GraphicsLayer::setFilters(const FilterOperations& filters) | 1129 void GraphicsLayer::setFilters(const FilterOperations& filters) |
| 1153 { | 1130 { |
| 1154 SkiaImageFilterBuilder builder; | 1131 SkiaImageFilterBuilder builder; |
| 1155 OwnPtr<CompositorFilterOperations> webFilters = adoptPtr(CompositorFactory::
current().createFilterOperations()); | 1132 OwnPtr<CompositorFilterOperations> webFilters = adoptPtr(CompositorFactory::
current().createFilterOperations()); |
| 1156 builder.buildFilterOperations(filters, webFilters.get()); | 1133 builder.buildFilterOperations(filters, webFilters.get()); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 m_scrollableArea = scrollableArea; | 1178 m_scrollableArea = scrollableArea; |
| 1202 | 1179 |
| 1203 // Viewport scrolling may involve pinch zoom and gets routed through | 1180 // Viewport scrolling may involve pinch zoom and gets routed through |
| 1204 // WebViewImpl explicitly rather than via GraphicsLayer::didScroll. | 1181 // WebViewImpl explicitly rather than via GraphicsLayer::didScroll. |
| 1205 if (isViewport) | 1182 if (isViewport) |
| 1206 m_layer->layer()->setScrollClient(0); | 1183 m_layer->layer()->setScrollClient(0); |
| 1207 else | 1184 else |
| 1208 m_layer->layer()->setScrollClient(this); | 1185 m_layer->layer()->setScrollClient(this); |
| 1209 } | 1186 } |
| 1210 | 1187 |
| 1211 void GraphicsLayer::notifyAnimationStarted(double monotonicTime, int group) | |
| 1212 { | |
| 1213 if (m_client) | |
| 1214 m_client->notifyAnimationStarted(this, monotonicTime, group); | |
| 1215 } | |
| 1216 | |
| 1217 void GraphicsLayer::notifyAnimationFinished(double, int group) | |
| 1218 { | |
| 1219 if (m_scrollableArea) | |
| 1220 m_scrollableArea->notifyCompositorAnimationFinished(group); | |
| 1221 } | |
| 1222 | |
| 1223 void GraphicsLayer::notifyAnimationAborted(double, int group) | |
| 1224 { | |
| 1225 if (m_scrollableArea) | |
| 1226 m_scrollableArea->notifyCompositorAnimationAborted(group); | |
| 1227 } | |
| 1228 | |
| 1229 void GraphicsLayer::didScroll() | 1188 void GraphicsLayer::didScroll() |
| 1230 { | 1189 { |
| 1231 if (m_scrollableArea) { | 1190 if (m_scrollableArea) { |
| 1232 DoublePoint newPosition = m_scrollableArea->minimumScrollPosition() + to
DoubleSize(m_layer->layer()->scrollPositionDouble()); | 1191 DoublePoint newPosition = m_scrollableArea->minimumScrollPosition() + to
DoubleSize(m_layer->layer()->scrollPositionDouble()); |
| 1233 | 1192 |
| 1234 // FrameView::setScrollPosition doesn't work for compositor commits (int
eracts poorly with programmatic scroll animations) | 1193 // FrameView::setScrollPosition doesn't work for compositor commits (int
eracts poorly with programmatic scroll animations) |
| 1235 // so we need to use the ScrollableArea version. The FrameView method sh
ould go away soon anyway. | 1194 // so we need to use the ScrollableArea version. The FrameView method sh
ould go away soon anyway. |
| 1236 m_scrollableArea->ScrollableArea::setScrollPosition(newPosition, Composi
torScroll); | 1195 m_scrollableArea->ScrollableArea::setScrollPosition(newPosition, Composi
torScroll); |
| 1237 } | 1196 } |
| 1238 } | 1197 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1271 { | 1230 { |
| 1272 if (!layer) { | 1231 if (!layer) { |
| 1273 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); | 1232 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); |
| 1274 return; | 1233 return; |
| 1275 } | 1234 } |
| 1276 | 1235 |
| 1277 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1236 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
| 1278 fprintf(stderr, "%s\n", output.utf8().data()); | 1237 fprintf(stderr, "%s\n", output.utf8().data()); |
| 1279 } | 1238 } |
| 1280 #endif | 1239 #endif |
| OLD | NEW |