| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/rendering/compositing/CompositingPropertyUpdater.h" | 6 #include "core/rendering/compositing/CompositingPropertyUpdater.h" |
| 7 | 7 |
| 8 #include "core/rendering/RenderBlock.h" |
| 8 #include "core/rendering/RenderLayer.h" | 9 #include "core/rendering/RenderLayer.h" |
| 9 #include "core/rendering/compositing/CompositedLayerMapping.h" | 10 #include "core/rendering/compositing/CompositedLayerMapping.h" |
| 10 | 11 |
| 11 namespace WebCore { | 12 namespace WebCore { |
| 12 | 13 |
| 13 CompositingPropertyUpdater::CompositingPropertyUpdater(RenderLayer* rootRenderLa
yer) | 14 CompositingPropertyUpdater::CompositingPropertyUpdater(RenderLayer* rootRenderLa
yer) |
| 14 : m_geometryMap(UseTransforms) | 15 : m_geometryMap(UseTransforms) |
| 15 , m_rootRenderLayer(rootRenderLayer) | 16 , m_rootRenderLayer(rootRenderLayer) |
| 16 { | 17 { |
| 17 rootRenderLayer->updateDescendantDependentFlags(); | 18 rootRenderLayer->updateDescendantDependentFlags(); |
| 18 } | 19 } |
| 19 | 20 |
| 20 CompositingPropertyUpdater::~CompositingPropertyUpdater() | 21 CompositingPropertyUpdater::~CompositingPropertyUpdater() |
| 21 { | 22 { |
| 22 } | 23 } |
| 23 | 24 |
| 24 void CompositingPropertyUpdater::updateAncestorDependentProperties(RenderLayer*
layer, UpdateType updateType, RenderLayer* enclosingCompositedLayer) | 25 void CompositingPropertyUpdater::updateAncestorDependentProperties(RenderLayer*
layer, UpdateType updateType, AncestorInfo info) |
| 25 { | 26 { |
| 26 if (!layer->childNeedsToUpdateAncestorDependantProperties() && updateType !=
ForceUpdate) | 27 if (!layer->childNeedsToUpdateAncestorDependantProperties() && updateType !=
ForceUpdate) |
| 27 return; | 28 return; |
| 28 | 29 |
| 29 m_geometryMap.pushMappingsToAncestor(layer, layer->parent()); | 30 m_geometryMap.pushMappingsToAncestor(layer, layer->parent()); |
| 30 | 31 |
| 31 if (layer->hasCompositedLayerMapping()) | 32 if (layer->hasCompositedLayerMapping()) |
| 32 enclosingCompositedLayer = layer; | 33 info.enclosingCompositedLayer = layer; |
| 33 | 34 |
| 34 if (layer->needsToUpdateAncestorDependentProperties()) { | 35 if (layer->needsToUpdateAncestorDependentProperties()) { |
| 35 if (enclosingCompositedLayer) | 36 if (info.enclosingCompositedLayer) |
| 36 enclosingCompositedLayer->compositedLayerMapping()->setNeedsGraphics
LayerUpdate(); | 37 info.enclosingCompositedLayer->compositedLayerMapping()->setNeedsGra
phicsLayerUpdate(); |
| 37 updateType = ForceUpdate; | 38 updateType = ForceUpdate; |
| 38 } | 39 } |
| 39 | 40 |
| 40 if (updateType == ForceUpdate) { | 41 if (updateType == ForceUpdate) { |
| 41 RenderLayer::AncestorDependentProperties properties; | 42 RenderLayer::AncestorDependentProperties properties; |
| 42 | 43 |
| 43 if (!layer->isRootLayer()) { | 44 if (!layer->isRootLayer()) { |
| 44 properties.clippedAbsoluteBoundingBox = enclosingIntRect(m_geometryM
ap.absoluteRect(layer->boundingBoxForCompositingOverlapTest())); | 45 properties.clippedAbsoluteBoundingBox = enclosingIntRect(m_geometryM
ap.absoluteRect(layer->boundingBoxForCompositingOverlapTest())); |
| 45 // FIXME: Setting the absBounds to 1x1 instead of 0x0 makes very lit
tle sense, | 46 // FIXME: Setting the absBounds to 1x1 instead of 0x0 makes very lit
tle sense, |
| 46 // but removing this code will make JSGameBench sad. | 47 // but removing this code will make JSGameBench sad. |
| 47 // See https://codereview.chromium.org/13912020/ | 48 // See https://codereview.chromium.org/13912020/ |
| 48 if (properties.clippedAbsoluteBoundingBox.isEmpty()) | 49 if (properties.clippedAbsoluteBoundingBox.isEmpty()) |
| 49 properties.clippedAbsoluteBoundingBox.setSize(IntSize(1, 1)); | 50 properties.clippedAbsoluteBoundingBox.setSize(IntSize(1, 1)); |
| 50 | 51 |
| 51 IntRect clipRect = pixelSnappedIntRect(layer->clipper().backgroundCl
ipRect(ClipRectsContext(m_rootRenderLayer, AbsoluteClipRects)).rect()); | 52 IntRect clipRect = pixelSnappedIntRect(layer->clipper().backgroundCl
ipRect(ClipRectsContext(m_rootRenderLayer, AbsoluteClipRects)).rect()); |
| 52 properties.clippedAbsoluteBoundingBox.intersect(clipRect); | 53 properties.clippedAbsoluteBoundingBox.intersect(clipRect); |
| 53 | 54 |
| 54 const RenderLayer* parent = layer->parent(); | 55 const RenderLayer* parent = layer->parent(); |
| 55 properties.opacityAncestor = parent->isTransparent() ? parent : pare
nt->ancestorDependentProperties().opacityAncestor; | 56 properties.opacityAncestor = parent->isTransparent() ? parent : pare
nt->ancestorDependentProperties().opacityAncestor; |
| 56 properties.transformAncestor = parent->hasTransform() ? parent : par
ent->ancestorDependentProperties().transformAncestor; | 57 properties.transformAncestor = parent->hasTransform() ? parent : par
ent->ancestorDependentProperties().transformAncestor; |
| 57 properties.filterAncestor = parent->hasFilter() ? parent : parent->a
ncestorDependentProperties().filterAncestor; | 58 properties.filterAncestor = parent->hasFilter() ? parent : parent->a
ncestorDependentProperties().filterAncestor; |
| 59 |
| 60 if (layer->renderer()->isOutOfFlowPositioned() && info.ancestorScrol
lingLayer && !layer->subtreeIsInvisible()) { |
| 61 const RenderObject* container = layer->renderer()->containingBlo
ck(); |
| 62 const RenderObject* scroller = info.ancestorScrollingLayer->rend
erer(); |
| 63 properties.isUnclippedDescendant = scroller != container && scro
ller->isDescendantOf(container); |
| 64 } |
| 58 } | 65 } |
| 59 | 66 |
| 60 layer->updateAncestorDependentProperties(properties); | 67 layer->updateAncestorDependentProperties(properties); |
| 61 } | 68 } |
| 62 | 69 |
| 70 if (layer->scrollsOverflow()) |
| 71 info.ancestorScrollingLayer = layer; |
| 72 |
| 63 for (RenderLayer* child = layer->firstChild(); child; child = child->nextSib
ling()) | 73 for (RenderLayer* child = layer->firstChild(); child; child = child->nextSib
ling()) |
| 64 updateAncestorDependentProperties(child, updateType, enclosingComposited
Layer); | 74 updateAncestorDependentProperties(child, updateType, info); |
| 65 | 75 |
| 66 m_geometryMap.popMappingsToAncestor(layer->parent()); | 76 m_geometryMap.popMappingsToAncestor(layer->parent()); |
| 67 | 77 |
| 68 layer->clearChildNeedsToUpdateAncestorDependantProperties(); | 78 layer->clearChildNeedsToUpdateAncestorDependantProperties(); |
| 69 } | 79 } |
| 70 | 80 |
| 71 #if !ASSERT_DISABLED | 81 #if !ASSERT_DISABLED |
| 72 | 82 |
| 73 void CompositingPropertyUpdater::assertNeedsToUpdateAncestorDependantPropertiesB
itsCleared(RenderLayer* layer) | 83 void CompositingPropertyUpdater::assertNeedsToUpdateAncestorDependantPropertiesB
itsCleared(RenderLayer* layer) |
| 74 { | 84 { |
| 75 ASSERT(!layer->childNeedsToUpdateAncestorDependantProperties()); | 85 ASSERT(!layer->childNeedsToUpdateAncestorDependantProperties()); |
| 76 ASSERT(!layer->needsToUpdateAncestorDependentProperties()); | 86 ASSERT(!layer->needsToUpdateAncestorDependentProperties()); |
| 77 | 87 |
| 78 for (RenderLayer* child = layer->firstChild(); child; child = child->nextSib
ling()) | 88 for (RenderLayer* child = layer->firstChild(); child; child = child->nextSib
ling()) |
| 79 assertNeedsToUpdateAncestorDependantPropertiesBitsCleared(child); | 89 assertNeedsToUpdateAncestorDependantPropertiesBitsCleared(child); |
| 80 } | 90 } |
| 81 | 91 |
| 82 #endif | 92 #endif |
| 83 | 93 |
| 84 } // namespace WebCore | 94 } // namespace WebCore |
| OLD | NEW |