diff --git a/gfx/ipc/GfxMessageUtils.h b/gfx/ipc/GfxMessageUtils.h index 3c7bcb50685c..f09c9d583bf6 100644 --- a/gfx/ipc/GfxMessageUtils.h +++ b/gfx/ipc/GfxMessageUtils.h @@ -7,25 +7,25 @@ #ifndef __GFXMESSAGEUTILS_H__ #define __GFXMESSAGEUTILS_H__ +#include "FilterSupport.h" +#include "FrameMetrics.h" +#include "ImageTypes.h" +#include "RegionBuilder.h" #include "base/process_util.h" #include "chrome/common/ipc_message_utils.h" -#include "ipc/IPCMessageUtils.h" - -#include - -#include "mozilla/gfx/Matrix.h" #include "gfxPoint.h" #include "gfxRect.h" +#include "gfxTypes.h" +#include "ipc/IPCMessageUtils.h" +#include "mozilla/gfx/Matrix.h" +#include "mozilla/layers/AsyncDragMetrics.h" +#include "mozilla/layers/CompositorTypes.h" +#include "mozilla/layers/GeckoContentController.h" +#include "mozilla/layers/LayersTypes.h" #include "nsRect.h" #include "nsRegion.h" -#include "gfxTypes.h" -#include "mozilla/layers/AsyncDragMetrics.h" -#include "mozilla/layers/LayersTypes.h" -#include "mozilla/layers/CompositorTypes.h" -#include "ImageTypes.h" -#include "FrameMetrics.h" -#include "FilterSupport.h" -#include "mozilla/layers/GeckoContentController.h" + +#include #ifdef _MSC_VER #pragma warning( disable : 4800 ) @@ -367,6 +367,7 @@ struct RegionParamTraits static void Write(Message* msg, const paramType& param) { + for (auto iter = param.RectIter(); !iter.Done(); iter.Next()) { const Rect& r = iter.Get(); MOZ_RELEASE_ASSERT(!r.IsEmpty()); @@ -379,12 +380,16 @@ struct RegionParamTraits static bool Read(const Message* msg, void** iter, paramType* result) { + RegionBuilder builder; Rect rect; while (ReadParam(msg, iter, &rect)) { - if (rect.IsEmpty()) + if (rect.IsEmpty()) { + *result = builder.ToRegion(); return true; - result->Or(*result, rect); + } + builder.Or(rect); } + return false; } }; diff --git a/gfx/src/nsRegion.h b/gfx/src/nsRegion.h index f8857c8a29db..1293b8837a0d 100644 --- a/gfx/src/nsRegion.h +++ b/gfx/src/nsRegion.h @@ -831,7 +831,7 @@ public: // Forward constructors. IntRegionTyped() {} MOZ_IMPLICIT IntRegionTyped(const IntRectTyped& aRect) : Super(aRect) {} - IntRegionTyped(const IntRegionTyped& aRegion) : Super(aRegion) {} + explicit IntRegionTyped(const IntRegionTyped& aRegion) : Super(aRegion) {} IntRegionTyped(const nsTArray& aRects) : Super(aRects) {} IntRegionTyped(IntRegionTyped&& aRegion) : Super(mozilla::Move(aRegion)) {}