Chromium Code Reviews| Index: Source/core/rendering/RenderLayerBacking.cpp |
| diff --git a/Source/core/rendering/RenderLayerBacking.cpp b/Source/core/rendering/RenderLayerBacking.cpp |
| index a5a84c2b7768a81120c75fe9546c869b246ec6c4..4c50536d67142c07103025c42060a63a84bbca05 100644 |
| --- a/Source/core/rendering/RenderLayerBacking.cpp |
| +++ b/Source/core/rendering/RenderLayerBacking.cpp |
| @@ -155,9 +155,6 @@ void RenderLayerBacking::updateDebugIndicators(bool showBorder, bool showRepaint |
| m_foregroundLayer->setShowRepaintCounter(showRepaintCounter); |
| } |
| - if (m_contentsContainmentLayer) |
| - m_contentsContainmentLayer->setShowDebugBorder(showBorder); |
| - |
| if (m_backgroundLayer) { |
| m_backgroundLayer->setShowDebugBorder(showBorder); |
| m_backgroundLayer->setShowRepaintCounter(showRepaintCounter); |
| @@ -214,7 +211,6 @@ void RenderLayerBacking::destroyGraphicsLayers() |
| m_graphicsLayer->removeFromParent(); |
| m_ancestorClippingLayer = nullptr; |
| - m_contentsContainmentLayer = nullptr; |
| m_graphicsLayer = nullptr; |
| m_foregroundLayer = nullptr; |
| m_backgroundLayer = nullptr; |
| @@ -240,11 +236,7 @@ void RenderLayerBacking::updateTransform(const RenderStyle* style) |
| makeMatrixRenderable(t, compositor()->canRender3DTransforms()); |
| } |
| - if (m_contentsContainmentLayer) { |
| - m_contentsContainmentLayer->setTransform(t); |
| - m_graphicsLayer->setTransform(TransformationMatrix()); |
| - } else |
| - m_graphicsLayer->setTransform(t); |
| + m_graphicsLayer->setTransform(t); |
| } |
| void RenderLayerBacking::updateFilters(const RenderStyle* style) |
| @@ -274,7 +266,12 @@ void RenderLayerBacking::updateContentsOpaque() |
| { |
| // For non-root layers, background is always painted by the primary graphics layer. |
| ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer); |
| - m_graphicsLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToBeOpaqueInRect(compositedBounds())); |
| + if (m_backgroundLayer) { |
| + m_graphicsLayer->setContentsOpaque(false); |
| + m_backgroundLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToBeOpaqueInRect(compositedBounds())); |
| + } else { |
| + m_graphicsLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToBeOpaqueInRect(compositedBounds())); |
| + } |
| } |
| static bool hasNonZeroTransformOrigin(const RenderObject* renderer) |
| @@ -561,14 +558,6 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() |
| FloatSize contentsSize = relativeCompositingBounds.size(); |
| - if (m_contentsContainmentLayer) { |
| - m_contentsContainmentLayer->setPreserves3D(preserves3D); |
| - m_contentsContainmentLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation)); |
| - // Use the same size as m_graphicsLayer so transforms behave correctly. |
| - m_contentsContainmentLayer->setSize(contentsSize); |
| - graphicsLayerParentLocation = relativeCompositingBounds.location(); |
| - } |
| - |
| m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation)); |
| m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.location())); |
| @@ -612,10 +601,7 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() |
| FloatPoint3D anchor(relativeCompositingBounds.width() != 0.0f ? ((layerBounds.x() - relativeCompositingBounds.x()) + transformOrigin.x()) / relativeCompositingBounds.width() : 0.5f, |
| relativeCompositingBounds.height() != 0.0f ? ((layerBounds.y() - relativeCompositingBounds.y()) + transformOrigin.y()) / relativeCompositingBounds.height() : 0.5f, |
| transformOrigin.z()); |
| - if (m_contentsContainmentLayer) |
| - m_contentsContainmentLayer->setAnchorPoint(anchor); |
| - else |
| - m_graphicsLayer->setAnchorPoint(anchor); |
| + m_graphicsLayer->setAnchorPoint(anchor); |
| RenderStyle* style = renderer()->style(); |
| GraphicsLayer* clipLayer = clippingLayer(); |
| @@ -636,8 +622,6 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() |
| } |
| } else { |
| m_graphicsLayer->setAnchorPoint(FloatPoint3D(0.5f, 0.5f, 0)); |
| - if (m_contentsContainmentLayer) |
| - m_contentsContainmentLayer->setAnchorPoint(FloatPoint3D(0.5f, 0.5f, 0)); |
| } |
| if (m_foregroundLayer) { |
| @@ -664,7 +648,6 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() |
| FloatSize backgroundSize = contentsSize; |
| if (backgroundLayerPaintsFixedRootBackground()) { |
| FrameView* frameView = toRenderView(renderer())->frameView(); |
| - backgroundPosition = IntPoint(frameView->scrollOffsetForFixedPosition()); |
| backgroundSize = frameView->visibleContentRect().size(); |
| } |
| m_backgroundLayer->setPosition(backgroundPosition); |
| @@ -762,19 +745,9 @@ void RenderLayerBacking::updateInternalHierarchy() |
| if (m_ancestorClippingLayer) |
| m_ancestorClippingLayer->removeAllChildren(); |
| - if (m_contentsContainmentLayer) { |
| - m_contentsContainmentLayer->removeAllChildren(); |
| - if (m_ancestorClippingLayer) |
| - m_ancestorClippingLayer->addChild(m_contentsContainmentLayer.get()); |
| - } |
| - |
| - if (m_backgroundLayer) |
| - m_contentsContainmentLayer->addChild(m_backgroundLayer.get()); |
| - |
| m_graphicsLayer->removeFromParent(); |
| - if (m_contentsContainmentLayer) |
| - m_contentsContainmentLayer->addChild(m_graphicsLayer.get()); |
| - else if (m_ancestorClippingLayer) |
| + |
| + if (m_ancestorClippingLayer) |
| m_ancestorClippingLayer->addChild(m_graphicsLayer.get()); |
| if (m_childContainmentLayer) { |
| @@ -865,7 +838,7 @@ bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs |
| } |
| if (needsDescendantClip) { |
| - if (!m_childContainmentLayer) { |
| + if (!m_childContainmentLayer && !m_isMainFrameRenderViewLayer) { |
| m_childContainmentLayer = createGraphicsLayer("Child clipping Layer", CompositingReasonLayerForClip); |
| m_childContainmentLayer->setMasksToBounds(true); |
| layersChanged = true; |
| @@ -1020,26 +993,12 @@ bool RenderLayerBacking::updateBackgroundLayer(bool needsBackgroundLayer) |
| m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintBackground); |
| layerChanged = true; |
| } |
| - |
| - if (!m_contentsContainmentLayer) { |
| - String layerName; |
| -#ifndef NDEBUG |
| - layerName = m_owningLayer->debugName() + " (contents containment)"; |
| -#endif |
| - m_contentsContainmentLayer = createGraphicsLayer(layerName, CompositingReasonLayerForBackground); |
| - layerChanged = true; |
| - } |
| } else { |
| if (m_backgroundLayer) { |
| m_backgroundLayer->removeFromParent(); |
| m_backgroundLayer = nullptr; |
| layerChanged = true; |
| } |
| - if (m_contentsContainmentLayer) { |
| - m_contentsContainmentLayer->removeFromParent(); |
| - m_contentsContainmentLayer = nullptr; |
| - layerChanged = true; |
| - } |
| } |
| return layerChanged; |
| @@ -1183,6 +1142,37 @@ void RenderLayerBacking::updateBackgroundColor(bool isSimpleContainer) |
| void RenderLayerBacking::updateRootLayerConfiguration() |
| { |
| + if (!backgroundLayerPaintsFixedRootBackground()) |
| + return; |
| + |
| + Color backgroundColor; |
| + FrameView* frameView = toRenderView(renderer())->frameView(); |
| + bool viewIsTransparent = frameView->isTransparent(); |
| + |
| + if (!viewIsTransparent) { |
|
jamesr
2013/06/13 19:48:47
A default-initialized Color and a color initialize
|
| + backgroundColor = frameView->documentBackgroundColor(); |
| + if (!backgroundColor.isValid() || backgroundColor.hasAlpha()) |
| + backgroundColor = Color::white; |
| + } |
| + |
| + if (m_backgroundLayerPaintsFixedRootBackground && m_backgroundLayer) { |
| + m_backgroundLayer->setBackgroundColor(backgroundColor); |
| + m_backgroundLayer->setContentsOpaque(!viewIsTransparent); |
| +#if !OS(ANDROID) |
| + // FIXME(vollick): This setting is not behaving as expected. What to do |
|
jamesr
2013/06/13 19:48:47
what setting is this comment referring to?
|
| + // about missing tiles wrt to checkerboarding or drawing background |
| + // color has been contentious, but in this case, the desired behavior is |
| + // certain: we never want to draw checkerboards for the content that |
| + // scrolls over the fixed root background layer. |
| + m_backgroundLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true); |
| + m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(false); |
| +#endif |
| + m_graphicsLayer->setBackgroundColor(Color()); |
| + m_graphicsLayer->setContentsOpaque(false); |
| + } else { |
| + m_graphicsLayer->setBackgroundColor(backgroundColor); |
| + m_graphicsLayer->setContentsOpaque(!viewIsTransparent); |
| + } |
| } |
| static bool supportsDirectBoxDecorationsComposition(const RenderObject* renderer) |
| @@ -1512,9 +1502,6 @@ GraphicsLayer* RenderLayerBacking::childForSuperlayers() const |
| if (m_ancestorClippingLayer) |
| return m_ancestorClippingLayer.get(); |
| - if (m_contentsContainmentLayer) |
| - return m_contentsContainmentLayer.get(); |
| - |
| return m_graphicsLayer.get(); |
| } |
| @@ -1626,6 +1613,8 @@ void RenderLayerBacking::paintIntoLayer(const GraphicsLayer* graphicsLayer, Grap |
| RenderLayer::LayerPaintingInfo paintingInfo(m_owningLayer, paintDirtyRect, paintBehavior, LayoutSize()); |
| m_owningLayer->paintLayerContents(context, paintingInfo, paintFlags); |
| + ASSERT(graphicsLayer != m_backgroundLayer || paintFlags & RenderLayer::PaintLayerPaintingRootBackgroundOnly); |
| + |
| if (m_owningLayer->containsDirtyOverlayScrollbars()) |
| m_owningLayer->paintLayerContents(context, paintingInfo, paintFlags | RenderLayer::PaintLayerPaintingOverlayScrollbars); |
| @@ -1696,8 +1685,7 @@ void RenderLayerBacking::didCommitChangesForLayer(const GraphicsLayer* layer) co |
| bool RenderLayerBacking::getCurrentTransform(const GraphicsLayer* graphicsLayer, TransformationMatrix& transform) const |
| { |
| - GraphicsLayer* transformedLayer = m_contentsContainmentLayer.get() ? m_contentsContainmentLayer.get() : m_graphicsLayer.get(); |
| - if (graphicsLayer != transformedLayer) |
| + if (graphicsLayer != m_graphicsLayer.get()) |
| return false; |
| if (m_owningLayer->hasTransform()) { |
| @@ -1927,7 +1915,7 @@ double RenderLayerBacking::backingStoreMemoryEstimate() const |
| { |
| double backingMemory; |
| - // m_ancestorClippingLayer, m_contentsContainmentLayer and m_childContainmentLayer are just used for masking or containment, so have no backing. |
| + // m_ancestorClippingLayer and m_childContainmentLayer are just used for masking or containment, so have no backing. |
| backingMemory = m_graphicsLayer->backingStoreMemoryEstimate(); |
| if (m_foregroundLayer) |
| backingMemory += m_foregroundLayer->backingStoreMemoryEstimate(); |
| @@ -1956,7 +1944,6 @@ void RenderLayerBacking::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) c |
| MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering); |
| info.addWeakPointer(m_owningLayer); |
| info.addMember(m_ancestorClippingLayer, "ancestorClippingLayer"); |
| - info.addMember(m_contentsContainmentLayer, "contentsContainmentLayer"); |
| info.addMember(m_graphicsLayer, "graphicsLayer"); |
| info.addMember(m_foregroundLayer, "foregroundLayer"); |
| info.addMember(m_backgroundLayer, "backgroundLayer"); |