# HG changeset patch # User Botond Ballo # Date 1518025957 18000 # Node ID d2a0298fb0fd2ed7c35d488ae7d5a8950633b0fb # Parent c48597164b82aea0cf23890c9b98ca30da5ec069 Bug 1434250 - Infrastructure for working with Box types in Gecko code. r=kats MozReview-Commit-ID: 5fbTj6vwOwu diff --git a/gfx/src/moz.build b/gfx/src/moz.build --- a/gfx/src/moz.build +++ b/gfx/src/moz.build @@ -18,16 +18,17 @@ EXPORTS += [ 'FilterSupport.h', 'gfxCrashReporterUtils.h', 'gfxTelemetry.h', 'nsBoundingMetrics.h', 'nsColor.h', 'nsColorNameList.h', 'nsColorNames.h', 'nsCoord.h', + 'nsCoordBox.h', 'nsDeviceContext.h', 'nsFont.h', 'nsFontMetrics.h', 'nsGfxCIID.h', 'nsITheme.h', 'nsMargin.h', 'nsPoint.h', 'nsRect.h', diff --git a/gfx/src/nsCoordBox.h b/gfx/src/nsCoordBox.h new file mode 100644 --- /dev/null +++ b/gfx/src/nsCoordBox.h @@ -0,0 +1,24 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef NSCOORDBOX_H +#define NSCOORDBOX_H + +#include "mozilla/gfx/Box.h" +#include "nsCoord.h" +#include "nsRect.h" + +// Would like to call this nsBox, but can't because nsBox is a frame type. +struct nsCoordBox : + public mozilla::gfx::BaseBox { + typedef mozilla::gfx::BaseBox Super; + + nsCoordBox() : Super() {} + nsCoordBox(nscoord aX1, nscoord aY1, nscoord aX2, nscoord aY2) : + Super(aX1, aY1, aX2, aY2) {} +}; + +#endif /* NSCOORDBOX_H */ diff --git a/layout/base/Units.h b/layout/base/Units.h --- a/layout/base/Units.h +++ b/layout/base/Units.h @@ -2,16 +2,17 @@ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef MOZ_UNITS_H_ #define MOZ_UNITS_H_ +#include "mozilla/gfx/Box.h" #include "mozilla/gfx/Coord.h" #include "mozilla/gfx/Point.h" #include "mozilla/gfx/Rect.h" #include "mozilla/gfx/ScaleFactor.h" #include "mozilla/gfx/ScaleFactors2D.h" #include "nsMargin.h" #include "nsRect.h" #include "nsRegion.h" @@ -69,16 +70,17 @@ typedef gfx::IntMarginTyped LayoutDeviceIntRegion; typedef gfx::CoordTyped LayerCoord; typedef gfx::IntCoordTyped LayerIntCoord; typedef gfx::PointTyped LayerPoint; typedef gfx::IntPointTyped LayerIntPoint; typedef gfx::SizeTyped LayerSize; typedef gfx::IntSizeTyped LayerIntSize; +typedef gfx::BoxTyped LayerBox; typedef gfx::RectTyped LayerRect; typedef gfx::IntRectTyped LayerIntRect; typedef gfx::MarginTyped LayerMargin; typedef gfx::IntMarginTyped LayerIntMargin; typedef gfx::IntRegionTyped LayerIntRegion; typedef gfx::CoordTyped CSSTransformedLayerCoord; typedef gfx::IntCoordTyped CSSTransformedLayerIntCoord;