- Revision
- 113335
- Author
- [email protected]
- Date
- 2012-04-05 10:44:13 -0700 (Thu, 05 Apr 2012)
Log Message
Add assertions to check for mutation of RenderLayer z-order lists during enumeration
https://bugs.webkit.org/show_bug.cgi?id=83242
Reviewed by James Robinson.
Add debug-only code that detects whether RenderLayer's z-order and
normal flow lists are being cleared or otherwise mutated while we're
enumerating over them.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):
(WebCore::RenderLayer::paintList):
(WebCore::RenderLayer::calculateLayerBounds):
(WebCore::RenderLayer::dirtyZOrderLists):
(WebCore::RenderLayer::dirtyNormalFlowList):
(WebCore::RenderLayer::updateZOrderListsSlowCase):
(WebCore::RenderLayer::updateNormalFlowList):
* rendering/RenderLayer.h:
(RenderLayer):
(WebCore::RenderLayer::layerListMutationAllowed):
(WebCore::RenderLayer::setLayerListMutationAllowed):
(WebCore):
(LayerListMutationDetector):
(WebCore::LayerListMutationDetector::LayerListMutationDetector):
(WebCore::LayerListMutationDetector::~LayerListMutationDetector):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::hasVisibleNonCompositingDescendantLayers):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::addToOverlapMapRecursive):
(WebCore::RenderLayerCompositor::computeCompositingRequirements):
(WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
(WebCore::RenderLayerCompositor::updateLayerTreeGeometry):
(WebCore::RenderLayerCompositor::updateCompositingDescendantGeometry):
(WebCore::RenderLayerCompositor::recursiveRepaintLayerRect):
(WebCore::RenderLayerCompositor::layerHas3DContent):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (113334 => 113335)
--- trunk/Source/WebCore/ChangeLog 2012-04-05 17:27:16 UTC (rev 113334)
+++ trunk/Source/WebCore/ChangeLog 2012-04-05 17:44:13 UTC (rev 113335)
@@ -1,3 +1,41 @@
+2012-04-04 Simon Fraser <[email protected]>
+
+ Add assertions to check for mutation of RenderLayer z-order lists during enumeration
+ https://bugs.webkit.org/show_bug.cgi?id=83242
+
+ Reviewed by James Robinson.
+
+ Add debug-only code that detects whether RenderLayer's z-order and
+ normal flow lists are being cleared or otherwise mutated while we're
+ enumerating over them.
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::RenderLayer):
+ (WebCore::RenderLayer::paintList):
+ (WebCore::RenderLayer::calculateLayerBounds):
+ (WebCore::RenderLayer::dirtyZOrderLists):
+ (WebCore::RenderLayer::dirtyNormalFlowList):
+ (WebCore::RenderLayer::updateZOrderListsSlowCase):
+ (WebCore::RenderLayer::updateNormalFlowList):
+ * rendering/RenderLayer.h:
+ (RenderLayer):
+ (WebCore::RenderLayer::layerListMutationAllowed):
+ (WebCore::RenderLayer::setLayerListMutationAllowed):
+ (WebCore):
+ (LayerListMutationDetector):
+ (WebCore::LayerListMutationDetector::LayerListMutationDetector):
+ (WebCore::LayerListMutationDetector::~LayerListMutationDetector):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::hasVisibleNonCompositingDescendantLayers):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::addToOverlapMapRecursive):
+ (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+ (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
+ (WebCore::RenderLayerCompositor::updateLayerTreeGeometry):
+ (WebCore::RenderLayerCompositor::updateCompositingDescendantGeometry):
+ (WebCore::RenderLayerCompositor::recursiveRepaintLayerRect):
+ (WebCore::RenderLayerCompositor::layerHas3DContent):
+
2012-04-05 Sheriff Bot <[email protected]>
Unreviewed, rolling out r113254.
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (113334 => 113335)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-04-05 17:27:16 UTC (rev 113334)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-04-05 17:44:13 UTC (rev 113335)
@@ -165,6 +165,9 @@
, m_mustOverlapCompositedLayers(false)
#endif
, m_containsDirtyOverlayScrollbars(false)
+#if !ASSERT_DISABLED
+ , m_layerListMutationAllowed(true)
+#endif
, m_canSkipRepaintRectsUpdateOnScroll(renderer->isTableCell())
, m_renderer(renderer)
, m_parent(0)
@@ -3132,7 +3135,11 @@
{
if (!list)
return;
-
+
+#if !ASSERT_DISABLED
+ LayerListMutationDetector mutationChecker(this);
+#endif
+
for (size_t i = 0; i < list->size(); ++i) {
RenderLayer* childLayer = list->at(i);
if (!childLayer->isPaginated())
@@ -4122,6 +4129,10 @@
ASSERT(layer->isStackingContext() || (!layer->m_posZOrderList || !layer->m_posZOrderList->size()));
+#if !ASSERT_DISABLED
+ LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(layer));
+#endif
+
if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
size_t listSize = negZOrderList->size();
for (size_t i = 0; i < listSize; ++i) {
@@ -4404,6 +4415,8 @@
void RenderLayer::dirtyZOrderLists()
{
+ ASSERT(m_layerListMutationAllowed);
+
if (m_posZOrderList)
m_posZOrderList->clear();
if (m_negZOrderList)
@@ -4425,6 +4438,8 @@
void RenderLayer::dirtyNormalFlowList()
{
+ ASSERT(m_layerListMutationAllowed);
+
if (m_normalFlowList)
m_normalFlowList->clear();
m_normalFlowListDirty = true;
@@ -4437,6 +4452,8 @@
void RenderLayer::updateZOrderListsSlowCase()
{
+ ASSERT(m_layerListMutationAllowed);
+
#if USE(ACCELERATED_COMPOSITING)
bool includeHiddenLayers = compositor()->inCompositingMode();
#else
@@ -4460,7 +4477,9 @@
{
if (!m_normalFlowListDirty)
return;
-
+
+ ASSERT(m_layerListMutationAllowed);
+
for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) {
// Ignore non-overflow layers and reflections.
if (child->isNormalFlowOnly() && (!m_reflection || reflectionLayer() != child)) {
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (113334 => 113335)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2012-04-05 17:27:16 UTC (rev 113334)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2012-04-05 17:44:13 UTC (rev 113335)
@@ -576,6 +576,11 @@
FilterEffectRenderer* filter() const { return m_filter.get(); }
#endif
+#if !ASSERT_DISABLED
+ bool layerListMutationAllowed() const { return m_layerListMutationAllowed; }
+ void setLayerListMutationAllowed(bool flag) { m_layerListMutationAllowed = flag; }
+#endif
+
private:
void updateZOrderListsSlowCase();
@@ -807,7 +812,9 @@
#endif
bool m_containsDirtyOverlayScrollbars : 1;
-
+#if !ASSERT_DISABLED
+ bool m_layerListMutationAllowed : 1;
+#endif
// This is an optimization added for <table>.
// Currently cells do not need to update their repaint rectangles when scrolling. This also
// saves a lot of time when scrolling on a table.
@@ -898,6 +905,28 @@
updateZOrderListsSlowCase();
}
+#if !ASSERT_DISABLED
+class LayerListMutationDetector {
+public:
+ LayerListMutationDetector(RenderLayer* layer)
+ : m_layer(layer)
+ , m_previousMutationAllowedState(layer->layerListMutationAllowed())
+ {
+ m_layer->setLayerListMutationAllowed(false);
+ }
+
+ ~LayerListMutationDetector()
+ {
+ m_layer->setLayerListMutationAllowed(m_previousMutationAllowedState);
+ }
+
+private:
+ RenderLayer* m_layer;
+ bool m_previousMutationAllowedState;
+};
+#endif
+
+
} // namespace WebCore
#ifndef NDEBUG
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (113334 => 113335)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2012-04-05 17:27:16 UTC (rev 113334)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2012-04-05 17:44:13 UTC (rev 113335)
@@ -895,6 +895,10 @@
// Conservative test for having no rendered children.
bool RenderLayerBacking::hasVisibleNonCompositingDescendantLayers() const
{
+#if !ASSERT_DISABLED
+ LayerListMutationDetector mutationChecker(m_owningLayer);
+#endif
+
if (Vector<RenderLayer*>* normalFlowList = m_owningLayer->normalFlowList()) {
size_t listSize = normalFlowList->size();
for (size_t i = 0; i < listSize; ++i) {
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (113334 => 113335)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-04-05 17:27:16 UTC (rev 113334)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-04-05 17:44:13 UTC (rev 113335)
@@ -584,6 +584,10 @@
bool haveComputedBounds = false;
addToOverlapMap(overlapMap, layer, bounds, haveComputedBounds);
+#if !ASSERT_DISABLED
+ LayerListMutationDetector mutationChecker(layer);
+#endif
+
if (layer->isStackingContext()) {
if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
size_t listSize = negZOrderList->size();
@@ -673,6 +677,10 @@
childState.m_subtreeIsCompositing = true;
#endif
+#if !ASSERT_DISABLED
+ LayerListMutationDetector mutationChecker(layer);
+#endif
+
if (layer->isStackingContext()) {
ASSERT(!layer->m_zOrderListsDirty);
if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
@@ -854,6 +862,10 @@
Vector<GraphicsLayer*> layerChildren;
Vector<GraphicsLayer*>& childList = layerBacking ? layerChildren : childLayersOfEnclosingLayer;
+#if !ASSERT_DISABLED
+ LayerListMutationDetector mutationChecker(layer);
+#endif
+
if (layer->isStackingContext()) {
ASSERT(!layer->m_zOrderListsDirty);
@@ -1028,6 +1040,10 @@
updateRootLayerPosition();
}
+#if !ASSERT_DISABLED
+ LayerListMutationDetector mutationChecker(layer);
+#endif
+
if (layer->isStackingContext()) {
ASSERT(!layer->m_zOrderListsDirty);
@@ -1077,6 +1093,10 @@
if (!layer->hasCompositingDescendant())
return;
+
+#if !ASSERT_DISABLED
+ LayerListMutationDetector mutationChecker(layer);
+#endif
if (layer->isStackingContext()) {
if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
@@ -1113,6 +1133,10 @@
if (layer->isComposited())
layer->setBackingNeedsRepaintInRect(rect);
+#if !ASSERT_DISABLED
+ LayerListMutationDetector mutationChecker(layer);
+#endif
+
if (layer->hasCompositingDescendant()) {
if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
size_t listSize = negZOrderList->size();
@@ -2055,6 +2079,10 @@
style->transform().has3DOperation()))
return true;
+#if !ASSERT_DISABLED
+ LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(layer));
+#endif
+
if (layer->isStackingContext()) {
if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
size_t listSize = negZOrderList->size();