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 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1350 | 1350 |
1351 return false; | 1351 return false; |
1352 } | 1352 } |
1353 | 1353 |
1354 enum ApplyToGraphicsLayersModeFlags { | 1354 enum ApplyToGraphicsLayersModeFlags { |
1355 ApplyToLayersAffectedByPreserve3D = (1 << 0), | 1355 ApplyToLayersAffectedByPreserve3D = (1 << 0), |
1356 ApplyToSquashingLayer = (1 << 1), | 1356 ApplyToSquashingLayer = (1 << 1), |
1357 ApplyToScrollbarLayers = (1 << 2), | 1357 ApplyToScrollbarLayers = (1 << 2), |
1358 ApplyToBackgroundLayer = (1 << 3), | 1358 ApplyToBackgroundLayer = (1 << 3), |
1359 ApplyToMaskLayers = (1 << 4), | 1359 ApplyToMaskLayers = (1 << 4), |
1360 ApplyToContentLayers = (1 << 5), // This doesn't include scrollingContentsLa
yer. | 1360 ApplyToContentLayers = (1 << 5), |
1361 ApplyToScrollingContentsLayer = (1 << 6), | 1361 ApplyToAllGraphicsLayers = (ApplyToSquashingLayer | ApplyToScrollbarLayers |
ApplyToBackgroundLayer | ApplyToMaskLayers | ApplyToLayersAffectedByPreserve3D
| ApplyToContentLayers) |
1362 ApplyToAllGraphicsLayers = (ApplyToSquashingLayer | ApplyToScrollbarLayers |
ApplyToBackgroundLayer | ApplyToMaskLayers | ApplyToLayersAffectedByPreserve3D
| ApplyToContentLayers | ApplyToScrollingContentsLayer) | |
1363 }; | 1362 }; |
1364 typedef unsigned ApplyToGraphicsLayersMode; | 1363 typedef unsigned ApplyToGraphicsLayersMode; |
1365 | 1364 |
1366 template <typename Func> | 1365 template <typename Func> |
1367 static void ApplyToGraphicsLayers(const CompositedLayerMapping* mapping, const F
unc& f, ApplyToGraphicsLayersMode mode) | 1366 static void ApplyToGraphicsLayers(const CompositedLayerMapping* mapping, const F
unc& f, ApplyToGraphicsLayersMode mode) |
1368 { | 1367 { |
1369 ASSERT(mode); | 1368 ASSERT(mode); |
1370 | 1369 |
1371 if ((mode & ApplyToLayersAffectedByPreserve3D) && mapping->childTransformLay
er()) | 1370 if ((mode & ApplyToLayersAffectedByPreserve3D) && mapping->childTransformLay
er()) |
1372 f(mapping->childTransformLayer()); | 1371 f(mapping->childTransformLayer()); |
1373 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLay
ers)) && mapping->mainGraphicsLayer()) | 1372 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLay
ers)) && mapping->mainGraphicsLayer()) |
1374 f(mapping->mainGraphicsLayer()); | 1373 f(mapping->mainGraphicsLayer()); |
1375 if ((mode & ApplyToLayersAffectedByPreserve3D) && mapping->clippingLayer()) | 1374 if ((mode & ApplyToLayersAffectedByPreserve3D) && mapping->clippingLayer()) |
1376 f(mapping->clippingLayer()); | 1375 f(mapping->clippingLayer()); |
1377 if ((mode & ApplyToLayersAffectedByPreserve3D) && mapping->scrollingLayer()) | 1376 if ((mode & ApplyToLayersAffectedByPreserve3D) && mapping->scrollingLayer()) |
1378 f(mapping->scrollingLayer()); | 1377 f(mapping->scrollingLayer()); |
1379 if ((mode & ApplyToLayersAffectedByPreserve3D) && mapping->scrollingBlockSel
ectionLayer()) | 1378 if ((mode & ApplyToLayersAffectedByPreserve3D) && mapping->scrollingBlockSel
ectionLayer()) |
1380 f(mapping->scrollingBlockSelectionLayer()); | 1379 f(mapping->scrollingBlockSelectionLayer()); |
1381 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToScrollingC
ontentsLayer)) && mapping->scrollingContentsLayer()) | 1380 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLay
ers)) && mapping->scrollingContentsLayer()) |
1382 f(mapping->scrollingContentsLayer()); | 1381 f(mapping->scrollingContentsLayer()); |
1383 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLay
ers)) && mapping->foregroundLayer()) | 1382 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLay
ers)) && mapping->foregroundLayer()) |
1384 f(mapping->foregroundLayer()); | 1383 f(mapping->foregroundLayer()); |
1385 | 1384 |
1386 if ((mode & ApplyToSquashingLayer) && mapping->squashingLayer()) | 1385 if ((mode & ApplyToSquashingLayer) && mapping->squashingLayer()) |
1387 f(mapping->squashingLayer()); | 1386 f(mapping->squashingLayer()); |
1388 | 1387 |
1389 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers)) && mapping
->maskLayer()) | 1388 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers)) && mapping
->maskLayer()) |
1390 f(mapping->maskLayer()); | 1389 f(mapping->maskLayer()); |
1391 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers)) && mapping
->childClippingMaskLayer()) | 1390 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers)) && mapping
->childClippingMaskLayer()) |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2053 // FIXME: need to split out paint invalidations for the background. | 2052 // FIXME: need to split out paint invalidations for the background. |
2054 ASSERT(!paintsIntoCompositedAncestor()); | 2053 ASSERT(!paintsIntoCompositedAncestor()); |
2055 | 2054 |
2056 SetContentsNeedsDisplayInRectFunctor functor = { | 2055 SetContentsNeedsDisplayInRectFunctor functor = { |
2057 pixelSnappedIntRect(r.location() + m_owningLayer.subpixelAccumulation(),
r.size()), | 2056 pixelSnappedIntRect(r.location() + m_owningLayer.subpixelAccumulation(),
r.size()), |
2058 invalidationReason | 2057 invalidationReason |
2059 }; | 2058 }; |
2060 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); | 2059 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); |
2061 } | 2060 } |
2062 | 2061 |
2063 void CompositedLayerMapping::setScrollingContentsNeedDisplay() | |
2064 { | |
2065 ASSERT(!paintsIntoCompositedAncestor()); | |
2066 ApplyToGraphicsLayers(this, SetContentsNeedsDisplayFunctor(), ApplyToScrolli
ngContentsLayer); | |
2067 } | |
2068 | |
2069 // FIXME: Temporarily r is in the coordinate space of the scrolling container la
yer. | |
2070 // Will make it in the coordinate space of the scrolling contents layer. crbug.c
om/416539. | |
2071 void CompositedLayerMapping::setScrollingContentsNeedDisplayInRect(const LayoutR
ect& r, PaintInvalidationReason invalidationReason) | |
2072 { | |
2073 ASSERT(!paintsIntoCompositedAncestor()); | |
2074 | |
2075 SetContentsNeedsDisplayInRectFunctor functor = { | |
2076 pixelSnappedIntRect(r.location() + m_owningLayer.subpixelAccumulation(),
r.size()), | |
2077 invalidationReason | |
2078 }; | |
2079 ApplyToGraphicsLayers(this, functor, ApplyToScrollingContentsLayer); | |
2080 } | |
2081 | |
2082 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst RenderObject* renderObject, const Vector<GraphicsLayerPaintInfo>& layers, un
signed maxSquashedLayerIndex) | 2062 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst RenderObject* renderObject, const Vector<GraphicsLayerPaintInfo>& layers, un
signed maxSquashedLayerIndex) |
2083 { | 2063 { |
2084 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) { | 2064 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) { |
2085 if (renderObject->isDescendantOf(layers[i].renderLayer->renderer())) | 2065 if (renderObject->isDescendantOf(layers[i].renderLayer->renderer())) |
2086 return &layers[i]; | 2066 return &layers[i]; |
2087 } | 2067 } |
2088 return 0; | 2068 return 0; |
2089 } | 2069 } |
2090 | 2070 |
2091 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst RenderObject* renderObject, unsigned maxSquashedLayerIndex) | 2071 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst RenderObject* renderObject, unsigned maxSquashedLayerIndex) |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2394 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2374 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
2395 name = "Scrolling Block Selection Layer"; | 2375 name = "Scrolling Block Selection Layer"; |
2396 } else { | 2376 } else { |
2397 ASSERT_NOT_REACHED(); | 2377 ASSERT_NOT_REACHED(); |
2398 } | 2378 } |
2399 | 2379 |
2400 return name; | 2380 return name; |
2401 } | 2381 } |
2402 | 2382 |
2403 } // namespace blink | 2383 } // namespace blink |
OLD | NEW |