| 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 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 } | 1409 } |
| 1410 | 1410 |
| 1411 enum ApplyToGraphicsLayersModeFlags { | 1411 enum ApplyToGraphicsLayersModeFlags { |
| 1412 ApplyToLayersAffectedByPreserve3D = (1 << 0), | 1412 ApplyToLayersAffectedByPreserve3D = (1 << 0), |
| 1413 ApplyToSquashingLayer = (1 << 1), | 1413 ApplyToSquashingLayer = (1 << 1), |
| 1414 ApplyToScrollbarLayers = (1 << 2), | 1414 ApplyToScrollbarLayers = (1 << 2), |
| 1415 ApplyToBackgroundLayer = (1 << 3), | 1415 ApplyToBackgroundLayer = (1 << 3), |
| 1416 ApplyToMaskLayers = (1 << 4), | 1416 ApplyToMaskLayers = (1 << 4), |
| 1417 ApplyToContentLayers = (1 << 5), | 1417 ApplyToContentLayers = (1 << 5), |
| 1418 ApplyToChildContainingLayers = (1 << 6), // layers between m_graphicsLayer a
nd children | 1418 ApplyToChildContainingLayers = (1 << 6), // layers between m_graphicsLayer a
nd children |
| 1419 ApplyToScrollingContentLayers = (1 << 7), | 1419 ApplyToNonScrollingContentLayers = (1 << 7), |
| 1420 ApplyToScrollingContentLayers = (1 << 8), |
| 1420 ApplyToAllGraphicsLayers = (ApplyToSquashingLayer | ApplyToScrollbarLayers |
ApplyToBackgroundLayer | ApplyToMaskLayers | ApplyToLayersAffectedByPreserve3D
| ApplyToContentLayers | ApplyToScrollingContentLayers) | 1421 ApplyToAllGraphicsLayers = (ApplyToSquashingLayer | ApplyToScrollbarLayers |
ApplyToBackgroundLayer | ApplyToMaskLayers | ApplyToLayersAffectedByPreserve3D
| ApplyToContentLayers | ApplyToScrollingContentLayers) |
| 1421 }; | 1422 }; |
| 1422 typedef unsigned ApplyToGraphicsLayersMode; | 1423 typedef unsigned ApplyToGraphicsLayersMode; |
| 1423 | 1424 |
| 1424 template <typename Func> | 1425 template <typename Func> |
| 1425 static void ApplyToGraphicsLayers(const CompositedLayerMapping* mapping, const F
unc& f, ApplyToGraphicsLayersMode mode) | 1426 static void ApplyToGraphicsLayers(const CompositedLayerMapping* mapping, const F
unc& f, ApplyToGraphicsLayersMode mode) |
| 1426 { | 1427 { |
| 1427 ASSERT(mode); | 1428 ASSERT(mode); |
| 1428 | 1429 |
| 1429 if ((mode & ApplyToLayersAffectedByPreserve3D) && mapping->childTransformLay
er()) | 1430 if ((mode & ApplyToLayersAffectedByPreserve3D) && mapping->childTransformLay
er()) |
| 1430 f(mapping->childTransformLayer()); | 1431 f(mapping->childTransformLayer()); |
| 1431 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLay
ers)) && mapping->mainGraphicsLayer()) | 1432 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLay
ers) || (mode & ApplyToNonScrollingContentLayers)) && mapping->mainGraphicsLayer
()) |
| 1432 f(mapping->mainGraphicsLayer()); | 1433 f(mapping->mainGraphicsLayer()); |
| 1433 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToChildConta
iningLayers)) && mapping->clippingLayer()) | 1434 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToChildConta
iningLayers)) && mapping->clippingLayer()) |
| 1434 f(mapping->clippingLayer()); | 1435 f(mapping->clippingLayer()); |
| 1435 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToChildConta
iningLayers)) && mapping->scrollingLayer()) | 1436 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToChildConta
iningLayers)) && mapping->scrollingLayer()) |
| 1436 f(mapping->scrollingLayer()); | 1437 f(mapping->scrollingLayer()); |
| 1437 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLay
ers) || (mode & ApplyToChildContainingLayers) || (mode & ApplyToScrollingContent
Layers)) && mapping->scrollingContentsLayer()) | 1438 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLay
ers) || (mode & ApplyToChildContainingLayers) || (mode & ApplyToScrollingContent
Layers)) && mapping->scrollingContentsLayer()) |
| 1438 f(mapping->scrollingContentsLayer()); | 1439 f(mapping->scrollingContentsLayer()); |
| 1439 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLay
ers) || (mode & ApplyToScrollingContentLayers)) && mapping->foregroundLayer()) | 1440 if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLay
ers) || (mode & ApplyToScrollingContentLayers)) && mapping->foregroundLayer()) |
| 1440 f(mapping->foregroundLayer()); | 1441 f(mapping->foregroundLayer()); |
| 1441 | 1442 |
| 1442 if ((mode & ApplyToChildContainingLayers) && mapping->childTransformLayer()) | 1443 if ((mode & ApplyToChildContainingLayers) && mapping->childTransformLayer()) |
| 1443 f(mapping->childTransformLayer()); | 1444 f(mapping->childTransformLayer()); |
| 1444 | 1445 |
| 1445 if ((mode & ApplyToSquashingLayer) && mapping->squashingLayer()) | 1446 if ((mode & ApplyToSquashingLayer) && mapping->squashingLayer()) |
| 1446 f(mapping->squashingLayer()); | 1447 f(mapping->squashingLayer()); |
| 1447 | 1448 |
| 1448 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers)) && mapping
->maskLayer()) | 1449 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers) || (mode &
ApplyToNonScrollingContentLayers)) && mapping->maskLayer()) |
| 1449 f(mapping->maskLayer()); | 1450 f(mapping->maskLayer()); |
| 1450 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers)) && mapping
->childClippingMaskLayer()) | 1451 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers) || (mode &
ApplyToNonScrollingContentLayers)) && mapping->childClippingMaskLayer()) |
| 1451 f(mapping->childClippingMaskLayer()); | 1452 f(mapping->childClippingMaskLayer()); |
| 1452 | 1453 |
| 1453 if (((mode & ApplyToBackgroundLayer) || (mode & ApplyToContentLayers)) && ma
pping->backgroundLayer()) | 1454 if (((mode & ApplyToBackgroundLayer) || (mode & ApplyToContentLayers) || (mo
de & ApplyToNonScrollingContentLayers)) && mapping->backgroundLayer()) |
| 1454 f(mapping->backgroundLayer()); | 1455 f(mapping->backgroundLayer()); |
| 1455 | 1456 |
| 1456 if ((mode & ApplyToScrollbarLayers) && mapping->layerForHorizontalScrollbar(
)) | 1457 if ((mode & ApplyToScrollbarLayers) && mapping->layerForHorizontalScrollbar(
)) |
| 1457 f(mapping->layerForHorizontalScrollbar()); | 1458 f(mapping->layerForHorizontalScrollbar()); |
| 1458 if ((mode & ApplyToScrollbarLayers) && mapping->layerForVerticalScrollbar()) | 1459 if ((mode & ApplyToScrollbarLayers) && mapping->layerForVerticalScrollbar()) |
| 1459 f(mapping->layerForVerticalScrollbar()); | 1460 f(mapping->layerForVerticalScrollbar()); |
| 1460 if ((mode & ApplyToScrollbarLayers) && mapping->layerForScrollCorner()) | 1461 if ((mode & ApplyToScrollbarLayers) && mapping->layerForScrollCorner()) |
| 1461 f(mapping->layerForScrollCorner()); | 1462 f(mapping->layerForScrollCorner()); |
| 1462 } | 1463 } |
| 1463 | 1464 |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2089 layerDirtyRect.move(-layer->offsetFromLayoutObject()); | 2090 layerDirtyRect.move(-layer->offsetFromLayoutObject()); |
| 2090 layer->setNeedsDisplayInRect(layerDirtyRect, invalidationReason, cli
ent); | 2091 layer->setNeedsDisplayInRect(layerDirtyRect, invalidationReason, cli
ent); |
| 2091 } | 2092 } |
| 2092 } | 2093 } |
| 2093 | 2094 |
| 2094 IntRect r; | 2095 IntRect r; |
| 2095 PaintInvalidationReason invalidationReason; | 2096 PaintInvalidationReason invalidationReason; |
| 2096 const DisplayItemClient& client; | 2097 const DisplayItemClient& client; |
| 2097 }; | 2098 }; |
| 2098 | 2099 |
| 2099 // r is in the coordinate space of the layer's layout object | |
| 2100 void CompositedLayerMapping::setContentsNeedDisplayInRect(const LayoutRect& r, P
aintInvalidationReason invalidationReason, const DisplayItemClient& client) | 2100 void CompositedLayerMapping::setContentsNeedDisplayInRect(const LayoutRect& r, P
aintInvalidationReason invalidationReason, const DisplayItemClient& client) |
| 2101 { | 2101 { |
| 2102 DCHECK(!m_owningLayer.layoutObject()->usesCompositedScrolling()); |
| 2102 // TODO(wangxianzhu): Enable the following assert after paint invalidation f
or spv2 is ready. | 2103 // TODO(wangxianzhu): Enable the following assert after paint invalidation f
or spv2 is ready. |
| 2103 // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 2104 // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 2104 | 2105 |
| 2105 SetContentsNeedsDisplayInRectFunctor functor = { | 2106 SetContentsNeedsDisplayInRectFunctor functor = { |
| 2106 enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumul
ation(), r.size())), | 2107 enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumul
ation(), r.size())), |
| 2107 invalidationReason, | 2108 invalidationReason, |
| 2108 client | 2109 client |
| 2109 }; | 2110 }; |
| 2110 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); | 2111 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); |
| 2111 } | 2112 } |
| 2112 | 2113 |
| 2114 void CompositedLayerMapping::setNonScrollingContentsNeedDisplayInRect(const Layo
utRect& r, PaintInvalidationReason invalidationReason, const DisplayItemClient&
client) |
| 2115 { |
| 2116 DCHECK(m_owningLayer.layoutObject()->usesCompositedScrolling()); |
| 2117 // TODO(wangxianzhu): Enable the following assert after paint invalidation f
or spv2 is ready. |
| 2118 // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 2119 |
| 2120 SetContentsNeedsDisplayInRectFunctor functor = { |
| 2121 enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumul
ation(), r.size())), |
| 2122 invalidationReason, |
| 2123 client |
| 2124 }; |
| 2125 ApplyToGraphicsLayers(this, functor, ApplyToNonScrollingContentLayers); |
| 2126 } |
| 2127 |
| 2113 void CompositedLayerMapping::setScrollingContentsNeedDisplayInRect(const LayoutR
ect& r, PaintInvalidationReason invalidationReason, const DisplayItemClient& cli
ent) | 2128 void CompositedLayerMapping::setScrollingContentsNeedDisplayInRect(const LayoutR
ect& r, PaintInvalidationReason invalidationReason, const DisplayItemClient& cli
ent) |
| 2114 { | 2129 { |
| 2130 DCHECK(m_owningLayer.layoutObject()->usesCompositedScrolling()); |
| 2115 // TODO(wangxianzhu): Enable the following assert after paint invalidation f
or spv2 is ready. | 2131 // TODO(wangxianzhu): Enable the following assert after paint invalidation f
or spv2 is ready. |
| 2116 // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 2132 // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 2117 | 2133 |
| 2118 SetContentsNeedsDisplayInRectFunctor functor = { | 2134 SetContentsNeedsDisplayInRectFunctor functor = { |
| 2119 enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumul
ation(), r.size())), | 2135 enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumul
ation(), r.size())), |
| 2120 invalidationReason, | 2136 invalidationReason, |
| 2121 client | 2137 client |
| 2122 }; | 2138 }; |
| 2123 ApplyToGraphicsLayers(this, functor, ApplyToScrollingContentLayers); | 2139 ApplyToGraphicsLayers(this, functor, ApplyToScrollingContentLayers); |
| 2124 } | 2140 } |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2636 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2652 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
| 2637 name = "Scrolling Contents Layer"; | 2653 name = "Scrolling Contents Layer"; |
| 2638 } else { | 2654 } else { |
| 2639 ASSERT_NOT_REACHED(); | 2655 ASSERT_NOT_REACHED(); |
| 2640 } | 2656 } |
| 2641 | 2657 |
| 2642 return name; | 2658 return name; |
| 2643 } | 2659 } |
| 2644 | 2660 |
| 2645 } // namespace blink | 2661 } // namespace blink |
| OLD | NEW |