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

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

Issue 10342008: Revert 114283 - Avoid using backing store for compositing layers that just need to clip (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1123/
Patch Set: Created 8 years, 7 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, 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 UNUSED_PARAM(renderer); 85 UNUSED_PARAM(renderer);
86 #endif 86 #endif
87 return false; 87 return false;
88 } 88 }
89 89
90 RenderLayerBacking::RenderLayerBacking(RenderLayer* layer) 90 RenderLayerBacking::RenderLayerBacking(RenderLayer* layer)
91 : m_owningLayer(layer) 91 : m_owningLayer(layer)
92 , m_artificiallyInflatedBounds(false) 92 , m_artificiallyInflatedBounds(false)
93 , m_isMainFrameRenderViewLayer(false) 93 , m_isMainFrameRenderViewLayer(false)
94 , m_usingTiledCacheLayer(false) 94 , m_usingTiledCacheLayer(false)
95 , m_requiresOwnBackingStore(true)
96 #if ENABLE(CSS_FILTERS) 95 #if ENABLE(CSS_FILTERS)
97 , m_canCompositeFilters(false) 96 , m_canCompositeFilters(false)
98 #endif 97 #endif
99 { 98 {
100 if (renderer()->isRenderView()) { 99 if (renderer()->isRenderView()) {
101 Frame* frame = toRenderView(renderer())->frameView()->frame(); 100 Frame* frame = toRenderView(renderer())->frameView()->frame();
102 Page* page = frame ? frame->page() : 0; 101 Page* page = frame ? frame->page() : 0;
103 if (page && frame && page->mainFrame() == frame) { 102 if (page && frame && page->mainFrame() == frame) {
104 m_isMainFrameRenderViewLayer = true; 103 m_isMainFrameRenderViewLayer = true;
105 104
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 reflectionBacking->updateGraphicsLayerGeometry(); 558 reflectionBacking->updateGraphicsLayerGeometry();
560 559
561 // The reflection layer has the bounds of m_owningLayer->reflectionLayer (), 560 // The reflection layer has the bounds of m_owningLayer->reflectionLayer (),
562 // but the reflected layer is the bounds of this layer, so we need to po sition it appropriately. 561 // but the reflected layer is the bounds of this layer, so we need to po sition it appropriately.
563 FloatRect layerBounds = compositedBounds(); 562 FloatRect layerBounds = compositedBounds();
564 FloatRect reflectionLayerBounds = reflectionBacking->compositedBounds(); 563 FloatRect reflectionLayerBounds = reflectionBacking->compositedBounds();
565 reflectionBacking->graphicsLayer()->setReplicatedLayerPosition(FloatPoin t() + (layerBounds.location() - reflectionLayerBounds.location())); 564 reflectionBacking->graphicsLayer()->setReplicatedLayerPosition(FloatPoin t() + (layerBounds.location() - reflectionLayerBounds.location()));
566 } 565 }
567 566
568 m_graphicsLayer->setContentsRect(contentsBox()); 567 m_graphicsLayer->setContentsRect(contentsBox());
569
570 // If this layer was created just for clipping or to apply perspective, it d oesn't need its own backing store.
571 setRequiresOwnBackingStore(compositor()->requiresOwnBackingStore(m_owningLay er, compAncestor));
572
573 updateDrawsContent(); 568 updateDrawsContent();
574 updateAfterWidgetResize(); 569 updateAfterWidgetResize();
575 } 570 }
576 571
577 void RenderLayerBacking::updateInternalHierarchy() 572 void RenderLayerBacking::updateInternalHierarchy()
578 { 573 {
579 // m_foregroundLayer has to be inserted in the correct order with child laye rs, 574 // m_foregroundLayer has to be inserted in the correct order with child laye rs,
580 // so it's not inserted here. 575 // so it's not inserted here.
581 if (m_ancestorClippingLayer) { 576 if (m_ancestorClippingLayer) {
582 m_ancestorClippingLayer->removeAllChildren(); 577 m_ancestorClippingLayer->removeAllChildren();
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 return true; 937 return true;
943 } 938 }
944 } 939 }
945 } 940 }
946 941
947 return false; 942 return false;
948 } 943 }
949 944
950 bool RenderLayerBacking::containsPaintedContent() const 945 bool RenderLayerBacking::containsPaintedContent() const
951 { 946 {
952 if (isSimpleContainerCompositingLayer() || paintsIntoWindow() || paintsIntoC ompositedAncestor() || m_artificiallyInflatedBounds || m_owningLayer->isReflecti on()) 947 if (isSimpleContainerCompositingLayer() || paintsIntoWindow() || m_artificia llyInflatedBounds || m_owningLayer->isReflection())
953 return false; 948 return false;
954 949
955 if (isDirectlyCompositedImage()) 950 if (isDirectlyCompositedImage())
956 return false; 951 return false;
957 952
958 // FIXME: we could optimize cases where the image, video or canvas is known to fill the border box entirely, 953 // FIXME: we could optimize cases where the image, video or canvas is known to fill the border box entirely,
959 // and set background color on the layer in that case, instead of allocating backing store and painting. 954 // and set background color on the layer in that case, instead of allocating backing store and painting.
960 #if ENABLE(VIDEO) 955 #if ENABLE(VIDEO)
961 if (renderer()->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo() ) 956 if (renderer()->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo() )
962 return hasBoxDecorationsOrBackground(renderer()); 957 return hasBoxDecorationsOrBackground(renderer());
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 #endif 1095 #endif
1101 1096
1102 return compositor()->rootLayerAttachment() != RenderLayerCompositor::Roo tLayerAttachedViaEnclosingFrame; 1097 return compositor()->rootLayerAttachment() != RenderLayerCompositor::Roo tLayerAttachedViaEnclosingFrame;
1103 } 1098 }
1104 1099
1105 return false; 1100 return false;
1106 } 1101 }
1107 1102
1108 void RenderLayerBacking::setContentsNeedDisplay() 1103 void RenderLayerBacking::setContentsNeedDisplay()
1109 { 1104 {
1110 ASSERT(!paintsIntoCompositedAncestor());
1111
1112 if (m_graphicsLayer && m_graphicsLayer->drawsContent()) 1105 if (m_graphicsLayer && m_graphicsLayer->drawsContent())
1113 m_graphicsLayer->setNeedsDisplay(); 1106 m_graphicsLayer->setNeedsDisplay();
1114 1107
1115 if (m_foregroundLayer && m_foregroundLayer->drawsContent()) 1108 if (m_foregroundLayer && m_foregroundLayer->drawsContent())
1116 m_foregroundLayer->setNeedsDisplay(); 1109 m_foregroundLayer->setNeedsDisplay();
1117 1110
1118 if (m_maskLayer && m_maskLayer->drawsContent()) 1111 if (m_maskLayer && m_maskLayer->drawsContent())
1119 m_maskLayer->setNeedsDisplay(); 1112 m_maskLayer->setNeedsDisplay();
1120 } 1113 }
1121 1114
1122 // r is in the coordinate space of the layer's render object 1115 // r is in the coordinate space of the layer's render object
1123 void RenderLayerBacking::setContentsNeedDisplayInRect(const IntRect& r) 1116 void RenderLayerBacking::setContentsNeedDisplayInRect(const IntRect& r)
1124 { 1117 {
1125 ASSERT(!paintsIntoCompositedAncestor());
1126
1127 if (m_graphicsLayer && m_graphicsLayer->drawsContent()) { 1118 if (m_graphicsLayer && m_graphicsLayer->drawsContent()) {
1128 IntRect layerDirtyRect = r; 1119 IntRect layerDirtyRect = r;
1129 layerDirtyRect.move(-m_graphicsLayer->offsetFromRenderer()); 1120 layerDirtyRect.move(-m_graphicsLayer->offsetFromRenderer());
1130 m_graphicsLayer->setNeedsDisplayInRect(layerDirtyRect); 1121 m_graphicsLayer->setNeedsDisplayInRect(layerDirtyRect);
1131 } 1122 }
1132 1123
1133 if (m_foregroundLayer && m_foregroundLayer->drawsContent()) { 1124 if (m_foregroundLayer && m_foregroundLayer->drawsContent()) {
1134 IntRect layerDirtyRect = r; 1125 IntRect layerDirtyRect = r;
1135 layerDirtyRect.move(-m_foregroundLayer->offsetFromRenderer()); 1126 layerDirtyRect.move(-m_foregroundLayer->offsetFromRenderer());
1136 m_foregroundLayer->setNeedsDisplayInRect(layerDirtyRect); 1127 m_foregroundLayer->setNeedsDisplayInRect(layerDirtyRect);
1137 } 1128 }
1138 1129
1139 if (m_maskLayer && m_maskLayer->drawsContent()) { 1130 if (m_maskLayer && m_maskLayer->drawsContent()) {
1140 IntRect layerDirtyRect = r; 1131 IntRect layerDirtyRect = r;
1141 layerDirtyRect.move(-m_maskLayer->offsetFromRenderer()); 1132 layerDirtyRect.move(-m_maskLayer->offsetFromRenderer());
1142 m_maskLayer->setNeedsDisplayInRect(layerDirtyRect); 1133 m_maskLayer->setNeedsDisplayInRect(layerDirtyRect);
1143 } 1134 }
1144 } 1135 }
1145 1136
1146 void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* context, 1137 void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* context,
1147 const IntRect& paintDirtyRect, // In the coords of rootLayer . 1138 const IntRect& paintDirtyRect, // In the coords of rootLayer .
1148 PaintBehavior paintBehavior, GraphicsLayerPaintingPhase pain tingPhase, 1139 PaintBehavior paintBehavior, GraphicsLayerPaintingPhase pain tingPhase,
1149 RenderObject* paintingRoot) 1140 RenderObject* paintingRoot)
1150 { 1141 {
1151 if (paintsIntoWindow() || paintsIntoCompositedAncestor()) { 1142 if (paintsIntoWindow()) {
1152 ASSERT_NOT_REACHED(); 1143 ASSERT_NOT_REACHED();
1153 return; 1144 return;
1154 } 1145 }
1155 1146
1156 FontCachePurgePreventer fontCachePurgePreventer; 1147 FontCachePurgePreventer fontCachePurgePreventer;
1157 1148
1158 RenderLayer::PaintLayerFlags paintFlags = 0; 1149 RenderLayer::PaintLayerFlags paintFlags = 0;
1159 if (paintingPhase & GraphicsLayerPaintBackground) 1150 if (paintingPhase & GraphicsLayerPaintBackground)
1160 paintFlags |= RenderLayer::PaintLayerPaintingCompositingBackgroundPhase; 1151 paintFlags |= RenderLayer::PaintLayerPaintingCompositingBackgroundPhase;
1161 if (paintingPhase & GraphicsLayerPaintForeground) 1152 if (paintingPhase & GraphicsLayerPaintForeground)
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 if (m_layerForScrollCorner) 1540 if (m_layerForScrollCorner)
1550 backingArea += m_layerForScrollCorner->backingStoreArea(); 1541 backingArea += m_layerForScrollCorner->backingStoreArea();
1551 1542
1552 return backingArea; 1543 return backingArea;
1553 } 1544 }
1554 1545
1555 } // namespace WebCore 1546 } // namespace WebCore
1556 1547
1557 #endif // USE(ACCELERATED_COMPOSITING) 1548 #endif // USE(ACCELERATED_COMPOSITING)
1558 1549
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
This is Rietveld 408576698