| 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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2019 } | 2020 } |
| 2020 | 2021 |
| 2021 IntRect r; | 2022 IntRect r; |
| 2022 PaintInvalidationReason invalidationReason; | 2023 PaintInvalidationReason invalidationReason; |
| 2023 }; | 2024 }; |
| 2024 | 2025 |
| 2025 // r is in the coordinate space of the layer's layout object | 2026 // r is in the coordinate space of the layer's layout object |
| 2026 void CompositedLayerMapping::setContentsNeedDisplayInRect(const LayoutRect& r, P
aintInvalidationReason invalidationReason) | 2027 void CompositedLayerMapping::setContentsNeedDisplayInRect(const LayoutRect& r, P
aintInvalidationReason invalidationReason) |
| 2027 { | 2028 { |
| 2028 ASSERT(!RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()); | 2029 ASSERT(!RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()); |
| 2029 // FIXME: need to split out paint invalidations for the background. | |
| 2030 // FIXME: need to distinguish invalidations for different layers (e.g. the m
ain layer and scrolling layer). crbug.com/416535. | |
| 2031 SetContentsNeedsDisplayInRectFunctor functor = { | 2030 SetContentsNeedsDisplayInRectFunctor functor = { |
| 2032 enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumul
ation(), r.size())), | 2031 enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumul
ation(), r.size())), |
| 2033 invalidationReason | 2032 invalidationReason |
| 2034 }; | 2033 }; |
| 2035 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); | 2034 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); |
| 2036 } | 2035 } |
| 2037 | 2036 |
| 2038 void CompositedLayerMapping::invalidateDisplayItemClient(const DisplayItemClient
Wrapper& displayItemClient, PaintInvalidationReason paintInvalidationReason, con
st LayoutRect& previousPaintInvalidationRect, const LayoutRect& newPaintInvalida
tionRect) | 2037 void CompositedLayerMapping::invalidateDisplayItemClient(const DisplayItemClient
Wrapper& displayItemClient, PaintInvalidationReason paintInvalidationReason, con
st LayoutRect& previousPaintInvalidationRect, const LayoutRect& newPaintInvalida
tionRect) |
| 2039 { | 2038 { |
| 2040 // 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) { | 2039 ApplyToGraphicsLayers(this, [&displayItemClient, paintInvalidationReason, pr
eviousPaintInvalidationRect, newPaintInvalidationRect](GraphicsLayer* layer) { |
| 2043 layer->invalidateDisplayItemClient(displayItemClient, paintInvalidationR
eason, enclosingIntRect(previousPaintInvalidationRect), enclosingIntRect(newPain
tInvalidationRect)); | 2040 layer->invalidateDisplayItemClient(displayItemClient, paintInvalidationR
eason, enclosingIntRect(previousPaintInvalidationRect), enclosingIntRect(newPain
tInvalidationRect)); |
| 2044 }, ApplyToContentLayers); | 2041 }, ApplyToContentLayers); |
| 2045 } | 2042 } |
| 2046 | 2043 |
| 2044 void CompositedLayerMapping::invalidateDisplayItemClientOnScrollingContentsLayer
(const DisplayItemClientWrapper& displayItemClient, PaintInvalidationReason pain
tInvalidationReason, const LayoutRect& previousPaintInvalidationRect, const Layo
utRect& newPaintInvalidationRect) |
| 2045 { |
| 2046 ApplyToGraphicsLayers(this, [&displayItemClient, paintInvalidationReason, pr
eviousPaintInvalidationRect, newPaintInvalidationRect](GraphicsLayer* layer) { |
| 2047 layer->invalidateDisplayItemClient(displayItemClient, paintInvalidationR
eason, enclosingIntRect(previousPaintInvalidationRect), enclosingIntRect(newPain
tInvalidationRect)); |
| 2048 }, ApplyToScrollingContentsLayer); |
| 2049 } |
| 2050 |
| 2047 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, un
signed maxSquashedLayerIndex) | 2051 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, un
signed maxSquashedLayerIndex) |
| 2048 { | 2052 { |
| 2049 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) { | 2053 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) { |
| 2050 if (layoutObject->isDescendantOf(layers[i].paintLayer->layoutObject())) | 2054 if (layoutObject->isDescendantOf(layers[i].paintLayer->layoutObject())) |
| 2051 return &layers[i]; | 2055 return &layers[i]; |
| 2052 } | 2056 } |
| 2053 return nullptr; | 2057 return nullptr; |
| 2054 } | 2058 } |
| 2055 | 2059 |
| 2056 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst LayoutObject* layoutObject, unsigned maxSquashedLayerIndex) | 2060 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()) { | 2429 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
| 2426 name = "Scrolling Block Selection Layer"; | 2430 name = "Scrolling Block Selection Layer"; |
| 2427 } else { | 2431 } else { |
| 2428 ASSERT_NOT_REACHED(); | 2432 ASSERT_NOT_REACHED(); |
| 2429 } | 2433 } |
| 2430 | 2434 |
| 2431 return name; | 2435 return name; |
| 2432 } | 2436 } |
| 2433 | 2437 |
| 2434 } // namespace blink | 2438 } // namespace blink |
| OLD | NEW |