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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 1227
1228 void RenderLayerCompositor::frameViewDidLayout() 1228 void RenderLayerCompositor::frameViewDidLayout()
1229 { 1229 {
1230 RenderLayerBacking* renderViewBacking = m_renderView->layer()->backing(); 1230 RenderLayerBacking* renderViewBacking = m_renderView->layer()->backing();
1231 if (renderViewBacking) 1231 if (renderViewBacking)
1232 renderViewBacking->adjustTiledBackingCoverage(); 1232 renderViewBacking->adjustTiledBackingCoverage();
1233 } 1233 }
1234 1234
1235 void RenderLayerCompositor::rootFixedBackgroundsChanged() 1235 void RenderLayerCompositor::rootFixedBackgroundsChanged()
1236 { 1236 {
1237 RenderLayerBacking* renderViewBacking = m_renderView->layer()->backing(); 1237 if (supportsFixedRootBackgroundCompositing())
1238 if (renderViewBacking && renderViewBacking->usingTiledBacking())
1239 setCompositingLayersNeedRebuild(); 1238 setCompositingLayersNeedRebuild();
1240 } 1239 }
1241 1240
1242 void RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer) 1241 void RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer)
1243 { 1242 {
1244 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) 1243 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( ))
1245 scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer); 1244 scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer);
1246 } 1245 }
1247 1246
1247 void RenderLayerCompositor::fixedRootBackgroundLayerChanged()
1248 {
1249 GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer();
1250 if (!backgroundLayer)
1251 return;
1252
1253 // 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
1254 // We'll also have to unhook it at some point.
1255 GraphicsLayer* root = m_rootContentLayer.get();
1256 while (root && root->parent())
1257 root = root->parent();
1258
1259 GraphicsLayer* frameClippingLayer = root->children()[0];
1260 GraphicsLayer* frameScrollingLayer = frameClippingLayer->children()[0];
1261 GraphicsLayer* nonCompositedContentLayer = frameScrollingLayer->children()[0 ];
1262
1263 // ??? Would we ever want to draw in both the NCCH *and* the fixed root bg?
1264 // If so, it seems like we're toast. We have to make this layer invisible
1265 // so that the fixed root bg can show through.
1266 nonCompositedContentLayer->setDrawsContent(false);
1267
1268 frameClippingLayer->addChildAtIndex(backgroundLayer, 0);
1269 }
1270
1248 String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags) 1271 String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags)
1249 { 1272 {
1250 updateCompositingLayers(CompositingUpdateAfterLayout); 1273 updateCompositingLayers(CompositingUpdateAfterLayout);
1251 1274
1252 if (!m_rootContentLayer) 1275 if (!m_rootContentLayer)
1253 return String(); 1276 return String();
1254 1277
1255 flushPendingLayerChanges(true); 1278 flushPendingLayerChanges(true);
1256 1279
1257 LayerTreeAsTextBehavior layerTreeBehavior = LayerTreeAsTextBehaviorNormal; 1280 LayerTreeAsTextBehavior layerTreeBehavior = LayerTreeAsTextBehaviorNormal;
1258 if (flags & LayerTreeFlagsIncludeDebugInfo) 1281 if (flags & LayerTreeFlagsIncludeDebugInfo)
1259 layerTreeBehavior |= LayerTreeAsTextDebug; 1282 layerTreeBehavior |= LayerTreeAsTextDebug;
1260 if (flags & LayerTreeFlagsIncludeVisibleRects) 1283 if (flags & LayerTreeFlagsIncludeVisibleRects)
1261 layerTreeBehavior |= LayerTreeAsTextIncludeVisibleRects; 1284 layerTreeBehavior |= LayerTreeAsTextIncludeVisibleRects;
1262 if (flags & LayerTreeFlagsIncludeTileCaches) 1285 if (flags & LayerTreeFlagsIncludeTileCaches)
1263 layerTreeBehavior |= LayerTreeAsTextIncludeTileCaches; 1286 layerTreeBehavior |= LayerTreeAsTextIncludeTileCaches;
1264 if (flags & LayerTreeFlagsIncludeRepaintRects) 1287 if (flags & LayerTreeFlagsIncludeRepaintRects)
1265 layerTreeBehavior |= LayerTreeAsTextIncludeRepaintRects; 1288 layerTreeBehavior |= LayerTreeAsTextIncludeRepaintRects;
1266 if (flags & LayerTreeFlagsIncludePaintingPhases) 1289 if (flags & LayerTreeFlagsIncludePaintingPhases)
1267 layerTreeBehavior |= LayerTreeAsTextIncludePaintingPhases; 1290 layerTreeBehavior |= LayerTreeAsTextIncludePaintingPhases;
1268 1291
1269 // We skip dumping the scroll and clip layers to keep layerTreeAsText output 1292 // We skip dumping the scroll and clip layers to keep layerTreeAsText output
1270 // similar between platforms. 1293 // similar between platforms.
1271 String layerTreeText = m_rootContentLayer->layerTreeAsText(layerTreeBehavior ); 1294 GraphicsLayer* layer = m_rootContentLayer.get();
1295 while (layer && layer->parent())
1296 layer = layer->parent();
1297 //String layerTreeText = m_rootContentLayer->layerTreeAsText(layerTreeBehavi or);
1298 String layerTreeText = layer->layerTreeAsText(layerTreeBehavior);
1272 1299
1273 // The true root layer is not included in the dump, so if we want to report 1300 // The true root layer is not included in the dump, so if we want to report
1274 // its repaint rects, they must be included here. 1301 // its repaint rects, they must be included here.
1275 if (flags & LayerTreeFlagsIncludeRepaintRects) { 1302 if (flags & LayerTreeFlagsIncludeRepaintRects) {
1276 String layerTreeTextWithRootRepaintRects = m_renderView->frameView()->tr ackedRepaintRectsAsText(); 1303 String layerTreeTextWithRootRepaintRects = m_renderView->frameView()->tr ackedRepaintRectsAsText();
1277 layerTreeTextWithRootRepaintRects.append(layerTreeText); 1304 layerTreeTextWithRootRepaintRects.append(layerTreeText);
1278 return layerTreeTextWithRootRepaintRects; 1305 return layerTreeTextWithRootRepaintRects;
1279 } 1306 }
1280 1307
1281 return layerTreeText; 1308 return layerTreeText;
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
2230 #if PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING) 2257 #if PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING)
2231 } else if (graphicsLayer == layerForOverhangAreas()) { 2258 } else if (graphicsLayer == layerForOverhangAreas()) {
2232 ScrollView* view = m_renderView->frameView(); 2259 ScrollView* view = m_renderView->frameView();
2233 view->calculateAndPaintOverhangAreas(&context, clip); 2260 view->calculateAndPaintOverhangAreas(&context, clip);
2234 #endif 2261 #endif
2235 } 2262 }
2236 } 2263 }
2237 2264
2238 bool RenderLayerCompositor::supportsFixedRootBackgroundCompositing() const 2265 bool RenderLayerCompositor::supportsFixedRootBackgroundCompositing() const
2239 { 2266 {
2240 RenderLayerBacking* renderViewBacking = m_renderView->layer()->backing(); 2267 return m_renderView->document()->settings() &&
2241 return renderViewBacking && renderViewBacking->usingTiledBacking(); 2268 m_renderView->document()->settings()->acceleratedCompositingForFixedR ootBackgroundEnabled();
2242 } 2269 }
2243 2270
2244 bool RenderLayerCompositor::needsFixedRootBackgroundLayer(const RenderLayer* lay er) const 2271 bool RenderLayerCompositor::needsFixedRootBackgroundLayer(const RenderLayer* lay er) const
2245 { 2272 {
2246 if (layer != m_renderView->layer()) 2273 if (layer != m_renderView->layer())
2247 return false; 2274 return false;
2248 2275
2249 return supportsFixedRootBackgroundCompositing() && m_renderView->rootBackgro undIsEntirelyFixed(); 2276 return supportsFixedRootBackgroundCompositing() && m_renderView->rootBackgro undIsEntirelyFixed();
2250 } 2277 }
2251 2278
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
3043 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea"); 3070 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea");
3044 info.addMember(m_layerForHeader, "layerForHeader"); 3071 info.addMember(m_layerForHeader, "layerForHeader");
3045 info.addMember(m_layerForFooter, "layerForFooter"); 3072 info.addMember(m_layerForFooter, "layerForFooter");
3046 #endif 3073 #endif
3047 info.addMember(m_layerUpdater, "layerUpdater"); 3074 info.addMember(m_layerUpdater, "layerUpdater");
3048 } 3075 }
3049 3076
3050 } // namespace WebCore 3077 } // namespace WebCore
3051 3078
3052 #endif // USE(ACCELERATED_COMPOSITING) 3079 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698