X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fcore%2Frendering%2Fcompositing%2FGraphicsLayerUpdater.cpp;h=216d772685fe4a30c89cd7090a032753e417e7fe;hb=4a1a0bdd01eef90b0826a0e761d3379d3715c10f;hp=ab9428cef19276e0aea05f6ae3f3c0567bc39e7f;hpb=b1be5ca53587d23e7aeb77b26861fdc0a181ffd8;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/core/rendering/compositing/GraphicsLayerUpdater.cpp b/src/third_party/WebKit/Source/core/rendering/compositing/GraphicsLayerUpdater.cpp index ab9428c..216d772 100644 --- a/src/third_party/WebKit/Source/core/rendering/compositing/GraphicsLayerUpdater.cpp +++ b/src/third_party/WebKit/Source/core/rendering/compositing/GraphicsLayerUpdater.cpp @@ -33,25 +33,44 @@ #include "core/rendering/RenderPart.h" #include "core/rendering/compositing/CompositedLayerMapping.h" #include "core/rendering/compositing/RenderLayerCompositor.h" +#include "platform/TraceEvent.h" -namespace WebCore { +namespace blink { -GraphicsLayerUpdater::UpdateContext::UpdateContext(const UpdateContext& other, const RenderLayer& layer) - : m_compositingStackingContext(other.m_compositingStackingContext) - , m_compositingAncestor(other.compositingContainer(layer)) -{ - CompositingState compositingState = layer.compositingState(); - if (compositingState != NotComposited && compositingState != PaintsIntoGroupedBacking) { - m_compositingAncestor = &layer; - if (layer.stackingNode()->isStackingContext()) - m_compositingStackingContext = &layer; +class GraphicsLayerUpdater::UpdateContext { +public: + UpdateContext() + : m_compositingStackingContext(0) + , m_compositingAncestor(0) + { } -} -const RenderLayer* GraphicsLayerUpdater::UpdateContext::compositingContainer(const RenderLayer& layer) const -{ - return layer.stackingNode()->isNormalFlowOnly() ? m_compositingAncestor : m_compositingStackingContext; -} + UpdateContext(const UpdateContext& other, const RenderLayer& layer) + : m_compositingStackingContext(other.m_compositingStackingContext) + , m_compositingAncestor(other.compositingContainer(layer)) + { + CompositingState compositingState = layer.compositingState(); + if (compositingState != NotComposited && compositingState != PaintsIntoGroupedBacking) { + m_compositingAncestor = &layer; + if (layer.stackingNode()->isStackingContext()) + m_compositingStackingContext = &layer; + } + } + + const RenderLayer* compositingContainer(const RenderLayer& layer) const + { + return layer.stackingNode()->isNormalFlowOnly() ? m_compositingAncestor : m_compositingStackingContext; + } + + const RenderLayer* compositingStackingContext() const + { + return m_compositingStackingContext; + } + +private: + const RenderLayer* m_compositingStackingContext; + const RenderLayer* m_compositingAncestor; +}; GraphicsLayerUpdater::GraphicsLayerUpdater() : m_needsRebuildTree(false) @@ -62,46 +81,55 @@ GraphicsLayerUpdater::~GraphicsLayerUpdater() { } -void GraphicsLayerUpdater::update(Vector& layersNeedingPaintInvalidation, RenderLayer& layer, UpdateType updateType, const UpdateContext& context) +void GraphicsLayerUpdater::update(RenderLayer& layer, Vector& layersNeedingPaintInvalidation) +{ + TRACE_EVENT0("blink", "GraphicsLayerUpdater::update"); + updateRecursive(layer, DoNotForceUpdate, UpdateContext(), layersNeedingPaintInvalidation); + layer.compositor()->updateRootLayerPosition(); +} + +void GraphicsLayerUpdater::updateRecursive(RenderLayer& layer, UpdateType updateType, const UpdateContext& context, Vector& layersNeedingPaintInvalidation) { if (layer.hasCompositedLayerMapping()) { - CompositedLayerMappingPtr mapping = layer.compositedLayerMapping(); + CompositedLayerMapping* mapping = layer.compositedLayerMapping(); - const RenderLayer* compositingContainer = context.compositingContainer(layer); - ASSERT(compositingContainer == layer.ancestorCompositingLayer()); - if (mapping->updateRequiresOwnBackingStoreForAncestorReasons(compositingContainer)) - updateType = ForceUpdate; + if (updateType == ForceUpdate || mapping->needsGraphicsLayerUpdate()) { + const RenderLayer* compositingContainer = context.compositingContainer(layer); + ASSERT(compositingContainer == layer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf)); - // Note carefully: here we assume that the compositing state of all descendants have been updated already, - // so it is legitimate to compute and cache the composited bounds for this layer. - mapping->updateCompositedBounds(updateType); + if (mapping->updateRequiresOwnBackingStoreForAncestorReasons(compositingContainer)) { + layersNeedingPaintInvalidation.append(&layer); + updateType = ForceUpdate; + } - if (RenderLayerReflectionInfo* reflection = layer.reflectionInfo()) { - if (reflection->reflectionLayer()->hasCompositedLayerMapping()) - reflection->reflectionLayer()->compositedLayerMapping()->updateCompositedBounds(ForceUpdate); - } + // Note carefully: here we assume that the compositing state of all descendants have been updated already, + // so it is legitimate to compute and cache the composited bounds for this layer. + mapping->updateCompositedBounds(); - if (mapping->updateGraphicsLayerConfiguration(updateType)) - m_needsRebuildTree = true; + if (RenderLayerReflectionInfo* reflection = layer.reflectionInfo()) { + if (reflection->reflectionLayer()->hasCompositedLayerMapping()) + reflection->reflectionLayer()->compositedLayerMapping()->updateCompositedBounds(); + } - mapping->updateGraphicsLayerGeometry(updateType, compositingContainer, layersNeedingPaintInvalidation); + if (mapping->updateGraphicsLayerConfiguration()) + m_needsRebuildTree = true; - updateType = mapping->updateTypeForChildren(updateType); - mapping->clearNeedsGraphicsLayerUpdate(); + mapping->updateGraphicsLayerGeometry(compositingContainer, context.compositingStackingContext(), layersNeedingPaintInvalidation); - if (!layer.parent()) - layer.compositor()->updateRootLayerPosition(); + if (mapping->hasUnpositionedOverflowControlsLayers()) + layer.scrollableArea()->positionOverflowControls(IntSize()); - if (mapping->hasUnpositionedOverflowControlsLayers()) - layer.scrollableArea()->positionOverflowControls(IntSize()); + updateType = mapping->updateTypeForChildren(updateType); + mapping->clearNeedsGraphicsLayerUpdate(); + } } UpdateContext childContext(context, layer); for (RenderLayer* child = layer.firstChild(); child; child = child->nextSibling()) - update(layersNeedingPaintInvalidation, *child, updateType, childContext); + updateRecursive(*child, updateType, childContext, layersNeedingPaintInvalidation); } -#if ASSERT_ENABLED +#if ENABLE(ASSERT) void GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared(RenderLayer& layer) { @@ -114,4 +142,4 @@ void GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared(RenderLay #endif -} // namespace WebCore +} // namespace blink