Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* * Copyright (C) 2009 Apple Inc. All rights reserved. |
|
tkent
2014/09/10 00:03:28
accidental edit?
kouhei (in TOK)
2014/09/10 23:46:29
Done.
| |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | |
| 3 * | 2 * |
| 4 * Redistribution and use in source and binary forms, with or without | 3 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 4 * modification, are permitted provided that the following conditions |
| 6 * are met: | 5 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 6 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 7 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 8 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 9 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. | 10 * documentation and/or other materials provided with the distribution. |
| 12 * | 11 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 12 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 13 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 14 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 15 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 16 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 17 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 18 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 19 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 20 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 21 * (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. | 22 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 23 */ |
| 25 | 24 |
| 26 #include "config.h" | 25 #include "config.h" |
| 27 | 26 |
| 28 #include "platform/graphics/GraphicsLayer.h" | 27 #include "platform/graphics/GraphicsLayer.h" |
| 29 | 28 |
| 30 #include "SkImageFilter.h" | 29 #include "SkImageFilter.h" |
| 31 #include "SkMatrix44.h" | 30 #include "SkMatrix44.h" |
| 31 #include "platform/TraceEvent.h" | |
| 32 #include "platform/geometry/FloatRect.h" | 32 #include "platform/geometry/FloatRect.h" |
| 33 #include "platform/geometry/LayoutRect.h" | 33 #include "platform/geometry/LayoutRect.h" |
| 34 #include "platform/graphics/FirstPaintInvalidationTracking.h" | |
| 34 #include "platform/graphics/GraphicsLayerFactory.h" | 35 #include "platform/graphics/GraphicsLayerFactory.h" |
| 35 #include "platform/graphics/Image.h" | 36 #include "platform/graphics/Image.h" |
| 36 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" | 37 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" |
| 37 #include "platform/graphics/skia/NativeImageSkia.h" | 38 #include "platform/graphics/skia/NativeImageSkia.h" |
| 38 #include "platform/scroll/ScrollableArea.h" | 39 #include "platform/scroll/ScrollableArea.h" |
| 39 #include "platform/text/TextStream.h" | 40 #include "platform/text/TextStream.h" |
| 40 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
| 41 #include "public/platform/WebCompositorAnimation.h" | 42 #include "public/platform/WebCompositorAnimation.h" |
| 42 #include "public/platform/WebCompositorSupport.h" | 43 #include "public/platform/WebCompositorSupport.h" |
| 43 #include "public/platform/WebFilterOperations.h" | 44 #include "public/platform/WebFilterOperations.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 266 | 267 |
| 267 // If the compositing layer offset changes, we need to repaint. | 268 // If the compositing layer offset changes, we need to repaint. |
| 268 if (shouldSetNeedsDisplay == SetNeedsDisplay) | 269 if (shouldSetNeedsDisplay == SetNeedsDisplay) |
| 269 setNeedsDisplay(); | 270 setNeedsDisplay(); |
| 270 } | 271 } |
| 271 | 272 |
| 272 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I ntRect& clip) | 273 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I ntRect& clip) |
| 273 { | 274 { |
| 274 if (!m_client) | 275 if (!m_client) |
| 275 return; | 276 return; |
| 277 if (firstPaintInvalidationTrackingEnabled()) | |
| 278 m_debugInfo.clearAnnotatedInvalidateRects(); | |
| 276 incrementPaintCount(); | 279 incrementPaintCount(); |
| 277 m_client->paintContents(this, context, m_paintingPhase, clip); | 280 m_client->paintContents(this, context, m_paintingPhase, clip); |
| 278 } | 281 } |
| 279 | 282 |
| 280 void GraphicsLayer::updateChildList() | 283 void GraphicsLayer::updateChildList() |
| 281 { | 284 { |
| 282 WebLayer* childHost = m_layer->layer(); | 285 WebLayer* childHost = m_layer->layer(); |
| 283 childHost->removeAllChildren(); | 286 childHost->removeAllChildren(); |
| 284 | 287 |
| 285 clearContentsLayerIfUnregistered(); | 288 clearContentsLayerIfUnregistered(); |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 890 void GraphicsLayer::setNeedsDisplay() | 893 void GraphicsLayer::setNeedsDisplay() |
| 891 { | 894 { |
| 892 if (drawsContent()) { | 895 if (drawsContent()) { |
| 893 m_layer->layer()->invalidate(); | 896 m_layer->layer()->invalidate(); |
| 894 addRepaintRect(FloatRect(FloatPoint(), m_size)); | 897 addRepaintRect(FloatRect(FloatPoint(), m_size)); |
| 895 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 898 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
| 896 m_linkHighlights[i]->invalidate(); | 899 m_linkHighlights[i]->invalidate(); |
| 897 } | 900 } |
| 898 } | 901 } |
| 899 | 902 |
| 900 void GraphicsLayer::setNeedsDisplayInRect(const FloatRect& rect) | 903 void GraphicsLayer::setNeedsDisplayInRect(const FloatRect& rect, WebInvalidation DebugAnnotations annotations) |
| 901 { | 904 { |
| 902 if (drawsContent()) { | 905 if (drawsContent()) { |
| 903 m_layer->layer()->invalidateRect(rect); | 906 m_layer->layer()->invalidateRect(rect); |
| 907 if (firstPaintInvalidationTrackingEnabled()) | |
| 908 m_debugInfo.appendAnnotatedInvalidateRect(rect, annotations); | |
| 904 addRepaintRect(rect); | 909 addRepaintRect(rect); |
| 905 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 910 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
| 906 m_linkHighlights[i]->invalidate(); | 911 m_linkHighlights[i]->invalidate(); |
| 907 } | 912 } |
| 908 } | 913 } |
| 909 | 914 |
| 910 void GraphicsLayer::setContentsRect(const IntRect& rect) | 915 void GraphicsLayer::setContentsRect(const IntRect& rect) |
| 911 { | 916 { |
| 912 if (rect == m_contentsRect) | 917 if (rect == m_contentsRect) |
| 913 return; | 918 return; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1056 #ifndef NDEBUG | 1061 #ifndef NDEBUG |
| 1057 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) | 1062 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) |
| 1058 { | 1063 { |
| 1059 if (!layer) | 1064 if (!layer) |
| 1060 return; | 1065 return; |
| 1061 | 1066 |
| 1062 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1067 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
| 1063 fprintf(stderr, "%s\n", output.utf8().data()); | 1068 fprintf(stderr, "%s\n", output.utf8().data()); |
| 1064 } | 1069 } |
| 1065 #endif | 1070 #endif |
| OLD | NEW |