OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 backgroundSize = frameView->visibleContentRect().size(); | 689 backgroundSize = frameView->visibleContentRect().size(); |
690 } | 690 } |
691 m_backgroundLayer->setPosition(backgroundPosition); | 691 m_backgroundLayer->setPosition(backgroundPosition); |
692 if (backgroundSize != m_backgroundLayer->size()) { | 692 if (backgroundSize != m_backgroundLayer->size()) { |
693 m_backgroundLayer->setSize(backgroundSize); | 693 m_backgroundLayer->setSize(backgroundSize); |
694 m_backgroundLayer->setNeedsDisplay(); | 694 m_backgroundLayer->setNeedsDisplay(); |
695 } | 695 } |
696 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend
erer()); | 696 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend
erer()); |
697 } | 697 } |
698 | 698 |
699 if (m_owningLayer->reflectionLayer() && m_owningLayer->reflectionLayer()->is
Composited()) { | 699 if (m_owningLayer->reflectionLayer() && m_owningLayer->reflectionLayer()->co
mpositedLayerMapping()) { |
700 CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer
->reflectionLayer()->compositedLayerMapping(); | 700 CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer
->reflectionLayer()->compositedLayerMapping(); |
701 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(); | 701 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(); |
702 | 702 |
703 // The reflection layer has the bounds of m_owningLayer->reflectionLayer
(), | 703 // The reflection layer has the bounds of m_owningLayer->reflectionLayer
(), |
704 // but the reflected layer is the bounds of this layer, so we need to po
sition it appropriately. | 704 // but the reflected layer is the bounds of this layer, so we need to po
sition it appropriately. |
705 FloatRect layerBounds = compositedBounds(); | 705 FloatRect layerBounds = compositedBounds(); |
706 FloatRect reflectionLayerBounds = reflectionCompositedLayerMapping->comp
ositedBounds(); | 706 FloatRect reflectionLayerBounds = reflectionCompositedLayerMapping->comp
ositedBounds(); |
707 reflectionCompositedLayerMapping->mainGraphicsLayer()->setReplicatedLaye
rPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location()))
; | 707 reflectionCompositedLayerMapping->mainGraphicsLayer()->setReplicatedLaye
rPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location()))
; |
708 } | 708 } |
709 | 709 |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 float CompositedLayerMapping::compositingOpacity(float rendererOpacity) const | 1190 float CompositedLayerMapping::compositingOpacity(float rendererOpacity) const |
1191 { | 1191 { |
1192 float finalOpacity = rendererOpacity; | 1192 float finalOpacity = rendererOpacity; |
1193 | 1193 |
1194 for (RenderLayer* curr = m_owningLayer->parent(); curr; curr = curr->parent(
)) { | 1194 for (RenderLayer* curr = m_owningLayer->parent(); curr; curr = curr->parent(
)) { |
1195 // We only care about parents that are stacking contexts. | 1195 // We only care about parents that are stacking contexts. |
1196 // Recall that opacity creates stacking context. | 1196 // Recall that opacity creates stacking context. |
1197 if (!curr->isStackingContainer()) | 1197 if (!curr->isStackingContainer()) |
1198 continue; | 1198 continue; |
1199 | 1199 |
1200 // If we found a compositing layer, we want to compute opacity | 1200 // If we found a composited layer, regardless of whether it actually |
1201 // relative to it. So we can break here. | 1201 // paints into it, we want to compute opacity relative to it. So we can |
1202 if (curr->isComposited()) | 1202 // break here. |
| 1203 // |
| 1204 // FIXME: with grouped backings, a composited descendant will have to |
| 1205 // continue past the grouped (squashed) layers that its parents may |
| 1206 // contribute to. This whole confusion can be avoided by specifying |
| 1207 // explicitly the composited ancestor where we would stop accumulating |
| 1208 // opacity. |
| 1209 if (curr->compositingState() == PaintsIntoOwnBacking || curr->compositin
gState() == HasOwnBackingButPaintsIntoAncestor) |
1203 break; | 1210 break; |
1204 | 1211 |
1205 finalOpacity *= curr->renderer()->opacity(); | 1212 finalOpacity *= curr->renderer()->opacity(); |
1206 } | 1213 } |
1207 | 1214 |
1208 return finalOpacity; | 1215 return finalOpacity; |
1209 } | 1216 } |
1210 | 1217 |
1211 Color CompositedLayerMapping::rendererBackgroundColor() const | 1218 Color CompositedLayerMapping::rendererBackgroundColor() const |
1212 { | 1219 { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 parent->updateLayerListsIfNeeded(); | 1337 parent->updateLayerListsIfNeeded(); |
1331 | 1338 |
1332 #if !ASSERT_DISABLED | 1339 #if !ASSERT_DISABLED |
1333 LayerListMutationDetector mutationChecker(parent); | 1340 LayerListMutationDetector mutationChecker(parent); |
1334 #endif | 1341 #endif |
1335 | 1342 |
1336 if (Vector<RenderLayer*>* normalFlowList = parent->normalFlowList()) { | 1343 if (Vector<RenderLayer*>* normalFlowList = parent->normalFlowList()) { |
1337 size_t listSize = normalFlowList->size(); | 1344 size_t listSize = normalFlowList->size(); |
1338 for (size_t i = 0; i < listSize; ++i) { | 1345 for (size_t i = 0; i < listSize; ++i) { |
1339 RenderLayer* curLayer = normalFlowList->at(i); | 1346 RenderLayer* curLayer = normalFlowList->at(i); |
1340 if (!curLayer->isComposited() | 1347 if (!curLayer->compositedLayerMapping() |
1341 && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDes
cendant(curLayer))) | 1348 && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDes
cendant(curLayer))) |
1342 return true; | 1349 return true; |
1343 } | 1350 } |
1344 } | 1351 } |
1345 | 1352 |
1346 if (parent->isStackingContainer()) { | 1353 if (parent->isStackingContainer()) { |
1347 if (!parent->hasVisibleDescendant()) | 1354 if (!parent->hasVisibleDescendant()) |
1348 return false; | 1355 return false; |
1349 | 1356 |
1350 // Use the m_hasCompositingDescendant bit to optimize? | 1357 // Use the m_hasCompositingDescendant bit to optimize? |
1351 if (Vector<RenderLayer*>* negZOrderList = parent->negZOrderList()) { | 1358 if (Vector<RenderLayer*>* negZOrderList = parent->negZOrderList()) { |
1352 size_t listSize = negZOrderList->size(); | 1359 size_t listSize = negZOrderList->size(); |
1353 for (size_t i = 0; i < listSize; ++i) { | 1360 for (size_t i = 0; i < listSize; ++i) { |
1354 RenderLayer* curLayer = negZOrderList->at(i); | 1361 RenderLayer* curLayer = negZOrderList->at(i); |
1355 if (!curLayer->isComposited() | 1362 if (!curLayer->compositedLayerMapping() |
1356 && (curLayer->hasVisibleContent() || hasVisibleNonCompositin
gDescendant(curLayer))) | 1363 && (curLayer->hasVisibleContent() || hasVisibleNonCompositin
gDescendant(curLayer))) |
1357 return true; | 1364 return true; |
1358 } | 1365 } |
1359 } | 1366 } |
1360 | 1367 |
1361 if (Vector<RenderLayer*>* posZOrderList = parent->posZOrderList()) { | 1368 if (Vector<RenderLayer*>* posZOrderList = parent->posZOrderList()) { |
1362 size_t listSize = posZOrderList->size(); | 1369 size_t listSize = posZOrderList->size(); |
1363 for (size_t i = 0; i < listSize; ++i) { | 1370 for (size_t i = 0; i < listSize; ++i) { |
1364 RenderLayer* curLayer = posZOrderList->at(i); | 1371 RenderLayer* curLayer = posZOrderList->at(i); |
1365 if (!curLayer->isComposited() | 1372 if (!curLayer->compositedLayerMapping() |
1366 && (curLayer->hasVisibleContent() || hasVisibleNonCompositin
gDescendant(curLayer))) | 1373 && (curLayer->hasVisibleContent() || hasVisibleNonCompositin
gDescendant(curLayer))) |
1367 return true; | 1374 return true; |
1368 } | 1375 } |
1369 } | 1376 } |
1370 } | 1377 } |
1371 | 1378 |
1372 return false; | 1379 return false; |
1373 } | 1380 } |
1374 | 1381 |
1375 // Conservative test for having no rendered children. | 1382 // FIXME: By name the implementation is correct. But the code that uses this fun
ction means something |
| 1383 // very slightly different - the implementation needs to also include composited
descendants that |
| 1384 // don't paint into their own backing, and instead paint into this backing. |
1376 bool CompositedLayerMapping::hasVisibleNonCompositingDescendantLayers() const | 1385 bool CompositedLayerMapping::hasVisibleNonCompositingDescendantLayers() const |
1377 { | 1386 { |
1378 return hasVisibleNonCompositingDescendant(m_owningLayer); | 1387 return hasVisibleNonCompositingDescendant(m_owningLayer); |
1379 } | 1388 } |
1380 | 1389 |
1381 bool CompositedLayerMapping::containsPaintedContent(bool isSimpleContainer) cons
t | 1390 bool CompositedLayerMapping::containsPaintedContent(bool isSimpleContainer) cons
t |
1382 { | 1391 { |
1383 if (isSimpleContainer || paintsIntoCompositedAncestor() || m_artificiallyInf
latedBounds || m_owningLayer->isReflection()) | 1392 if (isSimpleContainer || paintsIntoCompositedAncestor() || m_artificiallyInf
latedBounds || m_owningLayer->isReflection()) |
1384 return false; | 1393 return false; |
1385 | 1394 |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1964 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 1973 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
1965 name = "Scrolling Contents Layer"; | 1974 name = "Scrolling Contents Layer"; |
1966 } else { | 1975 } else { |
1967 ASSERT_NOT_REACHED(); | 1976 ASSERT_NOT_REACHED(); |
1968 } | 1977 } |
1969 | 1978 |
1970 return name; | 1979 return name; |
1971 } | 1980 } |
1972 | 1981 |
1973 } // namespace WebCore | 1982 } // namespace WebCore |
OLD | NEW |