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

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

Issue 8403008: Merge 98060 - Hidden composited iframes cause infinite loop (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/874/
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « Source/WebCore/rendering/RenderLayerCompositor.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 #ifndef NDEBUG 88 #ifndef NDEBUG
89 int m_depth; 89 int m_depth;
90 #endif 90 #endif
91 }; 91 };
92 92
93 RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView) 93 RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView)
94 : m_renderView(renderView) 94 : m_renderView(renderView)
95 , m_updateCompositingLayersTimer(this, &RenderLayerCompositor::updateComposi tingLayersTimerFired) 95 , m_updateCompositingLayersTimer(this, &RenderLayerCompositor::updateComposi tingLayersTimerFired)
96 , m_hasAcceleratedCompositing(true) 96 , m_hasAcceleratedCompositing(true)
97 , m_compositingTriggers(static_cast<ChromeClient::CompositingTriggerFlags>(C hromeClient::AllTriggers)) 97 , m_compositingTriggers(static_cast<ChromeClient::CompositingTriggerFlags>(C hromeClient::AllTriggers))
98 , m_compositedLayerCount(0)
98 , m_showDebugBorders(false) 99 , m_showDebugBorders(false)
99 , m_showRepaintCounter(false) 100 , m_showRepaintCounter(false)
100 , m_compositingConsultsOverlap(true) 101 , m_compositingConsultsOverlap(true)
101 , m_compositingDependsOnGeometry(false) 102 , m_compositingDependsOnGeometry(false)
102 , m_compositing(false) 103 , m_compositing(false)
103 , m_compositingLayersNeedRebuild(false) 104 , m_compositingLayersNeedRebuild(false)
104 , m_flushingLayers(false) 105 , m_flushingLayers(false)
105 , m_forceCompositingMode(false) 106 , m_forceCompositingMode(false)
106 , m_rootLayerAttachment(RootLayerUnattached) 107 , m_rootLayerAttachment(RootLayerUnattached)
107 #if PROFILE_LAYER_REBUILD 108 #if PROFILE_LAYER_REBUILD
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 { 235 {
235 if (!m_updateCompositingLayersTimer.isActive()) 236 if (!m_updateCompositingLayersTimer.isActive())
236 m_updateCompositingLayersTimer.startOneShot(0); 237 m_updateCompositingLayersTimer.startOneShot(0);
237 } 238 }
238 239
239 void RenderLayerCompositor::updateCompositingLayersTimerFired(Timer<RenderLayerC ompositor>*) 240 void RenderLayerCompositor::updateCompositingLayersTimerFired(Timer<RenderLayerC ompositor>*)
240 { 241 {
241 updateCompositingLayers(); 242 updateCompositingLayers();
242 } 243 }
243 244
245 bool RenderLayerCompositor::hasAnyAdditionalCompositedLayers(const RenderLayer* rootLayer) const
246 {
247 return m_compositedLayerCount > rootLayer->isComposited();
248 }
249
244 void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update Type, RenderLayer* updateRoot) 250 void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update Type, RenderLayer* updateRoot)
245 { 251 {
246 m_updateCompositingLayersTimer.stop(); 252 m_updateCompositingLayersTimer.stop();
247 253
248 if (m_forceCompositingMode && !m_compositing) 254 if (m_forceCompositingMode && !m_compositing)
249 enableCompositingMode(true); 255 enableCompositingMode(true);
250 256
251 if (!m_compositingDependsOnGeometry && !m_compositing) 257 if (!m_compositingDependsOnGeometry && !m_compositing)
252 return; 258 return;
253 259
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 304 }
299 305
300 if (needHierarchyUpdate) { 306 if (needHierarchyUpdate) {
301 // Update the hierarchy of the compositing layers. 307 // Update the hierarchy of the compositing layers.
302 CompositingState compState(updateRoot); 308 CompositingState compState(updateRoot);
303 Vector<GraphicsLayer*> childList; 309 Vector<GraphicsLayer*> childList;
304 rebuildCompositingLayerTree(updateRoot, compState, childList); 310 rebuildCompositingLayerTree(updateRoot, compState, childList);
305 311
306 // Host the document layer in the RenderView's root layer. 312 // Host the document layer in the RenderView's root layer.
307 if (updateRoot == rootRenderLayer()) { 313 if (updateRoot == rootRenderLayer()) {
308 if (childList.isEmpty()) 314 // Even when childList is empty, don't drop out of compositing mode if there are
315 // composited layers that we didn't hit in our traversal (e.g. becau se of visibility:hidden).
316 if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(updateR oot))
309 destroyRootLayer(); 317 destroyRootLayer();
310 else 318 else
311 m_rootContentLayer->setChildren(childList); 319 m_rootContentLayer->setChildren(childList);
312 } 320 }
313 } else if (needGeometryUpdate) { 321 } else if (needGeometryUpdate) {
314 // We just need to do a geometry update. This is only used for position: fixed scrolling; 322 // We just need to do a geometry update. This is only used for position: fixed scrolling;
315 // most of the time, geometry is updated via RenderLayer::styleChanged() . 323 // most of the time, geometry is updated via RenderLayer::styleChanged() .
316 updateLayerTreeGeometry(updateRoot); 324 updateLayerTreeGeometry(updateRoot);
317 } 325 }
318 326
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 771
764 // setHasCompositingDescendant() may have changed the answer to needsToBeCom posited() when clipping, 772 // setHasCompositingDescendant() may have changed the answer to needsToBeCom posited() when clipping,
765 // so test that again. 773 // so test that again.
766 if (!willBeComposited && canBeComposited(layer) && clipsCompositingDescendan ts(layer)) { 774 if (!willBeComposited && canBeComposited(layer) && clipsCompositingDescendan ts(layer)) {
767 if (overlapMap) 775 if (overlapMap)
768 addToOverlapMapRecursive(*overlapMap, layer); 776 addToOverlapMapRecursive(*overlapMap, layer);
769 willBeComposited = true; 777 willBeComposited = true;
770 } 778 }
771 779
772 // If we're back at the root, and no other layers need to be composited, and the root layer itself doesn't need 780 // If we're back at the root, and no other layers need to be composited, and the root layer itself doesn't need
773 // to be composited, then we can drop out of compositing mode altogether. 781 // to be composited, then we can drop out of compositing mode altogether. Ho wever, don't drop out of compositing mode
774 if (layer->isRootLayer() && !childState.m_subtreeIsCompositing && !requiresC ompositingLayer(layer) && !m_forceCompositingMode) { 782 // if there are composited layers that we didn't hit in our traversal (e.g. because of visibility:hidden).
783 if (layer->isRootLayer() && !childState.m_subtreeIsCompositing && !requiresC ompositingLayer(layer) && !m_forceCompositingMode && !hasAnyAdditionalComposited Layers(layer)) {
775 enableCompositingMode(false); 784 enableCompositingMode(false);
776 willBeComposited = false; 785 willBeComposited = false;
777 } 786 }
778 787
779 // If the layer is going into compositing mode, repaint its old location. 788 // If the layer is going into compositing mode, repaint its old location.
780 ASSERT(willBeComposited == needsToBeComposited(layer)); 789 ASSERT(willBeComposited == needsToBeComposited(layer));
781 if (!layer->isComposited() && willBeComposited) 790 if (!layer->isComposited() && willBeComposited)
782 repaintOnCompositingChange(layer); 791 repaintOnCompositingChange(layer);
783 792
784 // Update backing now, so that we can use isComposited() reliably during tre e traversal in rebuildCompositingLayerTree(). 793 // Update backing now, so that we can use isComposited() reliably during tre e traversal in rebuildCompositingLayerTree().
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 if (!viewLayer->isComposited()) 1911 if (!viewLayer->isComposited())
1903 return; 1912 return;
1904 1913
1905 if (GraphicsLayer* rootLayer = viewLayer->backing()->graphicsLayer()) 1914 if (GraphicsLayer* rootLayer = viewLayer->backing()->graphicsLayer())
1906 rootLayer->noteDeviceOrPageScaleFactorChangedIncludingDescendants(); 1915 rootLayer->noteDeviceOrPageScaleFactorChangedIncludingDescendants();
1907 } 1916 }
1908 1917
1909 } // namespace WebCore 1918 } // namespace WebCore
1910 1919
1911 #endif // USE(ACCELERATED_COMPOSITING) 1920 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/RenderLayerCompositor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698