Chromium Code Reviews| Index: Source/core/rendering/CompositedLayerMapping.cpp |
| diff --git a/Source/core/rendering/CompositedLayerMapping.cpp b/Source/core/rendering/CompositedLayerMapping.cpp |
| index 88403c4c618d310de41aaf501d686a5b3acc3b67..2e0fc394e9c20b5c70ec1406bd9ca15fe9ff550c 100644 |
| --- a/Source/core/rendering/CompositedLayerMapping.cpp |
| +++ b/Source/core/rendering/CompositedLayerMapping.cpp |
| @@ -344,7 +344,7 @@ void CompositedLayerMapping::updateCompositedBounds() |
| { |
| // We need to know if we draw content in order to update our bounds (this has an effect |
| // on whether or not descendands will paint into our backing). Update this value now. |
| - updateDrawsContent(isSimpleContainerCompositingLayer()); |
| + updateDrawsContent(); |
| LayoutRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer); |
| @@ -512,7 +512,7 @@ bool CompositedLayerMapping::updateGraphicsLayerConfiguration() |
| m_graphicsLayer->setReplicatedByLayer(0); |
| } |
| - updateBackgroundColor(isSimpleContainerCompositingLayer()); |
| + updateBackgroundColor(); |
| if (isDirectlyCompositedImage()) |
| updateImageContents(); |
| @@ -633,8 +633,6 @@ void CompositedLayerMapping::updateGraphicsLayerGeometry() |
| if (!hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyOpacity)) |
| updateOpacity(renderer()->style()); |
| - bool isSimpleContainer = isSimpleContainerCompositingLayer(); |
| - |
| m_owningLayer->updateDescendantDependentFlags(); |
| // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer and its non-compositing |
| @@ -855,9 +853,9 @@ void CompositedLayerMapping::updateGraphicsLayerGeometry() |
| updateIsRootForIsolatedGroup(); |
| } |
| - updateContentsRect(isSimpleContainer); |
| - updateBackgroundColor(isSimpleContainer); |
| - updateDrawsContent(isSimpleContainer); |
| + updateContentsRect(); |
| + updateBackgroundColor(); |
| + updateDrawsContent(); |
| updateContentsOpaque(); |
| updateAfterWidgetResize(); |
| updateRenderingContext(); |
| @@ -942,18 +940,12 @@ void CompositedLayerMapping::updateInternalHierarchy() |
| } |
| } |
| -void CompositedLayerMapping::updateContentsRect(bool isSimpleContainer) |
| +void CompositedLayerMapping::updateContentsRect() |
| { |
| - LayoutRect contentsRect; |
| - if (isSimpleContainer && renderer()->hasBackground()) |
| - contentsRect = backgroundBox(); |
| - else |
| - contentsRect = contentsBox(); |
| - |
| - m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsRect)); |
| + m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox())); |
| } |
| -void CompositedLayerMapping::updateDrawsContent(bool isSimpleContainer) |
| +void CompositedLayerMapping::updateDrawsContent() |
| { |
| if (m_scrollingLayer) { |
| // We don't have to consider overflow controls, because we know that the scrollbars are drawn elsewhere. |
| @@ -968,7 +960,7 @@ void CompositedLayerMapping::updateDrawsContent(bool isSimpleContainer) |
| return; |
| } |
| - bool hasPaintedContent = containsPaintedContent(isSimpleContainer); |
| + bool hasPaintedContent = containsPaintedContent(); |
| if (hasPaintedContent && isAcceleratedCanvas(renderer())) { |
| CanvasRenderingContext* context = toHTMLCanvasElement(renderer()->node())->renderingContext(); |
| // Content layer may be null if context is lost. |
| @@ -1502,45 +1494,9 @@ Color CompositedLayerMapping::rendererBackgroundColor() const |
| return backgroundRenderer->resolveColor(CSSPropertyBackgroundColor); |
| } |
| -void CompositedLayerMapping::updateBackgroundColor(bool isSimpleContainer) |
| +void CompositedLayerMapping::updateBackgroundColor() |
| { |
| - Color backgroundColor = rendererBackgroundColor(); |
| - if (isSimpleContainer) { |
| - m_graphicsLayer->setContentsToSolidColor(backgroundColor); |
| - m_graphicsLayer->setBackgroundColor(Color::transparent); |
| - } else { |
| - m_graphicsLayer->setContentsToSolidColor(Color::transparent); |
| - m_graphicsLayer->setBackgroundColor(backgroundColor); |
| - } |
| -} |
| - |
| -static bool supportsDirectBoxDecorationsComposition(const RenderObject* renderer) |
| -{ |
| - if (renderer->hasClip()) |
| - return false; |
| - |
| - if (hasBoxDecorationsOrBackgroundImage(renderer->style())) |
| - return false; |
| - |
| - // FIXME: we should be able to allow backgroundComposite; However since this is not a common use case it has been deferred for now. |
| - if (renderer->style()->backgroundComposite() != CompositeSourceOver) |
| - return false; |
| - |
| - if (renderer->style()->backgroundClip() == TextFillBox) |
| - return false; |
| - |
| - return true; |
| -} |
| - |
| -bool CompositedLayerMapping::paintsBoxDecorations() const |
| -{ |
| - if (!m_owningLayer->hasVisibleBoxDecorations()) |
| - return false; |
| - |
| - if (!supportsDirectBoxDecorationsComposition(renderer())) |
| - return true; |
| - |
| - return false; |
| + m_graphicsLayer->setBackgroundColor(rendererBackgroundColor()); |
| } |
| bool CompositedLayerMapping::paintsChildren() const |
| @@ -1559,23 +1515,22 @@ static bool isCompositedPlugin(RenderObject* renderer) |
| return renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allowsAcceleratedCompositing(); |
| } |
| -// A "simple container layer" is a RenderLayer which has no visible content to render. |
| -// It may have no children, or all its children may be themselves composited. |
| -// This is a useful optimization, because it allows us to avoid allocating backing store. |
| -bool CompositedLayerMapping::isSimpleContainerCompositingLayer() const |
| +// Check if RenderLayer which has visible content to render. |
| +// It may have its own visible content, or its children composited into its own backing store. |
| +bool CompositedLayerMapping::paintsIntoOwningLayer() const |
| { |
| RenderObject* renderObject = renderer(); |
| if (renderObject->hasMask()) // masks require special treatment |
| - return false; |
| + return true; |
| if (renderObject->isReplaced() && !isCompositedPlugin(renderObject)) |
| - return false; |
| + return true; |
| - if (paintsBoxDecorations() || paintsChildren()) |
| - return false; |
| + if (m_owningLayer->hasVisibleBoxDecorations() || paintsChildren()) |
| + return true; |
| if (renderObject->isRenderRegion()) |
| - return false; |
| + return true; |
| if (renderObject->node() && renderObject->node()->isDocumentNode()) { |
| // Look to see if the root object has a non-simple background |
| @@ -1588,7 +1543,7 @@ bool CompositedLayerMapping::isSimpleContainerCompositingLayer() const |
| // Reject anything that has a border, a border-radius or outline, |
| // or is not a simple background (no background, or solid color). |
| if (hasBoxDecorationsOrBackgroundImage(style)) |
| - return false; |
| + return true; |
| // Now look at the body's renderer. |
| HTMLElement* body = renderObject->document().body(); |
| @@ -1599,10 +1554,9 @@ bool CompositedLayerMapping::isSimpleContainerCompositingLayer() const |
| style = bodyObject->style(); |
| if (hasBoxDecorationsOrBackgroundImage(style)) |
| - return false; |
| + return true; |
| } |
| - |
| - return true; |
| + return false; |
| } |
| static bool hasVisibleNonCompositingDescendant(RenderLayer* parent) |
| @@ -1644,9 +1598,9 @@ bool CompositedLayerMapping::hasVisibleNonCompositingDescendantLayers() const |
| return hasVisibleNonCompositingDescendant(m_owningLayer); |
| } |
| -bool CompositedLayerMapping::containsPaintedContent(bool isSimpleContainer) const |
| +bool CompositedLayerMapping::containsPaintedContent() const |
| { |
| - if (isSimpleContainer || paintsIntoCompositedAncestor() || m_artificiallyInflatedBounds || m_owningLayer->isReflection()) |
| + if (!paintsIntoOwningLayer() || paintsIntoCompositedAncestor() || m_artificiallyInflatedBounds || m_owningLayer->isReflection()) |
|
dshwang
2014/02/25 18:44:49
I guess isSimpleContainerCompositingLayer() was im
|
| return false; |
| if (isDirectlyCompositedImage()) |
| @@ -1713,8 +1667,7 @@ void CompositedLayerMapping::updateImageContents() |
| // This is a no-op if the layer doesn't have an inner layer for the image. |
| m_graphicsLayer->setContentsToImage(image); |
| - bool isSimpleContainer = false; |
| - updateDrawsContent(isSimpleContainer); |
| + updateDrawsContent(); |
| // Image animation is "lazy", in that it automatically stops unless someone is drawing |
| // the image. So we have to kick the animation each time; this has the downside that the |