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 11 matching lines...) Expand all Loading... |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 | 27 |
28 #include "platform/graphics/GraphicsLayer.h" | 28 #include "platform/graphics/GraphicsLayer.h" |
29 | 29 |
30 #include "SkImageFilter.h" | 30 #include "SkImageFilter.h" |
31 #include "SkMatrix44.h" | 31 #include "SkMatrix44.h" |
| 32 #include "platform/TraceEvent.h" |
32 #include "platform/geometry/FloatRect.h" | 33 #include "platform/geometry/FloatRect.h" |
33 #include "platform/geometry/LayoutRect.h" | 34 #include "platform/geometry/LayoutRect.h" |
| 35 #include "platform/graphics/FirstPaintInvalidationTracking.h" |
34 #include "platform/graphics/GraphicsLayerFactory.h" | 36 #include "platform/graphics/GraphicsLayerFactory.h" |
35 #include "platform/graphics/Image.h" | 37 #include "platform/graphics/Image.h" |
36 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" | 38 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" |
37 #include "platform/graphics/skia/NativeImageSkia.h" | 39 #include "platform/graphics/skia/NativeImageSkia.h" |
38 #include "platform/scroll/ScrollableArea.h" | 40 #include "platform/scroll/ScrollableArea.h" |
39 #include "platform/text/TextStream.h" | 41 #include "platform/text/TextStream.h" |
40 #include "public/platform/Platform.h" | 42 #include "public/platform/Platform.h" |
41 #include "public/platform/WebCompositorAnimation.h" | 43 #include "public/platform/WebCompositorAnimation.h" |
42 #include "public/platform/WebCompositorSupport.h" | 44 #include "public/platform/WebCompositorSupport.h" |
43 #include "public/platform/WebFilterOperations.h" | 45 #include "public/platform/WebFilterOperations.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 268 |
267 // If the compositing layer offset changes, we need to repaint. | 269 // If the compositing layer offset changes, we need to repaint. |
268 if (shouldSetNeedsDisplay == SetNeedsDisplay) | 270 if (shouldSetNeedsDisplay == SetNeedsDisplay) |
269 setNeedsDisplay(); | 271 setNeedsDisplay(); |
270 } | 272 } |
271 | 273 |
272 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I
ntRect& clip) | 274 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I
ntRect& clip) |
273 { | 275 { |
274 if (!m_client) | 276 if (!m_client) |
275 return; | 277 return; |
| 278 if (firstPaintInvalidationTrackingEnabled()) |
| 279 m_debugInfo.clearAnnotatedInvalidateRects(); |
276 incrementPaintCount(); | 280 incrementPaintCount(); |
277 m_client->paintContents(this, context, m_paintingPhase, clip); | 281 m_client->paintContents(this, context, m_paintingPhase, clip); |
278 } | 282 } |
279 | 283 |
280 void GraphicsLayer::updateChildList() | 284 void GraphicsLayer::updateChildList() |
281 { | 285 { |
282 WebLayer* childHost = m_layer->layer(); | 286 WebLayer* childHost = m_layer->layer(); |
283 childHost->removeAllChildren(); | 287 childHost->removeAllChildren(); |
284 | 288 |
285 clearContentsLayerIfUnregistered(); | 289 clearContentsLayerIfUnregistered(); |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 void GraphicsLayer::setNeedsDisplay() | 894 void GraphicsLayer::setNeedsDisplay() |
891 { | 895 { |
892 if (drawsContent()) { | 896 if (drawsContent()) { |
893 m_layer->layer()->invalidate(); | 897 m_layer->layer()->invalidate(); |
894 addRepaintRect(FloatRect(FloatPoint(), m_size)); | 898 addRepaintRect(FloatRect(FloatPoint(), m_size)); |
895 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 899 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
896 m_linkHighlights[i]->invalidate(); | 900 m_linkHighlights[i]->invalidate(); |
897 } | 901 } |
898 } | 902 } |
899 | 903 |
900 void GraphicsLayer::setNeedsDisplayInRect(const FloatRect& rect) | 904 void GraphicsLayer::setNeedsDisplayInRect(const FloatRect& rect, WebInvalidation
DebugAnnotations annotations) |
901 { | 905 { |
902 if (drawsContent()) { | 906 if (drawsContent()) { |
903 m_layer->layer()->invalidateRect(rect); | 907 m_layer->layer()->invalidateRect(rect); |
| 908 if (firstPaintInvalidationTrackingEnabled()) |
| 909 m_debugInfo.appendAnnotatedInvalidateRect(rect, annotations); |
904 addRepaintRect(rect); | 910 addRepaintRect(rect); |
905 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 911 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
906 m_linkHighlights[i]->invalidate(); | 912 m_linkHighlights[i]->invalidate(); |
907 } | 913 } |
908 } | 914 } |
909 | 915 |
910 void GraphicsLayer::setContentsRect(const IntRect& rect) | 916 void GraphicsLayer::setContentsRect(const IntRect& rect) |
911 { | 917 { |
912 if (rect == m_contentsRect) | 918 if (rect == m_contentsRect) |
913 return; | 919 return; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 #ifndef NDEBUG | 1062 #ifndef NDEBUG |
1057 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) | 1063 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) |
1058 { | 1064 { |
1059 if (!layer) | 1065 if (!layer) |
1060 return; | 1066 return; |
1061 | 1067 |
1062 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1068 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
1063 fprintf(stderr, "%s\n", output.utf8().data()); | 1069 fprintf(stderr, "%s\n", output.utf8().data()); |
1064 } | 1070 } |
1065 #endif | 1071 #endif |
OLD | NEW |