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

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: . Created 7 years, 5 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
« no previous file with comments | « Source/core/rendering/RenderLayerBacking.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderLayerCompositor.cpp
diff --git a/Source/core/rendering/RenderLayerCompositor.cpp b/Source/core/rendering/RenderLayerCompositor.cpp
index f13545301b90fd6471fb610da511bf29db6a6073..5375e292a8db2272cc2a0594ce59cbe73d3f80d4 100644
--- a/Source/core/rendering/RenderLayerCompositor.cpp
+++ b/Source/core/rendering/RenderLayerCompositor.cpp
@@ -1185,9 +1185,6 @@ void RenderLayerCompositor::frameViewDidScroll()
}
m_scrollLayer->setPosition(FloatPoint(-scrollPosition.x(), -scrollPosition.y()));
-
- if (GraphicsLayer* fixedBackgroundLayer = fixedRootBackgroundLayer())
- fixedBackgroundLayer->setPosition(IntPoint(frameView->scrollOffsetForFixedPosition()));
}
void RenderLayerCompositor::frameViewDidLayout()
@@ -1196,7 +1193,24 @@ void RenderLayerCompositor::frameViewDidLayout()
void RenderLayerCompositor::rootFixedBackgroundsChanged()
{
- // FIXME: Implement when root fixed background layer is implemented.
+ if (!supportsFixedRootBackgroundCompositing())
+ return;
+
+ // 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).
+ if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer())
+ m_clipLayer->addChildBelow(backgroundLayer, m_scrollLayer.get());
}
void RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer)
@@ -2096,7 +2110,11 @@ void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, Gr
bool RenderLayerCompositor::supportsFixedRootBackgroundCompositing() const
{
- return false; // FIXME: Return true if this is supported when implemented.
+ if (Settings* settings = m_renderView->document()->settings()) {
+ if (settings->acceleratedCompositingForFixedRootBackgroundEnabled())
+ return true;
+ }
+ return false;
}
bool RenderLayerCompositor::needsFixedRootBackgroundLayer(const RenderLayer* layer) const
« no previous file with comments | « Source/core/rendering/RenderLayerBacking.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698