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

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

Issue 13818029: Remove TiledBacking / TileCache code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased 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 | Annotate | Revision Log
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "RenderApplet.h" 46 #include "RenderApplet.h"
47 #include "RenderIFrame.h" 47 #include "RenderIFrame.h"
48 #include "RenderImage.h" 48 #include "RenderImage.h"
49 #include "RenderLayerCompositor.h" 49 #include "RenderLayerCompositor.h"
50 #include "RenderEmbeddedObject.h" 50 #include "RenderEmbeddedObject.h"
51 #include "RenderVideo.h" 51 #include "RenderVideo.h"
52 #include "RenderView.h" 52 #include "RenderView.h"
53 #include "ScrollingCoordinator.h" 53 #include "ScrollingCoordinator.h"
54 #include "Settings.h" 54 #include "Settings.h"
55 #include "StyleResolver.h" 55 #include "StyleResolver.h"
56 #include "TiledBacking.h"
57 #include "WebCoreMemoryInstrumentation.h" 56 #include "WebCoreMemoryInstrumentation.h"
58 #include <wtf/CurrentTime.h> 57 #include <wtf/CurrentTime.h>
59 #include <wtf/text/StringBuilder.h> 58 #include <wtf/text/StringBuilder.h>
60 59
61 #if ENABLE(CSS_FILTERS) 60 #if ENABLE(CSS_FILTERS)
62 #include "FilterEffectRenderer.h" 61 #include "FilterEffectRenderer.h"
63 #include "CustomFilterOperation.h" 62 #include "CustomFilterOperation.h"
64 #endif 63 #endif
65 64
66 #include "GraphicsContext3D.h" 65 #include "GraphicsContext3D.h"
(...skipping 25 matching lines...) Expand all
92 return 0; 91 return 0;
93 92
94 return page->scrollingCoordinator(); 93 return page->scrollingCoordinator();
95 } 94 }
96 95
97 RenderLayerBacking::RenderLayerBacking(RenderLayer* layer) 96 RenderLayerBacking::RenderLayerBacking(RenderLayer* layer)
98 : m_owningLayer(layer) 97 : m_owningLayer(layer)
99 , m_artificiallyInflatedBounds(false) 98 , m_artificiallyInflatedBounds(false)
100 , m_boundsConstrainedByClipping(false) 99 , m_boundsConstrainedByClipping(false)
101 , m_isMainFrameRenderViewLayer(false) 100 , m_isMainFrameRenderViewLayer(false)
102 , m_usingTiledCacheLayer(false)
103 , m_requiresOwnBackingStore(true) 101 , m_requiresOwnBackingStore(true)
104 #if ENABLE(CSS_FILTERS) 102 #if ENABLE(CSS_FILTERS)
105 , m_canCompositeFilters(false) 103 , m_canCompositeFilters(false)
106 #endif 104 #endif
107 , m_backgroundLayerPaintsFixedRootBackground(false) 105 , m_backgroundLayerPaintsFixedRootBackground(false)
108 { 106 {
109 if (layer->isRootLayer()) { 107 if (layer->isRootLayer()) {
110 Frame* frame = toRenderView(renderer())->frameView()->frame(); 108 Frame* frame = toRenderView(renderer())->frameView()->frame();
111 Page* page = frame ? frame->page() : 0; 109 Page* page = frame ? frame->page() : 0;
112 if (page && frame && page->mainFrame() == frame) { 110 if (page && frame && page->mainFrame() == frame) {
113 m_isMainFrameRenderViewLayer = true; 111 m_isMainFrameRenderViewLayer = true;
114
115 #if PLATFORM(MAC)
116 // FIXME: It's a little weird that we base this decision on whether there's a scrolling coordinator or not.
117 if (page->scrollingCoordinator())
118 m_usingTiledCacheLayer = true;
119 #endif
120 } 112 }
121 } 113 }
122 114
123 createPrimaryGraphicsLayer(); 115 createPrimaryGraphicsLayer();
124 } 116 }
125 117
126 RenderLayerBacking::~RenderLayerBacking() 118 RenderLayerBacking::~RenderLayerBacking()
127 { 119 {
128 updateClippingLayers(false, false); 120 updateClippingLayers(false, false);
129 updateOverflowControlsLayers(false, false, false); 121 updateOverflowControlsLayers(false, false, false);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 190
199 void RenderLayerBacking::createPrimaryGraphicsLayer() 191 void RenderLayerBacking::createPrimaryGraphicsLayer()
200 { 192 {
201 String layerName; 193 String layerName;
202 #ifndef NDEBUG 194 #ifndef NDEBUG
203 layerName = m_owningLayer->name(); 195 layerName = m_owningLayer->name();
204 #endif 196 #endif
205 197
206 m_graphicsLayer = createGraphicsLayer(layerName); 198 m_graphicsLayer = createGraphicsLayer(layerName);
207 199
208 if (m_usingTiledCacheLayer)
209 m_childContainmentLayer = createGraphicsLayer("TiledBacking Flattening L ayer");
210
211 if (m_isMainFrameRenderViewLayer) { 200 if (m_isMainFrameRenderViewLayer) {
212 m_graphicsLayer->setContentsOpaque(true); 201 m_graphicsLayer->setContentsOpaque(true);
213 m_graphicsLayer->setAppliesPageScale(); 202 m_graphicsLayer->setAppliesPageScale();
214 } 203 }
215 204
216 updateOpacity(renderer()->style()); 205 updateOpacity(renderer()->style());
217 updateTransform(renderer()->style()); 206 updateTransform(renderer()->style());
218 #if ENABLE(CSS_FILTERS) 207 #if ENABLE(CSS_FILTERS)
219 updateFilters(renderer()->style()); 208 updateFilters(renderer()->style());
220 #endif 209 #endif
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 294
306 return false; 295 return false;
307 } 296 }
308 297
309 bool RenderLayerBacking::shouldClipCompositedBounds() const 298 bool RenderLayerBacking::shouldClipCompositedBounds() const
310 { 299 {
311 // Scrollbar layers use this layer for relative positioning, so don't clip. 300 // Scrollbar layers use this layer for relative positioning, so don't clip.
312 if (layerForHorizontalScrollbar() || layerForVerticalScrollbar()) 301 if (layerForHorizontalScrollbar() || layerForVerticalScrollbar())
313 return false; 302 return false;
314 303
315 if (m_usingTiledCacheLayer)
316 return false;
317
318 if (!compositor()->compositingConsultsOverlap()) 304 if (!compositor()->compositingConsultsOverlap())
319 return false; 305 return false;
320 306
321 if (layerOrAncestorIsTransformedOrUsingCompositedScrolling(m_owningLayer)) 307 if (layerOrAncestorIsTransformedOrUsingCompositedScrolling(m_owningLayer))
322 return false; 308 return false;
323 309
324 return true; 310 return true;
325 } 311 }
326 312
327 void RenderLayerBacking::updateCompositedBounds() 313 void RenderLayerBacking::updateCompositedBounds()
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 418
433 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require sVerticalScrollbarLayer(), requiresScrollCornerLayer())) 419 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require sVerticalScrollbarLayer(), requiresScrollCornerLayer()))
434 layerConfigChanged = true; 420 layerConfigChanged = true;
435 421
436 if (updateScrollingLayers(m_owningLayer->needsCompositedScrolling())) 422 if (updateScrollingLayers(m_owningLayer->needsCompositedScrolling()))
437 layerConfigChanged = true; 423 layerConfigChanged = true;
438 424
439 if (layerConfigChanged) 425 if (layerConfigChanged)
440 updateInternalHierarchy(); 426 updateInternalHierarchy();
441 427
442 if (GraphicsLayer* flatteningLayer = tileCacheFlatteningLayer()) {
443 flatteningLayer->removeFromParent();
444 m_graphicsLayer->addChild(flatteningLayer);
445 }
446
447 if (updateMaskLayer(renderer->hasMask())) 428 if (updateMaskLayer(renderer->hasMask()))
448 m_graphicsLayer->setMaskLayer(m_maskLayer.get()); 429 m_graphicsLayer->setMaskLayer(m_maskLayer.get());
449 430
450 if (m_owningLayer->hasReflection()) { 431 if (m_owningLayer->hasReflection()) {
451 if (m_owningLayer->reflectionLayer()->backing()) { 432 if (m_owningLayer->reflectionLayer()->backing()) {
452 GraphicsLayer* reflectionLayer = m_owningLayer->reflectionLayer()->b acking()->graphicsLayer(); 433 GraphicsLayer* reflectionLayer = m_owningLayer->reflectionLayer()->b acking()->graphicsLayer();
453 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); 434 m_graphicsLayer->setReplicatedByLayer(reflectionLayer);
454 } 435 }
455 } else 436 } else
456 m_graphicsLayer->setReplicatedByLayer(0); 437 m_graphicsLayer->setReplicatedByLayer(0);
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 m_ancestorClippingLayer->setMasksToBounds(true); 863 m_ancestorClippingLayer->setMasksToBounds(true);
883 layersChanged = true; 864 layersChanged = true;
884 } 865 }
885 } else if (m_ancestorClippingLayer) { 866 } else if (m_ancestorClippingLayer) {
886 m_ancestorClippingLayer->removeFromParent(); 867 m_ancestorClippingLayer->removeFromParent();
887 m_ancestorClippingLayer = nullptr; 868 m_ancestorClippingLayer = nullptr;
888 layersChanged = true; 869 layersChanged = true;
889 } 870 }
890 871
891 if (needsDescendantClip) { 872 if (needsDescendantClip) {
892 if (!m_childContainmentLayer && !m_usingTiledCacheLayer) { 873 if (!m_childContainmentLayer) {
893 m_childContainmentLayer = createGraphicsLayer("Child clipping Layer" ); 874 m_childContainmentLayer = createGraphicsLayer("Child clipping Layer" );
894 m_childContainmentLayer->setMasksToBounds(true); 875 m_childContainmentLayer->setMasksToBounds(true);
895 layersChanged = true; 876 layersChanged = true;
896 } 877 }
897 } else if (hasClippingLayer()) { 878 } else if (hasClippingLayer()) {
898 m_childContainmentLayer->removeFromParent(); 879 m_childContainmentLayer->removeFromParent();
899 m_childContainmentLayer = nullptr; 880 m_childContainmentLayer = nullptr;
900 layersChanged = true; 881 layersChanged = true;
901 } 882 }
902 883
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 Color backgroundColor; 1181 Color backgroundColor;
1201 if (isSimpleContainer) 1182 if (isSimpleContainer)
1202 backgroundColor = rendererBackgroundColor(); 1183 backgroundColor = rendererBackgroundColor();
1203 1184
1204 // An unset (invalid) color will remove the solid color. 1185 // An unset (invalid) color will remove the solid color.
1205 m_graphicsLayer->setContentsToSolidColor(backgroundColor); 1186 m_graphicsLayer->setContentsToSolidColor(backgroundColor);
1206 } 1187 }
1207 1188
1208 void RenderLayerBacking::updateRootLayerConfiguration() 1189 void RenderLayerBacking::updateRootLayerConfiguration()
1209 { 1190 {
1210 if (!m_usingTiledCacheLayer)
1211 return;
1212
1213 Color backgroundColor;
1214 bool viewIsTransparent = compositor()->viewHasTransparentBackground(&backgro undColor);
1215
1216 if (m_backgroundLayerPaintsFixedRootBackground && m_backgroundLayer) {
1217 m_backgroundLayer->setBackgroundColor(backgroundColor);
1218 m_backgroundLayer->setContentsOpaque(!viewIsTransparent);
1219
1220 m_graphicsLayer->setBackgroundColor(Color());
1221 m_graphicsLayer->setContentsOpaque(false);
1222 } else {
1223 m_graphicsLayer->setBackgroundColor(backgroundColor);
1224 m_graphicsLayer->setContentsOpaque(!viewIsTransparent);
1225 }
1226 } 1191 }
1227 1192
1228 static bool supportsDirectBoxDecorationsComposition(const RenderObject* renderer ) 1193 static bool supportsDirectBoxDecorationsComposition(const RenderObject* renderer )
1229 { 1194 {
1230 if (!GraphicsLayer::supportsBackgroundColorContent()) 1195 if (!GraphicsLayer::supportsBackgroundColorContent())
1231 return false; 1196 return false;
1232 1197
1233 if (renderer->hasClip()) 1198 if (renderer->hasClip())
1234 return false; 1199 return false;
1235 1200
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 return m_ancestorClippingLayer.get(); 1524 return m_ancestorClippingLayer.get();
1560 1525
1561 if (m_contentsContainmentLayer) 1526 if (m_contentsContainmentLayer)
1562 return m_contentsContainmentLayer.get(); 1527 return m_contentsContainmentLayer.get();
1563 1528
1564 return m_graphicsLayer.get(); 1529 return m_graphicsLayer.get();
1565 } 1530 }
1566 1531
1567 bool RenderLayerBacking::paintsIntoWindow() const 1532 bool RenderLayerBacking::paintsIntoWindow() const
1568 { 1533 {
1569 if (m_usingTiledCacheLayer)
1570 return false;
1571
1572 if (m_owningLayer->isRootLayer()) { 1534 if (m_owningLayer->isRootLayer()) {
1573 return compositor()->rootLayerAttachment() != RenderLayerCompositor::Roo tLayerAttachedViaEnclosingFrame; 1535 return compositor()->rootLayerAttachment() != RenderLayerCompositor::Roo tLayerAttachedViaEnclosingFrame;
1574 } 1536 }
1575 1537
1576 return false; 1538 return false;
1577 } 1539 }
1578 1540
1579 void RenderLayerBacking::setRequiresOwnBackingStore(bool requiresOwnBacking) 1541 void RenderLayerBacking::setRequiresOwnBackingStore(bool requiresOwnBacking)
1580 { 1542 {
1581 if (requiresOwnBacking == m_requiresOwnBackingStore) 1543 if (requiresOwnBacking == m_requiresOwnBackingStore)
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 InspectorInstrumentation::willPaint(renderer()); 1684 InspectorInstrumentation::willPaint(renderer());
1723 1685
1724 // The dirtyRect is in the coords of the painting root. 1686 // The dirtyRect is in the coords of the painting root.
1725 IntRect dirtyRect = clip; 1687 IntRect dirtyRect = clip;
1726 if (!(paintingPhase & GraphicsLayerPaintOverflowContents)) 1688 if (!(paintingPhase & GraphicsLayerPaintOverflowContents))
1727 dirtyRect.intersect(compositedBounds()); 1689 dirtyRect.intersect(compositedBounds());
1728 1690
1729 // We have to use the same root as for hit testing, because both methods can compute and cache clipRects. 1691 // We have to use the same root as for hit testing, because both methods can compute and cache clipRects.
1730 paintIntoLayer(graphicsLayer, &context, dirtyRect, PaintBehaviorNormal, paintingPhase); 1692 paintIntoLayer(graphicsLayer, &context, dirtyRect, PaintBehaviorNormal, paintingPhase);
1731 1693
1732 if (m_usingTiledCacheLayer)
1733 renderer()->frame()->view()->setLastPaintTime(currentTime());
1734
1735 InspectorInstrumentation::didPaint(renderer(), &context, clip); 1694 InspectorInstrumentation::didPaint(renderer(), &context, clip);
1736 } else if (graphicsLayer == layerForHorizontalScrollbar()) { 1695 } else if (graphicsLayer == layerForHorizontalScrollbar()) {
1737 paintScrollbar(m_owningLayer->horizontalScrollbar(), context, clip); 1696 paintScrollbar(m_owningLayer->horizontalScrollbar(), context, clip);
1738 } else if (graphicsLayer == layerForVerticalScrollbar()) { 1697 } else if (graphicsLayer == layerForVerticalScrollbar()) {
1739 paintScrollbar(m_owningLayer->verticalScrollbar(), context, clip); 1698 paintScrollbar(m_owningLayer->verticalScrollbar(), context, clip);
1740 } else if (graphicsLayer == layerForScrollCorner()) { 1699 } else if (graphicsLayer == layerForScrollCorner()) {
1741 const IntRect& scrollCornerAndResizer = m_owningLayer->scrollCornerAndRe sizerRect(); 1700 const IntRect& scrollCornerAndResizer = m_owningLayer->scrollCornerAndRe sizerRect();
1742 context.save(); 1701 context.save();
1743 context.translate(-scrollCornerAndResizer.x(), -scrollCornerAndResizer.y ()); 1702 context.translate(-scrollCornerAndResizer.x(), -scrollCornerAndResizer.y ());
1744 IntRect transformedClip = clip; 1703 IntRect transformedClip = clip;
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 info.addMember(m_childContainmentLayer, "childContainmentLayer"); 2029 info.addMember(m_childContainmentLayer, "childContainmentLayer");
2071 info.addMember(m_maskLayer, "maskLayer"); 2030 info.addMember(m_maskLayer, "maskLayer");
2072 info.addMember(m_layerForHorizontalScrollbar, "layerForHorizontalScrollbar") ; 2031 info.addMember(m_layerForHorizontalScrollbar, "layerForHorizontalScrollbar") ;
2073 info.addMember(m_layerForVerticalScrollbar, "layerForVerticalScrollbar"); 2032 info.addMember(m_layerForVerticalScrollbar, "layerForVerticalScrollbar");
2074 info.addMember(m_layerForScrollCorner, "layerForScrollCorner"); 2033 info.addMember(m_layerForScrollCorner, "layerForScrollCorner");
2075 info.addMember(m_scrollingLayer, "scrollingLayer"); 2034 info.addMember(m_scrollingLayer, "scrollingLayer");
2076 info.addMember(m_scrollingContentsLayer, "scrollingContentsLayer"); 2035 info.addMember(m_scrollingContentsLayer, "scrollingContentsLayer");
2077 } 2036 }
2078 2037
2079 } // namespace WebCore 2038 } // namespace WebCore
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