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