| 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/CompositingInputsUpdater.h" |
| 7 | 7 |
| 8 #include "core/rendering/RenderBlock.h" | 8 #include "core/rendering/RenderBlock.h" |
| 9 #include "core/rendering/RenderLayer.h" | 9 #include "core/rendering/RenderLayer.h" |
| 10 #include "core/rendering/compositing/CompositedLayerMapping.h" | 10 #include "core/rendering/compositing/CompositedLayerMapping.h" |
| 11 | 11 |
| 12 namespace WebCore { | 12 namespace WebCore { |
| 13 | 13 |
| 14 CompositingPropertyUpdater::CompositingPropertyUpdater(RenderLayer* rootRenderLa
yer) | 14 CompositingInputsUpdater::CompositingInputsUpdater(RenderLayer* rootRenderLayer) |
| 15 : m_geometryMap(UseTransforms) | 15 : m_geometryMap(UseTransforms) |
| 16 , m_rootRenderLayer(rootRenderLayer) | 16 , m_rootRenderLayer(rootRenderLayer) |
| 17 { | 17 { |
| 18 rootRenderLayer->updateDescendantDependentFlags(); | 18 rootRenderLayer->updateDescendantDependentFlags(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 CompositingPropertyUpdater::~CompositingPropertyUpdater() | 21 CompositingInputsUpdater::~CompositingInputsUpdater() |
| 22 { | 22 { |
| 23 } | 23 } |
| 24 | 24 |
| 25 void CompositingPropertyUpdater::updateAncestorDependentProperties(RenderLayer*
layer, UpdateType updateType, AncestorInfo info) | 25 void CompositingInputsUpdater::update(RenderLayer* layer, UpdateType updateType,
AncestorInfo info) |
| 26 { | 26 { |
| 27 if (!layer->childNeedsToUpdateAncestorDependantProperties() && updateType !=
ForceUpdate) | 27 if (!layer->childNeedsCompositingInputsUpdate() && updateType != ForceUpdate
) |
| 28 return; | 28 return; |
| 29 | 29 |
| 30 m_geometryMap.pushMappingsToAncestor(layer, layer->parent()); | 30 m_geometryMap.pushMappingsToAncestor(layer, layer->parent()); |
| 31 | 31 |
| 32 if (layer->hasCompositedLayerMapping()) | 32 if (layer->hasCompositedLayerMapping()) |
| 33 info.enclosingCompositedLayer = layer; | 33 info.enclosingCompositedLayer = layer; |
| 34 | 34 |
| 35 if (layer->needsToUpdateAncestorDependentProperties()) { | 35 if (layer->needsCompositingInputsUpdate()) { |
| 36 if (info.enclosingCompositedLayer) | 36 if (info.enclosingCompositedLayer) |
| 37 info.enclosingCompositedLayer->compositedLayerMapping()->setNeedsGra
phicsLayerUpdate(); | 37 info.enclosingCompositedLayer->compositedLayerMapping()->setNeedsGra
phicsLayerUpdate(); |
| 38 updateType = ForceUpdate; | 38 updateType = ForceUpdate; |
| 39 } | 39 } |
| 40 | 40 |
| 41 if (updateType == ForceUpdate) { | 41 if (updateType == ForceUpdate) { |
| 42 RenderLayer::AncestorDependentProperties properties; | 42 RenderLayer::CompositingInputs properties; |
| 43 | 43 |
| 44 if (!layer->isRootLayer()) { | 44 if (!layer->isRootLayer()) { |
| 45 properties.clippedAbsoluteBoundingBox = enclosingIntRect(m_geometryM
ap.absoluteRect(layer->boundingBoxForCompositingOverlapTest())); | 45 properties.clippedAbsoluteBoundingBox = enclosingIntRect(m_geometryM
ap.absoluteRect(layer->boundingBoxForCompositingOverlapTest())); |
| 46 // 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, |
| 47 // but removing this code will make JSGameBench sad. | 47 // but removing this code will make JSGameBench sad. |
| 48 // See https://codereview.chromium.org/13912020/ | 48 // See https://codereview.chromium.org/13912020/ |
| 49 if (properties.clippedAbsoluteBoundingBox.isEmpty()) | 49 if (properties.clippedAbsoluteBoundingBox.isEmpty()) |
| 50 properties.clippedAbsoluteBoundingBox.setSize(IntSize(1, 1)); | 50 properties.clippedAbsoluteBoundingBox.setSize(IntSize(1, 1)); |
| 51 | 51 |
| 52 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()); |
| 53 properties.clippedAbsoluteBoundingBox.intersect(clipRect); | 53 properties.clippedAbsoluteBoundingBox.intersect(clipRect); |
| 54 | 54 |
| 55 const RenderLayer* parent = layer->parent(); | 55 const RenderLayer* parent = layer->parent(); |
| 56 properties.opacityAncestor = parent->isTransparent() ? parent : pare
nt->ancestorDependentProperties().opacityAncestor; | 56 properties.opacityAncestor = parent->isTransparent() ? parent : pare
nt->compositingInputs().opacityAncestor; |
| 57 properties.transformAncestor = parent->hasTransform() ? parent : par
ent->ancestorDependentProperties().transformAncestor; | 57 properties.transformAncestor = parent->hasTransform() ? parent : par
ent->compositingInputs().transformAncestor; |
| 58 properties.filterAncestor = parent->hasFilter() ? parent : parent->a
ncestorDependentProperties().filterAncestor; | 58 properties.filterAncestor = parent->hasFilter() ? parent : parent->c
ompositingInputs().filterAncestor; |
| 59 | 59 |
| 60 if (layer->renderer()->isOutOfFlowPositioned() && info.ancestorScrol
lingLayer && !layer->subtreeIsInvisible()) { | 60 if (layer->renderer()->isOutOfFlowPositioned() && info.ancestorScrol
lingLayer && !layer->subtreeIsInvisible()) { |
| 61 const RenderObject* container = layer->renderer()->containingBlo
ck(); | 61 const RenderObject* container = layer->renderer()->containingBlo
ck(); |
| 62 const RenderObject* scroller = info.ancestorScrollingLayer->rend
erer(); | 62 const RenderObject* scroller = info.ancestorScrollingLayer->rend
erer(); |
| 63 properties.isUnclippedDescendant = scroller != container && scro
ller->isDescendantOf(container); | 63 properties.isUnclippedDescendant = scroller != container && scro
ller->isDescendantOf(container); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 layer->updateAncestorDependentProperties(properties); | 67 layer->updateCompositingInputs(properties); |
| 68 } | 68 } |
| 69 | 69 |
| 70 if (layer->scrollsOverflow()) | 70 if (layer->scrollsOverflow()) |
| 71 info.ancestorScrollingLayer = layer; | 71 info.ancestorScrollingLayer = layer; |
| 72 | 72 |
| 73 for (RenderLayer* child = layer->firstChild(); child; child = child->nextSib
ling()) | 73 for (RenderLayer* child = layer->firstChild(); child; child = child->nextSib
ling()) |
| 74 updateAncestorDependentProperties(child, updateType, info); | 74 update(child, updateType, info); |
| 75 | 75 |
| 76 m_geometryMap.popMappingsToAncestor(layer->parent()); | 76 m_geometryMap.popMappingsToAncestor(layer->parent()); |
| 77 | 77 |
| 78 layer->clearChildNeedsToUpdateAncestorDependantProperties(); | 78 layer->clearChildNeedsCompositingInputsUpdate(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 #if !ASSERT_DISABLED | 81 #if !ASSERT_DISABLED |
| 82 | 82 |
| 83 void CompositingPropertyUpdater::assertNeedsToUpdateAncestorDependantPropertiesB
itsCleared(RenderLayer* layer) | 83 void CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared(Ren
derLayer* layer) |
| 84 { | 84 { |
| 85 ASSERT(!layer->childNeedsToUpdateAncestorDependantProperties()); | 85 ASSERT(!layer->childNeedsCompositingInputsUpdate()); |
| 86 ASSERT(!layer->needsToUpdateAncestorDependentProperties()); | 86 ASSERT(!layer->needsCompositingInputsUpdate()); |
| 87 | 87 |
| 88 for (RenderLayer* child = layer->firstChild(); child; child = child->nextSib
ling()) | 88 for (RenderLayer* child = layer->firstChild(); child; child = child->nextSib
ling()) |
| 89 assertNeedsToUpdateAncestorDependantPropertiesBitsCleared(child); | 89 assertNeedsCompositingInputsUpdateBitsCleared(child); |
| 90 } | 90 } |
| 91 | 91 |
| 92 #endif | 92 #endif |
| 93 | 93 |
| 94 } // namespace WebCore | 94 } // namespace WebCore |
| OLD | NEW |