Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(28)

Side by Side Diff: Source/WebCore/rendering/RenderLayerBacking.cpp

Issue 7625051: Layer squashing prototype
Patch Set: correct diff Created 11 years, 12 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 149 }
150 } 150 }
151 } 151 }
152 152
153 RenderLayerBacking::~RenderLayerBacking() 153 RenderLayerBacking::~RenderLayerBacking()
154 { 154 {
155 updateClippingLayers(false, false); 155 updateClippingLayers(false, false);
156 updateOverflowControlsLayers(false, false, false); 156 updateOverflowControlsLayers(false, false, false);
157 updateForegroundLayer(false); 157 updateForegroundLayer(false);
158 updateBackgroundLayer(false); 158 updateBackgroundLayer(false);
159 updateOverlapLayer(false);
159 updateMaskLayer(false); 160 updateMaskLayer(false);
160 updateScrollingLayers(false); 161 updateScrollingLayers(false);
161 detachFromScrollingCoordinator(); 162 detachFromScrollingCoordinator();
162 destroyGraphicsLayers(); 163 destroyGraphicsLayers();
163 } 164 }
164 165
165 void RenderLayerBacking::willDestroyLayer(const GraphicsLayer* layer) 166 void RenderLayerBacking::willDestroyLayer(const GraphicsLayer* layer)
166 { 167 {
167 if (layer && layer->usingTiledBacking()) { 168 if (layer && layer->usingTiledBacking()) {
168 if (RenderLayerCompositor* compositor = this->compositor()) 169 if (RenderLayerCompositor* compositor = this->compositor())
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 } 251 }
251 ···· 252 ····
252 if (m_contentsContainmentLayer) 253 if (m_contentsContainmentLayer)
253 m_contentsContainmentLayer->setShowDebugBorder(showBorder); 254 m_contentsContainmentLayer->setShowDebugBorder(showBorder);
254 ···· 255 ····
255 if (m_backgroundLayer) { 256 if (m_backgroundLayer) {
256 m_backgroundLayer->setShowDebugBorder(showBorder); 257 m_backgroundLayer->setShowDebugBorder(showBorder);
257 m_backgroundLayer->setShowRepaintCounter(showRepaintCounter); 258 m_backgroundLayer->setShowRepaintCounter(showRepaintCounter);
258 } 259 }
259 260
261 if (m_overlapLayer) {
262 m_overlapLayer->setShowDebugBorder(showBorder);
263 m_overlapLayer->setShowRepaintCounter(showRepaintCounter);
264 }
265
260 if (m_maskLayer) { 266 if (m_maskLayer) {
261 m_maskLayer->setShowDebugBorder(showBorder); 267 m_maskLayer->setShowDebugBorder(showBorder);
262 m_maskLayer->setShowRepaintCounter(showRepaintCounter); 268 m_maskLayer->setShowRepaintCounter(showRepaintCounter);
263 } 269 }
264 270
265 if (m_layerForHorizontalScrollbar) 271 if (m_layerForHorizontalScrollbar)
266 m_layerForHorizontalScrollbar->setShowDebugBorder(showBorder); 272 m_layerForHorizontalScrollbar->setShowDebugBorder(showBorder);
267 273
268 if (m_layerForVerticalScrollbar) 274 if (m_layerForVerticalScrollbar)
269 m_layerForVerticalScrollbar->setShowDebugBorder(showBorder); 275 m_layerForVerticalScrollbar->setShowDebugBorder(showBorder);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 if (m_graphicsLayer) { 333 if (m_graphicsLayer) {
328 willDestroyLayer(m_graphicsLayer.get()); 334 willDestroyLayer(m_graphicsLayer.get());
329 m_graphicsLayer->removeFromParent(); 335 m_graphicsLayer->removeFromParent();
330 } 336 }
331 337
332 m_ancestorClippingLayer = nullptr; 338 m_ancestorClippingLayer = nullptr;
333 m_contentsContainmentLayer = nullptr; 339 m_contentsContainmentLayer = nullptr;
334 m_graphicsLayer = nullptr; 340 m_graphicsLayer = nullptr;
335 m_foregroundLayer = nullptr; 341 m_foregroundLayer = nullptr;
336 m_backgroundLayer = nullptr; 342 m_backgroundLayer = nullptr;
343 m_overlapLayer = nullptr;
337 m_childContainmentLayer = nullptr; 344 m_childContainmentLayer = nullptr;
338 m_maskLayer = nullptr; 345 m_maskLayer = nullptr;
339 346
340 m_scrollingLayer = nullptr; 347 m_scrollingLayer = nullptr;
341 m_scrollingContentsLayer = nullptr; 348 m_scrollingContentsLayer = nullptr;
342 } 349 }
343 350
344 void RenderLayerBacking::updateOpacity(const RenderStyle* style) 351 void RenderLayerBacking::updateOpacity(const RenderStyle* style)
345 { 352 {
346 m_graphicsLayer->setOpacity(compositingOpacity(style->opacity())); 353 m_graphicsLayer->setOpacity(compositingOpacity(style->opacity()));
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 507
501 bool layerConfigChanged = false; 508 bool layerConfigChanged = false;
502 setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgr oundLayer(m_owningLayer)); 509 setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgr oundLayer(m_owningLayer));
503 ···· 510 ····
504 // The background layer is currently only used for fixed root backgrounds. 511 // The background layer is currently only used for fixed root backgrounds.
505 if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground)) 512 if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground))
506 layerConfigChanged = true; 513 layerConfigChanged = true;
507 514
508 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(m_owning Layer))) 515 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(m_owning Layer)))
509 layerConfigChanged = true; 516 layerConfigChanged = true;
510 ···· 517
518 if (updateOverlapLayer(compositor->needsOverlapLayer(m_owningLayer)))
519 layerConfigChanged = true;
520
511 bool needsDescendentsClippingLayer = compositor->clipsCompositingDescendants (m_owningLayer); 521 bool needsDescendentsClippingLayer = compositor->clipsCompositingDescendants (m_owningLayer);
512 522
513 // Our scrolling layer will clip. 523 // Our scrolling layer will clip.
514 if (m_owningLayer->needsCompositedScrolling()) 524 if (m_owningLayer->needsCompositedScrolling())
515 needsDescendentsClippingLayer = false; 525 needsDescendentsClippingLayer = false;
516 526
517 if (updateClippingLayers(compositor->clippedByAncestor(m_owningLayer), needs DescendentsClippingLayer)) 527 if (updateClippingLayers(compositor->clippedByAncestor(m_owningLayer), needs DescendentsClippingLayer))
518 layerConfigChanged = true; 528 layerConfigChanged = true;
519 529
520 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require sVerticalScrollbarLayer(), requiresScrollCornerLayer())) 530 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require sVerticalScrollbarLayer(), requiresScrollCornerLayer()))
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 backgroundSize = frameView->visibleContentRect().size(); 792 backgroundSize = frameView->visibleContentRect().size();
783 } 793 }
784 m_backgroundLayer->setPosition(backgroundPosition); 794 m_backgroundLayer->setPosition(backgroundPosition);
785 if (backgroundSize != m_backgroundLayer->size()) { 795 if (backgroundSize != m_backgroundLayer->size()) {
786 m_backgroundLayer->setSize(backgroundSize); 796 m_backgroundLayer->setSize(backgroundSize);
787 m_backgroundLayer->setNeedsDisplay(); 797 m_backgroundLayer->setNeedsDisplay();
788 } 798 }
789 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend erer()); 799 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend erer());
790 } 800 }
791 801
802 if (m_overlapLayer) {
803 // The overlap layer should be treated as essentially the same level of abstraction as the foreground layer
804 // (except that it renders on top of composited children, rather than be low them)
805 FloatPoint overlapPosition;
806 FloatSize overlapSize = contentsSize;
807 IntSize overlapOffset = m_graphicsLayer->offsetFromRenderer();
808 if (hasClippingLayer()) {
809 // If we have a clipping layer (which clips descendants), then the o verlap layer is a child of it,
810 // so that it gets correctly sorted with children. In that case, pos ition relative to the clipping layer.
811 overlapSize = FloatSize(clippingBox.size());
812 overlapOffset = toIntSize(clippingBox.location());
813 }
814
815 m_overlapLayer->setPosition(overlapPosition);
816 if (overlapSize != m_overlapLayer->size()) {
817 m_overlapLayer->setSize(overlapSize);
818 m_overlapLayer->setNeedsDisplay();
819 }
820 m_overlapLayer->setOffsetFromRenderer(overlapOffset);
821 }
822
792 if (m_owningLayer->reflectionLayer() && m_owningLayer->reflectionLayer()->is Composited()) { 823 if (m_owningLayer->reflectionLayer() && m_owningLayer->reflectionLayer()->is Composited()) {
793 RenderLayerBacking* reflectionBacking = m_owningLayer->reflectionLayer() ->backing(); 824 RenderLayerBacking* reflectionBacking = m_owningLayer->reflectionLayer() ->backing();
794 reflectionBacking->updateGraphicsLayerGeometry(); 825 reflectionBacking->updateGraphicsLayerGeometry();
795 ········ 826 ········
796 // The reflection layer has the bounds of m_owningLayer->reflectionLayer (), 827 // The reflection layer has the bounds of m_owningLayer->reflectionLayer (),
797 // but the reflected layer is the bounds of this layer, so we need to po sition it appropriately. 828 // but the reflected layer is the bounds of this layer, so we need to po sition it appropriately.
798 FloatRect layerBounds = compositedBounds(); 829 FloatRect layerBounds = compositedBounds();
799 FloatRect reflectionLayerBounds = reflectionBacking->compositedBounds(); 830 FloatRect reflectionLayerBounds = reflectionBacking->compositedBounds();
800 reflectionBacking->graphicsLayer()->setReplicatedLayerPosition(FloatPoin t(layerBounds.location() - reflectionLayerBounds.location())); 831 reflectionBacking->graphicsLayer()->setReplicatedLayerPosition(FloatPoin t(layerBounds.location() - reflectionLayerBounds.location()));
801 } 832 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 } 896 }
866 // Page scale is applied as a transform on the root render view layer. Becau se the scroll 897 // Page scale is applied as a transform on the root render view layer. Becau se the scroll
867 // layer is further up in the hierarchy, we need to avoid marking the root r ender view 898 // layer is further up in the hierarchy, we need to avoid marking the root r ender view
868 // layer as a container. 899 // layer as a container.
869 bool isContainer = m_owningLayer->hasTransform() && !m_owningLayer->isRootLa yer(); 900 bool isContainer = m_owningLayer->hasTransform() && !m_owningLayer->isRootLa yer();
870 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(childForSupe rlayers(), isContainer); 901 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(childForSupe rlayers(), isContainer);
871 } 902 }
872 903
873 void RenderLayerBacking::updateInternalHierarchy() 904 void RenderLayerBacking::updateInternalHierarchy()
874 { 905 {
875 // m_foregroundLayer has to be inserted in the correct order with child laye rs, 906 // m_foregroundLayer and m_overlapLayer have to be inserted in the correct o rder with child layers,
876 // so it's not inserted here. 907 // so they're not inserted here.
877 if (m_ancestorClippingLayer) 908 if (m_ancestorClippingLayer)
878 m_ancestorClippingLayer->removeAllChildren(); 909 m_ancestorClippingLayer->removeAllChildren();
879 ···· 910 ····
880 if (m_contentsContainmentLayer) { 911 if (m_contentsContainmentLayer) {
881 m_contentsContainmentLayer->removeAllChildren(); 912 m_contentsContainmentLayer->removeAllChildren();
882 if (m_ancestorClippingLayer) 913 if (m_ancestorClippingLayer)
883 m_ancestorClippingLayer->addChild(m_contentsContainmentLayer.get()); 914 m_ancestorClippingLayer->addChild(m_contentsContainmentLayer.get());
884 } 915 }
885 ···· 916 ····
886 if (m_backgroundLayer) 917 if (m_backgroundLayer)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 984
954 bool hasPaintedContent = !isSimpleContainer && containsPaintedContent(); 985 bool hasPaintedContent = !isSimpleContainer && containsPaintedContent();
955 986
956 // FIXME: we could refine this to only allocate backing for one of these lay ers if possible. 987 // FIXME: we could refine this to only allocate backing for one of these lay ers if possible.
957 m_graphicsLayer->setDrawsContent(hasPaintedContent); 988 m_graphicsLayer->setDrawsContent(hasPaintedContent);
958 if (m_foregroundLayer) 989 if (m_foregroundLayer)
959 m_foregroundLayer->setDrawsContent(hasPaintedContent); 990 m_foregroundLayer->setDrawsContent(hasPaintedContent);
960 991
961 if (m_backgroundLayer) 992 if (m_backgroundLayer)
962 m_backgroundLayer->setDrawsContent(hasPaintedContent); 993 m_backgroundLayer->setDrawsContent(hasPaintedContent);
994
995 if (m_overlapLayer)
996 m_overlapLayer->setDrawsContent(hasPaintedContent);
963 } 997 }
964 998
965 // Return true if the layers changed. 999 // Return true if the layers changed.
966 bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs DescendantClip) 1000 bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs DescendantClip)
967 { 1001 {
968 bool layersChanged = false; 1002 bool layersChanged = false;
969 1003
970 if (needsAncestorClip) { 1004 if (needsAncestorClip) {
971 if (!m_ancestorClippingLayer) { 1005 if (!m_ancestorClippingLayer) {
972 m_ancestorClippingLayer = createGraphicsLayer("Ancestor clipping Lay er"); 1006 m_ancestorClippingLayer = createGraphicsLayer("Ancestor clipping Lay er");
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 ···· 1231 ····
1198 if (layerChanged) { 1232 if (layerChanged) {
1199 // This assumes that the background layer is only used for fixed backgro unds, which is currently a correct assumption. 1233 // This assumes that the background layer is only used for fixed backgro unds, which is currently a correct assumption.
1200 if (renderer()->view()) 1234 if (renderer()->view())
1201 compositor()->fixedRootBackgroundLayerChanged(); 1235 compositor()->fixedRootBackgroundLayerChanged();
1202 } 1236 }
1203 ···· 1237 ····
1204 return layerChanged; 1238 return layerChanged;
1205 } 1239 }
1206 1240
1241 bool RenderLayerBacking::updateOverlapLayer(bool needsOverlapLayer)
1242 {
1243 bool layerChanged = false;
1244 if (needsOverlapLayer) {
1245 if (!m_overlapLayer) {
1246 String layerName;
1247 #ifndef NDEBUG
1248 layerName = m_owningLayer->name() + " (overlap)";
1249 #endif
1250 m_overlapLayer = createGraphicsLayer(layerName);
1251 m_overlapLayer->setDrawsContent(true);
1252 m_overlapLayer->setPaintingPhase(GraphicsLayerPaintOverlap);
1253 layerChanged = true;
1254 }
1255 } else if (m_overlapLayer) {
1256 m_overlapLayer->removeFromParent();
1257 m_overlapLayer = nullptr;
1258 layerChanged = true;
1259 }
1260
1261 if (layerChanged)
1262 m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
1263
1264 return layerChanged;
1265 }
1266
1207 bool RenderLayerBacking::updateMaskLayer(bool needsMaskLayer) 1267 bool RenderLayerBacking::updateMaskLayer(bool needsMaskLayer)
1208 { 1268 {
1209 bool layerChanged = false; 1269 bool layerChanged = false;
1210 if (needsMaskLayer) { 1270 if (needsMaskLayer) {
1211 if (!m_maskLayer) { 1271 if (!m_maskLayer) {
1212 m_maskLayer = createGraphicsLayer("Mask"); 1272 m_maskLayer = createGraphicsLayer("Mask");
1213 m_maskLayer->setDrawsContent(true); 1273 m_maskLayer->setDrawsContent(true);
1214 m_maskLayer->setPaintingPhase(GraphicsLayerPaintMask); 1274 m_maskLayer->setPaintingPhase(GraphicsLayerPaintMask);
1215 layerChanged = true; 1275 layerChanged = true;
1216 } 1276 }
(...skipping 17 matching lines...) Expand all
1234 if (needsScrollingLayers) { 1294 if (needsScrollingLayers) {
1235 if (!m_scrollingLayer) { 1295 if (!m_scrollingLayer) {
1236 // Outer layer which corresponds with the scroll view. 1296 // Outer layer which corresponds with the scroll view.
1237 m_scrollingLayer = createGraphicsLayer("Scrolling container"); 1297 m_scrollingLayer = createGraphicsLayer("Scrolling container");
1238 m_scrollingLayer->setDrawsContent(false); 1298 m_scrollingLayer->setDrawsContent(false);
1239 m_scrollingLayer->setMasksToBounds(true); 1299 m_scrollingLayer->setMasksToBounds(true);
1240 1300
1241 // Inner layer which renders the content that scrolls. 1301 // Inner layer which renders the content that scrolls.
1242 m_scrollingContentsLayer = createGraphicsLayer("Scrolled Contents"); 1302 m_scrollingContentsLayer = createGraphicsLayer("Scrolled Contents");
1243 m_scrollingContentsLayer->setDrawsContent(true); 1303 m_scrollingContentsLayer->setDrawsContent(true);
1244 GraphicsLayerPaintingPhase paintPhase = GraphicsLayerPaintOverflowCo ntents | GraphicsLayerPaintCompositedScroll; 1304
1305 GraphicsLayerPaintingPhase paintPhase = GraphicsLayerPaintOverflowCo ntents | GraphicsLayerPaintCompositedScroll | GraphicsLayerPaintOverlap;
1245 if (!m_foregroundLayer) 1306 if (!m_foregroundLayer)
1246 paintPhase |= GraphicsLayerPaintForeground; 1307 paintPhase |= GraphicsLayerPaintForeground;
1247 m_scrollingContentsLayer->setPaintingPhase(paintPhase); 1308 m_scrollingContentsLayer->setPaintingPhase(paintPhase);
1248 m_scrollingLayer->addChild(m_scrollingContentsLayer.get()); 1309 m_scrollingLayer->addChild(m_scrollingContentsLayer.get());
1249 1310
1250 layerChanged = true; 1311 layerChanged = true;
1251 if (scrollingCoordinator) 1312 if (scrollingCoordinator)
1252 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_ownin gLayer); 1313 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_ownin gLayer);
1253 } 1314 }
1254 } else if (m_scrollingLayer) { 1315 } else if (m_scrollingLayer) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 m_scrollLayerID = 0; 1367 m_scrollLayerID = 0;
1307 } 1368 }
1308 1369
1309 GraphicsLayerPaintingPhase RenderLayerBacking::paintingPhaseForPrimaryLayer() co nst 1370 GraphicsLayerPaintingPhase RenderLayerBacking::paintingPhaseForPrimaryLayer() co nst
1310 { 1371 {
1311 unsigned phase = 0; 1372 unsigned phase = 0;
1312 if (!m_backgroundLayer) 1373 if (!m_backgroundLayer)
1313 phase |= GraphicsLayerPaintBackground; 1374 phase |= GraphicsLayerPaintBackground;
1314 if (!m_foregroundLayer) 1375 if (!m_foregroundLayer)
1315 phase |= GraphicsLayerPaintForeground; 1376 phase |= GraphicsLayerPaintForeground;
1377 if (!m_overlapLayer)
1378 phase |= GraphicsLayerPaintOverlap;
1316 if (!m_maskLayer) 1379 if (!m_maskLayer)
1317 phase |= GraphicsLayerPaintMask; 1380 phase |= GraphicsLayerPaintMask;
1318 1381
1319 if (m_scrollingContentsLayer) { 1382 if (m_scrollingContentsLayer) {
1320 phase &= ~GraphicsLayerPaintForeground; 1383 phase &= ~(GraphicsLayerPaintForeground & GraphicsLayerPaintOverlap);
shawnsingh 2013/03/21 05:01:02 Actually I think this should be bitwise OR | inst
1321 phase |= GraphicsLayerPaintCompositedScroll; 1384 phase |= GraphicsLayerPaintCompositedScroll;
1322 } 1385 }
1323 1386
1324 return static_cast<GraphicsLayerPaintingPhase>(phase); 1387 return static_cast<GraphicsLayerPaintingPhase>(phase);
1325 } 1388 }
1326 1389
1327 float RenderLayerBacking::compositingOpacity(float rendererOpacity) const 1390 float RenderLayerBacking::compositingOpacity(float rendererOpacity) const
1328 { 1391 {
1329 float finalOpacity = rendererOpacity; 1392 float finalOpacity = rendererOpacity;
1330 ···· 1393 ····
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 ···· 1842 ····
1780 if (m_graphicsLayer && m_graphicsLayer->drawsContent()) 1843 if (m_graphicsLayer && m_graphicsLayer->drawsContent())
1781 m_graphicsLayer->setNeedsDisplay(); 1844 m_graphicsLayer->setNeedsDisplay();
1782 ···· 1845 ····
1783 if (m_foregroundLayer && m_foregroundLayer->drawsContent()) 1846 if (m_foregroundLayer && m_foregroundLayer->drawsContent())
1784 m_foregroundLayer->setNeedsDisplay(); 1847 m_foregroundLayer->setNeedsDisplay();
1785 1848
1786 if (m_backgroundLayer && m_backgroundLayer->drawsContent()) 1849 if (m_backgroundLayer && m_backgroundLayer->drawsContent())
1787 m_backgroundLayer->setNeedsDisplay(); 1850 m_backgroundLayer->setNeedsDisplay();
1788 1851
1852 if (m_overlapLayer && m_overlapLayer->drawsContent())
1853 m_overlapLayer->setNeedsDisplay();
1854
1789 if (m_maskLayer && m_maskLayer->drawsContent()) 1855 if (m_maskLayer && m_maskLayer->drawsContent())
1790 m_maskLayer->setNeedsDisplay(); 1856 m_maskLayer->setNeedsDisplay();
1791 1857
1792 if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent()) 1858 if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent())
1793 m_scrollingContentsLayer->setNeedsDisplay(); 1859 m_scrollingContentsLayer->setNeedsDisplay();
1794 } 1860 }
1795 1861
1796 // r is in the coordinate space of the layer's render object 1862 // r is in the coordinate space of the layer's render object
1797 void RenderLayerBacking::setContentsNeedDisplayInRect(const IntRect& r) 1863 void RenderLayerBacking::setContentsNeedDisplayInRect(const IntRect& r)
1798 { 1864 {
1799 ASSERT(!paintsIntoCompositedAncestor()); 1865 ASSERT(!paintsIntoCompositedAncestor());
1800 1866
1801 if (m_graphicsLayer && m_graphicsLayer->drawsContent()) { 1867 if (m_graphicsLayer && m_graphicsLayer->drawsContent()) {
1802 IntRect layerDirtyRect = r; 1868 IntRect layerDirtyRect = r;
1803 layerDirtyRect.move(-m_graphicsLayer->offsetFromRenderer()); 1869 layerDirtyRect.move(-m_graphicsLayer->offsetFromRenderer());
1804 m_graphicsLayer->setNeedsDisplayInRect(layerDirtyRect); 1870 m_graphicsLayer->setNeedsDisplayInRect(layerDirtyRect);
1805 } 1871 }
1806 1872
1807 if (m_foregroundLayer && m_foregroundLayer->drawsContent()) { 1873 if (m_foregroundLayer && m_foregroundLayer->drawsContent()) {
1808 IntRect layerDirtyRect = r; 1874 IntRect layerDirtyRect = r;
1809 layerDirtyRect.move(-m_foregroundLayer->offsetFromRenderer()); 1875 layerDirtyRect.move(-m_foregroundLayer->offsetFromRenderer());
1810 m_foregroundLayer->setNeedsDisplayInRect(layerDirtyRect); 1876 m_foregroundLayer->setNeedsDisplayInRect(layerDirtyRect);
1811 } 1877 }
1812 1878
1879 if (m_overlapLayer && m_overlapLayer->drawsContent()) {
1880 IntRect layerDirtyRect = r;
1881 layerDirtyRect.move(-m_overlapLayer->offsetFromRenderer());
1882 m_overlapLayer->setNeedsDisplayInRect(layerDirtyRect);
1883 }
1884
1813 // FIXME: need to split out repaints for the background. 1885 // FIXME: need to split out repaints for the background.
1814 if (m_backgroundLayer && m_backgroundLayer->drawsContent()) { 1886 if (m_backgroundLayer && m_backgroundLayer->drawsContent()) {
1815 IntRect layerDirtyRect = r; 1887 IntRect layerDirtyRect = r;
1816 layerDirtyRect.move(-m_backgroundLayer->offsetFromRenderer()); 1888 layerDirtyRect.move(-m_backgroundLayer->offsetFromRenderer());
1817 m_backgroundLayer->setNeedsDisplayInRect(layerDirtyRect); 1889 m_backgroundLayer->setNeedsDisplayInRect(layerDirtyRect);
1818 } 1890 }
1819 1891
1820 if (m_maskLayer && m_maskLayer->drawsContent()) { 1892 if (m_maskLayer && m_maskLayer->drawsContent()) {
1821 IntRect layerDirtyRect = r; 1893 IntRect layerDirtyRect = r;
1822 layerDirtyRect.move(-m_maskLayer->offsetFromRenderer()); 1894 layerDirtyRect.move(-m_maskLayer->offsetFromRenderer());
(...skipping 16 matching lines...) Expand all
1839 return; 1911 return;
1840 } 1912 }
1841 1913
1842 FontCachePurgePreventer fontCachePurgePreventer; 1914 FontCachePurgePreventer fontCachePurgePreventer;
1843 ···· 1915 ····
1844 RenderLayer::PaintLayerFlags paintFlags = 0; 1916 RenderLayer::PaintLayerFlags paintFlags = 0;
1845 if (paintingPhase & GraphicsLayerPaintBackground) 1917 if (paintingPhase & GraphicsLayerPaintBackground)
1846 paintFlags |= RenderLayer::PaintLayerPaintingCompositingBackgroundPhase; 1918 paintFlags |= RenderLayer::PaintLayerPaintingCompositingBackgroundPhase;
1847 if (paintingPhase & GraphicsLayerPaintForeground) 1919 if (paintingPhase & GraphicsLayerPaintForeground)
1848 paintFlags |= RenderLayer::PaintLayerPaintingCompositingForegroundPhase; 1920 paintFlags |= RenderLayer::PaintLayerPaintingCompositingForegroundPhase;
1921 if (paintingPhase & GraphicsLayerPaintOverlap)
1922 paintFlags |= RenderLayer::PaintLayerPaintingCompositingOverlapPhase;
1849 if (paintingPhase & GraphicsLayerPaintMask) 1923 if (paintingPhase & GraphicsLayerPaintMask)
1850 paintFlags |= RenderLayer::PaintLayerPaintingCompositingMaskPhase; 1924 paintFlags |= RenderLayer::PaintLayerPaintingCompositingMaskPhase;
1851 if (paintingPhase & GraphicsLayerPaintOverflowContents) 1925 if (paintingPhase & GraphicsLayerPaintOverflowContents)
1852 paintFlags |= RenderLayer::PaintLayerPaintingOverflowContents; 1926 paintFlags |= RenderLayer::PaintLayerPaintingOverflowContents;
1853 if (paintingPhase & GraphicsLayerPaintCompositedScroll) 1927 if (paintingPhase & GraphicsLayerPaintCompositedScroll)
1854 paintFlags |= RenderLayer::PaintLayerPaintingCompositingScrollingPhase; 1928 paintFlags |= RenderLayer::PaintLayerPaintingCompositingScrollingPhase;
1855 1929
1856 if (graphicsLayer == m_backgroundLayer) 1930 if (graphicsLayer == m_backgroundLayer) {
1857 paintFlags |= (RenderLayer::PaintLayerPaintingRootBackgroundOnly | Rende rLayer::PaintLayerPaintingCompositingForegroundPhase); // Need PaintLayerPaintin gCompositingForegroundPhase to walk child layers. 1931 paintFlags |= (RenderLayer::PaintLayerPaintingRootBackgroundOnly
1932 | RenderLayer::PaintLayerPaintingCompositingForegroundPha se
1933 | RenderLayer::PaintLayerPaintingCompositingOverlapPhase) ; // Need ForegroundPhase and OverlapPhase here, to correctly walk child layers.
1934 }
1858 else if (m_backgroundLayer) 1935 else if (m_backgroundLayer)
1859 paintFlags |= RenderLayer::PaintLayerPaintingSkipRootBackground; 1936 paintFlags |= RenderLayer::PaintLayerPaintingSkipRootBackground;
1860 ···· 1937 ····
1861 // FIXME: GraphicsLayers need a way to split for RenderRegions. 1938 // FIXME: GraphicsLayers need a way to split for RenderRegions.
1862 RenderLayer::LayerPaintingInfo paintingInfo(m_owningLayer, paintDirtyRect, p aintBehavior, LayoutSize()); 1939 RenderLayer::LayerPaintingInfo paintingInfo(m_owningLayer, paintDirtyRect, p aintBehavior, LayoutSize());
1863 m_owningLayer->paintLayerContents(context, paintingInfo, paintFlags); 1940 m_owningLayer->paintLayerContents(context, paintingInfo, paintFlags);
1864 1941
1865 if (m_owningLayer->containsDirtyOverlayScrollbars()) 1942 if (m_owningLayer->containsDirtyOverlayScrollbars())
1866 m_owningLayer->paintLayerContents(context, paintingInfo, paintFlags | Re nderLayer::PaintLayerPaintingOverlayScrollbars); 1943 m_owningLayer->paintLayerContents(context, paintingInfo, paintFlags | Re nderLayer::PaintLayerPaintingOverlayScrollbars);
1867 1944
(...skipping 18 matching lines...) Expand all
1886 void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, Graph icsContext& context, GraphicsLayerPaintingPhase paintingPhase, const IntRect& cl ip) 1963 void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, Graph icsContext& context, GraphicsLayerPaintingPhase paintingPhase, const IntRect& cl ip)
1887 { 1964 {
1888 #ifndef NDEBUG 1965 #ifndef NDEBUG
1889 if (Page* page = renderer()->frame()->page()) 1966 if (Page* page = renderer()->frame()->page())
1890 page->setIsPainting(true); 1967 page->setIsPainting(true);
1891 #endif 1968 #endif
1892 1969
1893 if (graphicsLayer == m_graphicsLayer.get() 1970 if (graphicsLayer == m_graphicsLayer.get()
1894 || graphicsLayer == m_foregroundLayer.get() 1971 || graphicsLayer == m_foregroundLayer.get()
1895 || graphicsLayer == m_backgroundLayer.get() 1972 || graphicsLayer == m_backgroundLayer.get()
1973 || graphicsLayer == m_overlapLayer.get()
1896 || graphicsLayer == m_maskLayer.get() 1974 || graphicsLayer == m_maskLayer.get()
1897 || graphicsLayer == m_scrollingContentsLayer.get()) { 1975 || graphicsLayer == m_scrollingContentsLayer.get()) {
1898 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willPa int(m_owningLayer->renderer()->frame()); 1976 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willPa int(m_owningLayer->renderer()->frame());
1899 1977
1900 // The dirtyRect is in the coords of the painting root. 1978 // The dirtyRect is in the coords of the painting root.
1901 IntRect dirtyRect = clip; 1979 IntRect dirtyRect = clip;
1902 if (!(paintingPhase & GraphicsLayerPaintOverflowContents)) 1980 if (!(paintingPhase & GraphicsLayerPaintOverflowContents))
1903 dirtyRect.intersect(compositedBounds()); 1981 dirtyRect.intersect(compositedBounds());
1904 1982
1905 // We have to use the same root as for hit testing, because both methods can compute and cache clipRects. 1983 // We have to use the same root as for hit testing, because both methods can compute and cache clipRects.
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 double RenderLayerBacking::backingStoreMemoryEstimate() const 2299 double RenderLayerBacking::backingStoreMemoryEstimate() const
2222 { 2300 {
2223 double backingMemory; 2301 double backingMemory;
2224 ···· 2302 ····
2225 // m_ancestorClippingLayer, m_contentsContainmentLayer and m_childContainmen tLayer are just used for masking or containment, so have no backing. 2303 // m_ancestorClippingLayer, m_contentsContainmentLayer and m_childContainmen tLayer are just used for masking or containment, so have no backing.
2226 backingMemory = m_graphicsLayer->backingStoreMemoryEstimate(); 2304 backingMemory = m_graphicsLayer->backingStoreMemoryEstimate();
2227 if (m_foregroundLayer) 2305 if (m_foregroundLayer)
2228 backingMemory += m_foregroundLayer->backingStoreMemoryEstimate(); 2306 backingMemory += m_foregroundLayer->backingStoreMemoryEstimate();
2229 if (m_backgroundLayer) 2307 if (m_backgroundLayer)
2230 backingMemory += m_backgroundLayer->backingStoreMemoryEstimate(); 2308 backingMemory += m_backgroundLayer->backingStoreMemoryEstimate();
2309 if (m_overlapLayer)
2310 backingMemory += m_overlapLayer->backingStoreMemoryEstimate();
2231 if (m_maskLayer) 2311 if (m_maskLayer)
2232 backingMemory += m_maskLayer->backingStoreMemoryEstimate(); 2312 backingMemory += m_maskLayer->backingStoreMemoryEstimate();
2233 2313
2234 if (m_scrollingContentsLayer) 2314 if (m_scrollingContentsLayer)
2235 backingMemory += m_scrollingContentsLayer->backingStoreMemoryEstimate(); 2315 backingMemory += m_scrollingContentsLayer->backingStoreMemoryEstimate();
2236 2316
2237 if (m_layerForHorizontalScrollbar) 2317 if (m_layerForHorizontalScrollbar)
2238 backingMemory += m_layerForHorizontalScrollbar->backingStoreMemoryEstima te(); 2318 backingMemory += m_layerForHorizontalScrollbar->backingStoreMemoryEstima te();
2239 2319
2240 if (m_layerForVerticalScrollbar) 2320 if (m_layerForVerticalScrollbar)
(...skipping 21 matching lines...) Expand all
2262 2342
2263 void RenderLayerBacking::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) c onst 2343 void RenderLayerBacking::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) c onst
2264 { 2344 {
2265 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering) ; 2345 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering) ;
2266 info.addWeakPointer(m_owningLayer); 2346 info.addWeakPointer(m_owningLayer);
2267 info.addMember(m_ancestorClippingLayer, "ancestorClippingLayer"); 2347 info.addMember(m_ancestorClippingLayer, "ancestorClippingLayer");
2268 info.addMember(m_contentsContainmentLayer, "contentsContainmentLayer"); 2348 info.addMember(m_contentsContainmentLayer, "contentsContainmentLayer");
2269 info.addMember(m_graphicsLayer, "graphicsLayer"); 2349 info.addMember(m_graphicsLayer, "graphicsLayer");
2270 info.addMember(m_foregroundLayer, "foregroundLayer"); 2350 info.addMember(m_foregroundLayer, "foregroundLayer");
2271 info.addMember(m_backgroundLayer, "backgroundLayer"); 2351 info.addMember(m_backgroundLayer, "backgroundLayer");
2352 info.addMember(m_overlapLayer, "overlapLayer");
2272 info.addMember(m_childContainmentLayer, "childContainmentLayer"); 2353 info.addMember(m_childContainmentLayer, "childContainmentLayer");
2273 info.addMember(m_maskLayer, "maskLayer"); 2354 info.addMember(m_maskLayer, "maskLayer");
2274 info.addMember(m_layerForHorizontalScrollbar, "layerForHorizontalScrollbar") ; 2355 info.addMember(m_layerForHorizontalScrollbar, "layerForHorizontalScrollbar") ;
2275 info.addMember(m_layerForVerticalScrollbar, "layerForVerticalScrollbar"); 2356 info.addMember(m_layerForVerticalScrollbar, "layerForVerticalScrollbar");
2276 info.addMember(m_layerForScrollCorner, "layerForScrollCorner"); 2357 info.addMember(m_layerForScrollCorner, "layerForScrollCorner");
2277 info.addMember(m_scrollingLayer, "scrollingLayer"); 2358 info.addMember(m_scrollingLayer, "scrollingLayer");
2278 info.addMember(m_scrollingContentsLayer, "scrollingContentsLayer"); 2359 info.addMember(m_scrollingContentsLayer, "scrollingContentsLayer");
2279 } 2360 }
2280 2361
2281 } // namespace WebCore 2362 } // namespace WebCore
2282 2363
2283 #endif // USE(ACCELERATED_COMPOSITING) 2364 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/RenderLayerBacking.h ('k') | Source/WebCore/rendering/RenderLayerCompositor.h » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b