Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(464)

Side by Side Diff: Source/core/rendering/CompositedLayerMapping.cpp

Issue 27030009: Revert "Make compositingState explicit (re-land #2 with bogus ASSERT removed)" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix build error Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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()->co mpositedLayerMapping()) { 699 if (m_owningLayer->reflectionLayer() && m_owningLayer->reflectionLayer()->is Composited()) {
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
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 composited layer, regardless of whether it actually 1200 // If we found a compositing layer, we want to compute opacity
1201 // paints into it, we want to compute opacity relative to it. So we can 1201 // relative to it. So we can break here.
1202 // break here. 1202 if (curr->isComposited())
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)
1210 break; 1203 break;
1211 1204
1212 finalOpacity *= curr->renderer()->opacity(); 1205 finalOpacity *= curr->renderer()->opacity();
1213 } 1206 }
1214 1207
1215 return finalOpacity; 1208 return finalOpacity;
1216 } 1209 }
1217 1210
1218 Color CompositedLayerMapping::rendererBackgroundColor() const 1211 Color CompositedLayerMapping::rendererBackgroundColor() const
1219 { 1212 {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 parent->updateLayerListsIfNeeded(); 1330 parent->updateLayerListsIfNeeded();
1338 1331
1339 #if !ASSERT_DISABLED 1332 #if !ASSERT_DISABLED
1340 LayerListMutationDetector mutationChecker(parent); 1333 LayerListMutationDetector mutationChecker(parent);
1341 #endif 1334 #endif
1342 1335
1343 if (Vector<RenderLayer*>* normalFlowList = parent->normalFlowList()) { 1336 if (Vector<RenderLayer*>* normalFlowList = parent->normalFlowList()) {
1344 size_t listSize = normalFlowList->size(); 1337 size_t listSize = normalFlowList->size();
1345 for (size_t i = 0; i < listSize; ++i) { 1338 for (size_t i = 0; i < listSize; ++i) {
1346 RenderLayer* curLayer = normalFlowList->at(i); 1339 RenderLayer* curLayer = normalFlowList->at(i);
1347 if (!curLayer->compositedLayerMapping() 1340 if (!curLayer->isComposited()
1348 && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDes cendant(curLayer))) 1341 && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDes cendant(curLayer)))
1349 return true; 1342 return true;
1350 } 1343 }
1351 } 1344 }
1352 1345
1353 if (parent->isStackingContainer()) { 1346 if (parent->isStackingContainer()) {
1354 if (!parent->hasVisibleDescendant()) 1347 if (!parent->hasVisibleDescendant())
1355 return false; 1348 return false;
1356 1349
1357 // Use the m_hasCompositingDescendant bit to optimize? 1350 // Use the m_hasCompositingDescendant bit to optimize?
1358 if (Vector<RenderLayer*>* negZOrderList = parent->negZOrderList()) { 1351 if (Vector<RenderLayer*>* negZOrderList = parent->negZOrderList()) {
1359 size_t listSize = negZOrderList->size(); 1352 size_t listSize = negZOrderList->size();
1360 for (size_t i = 0; i < listSize; ++i) { 1353 for (size_t i = 0; i < listSize; ++i) {
1361 RenderLayer* curLayer = negZOrderList->at(i); 1354 RenderLayer* curLayer = negZOrderList->at(i);
1362 if (!curLayer->compositedLayerMapping() 1355 if (!curLayer->isComposited()
1363 && (curLayer->hasVisibleContent() || hasVisibleNonCompositin gDescendant(curLayer))) 1356 && (curLayer->hasVisibleContent() || hasVisibleNonCompositin gDescendant(curLayer)))
1364 return true; 1357 return true;
1365 } 1358 }
1366 } 1359 }
1367 1360
1368 if (Vector<RenderLayer*>* posZOrderList = parent->posZOrderList()) { 1361 if (Vector<RenderLayer*>* posZOrderList = parent->posZOrderList()) {
1369 size_t listSize = posZOrderList->size(); 1362 size_t listSize = posZOrderList->size();
1370 for (size_t i = 0; i < listSize; ++i) { 1363 for (size_t i = 0; i < listSize; ++i) {
1371 RenderLayer* curLayer = posZOrderList->at(i); 1364 RenderLayer* curLayer = posZOrderList->at(i);
1372 if (!curLayer->compositedLayerMapping() 1365 if (!curLayer->isComposited()
1373 && (curLayer->hasVisibleContent() || hasVisibleNonCompositin gDescendant(curLayer))) 1366 && (curLayer->hasVisibleContent() || hasVisibleNonCompositin gDescendant(curLayer)))
1374 return true; 1367 return true;
1375 } 1368 }
1376 } 1369 }
1377 } 1370 }
1378 1371
1379 return false; 1372 return false;
1380 } 1373 }
1381 1374
1382 // FIXME: By name the implementation is correct. But the code that uses this fun ction means something 1375 // Conservative test for having no rendered children.
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.
1385 bool CompositedLayerMapping::hasVisibleNonCompositingDescendantLayers() const 1376 bool CompositedLayerMapping::hasVisibleNonCompositingDescendantLayers() const
1386 { 1377 {
1387 return hasVisibleNonCompositingDescendant(m_owningLayer); 1378 return hasVisibleNonCompositingDescendant(m_owningLayer);
1388 } 1379 }
1389 1380
1390 bool CompositedLayerMapping::containsPaintedContent(bool isSimpleContainer) cons t 1381 bool CompositedLayerMapping::containsPaintedContent(bool isSimpleContainer) cons t
1391 { 1382 {
1392 if (isSimpleContainer || paintsIntoCompositedAncestor() || m_artificiallyInf latedBounds || m_owningLayer->isReflection()) 1383 if (isSimpleContainer || paintsIntoCompositedAncestor() || m_artificiallyInf latedBounds || m_owningLayer->isReflection())
1393 return false; 1384 return false;
1394 1385
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 1964 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
1974 name = "Scrolling Contents Layer"; 1965 name = "Scrolling Contents Layer";
1975 } else { 1966 } else {
1976 ASSERT_NOT_REACHED(); 1967 ASSERT_NOT_REACHED();
1977 } 1968 }
1978 1969
1979 return name; 1970 return name;
1980 } 1971 }
1981 1972
1982 } // namespace WebCore 1973 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/scrolling/ScrollingCoordinator.cpp ('k') | Source/core/rendering/CompositingState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698