diff --git a/gfx/layers/basic/BasicLayers.cpp b/gfx/layers/basic/BasicLayers.cpp index acc82ca82359..19730dd0a57b 100644 --- a/gfx/layers/basic/BasicLayers.cpp +++ b/gfx/layers/basic/BasicLayers.cpp @@ -423,7 +423,11 @@ protected: } aCallback(this, aContext, aRegionToDraw, aRegionToInvalidate, aCallbackData); - mValidRegion.Or(mValidRegion, aRegionToDraw); + // Everything that's visible has been validated. Do this instead of + // OR-ing with aRegionToDraw, since that can lead to a very complex region + // here (OR doesn't automatically simplify to the simplest possible + // representation of a region.) + mValidRegion.Or(mValidRegion, mVisibleRegion); } Buffer mBuffer; diff --git a/gfx/layers/opengl/ThebesLayerOGL.cpp b/gfx/layers/opengl/ThebesLayerOGL.cpp index de812d79114d..c4757bff8989 100644 --- a/gfx/layers/opengl/ThebesLayerOGL.cpp +++ b/gfx/layers/opengl/ThebesLayerOGL.cpp @@ -555,7 +555,11 @@ ThebesLayerOGL::RenderLayer(int aPreviousFrameBuffer, void* callbackData = mOGLManager->GetThebesLayerCallbackData(); callback(this, state.mContext, state.mRegionToDraw, state.mRegionToInvalidate, callbackData); - mValidRegion.Or(mValidRegion, state.mRegionToDraw); + // Everything that's visible has been validated. Do this instead of + // OR-ing with aRegionToDraw, since that can lead to a very complex region + // here (OR doesn't automatically simplify to the simplest possible + // representation of a region.) + mValidRegion.Or(mValidRegion, mVisibleRegion); } DEBUG_GL_ERROR_CHECK(gl());