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

Unified Diff: Source/WebCore/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: Adding a FIXME for a bit that'll need fixing. Created 7 years, 8 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/WebCore/rendering/RenderLayerCompositor.cpp
diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp
index 68340231904d10d195019ad1de35266358fb04e5..3d09f408d6b2da475809e58878bce0e10821d395 100644
--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp
@@ -1234,8 +1234,7 @@ void RenderLayerCompositor::frameViewDidLayout()
void RenderLayerCompositor::rootFixedBackgroundsChanged()
{
- RenderLayerBacking* renderViewBacking = m_renderView->layer()->backing();
- if (renderViewBacking && renderViewBacking->usingTiledBacking())
+ if (supportsFixedRootBackgroundCompositing())
setCompositingLayersNeedRebuild();
}
@@ -1245,6 +1244,30 @@ void RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer)
scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer);
}
+void RenderLayerCompositor::fixedRootBackgroundLayerChanged()
+{
+ GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer();
+ if (!backgroundLayer)
+ return;
+
+ // FIXME: there must be a better way to insert this layer into the tree.
jamesr 2013/04/09 19:45:48 yes, please figure out a better way. are the layer
+ // We'll also have to unhook it at some point.
+ GraphicsLayer* root = m_rootContentLayer.get();
+ while (root && root->parent())
+ root = root->parent();
+
+ GraphicsLayer* frameClippingLayer = root->children()[0];
+ GraphicsLayer* frameScrollingLayer = frameClippingLayer->children()[0];
+ GraphicsLayer* nonCompositedContentLayer = frameScrollingLayer->children()[0];
+
+ // ??? Would we ever want to draw in both the NCCH *and* the fixed root bg?
+ // If so, it seems like we're toast. We have to make this layer invisible
+ // so that the fixed root bg can show through.
+ nonCompositedContentLayer->setDrawsContent(false);
+
+ frameClippingLayer->addChildAtIndex(backgroundLayer, 0);
+}
+
String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags)
{
updateCompositingLayers(CompositingUpdateAfterLayout);
@@ -1268,7 +1291,11 @@ String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags)
// We skip dumping the scroll and clip layers to keep layerTreeAsText output
// similar between platforms.
- String layerTreeText = m_rootContentLayer->layerTreeAsText(layerTreeBehavior);
+ GraphicsLayer* layer = m_rootContentLayer.get();
+ while (layer && layer->parent())
+ layer = layer->parent();
+ //String layerTreeText = m_rootContentLayer->layerTreeAsText(layerTreeBehavior);
+ String layerTreeText = layer->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.
@@ -2237,8 +2264,8 @@ void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, Gr
bool RenderLayerCompositor::supportsFixedRootBackgroundCompositing() const
{
- RenderLayerBacking* renderViewBacking = m_renderView->layer()->backing();
- return renderViewBacking && renderViewBacking->usingTiledBacking();
+ return m_renderView->document()->settings() &&
+ m_renderView->document()->settings()->acceleratedCompositingForFixedRootBackgroundEnabled();
}
bool RenderLayerCompositor::needsFixedRootBackgroundLayer(const RenderLayer* layer) const

Powered by Google App Engine
This is Rietveld 408576698