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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 , m_hasScrollParent(false) | 92 , m_hasScrollParent(false) |
93 , m_hasClipParent(false) | 93 , m_hasClipParent(false) |
94 , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip) | 94 , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip) |
95 , m_contentsOrientation(CompositingCoordinatesTopDown) | 95 , m_contentsOrientation(CompositingCoordinatesTopDown) |
96 , m_parent(0) | 96 , m_parent(0) |
97 , m_maskLayer(0) | 97 , m_maskLayer(0) |
98 , m_contentsClippingMaskLayer(0) | 98 , m_contentsClippingMaskLayer(0) |
99 , m_replicaLayer(0) | 99 , m_replicaLayer(0) |
100 , m_replicatedLayer(0) | 100 , m_replicatedLayer(0) |
101 , m_paintCount(0) | 101 , m_paintCount(0) |
| 102 , m_contentsSolidColor(Color::transparent) |
102 , m_contentsLayer(0) | 103 , m_contentsLayer(0) |
103 , m_contentsLayerId(0) | 104 , m_contentsLayerId(0) |
104 , m_scrollableArea(0) | 105 , m_scrollableArea(0) |
105 , m_3dRenderingContext(0) | 106 , m_3dRenderingContext(0) |
106 { | 107 { |
107 #ifndef NDEBUG | 108 #ifndef NDEBUG |
108 if (m_client) | 109 if (m_client) |
109 m_client->verifyNotPainting(); | 110 m_client->verifyNotPainting(); |
110 #endif | 111 #endif |
111 | 112 |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr
ame() : nullptr; | 1012 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr
ame() : nullptr; |
1012 if (nativeImage) { | 1013 if (nativeImage) { |
1013 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateNinePatchLayer()); | 1014 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateNinePatchLayer()); |
1014 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture); | 1015 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture); |
1015 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque(
)); | 1016 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque(
)); |
1016 registerContentsLayer(m_ninePatchLayer->layer()); | 1017 registerContentsLayer(m_ninePatchLayer->layer()); |
1017 } | 1018 } |
1018 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); | 1019 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); |
1019 } | 1020 } |
1020 | 1021 |
| 1022 void GraphicsLayer::setContentsToSolidColor(const Color& color) |
| 1023 { |
| 1024 if (color == m_contentsSolidColor) |
| 1025 return; |
| 1026 |
| 1027 m_contentsSolidColor = color; |
| 1028 if (color.alpha()) { |
| 1029 if (!m_solidColorLayer) { |
| 1030 m_solidColorLayer = adoptPtr(Platform::current()->compositorSupport(
)->createSolidColorLayer()); |
| 1031 registerContentsLayer(m_solidColorLayer->layer()); |
| 1032 } |
| 1033 m_solidColorLayer->setBackgroundColor(color.rgb()); |
| 1034 } else { |
| 1035 if (!m_solidColorLayer) |
| 1036 return; |
| 1037 unregisterContentsLayer(m_solidColorLayer->layer()); |
| 1038 m_solidColorLayer.clear(); |
| 1039 } |
| 1040 setContentsTo(m_solidColorLayer ? m_solidColorLayer->layer() : 0); |
| 1041 } |
| 1042 |
1021 bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation) | 1043 bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation) |
1022 { | 1044 { |
1023 OwnPtr<WebAnimation> animation(popAnimation); | 1045 OwnPtr<WebAnimation> animation(popAnimation); |
1024 ASSERT(animation); | 1046 ASSERT(animation); |
1025 platformLayer()->setAnimationDelegate(this); | 1047 platformLayer()->setAnimationDelegate(this); |
1026 | 1048 |
1027 // Remove any existing animations with the same animation id and target prop
erty. | 1049 // Remove any existing animations with the same animation id and target prop
erty. |
1028 platformLayer()->removeAnimation(animation->id(), animation->targetProperty(
)); | 1050 platformLayer()->removeAnimation(animation->id(), animation->targetProperty(
)); |
1029 return platformLayer()->addAnimation(animation.leakPtr()); | 1051 return platformLayer()->addAnimation(animation.leakPtr()); |
1030 } | 1052 } |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 #ifndef NDEBUG | 1224 #ifndef NDEBUG |
1203 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) | 1225 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) |
1204 { | 1226 { |
1205 if (!layer) | 1227 if (!layer) |
1206 return; | 1228 return; |
1207 | 1229 |
1208 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); | 1230 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); |
1209 fprintf(stderr, "%s\n", output.utf8().data()); | 1231 fprintf(stderr, "%s\n", output.utf8().data()); |
1210 } | 1232 } |
1211 #endif | 1233 #endif |
OLD | NEW |