Bug 886298 - Add a typed-units Margin. r=kats

This commit is contained in:
Chris Lord 2013-07-22 09:50:11 +01:00
Родитель baaed043f6
Коммит e3186541d9
2 изменённых файлов: 16 добавлений и 8 удалений

Просмотреть файл

@ -14,16 +14,20 @@
namespace mozilla {
namespace gfx {
struct Margin :
public BaseMargin<Float, Margin> {
typedef BaseMargin<Float, Margin> Super;
template<class units>
struct MarginTyped:
public BaseMargin<Float, MarginTyped<units> >,
public units {
typedef BaseMargin<Float, MarginTyped<units> > Super;
// Constructors
Margin() : Super(0, 0, 0, 0) {}
Margin(const Margin& aMargin) : Super(aMargin) {}
Margin(Float aTop, Float aRight, Float aBottom, Float aLeft)
: Super(aTop, aRight, aBottom, aLeft) {}
MarginTyped() : Super(0, 0, 0, 0) {}
MarginTyped(const MarginTyped<units>& aMargin) :
Super(float(aMargin.top), float(aMargin.right),
float(aMargin.bottom), float(aMargin.left)) {}
MarginTyped(Float aTop, Float aRight, Float aBottom, Float aLeft) :
Super(aTop, aRight, aBottom, aLeft) {}
};
typedef MarginTyped<UnknownUnits> Margin;
template<class units>
struct IntRectTyped :

Просмотреть файл

@ -25,6 +25,7 @@ typedef gfx::SizeTyped<CSSPixel> CSSSize;
typedef gfx::IntSizeTyped<CSSPixel> CSSIntSize;
typedef gfx::RectTyped<CSSPixel> CSSRect;
typedef gfx::IntRectTyped<CSSPixel> CSSIntRect;
typedef gfx::MarginTyped<CSSPixel> CSSMargin;
typedef gfx::PointTyped<LayoutDevicePixel> LayoutDevicePoint;
typedef gfx::IntPointTyped<LayoutDevicePixel> LayoutDeviceIntPoint;
@ -32,6 +33,7 @@ typedef gfx::SizeTyped<LayoutDevicePixel> LayoutDeviceSize;
typedef gfx::IntSizeTyped<LayoutDevicePixel> LayoutDeviceIntSize;
typedef gfx::RectTyped<LayoutDevicePixel> LayoutDeviceRect;
typedef gfx::IntRectTyped<LayoutDevicePixel> LayoutDeviceIntRect;
typedef gfx::MarginTyped<LayoutDevicePixel> LayoutDeviceMargin;
typedef gfx::PointTyped<LayerPixel> LayerPoint;
typedef gfx::IntPointTyped<LayerPixel> LayerIntPoint;
@ -39,6 +41,7 @@ typedef gfx::SizeTyped<LayerPixel> LayerSize;
typedef gfx::IntSizeTyped<LayerPixel> LayerIntSize;
typedef gfx::RectTyped<LayerPixel> LayerRect;
typedef gfx::IntRectTyped<LayerPixel> LayerIntRect;
typedef gfx::MarginTyped<LayerPixel> LayerMargin;
typedef gfx::PointTyped<ScreenPixel> ScreenPoint;
typedef gfx::IntPointTyped<ScreenPixel> ScreenIntPoint;
@ -46,6 +49,7 @@ typedef gfx::SizeTyped<ScreenPixel> ScreenSize;
typedef gfx::IntSizeTyped<ScreenPixel> ScreenIntSize;
typedef gfx::RectTyped<ScreenPixel> ScreenRect;
typedef gfx::IntRectTyped<ScreenPixel> ScreenIntRect;
typedef gfx::MarginTyped<ScreenPixel> ScreenMargin;
typedef gfx::ScaleFactor<CSSPixel, LayoutDevicePixel> CSSToLayoutDeviceScale;
typedef gfx::ScaleFactor<LayoutDevicePixel, CSSPixel> LayoutDeviceToCSSScale;