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

Unified Diff: Source/WebCore/rendering/RenderLayerBacking.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/RenderLayerBacking.cpp
diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp
index 5a955cc5d30cf3c0a467f29415cd59bb817adb3f..ee8d38435a6636fe64e24a0dfbb23d377b797b5f 100644
--- a/Source/WebCore/rendering/RenderLayerBacking.cpp
+++ b/Source/WebCore/rendering/RenderLayerBacking.cpp
@@ -121,17 +121,10 @@ RenderLayerBacking::RenderLayerBacking(RenderLayer* layer)
if (layer->isRootLayer()) {
Frame* frame = toRenderView(renderer())->frameView()->frame();
Page* page = frame ? frame->page() : 0;
- if (page && frame && page->mainFrame() == frame) {
+ if (page && frame && page->mainFrame() == frame)
m_isMainFrameRenderViewLayer = true;
-
-#if PLATFORM(MAC)
- // FIXME: It's a little weird that we base this decision on whether there's a scrolling coordinator or not.
- if (page->scrollingCoordinator())
- m_usingTiledCacheLayer = true;
-#endif
- }
}
-
+
createPrimaryGraphicsLayer();
if (m_usingTiledCacheLayer) {
@@ -287,9 +280,6 @@ void RenderLayerBacking::createPrimaryGraphicsLayer()
m_graphicsLayer = createGraphicsLayer(layerName);
m_creatingPrimaryGraphicsLayer = false;
- if (m_usingTiledCacheLayer)
- m_childContainmentLayer = createGraphicsLayer("TiledBacking Flattening Layer");
-
if (m_isMainFrameRenderViewLayer) {
m_graphicsLayer->setContentsOpaque(true);
m_graphicsLayer->setAppliesPageScale();
@@ -404,7 +394,7 @@ bool RenderLayerBacking::shouldClipCompositedBounds() const
if (layerForHorizontalScrollbar() || layerForVerticalScrollbar())
return false;
- if (m_usingTiledCacheLayer)
+ if (m_usingTiledCacheLayer || m_backgroundLayerPaintsFixedRootBackground)
return false;
if (!compositor()->compositingConsultsOverlap())
@@ -782,17 +772,11 @@ void RenderLayerBacking::updateGraphicsLayerGeometry()
if (m_backgroundLayer) {
FloatPoint backgroundPosition;
FloatSize backgroundSize = contentsSize;
- if (backgroundLayerPaintsFixedRootBackground()) {
- FrameView* frameView = toRenderView(renderer())->frameView();
- backgroundPosition = IntPoint(frameView->scrollOffsetForFixedPosition());
- backgroundSize = frameView->visibleContentRect().size();
- }
m_backgroundLayer->setPosition(backgroundPosition);
if (backgroundSize != m_backgroundLayer->size()) {
m_backgroundLayer->setSize(backgroundSize);
m_backgroundLayer->setNeedsDisplay();
}
- m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer());
}
if (m_owningLayer->reflectionLayer() && m_owningLayer->reflectionLayer()->isComposited()) {
@@ -885,9 +869,6 @@ void RenderLayerBacking::updateInternalHierarchy()
if (m_ancestorClippingLayer)
m_ancestorClippingLayer->addChild(m_contentsContainmentLayer.get());
}
-
- if (m_backgroundLayer)
- m_contentsContainmentLayer->addChild(m_backgroundLayer.get());
m_graphicsLayer->removeFromParent();
if (m_contentsContainmentLayer)
@@ -984,7 +965,7 @@ bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs
}
if (needsDescendantClip) {
- if (!m_childContainmentLayer && !m_usingTiledCacheLayer) {
+ if (!m_childContainmentLayer && !m_usingTiledCacheLayer && !m_backgroundLayerPaintsFixedRootBackground) {
m_childContainmentLayer = createGraphicsLayer("Child clipping Layer");
m_childContainmentLayer->setMasksToBounds(true);
layersChanged = true;
@@ -1171,17 +1152,6 @@ bool RenderLayerBacking::updateBackgroundLayer(bool needsBackgroundLayer)
m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintBackground);
layerChanged = true;
}
-
- if (!m_contentsContainmentLayer) {
- String layerName;
-#ifndef NDEBUG
- layerName = m_owningLayer->name() + " (contents containment)";
-#endif
- m_contentsContainmentLayer = createGraphicsLayer(layerName);
- m_contentsContainmentLayer->setAppliesPageScale(true);
- m_graphicsLayer->setAppliesPageScale(false);
- layerChanged = true;
- }
} else {
if (m_backgroundLayer) {
willDestroyLayer(m_backgroundLayer.get());
@@ -1189,13 +1159,12 @@ bool RenderLayerBacking::updateBackgroundLayer(bool needsBackgroundLayer)
m_backgroundLayer = nullptr;
layerChanged = true;
}
- if (m_contentsContainmentLayer) {
- willDestroyLayer(m_contentsContainmentLayer.get());
- m_contentsContainmentLayer->removeFromParent();
- m_contentsContainmentLayer = nullptr;
- layerChanged = true;
- m_graphicsLayer->setAppliesPageScale(true);
- }
+ }
+
+ if (layerChanged) {
+ // This assumes that the background layer is only used for fixed backgrounds, which is currently a correct assumption.
+ if (renderer()->view())
+ compositor()->fixedRootBackgroundLayerChanged();
}
return layerChanged;
@@ -1339,7 +1308,7 @@ void RenderLayerBacking::updateBackgroundColor(bool isSimpleContainer)
void RenderLayerBacking::updateRootLayerConfiguration()
{
- if (!m_usingTiledCacheLayer)
+ if (!m_usingTiledCacheLayer && !m_backgroundLayerPaintsFixedRootBackground)
return;
Color backgroundColor;
@@ -1700,7 +1669,7 @@ GraphicsLayer* RenderLayerBacking::childForSuperlayers() const
bool RenderLayerBacking::paintsIntoWindow() const
{
- if (m_usingTiledCacheLayer)
+ if (m_usingTiledCacheLayer || m_backgroundLayerPaintsFixedRootBackground)
return false;
if (m_owningLayer->isRootLayer()) {

Powered by Google App Engine
This is Rietveld 408576698