OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 | 475 |
476 void GraphicsLayerCA::setDrawsContent(bool drawsContent) | 476 void GraphicsLayerCA::setDrawsContent(bool drawsContent) |
477 { | 477 { |
478 if (drawsContent == m_drawsContent) | 478 if (drawsContent == m_drawsContent) |
479 return; | 479 return; |
480 | 480 |
481 GraphicsLayer::setDrawsContent(drawsContent); | 481 GraphicsLayer::setDrawsContent(drawsContent); |
482 noteLayerPropertyChanged(DrawsContentChanged); | 482 noteLayerPropertyChanged(DrawsContentChanged); |
483 } | 483 } |
484 | 484 |
485 void GraphicsLayerCA::setContentsVisible(bool contentsVisible) | |
486 { | |
487 if (contentsVisible == m_contentsVisible) | |
488 return; | |
489 | |
490 GraphicsLayer::setContentsVisible(contentsVisible); | |
491 noteLayerPropertyChanged(ContentsVisibilityChanged); | |
492 // Visibility affects whether the contentsLayer is parented. | |
493 if (m_contentsLayer) | |
494 noteSublayersChanged(); | |
495 } | |
496 | |
497 void GraphicsLayerCA::setAcceleratesDrawing(bool acceleratesDrawing) | 485 void GraphicsLayerCA::setAcceleratesDrawing(bool acceleratesDrawing) |
498 { | 486 { |
499 if (acceleratesDrawing == m_acceleratesDrawing) | 487 if (acceleratesDrawing == m_acceleratesDrawing) |
500 return; | 488 return; |
501 | 489 |
502 GraphicsLayer::setAcceleratesDrawing(acceleratesDrawing); | 490 GraphicsLayer::setAcceleratesDrawing(acceleratesDrawing); |
503 noteLayerPropertyChanged(AcceleratesDrawingChanged); | 491 noteLayerPropertyChanged(AcceleratesDrawingChanged); |
504 } | 492 } |
505 | 493 |
506 void GraphicsLayerCA::setAllowTiledLayer(bool allowTiledLayer) | 494 void GraphicsLayerCA::setAllowTiledLayer(bool allowTiledLayer) |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 | 930 |
943 if (m_uncommittedChanges & ChildrenTransformChanged) | 931 if (m_uncommittedChanges & ChildrenTransformChanged) |
944 updateChildrenTransform(); | 932 updateChildrenTransform(); |
945 | 933 |
946 if (m_uncommittedChanges & MasksToBoundsChanged) | 934 if (m_uncommittedChanges & MasksToBoundsChanged) |
947 updateMasksToBounds(); | 935 updateMasksToBounds(); |
948 | 936 |
949 if (m_uncommittedChanges & DrawsContentChanged) | 937 if (m_uncommittedChanges & DrawsContentChanged) |
950 updateLayerDrawsContent(pageScaleFactor, positionRelativeToBase); | 938 updateLayerDrawsContent(pageScaleFactor, positionRelativeToBase); |
951 | 939 |
952 if (m_uncommittedChanges & ContentsVisibilityChanged) | |
953 updateContentsVisibility(); | |
954 | |
955 if (m_uncommittedChanges & ContentsOpaqueChanged) | 940 if (m_uncommittedChanges & ContentsOpaqueChanged) |
956 updateContentsOpaque(); | 941 updateContentsOpaque(); |
957 | 942 |
958 if (m_uncommittedChanges & BackfaceVisibilityChanged) | 943 if (m_uncommittedChanges & BackfaceVisibilityChanged) |
959 updateBackfaceVisibility(); | 944 updateBackfaceVisibility(); |
960 | 945 |
961 if (m_uncommittedChanges & OpacityChanged) | 946 if (m_uncommittedChanges & OpacityChanged) |
962 updateOpacityOnLayer(); | 947 updateOpacityOnLayer(); |
963 | 948 |
964 if (m_uncommittedChanges & AnimationChanged) | 949 if (m_uncommittedChanges & AnimationChanged) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 PlatformCALayerList newSublayers; | 999 PlatformCALayerList newSublayers; |
1015 const Vector<GraphicsLayer*>& childLayers = children(); | 1000 const Vector<GraphicsLayer*>& childLayers = children(); |
1016 | 1001 |
1017 if (m_structuralLayer || m_contentsLayer || childLayers.size() > 0) { | 1002 if (m_structuralLayer || m_contentsLayer || childLayers.size() > 0) { |
1018 if (m_structuralLayer) { | 1003 if (m_structuralLayer) { |
1019 // Add the replica layer first. | 1004 // Add the replica layer first. |
1020 if (m_replicaLayer) | 1005 if (m_replicaLayer) |
1021 newSublayers.append(static_cast<GraphicsLayerCA*>(m_replicaLayer
)->primaryLayer()); | 1006 newSublayers.append(static_cast<GraphicsLayerCA*>(m_replicaLayer
)->primaryLayer()); |
1022 // Add the primary layer. Even if we have negative z-order children,
the primary layer always comes behind. | 1007 // Add the primary layer. Even if we have negative z-order children,
the primary layer always comes behind. |
1023 newSublayers.append(m_layer); | 1008 newSublayers.append(m_layer); |
1024 } else if (m_contentsLayer && m_contentsVisible) { | 1009 } else if (m_contentsLayer) { |
1025 // FIXME: add the contents layer in the correct order with negative
z-order children. | 1010 // FIXME: add the contents layer in the correct order with negative
z-order children. |
1026 // This does not cause visible rendering issues because currently co
ntents layers are only used | 1011 // This does not cause visible rendering issues because currently co
ntents layers are only used |
1027 // for replaced elements that don't have children. | 1012 // for replaced elements that don't have children. |
1028 newSublayers.append(m_contentsLayer); | 1013 newSublayers.append(m_contentsLayer); |
1029 } | 1014 } |
1030 | 1015 |
1031 size_t numChildren = childLayers.size(); | 1016 size_t numChildren = childLayers.size(); |
1032 for (size_t i = 0; i < numChildren; ++i) { | 1017 for (size_t i = 0; i < numChildren; ++i) { |
1033 GraphicsLayerCA* curChild = static_cast<GraphicsLayerCA*>(childLayer
s[i]); | 1018 GraphicsLayerCA* curChild = static_cast<GraphicsLayerCA*>(childLayer
s[i]); |
1034 PlatformCALayer* childLayer = curChild->layerForSuperlayer(); | 1019 PlatformCALayer* childLayer = curChild->layerForSuperlayer(); |
1035 newSublayers.append(childLayer); | 1020 newSublayers.append(childLayer); |
1036 } | 1021 } |
1037 | 1022 |
1038 for (size_t i = 0; i < newSublayers.size(); --i) | 1023 for (size_t i = 0; i < newSublayers.size(); --i) |
1039 newSublayers[i]->removeFromSuperlayer(); | 1024 newSublayers[i]->removeFromSuperlayer(); |
1040 } | 1025 } |
1041 | 1026 |
1042 #ifdef VISIBLE_TILE_WASH | 1027 #ifdef VISIBLE_TILE_WASH |
1043 if (m_visibleTileWashLayer) | 1028 if (m_visibleTileWashLayer) |
1044 newSublayers.append(m_visibleTileWashLayer); | 1029 newSublayers.append(m_visibleTileWashLayer); |
1045 #endif | 1030 #endif |
1046 | 1031 |
1047 if (m_structuralLayer) { | 1032 if (m_structuralLayer) { |
1048 m_structuralLayer->setSublayers(newSublayers); | 1033 m_structuralLayer->setSublayers(newSublayers); |
1049 | 1034 |
1050 if (m_contentsLayer) { | 1035 if (m_contentsLayer) { |
1051 // If we have a transform layer, then the contents layer is parented
in the | 1036 // If we have a transform layer, then the contents layer is parented
in the |
1052 // primary layer (which is itself a child of the transform layer). | 1037 // primary layer (which is itself a child of the transform layer). |
1053 m_layer->removeAllSublayers(); | 1038 m_layer->removeAllSublayers(); |
1054 if (m_contentsVisible) | 1039 m_layer->appendSublayer(m_contentsLayer.get()); |
1055 m_layer->appendSublayer(m_contentsLayer.get()); | |
1056 } | 1040 } |
1057 } else | 1041 } else |
1058 m_layer->setSublayers(newSublayers); | 1042 m_layer->setSublayers(newSublayers); |
1059 } | 1043 } |
1060 | 1044 |
1061 void GraphicsLayerCA::updateGeometry(float pageScaleFactor, const FloatPoint& po
sitionRelativeToBase) | 1045 void GraphicsLayerCA::updateGeometry(float pageScaleFactor, const FloatPoint& po
sitionRelativeToBase) |
1062 { | 1046 { |
1063 FloatPoint scaledPosition; | 1047 FloatPoint scaledPosition; |
1064 FloatPoint3D scaledAnchorPoint; | 1048 FloatPoint3D scaledAnchorPoint; |
1065 FloatSize scaledSize; | 1049 FloatSize scaledSize; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 | 1150 |
1167 if (LayerMap* layerCloneMap = m_layerClones.get()) { | 1151 if (LayerMap* layerCloneMap = m_layerClones.get()) { |
1168 LayerMap::const_iterator end = layerCloneMap->end(); | 1152 LayerMap::const_iterator end = layerCloneMap->end(); |
1169 for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++
it) | 1153 for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++
it) |
1170 it->second->setMasksToBounds(m_masksToBounds); | 1154 it->second->setMasksToBounds(m_masksToBounds); |
1171 } | 1155 } |
1172 | 1156 |
1173 updateDebugIndicators(); | 1157 updateDebugIndicators(); |
1174 } | 1158 } |
1175 | 1159 |
1176 void GraphicsLayerCA::updateContentsVisibility() | |
1177 { | |
1178 // Note that m_contentsVisible also affects whether m_contentsLayer is paren
ted. | |
1179 if (m_contentsVisible) { | |
1180 if (m_drawsContent) | |
1181 m_layer->setNeedsDisplay(); | |
1182 } else { | |
1183 m_layer.get()->setContents(0); | |
1184 | |
1185 if (LayerMap* layerCloneMap = m_layerClones.get()) { | |
1186 LayerMap::const_iterator end = layerCloneMap->end(); | |
1187 for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end
; ++it) | |
1188 it->second->setContents(0); | |
1189 } | |
1190 } | |
1191 } | |
1192 | |
1193 void GraphicsLayerCA::updateContentsOpaque() | 1160 void GraphicsLayerCA::updateContentsOpaque() |
1194 { | 1161 { |
1195 m_layer.get()->setOpaque(m_contentsOpaque); | 1162 m_layer.get()->setOpaque(m_contentsOpaque); |
1196 | 1163 |
1197 if (LayerMap* layerCloneMap = m_layerClones.get()) { | 1164 if (LayerMap* layerCloneMap = m_layerClones.get()) { |
1198 LayerMap::const_iterator end = layerCloneMap->end(); | 1165 LayerMap::const_iterator end = layerCloneMap->end(); |
1199 for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++
it) | 1166 for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++
it) |
1200 it->second->setOpaque(m_contentsOpaque); | 1167 it->second->setOpaque(m_contentsOpaque); |
1201 } | 1168 } |
1202 } | 1169 } |
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2548 { | 2515 { |
2549 if (!m_uncommittedChanges && m_client) | 2516 if (!m_uncommittedChanges && m_client) |
2550 m_client->notifySyncRequired(this); | 2517 m_client->notifySyncRequired(this); |
2551 | 2518 |
2552 m_uncommittedChanges |= flags; | 2519 m_uncommittedChanges |= flags; |
2553 } | 2520 } |
2554 | 2521 |
2555 } // namespace WebCore | 2522 } // namespace WebCore |
2556 | 2523 |
2557 #endif // USE(ACCELERATED_COMPOSITING) | 2524 #endif // USE(ACCELERATED_COMPOSITING) |
OLD | NEW |