Chromium Code Reviews| 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 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1369 } | 1369 } |
| 1370 | 1370 |
| 1371 enum ApplyToGraphicsLayersModeFlags { | 1371 enum ApplyToGraphicsLayersModeFlags { |
| 1372 ApplyToLayersAffectedByPreserve3D = (1 << 0), | 1372 ApplyToLayersAffectedByPreserve3D = (1 << 0), |
| 1373 ApplyToSquashingLayer = (1 << 1), | 1373 ApplyToSquashingLayer = (1 << 1), |
| 1374 ApplyToScrollbarLayers = (1 << 2), | 1374 ApplyToScrollbarLayers = (1 << 2), |
| 1375 ApplyToBackgroundLayer = (1 << 3), | 1375 ApplyToBackgroundLayer = (1 << 3), |
| 1376 ApplyToMaskLayers = (1 << 4), | 1376 ApplyToMaskLayers = (1 << 4), |
| 1377 ApplyToContentLayers = (1 << 5), | 1377 ApplyToContentLayers = (1 << 5), |
| 1378 ApplyToChildContainingLayers = (1 << 6), // layers between m_graphicsLayer a nd children | 1378 ApplyToChildContainingLayers = (1 << 6), // layers between m_graphicsLayer a nd children |
| 1379 ApplyToScrollingContentsLayer = (1 << 7), | |
| 1379 ApplyToAllGraphicsLayers = (ApplyToSquashingLayer | ApplyToScrollbarLayers | ApplyToBackgroundLayer | ApplyToMaskLayers | ApplyToLayersAffectedByPreserve3D | ApplyToContentLayers) | 1380 ApplyToAllGraphicsLayers = (ApplyToSquashingLayer | ApplyToScrollbarLayers | ApplyToBackgroundLayer | ApplyToMaskLayers | ApplyToLayersAffectedByPreserve3D | ApplyToContentLayers) |
| 1380 }; | 1381 }; |
| 1381 typedef unsigned ApplyToGraphicsLayersMode; | 1382 typedef unsigned ApplyToGraphicsLayersMode; |
| 1382 | 1383 |
| 1383 template <typename Func> | 1384 template <typename Func> |
| 1384 static void ApplyToGraphicsLayers(const CompositedLayerMapping* mapping, const F unc& f, ApplyToGraphicsLayersMode mode) | 1385 static void ApplyToGraphicsLayers(const CompositedLayerMapping* mapping, const F unc& f, ApplyToGraphicsLayersMode mode) |
| 1385 { | 1386 { |
| 1386 ASSERT(mode); | 1387 ASSERT(mode); |
| 1387 | 1388 |
| 1388 if ((mode & ApplyToLayersAffectedByPreserve3D) && mapping->childTransformLay er()) | 1389 if ((mode & ApplyToLayersAffectedByPreserve3D) && mapping->childTransformLay er()) |
| 1389 f(mapping->childTransformLayer()); | 1390 f(mapping->childTransformLayer()); |
| 1390 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLay ers)) && mapping->mainGraphicsLayer()) | 1391 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLay ers)) && mapping->mainGraphicsLayer()) |
| 1391 f(mapping->mainGraphicsLayer()); | 1392 f(mapping->mainGraphicsLayer()); |
| 1392 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToChildConta iningLayers)) && mapping->clippingLayer()) | 1393 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToChildConta iningLayers)) && mapping->clippingLayer()) |
| 1393 f(mapping->clippingLayer()); | 1394 f(mapping->clippingLayer()); |
| 1394 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToChildConta iningLayers)) && mapping->scrollingLayer()) | 1395 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToChildConta iningLayers)) && mapping->scrollingLayer()) |
| 1395 f(mapping->scrollingLayer()); | 1396 f(mapping->scrollingLayer()); |
| 1396 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToChildConta iningLayers)) && mapping->scrollingBlockSelectionLayer()) | 1397 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToChildConta iningLayers)) && mapping->scrollingBlockSelectionLayer()) |
| 1397 f(mapping->scrollingBlockSelectionLayer()); | 1398 f(mapping->scrollingBlockSelectionLayer()); |
| 1398 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLay ers) || (mode & ApplyToChildContainingLayers)) && mapping->scrollingContentsLaye r()) | 1399 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLay ers) || (mode & ApplyToChildContainingLayers) || (mode & ApplyToScrollingContent sLayer)) && mapping->scrollingContentsLayer()) |
| 1399 f(mapping->scrollingContentsLayer()); | 1400 f(mapping->scrollingContentsLayer()); |
| 1400 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLay ers)) && mapping->foregroundLayer()) | 1401 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLay ers)) && mapping->foregroundLayer()) |
| 1401 f(mapping->foregroundLayer()); | 1402 f(mapping->foregroundLayer()); |
| 1402 | 1403 |
| 1403 if ((mode & ApplyToChildContainingLayers) && mapping->childTransformLayer()) | 1404 if ((mode & ApplyToChildContainingLayers) && mapping->childTransformLayer()) |
| 1404 f(mapping->childTransformLayer()); | 1405 f(mapping->childTransformLayer()); |
| 1405 | 1406 |
| 1406 if ((mode & ApplyToSquashingLayer) && mapping->squashingLayer()) | 1407 if ((mode & ApplyToSquashingLayer) && mapping->squashingLayer()) |
| 1407 f(mapping->squashingLayer()); | 1408 f(mapping->squashingLayer()); |
| 1408 | 1409 |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2031 SetContentsNeedsDisplayInRectFunctor functor = { | 2032 SetContentsNeedsDisplayInRectFunctor functor = { |
| 2032 enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumul ation(), r.size())), | 2033 enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumul ation(), r.size())), |
| 2033 invalidationReason | 2034 invalidationReason |
| 2034 }; | 2035 }; |
| 2035 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); | 2036 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); |
| 2036 } | 2037 } |
| 2037 | 2038 |
| 2038 void CompositedLayerMapping::invalidateDisplayItemClient(const DisplayItemClient Wrapper& displayItemClient, PaintInvalidationReason paintInvalidationReason, con st LayoutRect& previousPaintInvalidationRect, const LayoutRect& newPaintInvalida tionRect) | 2039 void CompositedLayerMapping::invalidateDisplayItemClient(const DisplayItemClient Wrapper& displayItemClient, PaintInvalidationReason paintInvalidationReason, con st LayoutRect& previousPaintInvalidationRect, const LayoutRect& newPaintInvalida tionRect) |
| 2039 { | 2040 { |
| 2040 // FIXME: need to split out paint invalidations for the background. | 2041 // FIXME: need to split out paint invalidations for the background. |
| 2041 // FIXME: need to distinguish invalidations for different layers (e.g. the m ain layer and scrolling layer). crbug.com/416535. | |
| 2042 ApplyToGraphicsLayers(this, [&displayItemClient, paintInvalidationReason, pr eviousPaintInvalidationRect, newPaintInvalidationRect](GraphicsLayer* layer) { | 2042 ApplyToGraphicsLayers(this, [&displayItemClient, paintInvalidationReason, pr eviousPaintInvalidationRect, newPaintInvalidationRect](GraphicsLayer* layer) { |
| 2043 layer->invalidateDisplayItemClient(displayItemClient, paintInvalidationR eason, enclosingIntRect(previousPaintInvalidationRect), enclosingIntRect(newPain tInvalidationRect)); | 2043 layer->invalidateDisplayItemClient(displayItemClient, paintInvalidationR eason, enclosingIntRect(previousPaintInvalidationRect), enclosingIntRect(newPain tInvalidationRect)); |
| 2044 }, ApplyToContentLayers); | 2044 }, ApplyToContentLayers); |
| 2045 } | 2045 } |
| 2046 | 2046 |
| 2047 void CompositedLayerMapping::invalidateDisplayItemClientOnScrollingContentsLayer (const DisplayItemClientWrapper& displayItemClient, PaintInvalidationReason pain tInvalidationReason, const LayoutRect& previousPaintInvalidationRect, const Layo utRect& newPaintInvalidationRect) | |
| 2048 { | |
| 2049 // FIXME: need to split out paint invalidations for the background. | |
|
chrishtr
2015/10/16 00:55:38
TODO(wangxianzhu). Also represent in a bug blockin
Xianzhu
2015/10/16 17:38:05
Actually the FIXME won't apply for spv2 so I remov
| |
| 2050 ApplyToGraphicsLayers(this, [&displayItemClient, paintInvalidationReason, pr eviousPaintInvalidationRect, newPaintInvalidationRect](GraphicsLayer* layer) { | |
| 2051 layer->invalidateDisplayItemClient(displayItemClient, paintInvalidationR eason, enclosingIntRect(previousPaintInvalidationRect), enclosingIntRect(newPain tInvalidationRect)); | |
| 2052 }, ApplyToScrollingContentsLayer); | |
| 2053 } | |
| 2054 | |
| 2047 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co nst LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, un signed maxSquashedLayerIndex) | 2055 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co nst LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, un signed maxSquashedLayerIndex) |
| 2048 { | 2056 { |
| 2049 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) { | 2057 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) { |
| 2050 if (layoutObject->isDescendantOf(layers[i].paintLayer->layoutObject())) | 2058 if (layoutObject->isDescendantOf(layers[i].paintLayer->layoutObject())) |
| 2051 return &layers[i]; | 2059 return &layers[i]; |
| 2052 } | 2060 } |
| 2053 return nullptr; | 2061 return nullptr; |
| 2054 } | 2062 } |
| 2055 | 2063 |
| 2056 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co nst LayoutObject* layoutObject, unsigned maxSquashedLayerIndex) | 2064 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co nst LayoutObject* layoutObject, unsigned maxSquashedLayerIndex) |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2425 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2433 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
| 2426 name = "Scrolling Block Selection Layer"; | 2434 name = "Scrolling Block Selection Layer"; |
| 2427 } else { | 2435 } else { |
| 2428 ASSERT_NOT_REACHED(); | 2436 ASSERT_NOT_REACHED(); |
| 2429 } | 2437 } |
| 2430 | 2438 |
| 2431 return name; | 2439 return name; |
| 2432 } | 2440 } |
| 2433 | 2441 |
| 2434 } // namespace blink | 2442 } // namespace blink |
| OLD | NEW |