Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1234)

Unified Diff: Source/core/rendering/RenderLayerCompositor.cpp

Issue 13462003: Add support for accelerated fixed root background (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@background-attachment-fixed2
Patch Set: Moved the layout tests. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/RenderLayerCompositor.cpp
diff --git a/Source/core/rendering/RenderLayerCompositor.cpp b/Source/core/rendering/RenderLayerCompositor.cpp
index 8dfcfe82615d49e2c7f06891b70e7eb740f02b28..3fb29cc28f77e51984e60f9802f347c6b62d04d6 100644
--- a/Source/core/rendering/RenderLayerCompositor.cpp
+++ b/Source/core/rendering/RenderLayerCompositor.cpp
@@ -1087,6 +1087,22 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, Vect
// If a negative z-order child is compositing, we get a foreground layer which needs to get parented.
if (layerBacking && layerBacking->foregroundLayer())
childList.append(layerBacking->foregroundLayer());
+
+ // To avoid having to make the fixed root background layer fixed positioned to
+ // stay put, we position it in the layer tree as follows:
+ //
+ // + Overflow controls host
+ // + Frame clip
+ // + (Fixed root background) <-- Here.
+ // + Frame scroll
+ // + Root content layer
+ // + Scrollbars
+ //
+ // That is, it needs to be the first child of the frame clip, the sibling of
+ // the frame scroll layer. The compositor does not own the background layer, it
+ // just positions it (like the foreground layer above).
+ if (layerBacking && layerBacking->backgroundLayer())
+ m_clipLayer->addChildBelow(layerBacking->backgroundLayer(), m_scrollLayer.get());
jamesr 2013/06/13 19:48:47 why is this here? the code above and below this po
}
if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) {
@@ -1183,9 +1199,6 @@ void RenderLayerCompositor::frameViewDidScroll()
}
m_scrollLayer->setPosition(FloatPoint(-scrollPosition.x(), -scrollPosition.y()));
-
- if (GraphicsLayer* fixedBackgroundLayer = fixedRootBackgroundLayer())
- fixedBackgroundLayer->setPosition(IntPoint(frameView->scrollOffsetForFixedPosition()));
}
void RenderLayerCompositor::frameViewDidLayout()
@@ -1194,7 +1207,8 @@ void RenderLayerCompositor::frameViewDidLayout()
void RenderLayerCompositor::rootFixedBackgroundsChanged()
{
- // FIXME: Implement when root fixed background layer is implemented.
+ if (supportsFixedRootBackgroundCompositing())
+ setCompositingLayersNeedRebuild();
jamesr 2013/06/13 19:48:47 this seems really heavyweight. does promoting due
}
void RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer)
@@ -1220,9 +1234,13 @@ String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags)
if (flags & LayerTreeFlagsIncludePaintingPhases)
layerTreeBehavior |= LayerTreeAsTextIncludePaintingPhases;
+ GraphicsLayer* rootLayer = m_rootContentLayer.get();
+ if (flags & LayerTreeFlagsIncludeRootLayer)
+ rootLayer = rootGraphicsLayer();
+
// We skip dumping the scroll and clip layers to keep layerTreeAsText output
// similar between platforms.
- String layerTreeText = m_rootContentLayer->layerTreeAsText(layerTreeBehavior);
+ String layerTreeText = rootLayer->layerTreeAsText(layerTreeBehavior);
// The true root layer is not included in the dump, so if we want to report
// its repaint rects, they must be included here.
@@ -2101,7 +2119,10 @@ void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, Gr
bool RenderLayerCompositor::supportsFixedRootBackgroundCompositing() const
{
- return false; // FIXME: Return true if this is supported when implemented.
+ return m_renderView->layer()
+ && m_renderView->layer()->backing()
+ && m_renderView->document()->settings()
+ && m_renderView->document()->settings()->acceleratedCompositingForFixedRootBackgroundEnabled();
jamesr 2013/06/13 19:48:47 why isn't this setting stashed along with the othe
}
bool RenderLayerCompositor::needsFixedRootBackgroundLayer(const RenderLayer* layer) const
@@ -2112,19 +2133,6 @@ bool RenderLayerCompositor::needsFixedRootBackgroundLayer(const RenderLayer* lay
return supportsFixedRootBackgroundCompositing() && m_renderView->rootBackgroundIsEntirelyFixed();
}
-GraphicsLayer* RenderLayerCompositor::fixedRootBackgroundLayer() const
-{
- // Get the fixed root background from the RenderView layer's backing.
- RenderLayer* viewLayer = m_renderView->layer();
- if (!viewLayer)
- return 0;
-
- if (viewLayer->isComposited() && viewLayer->backing()->backgroundLayerPaintsFixedRootBackground())
- return viewLayer->backing()->backgroundLayer();
-
- return 0;
-}
-
static void resetTrackedRepaintRectsRecursive(GraphicsLayer* graphicsLayer)
{
if (!graphicsLayer)

Powered by Google App Engine
This is Rietveld 408576698