2013-06-12 00:00:08 -07:00
|
|
|
/* -*- 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
|
2013-05-30 18:30:13 -07:00
|
|
|
* 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/Point.h"
|
2013-06-14 13:11:30 -07:00
|
|
|
#include "mozilla/gfx/Rect.h"
|
2013-06-14 13:11:31 -07:00
|
|
|
#include "mozilla/gfx/ScaleFactor.h"
|
2013-08-02 00:04:22 -07:00
|
|
|
#include "nsRect.h"
|
2013-09-11 10:20:43 -07:00
|
|
|
#include "nsMargin.h"
|
2013-09-06 13:15:04 -07:00
|
|
|
#include "mozilla/AppUnits.h"
|
2013-05-30 18:30:13 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2013-06-14 13:11:30 -07:00
|
|
|
struct CSSPixel;
|
2013-06-21 14:03:56 -07:00
|
|
|
struct LayoutDevicePixel;
|
2013-06-14 13:11:30 -07:00
|
|
|
struct LayerPixel;
|
|
|
|
struct ScreenPixel;
|
|
|
|
|
|
|
|
typedef gfx::PointTyped<CSSPixel> CSSPoint;
|
|
|
|
typedef gfx::IntPointTyped<CSSPixel> CSSIntPoint;
|
|
|
|
typedef gfx::SizeTyped<CSSPixel> CSSSize;
|
|
|
|
typedef gfx::IntSizeTyped<CSSPixel> CSSIntSize;
|
|
|
|
typedef gfx::RectTyped<CSSPixel> CSSRect;
|
|
|
|
typedef gfx::IntRectTyped<CSSPixel> CSSIntRect;
|
2013-07-22 01:50:11 -07:00
|
|
|
typedef gfx::MarginTyped<CSSPixel> CSSMargin;
|
2013-08-22 09:41:51 -07:00
|
|
|
typedef gfx::IntMarginTyped<CSSPixel> CSSIntMargin;
|
2013-06-14 13:11:30 -07:00
|
|
|
|
2013-06-21 14:03:56 -07:00
|
|
|
typedef gfx::PointTyped<LayoutDevicePixel> LayoutDevicePoint;
|
|
|
|
typedef gfx::IntPointTyped<LayoutDevicePixel> LayoutDeviceIntPoint;
|
|
|
|
typedef gfx::SizeTyped<LayoutDevicePixel> LayoutDeviceSize;
|
|
|
|
typedef gfx::IntSizeTyped<LayoutDevicePixel> LayoutDeviceIntSize;
|
|
|
|
typedef gfx::RectTyped<LayoutDevicePixel> LayoutDeviceRect;
|
|
|
|
typedef gfx::IntRectTyped<LayoutDevicePixel> LayoutDeviceIntRect;
|
2013-07-22 01:50:11 -07:00
|
|
|
typedef gfx::MarginTyped<LayoutDevicePixel> LayoutDeviceMargin;
|
2013-08-22 09:41:51 -07:00
|
|
|
typedef gfx::IntMarginTyped<LayoutDevicePixel> LayoutDeviceIntMargin;
|
2013-06-21 14:03:56 -07:00
|
|
|
|
2013-06-14 13:11:30 -07:00
|
|
|
typedef gfx::PointTyped<LayerPixel> LayerPoint;
|
|
|
|
typedef gfx::IntPointTyped<LayerPixel> LayerIntPoint;
|
|
|
|
typedef gfx::SizeTyped<LayerPixel> LayerSize;
|
|
|
|
typedef gfx::IntSizeTyped<LayerPixel> LayerIntSize;
|
|
|
|
typedef gfx::RectTyped<LayerPixel> LayerRect;
|
|
|
|
typedef gfx::IntRectTyped<LayerPixel> LayerIntRect;
|
2013-07-22 01:50:11 -07:00
|
|
|
typedef gfx::MarginTyped<LayerPixel> LayerMargin;
|
2013-08-22 09:41:51 -07:00
|
|
|
typedef gfx::IntMarginTyped<LayerPixel> LayerIntMargin;
|
2013-06-14 13:11:30 -07:00
|
|
|
|
|
|
|
typedef gfx::PointTyped<ScreenPixel> ScreenPoint;
|
|
|
|
typedef gfx::IntPointTyped<ScreenPixel> ScreenIntPoint;
|
|
|
|
typedef gfx::SizeTyped<ScreenPixel> ScreenSize;
|
|
|
|
typedef gfx::IntSizeTyped<ScreenPixel> ScreenIntSize;
|
|
|
|
typedef gfx::RectTyped<ScreenPixel> ScreenRect;
|
|
|
|
typedef gfx::IntRectTyped<ScreenPixel> ScreenIntRect;
|
2013-07-22 01:50:11 -07:00
|
|
|
typedef gfx::MarginTyped<ScreenPixel> ScreenMargin;
|
2013-08-22 09:41:51 -07:00
|
|
|
typedef gfx::IntMarginTyped<ScreenPixel> ScreenIntMargin;
|
2013-06-14 13:11:30 -07:00
|
|
|
|
2013-06-21 14:03:56 -07:00
|
|
|
typedef gfx::ScaleFactor<CSSPixel, LayoutDevicePixel> CSSToLayoutDeviceScale;
|
|
|
|
typedef gfx::ScaleFactor<LayoutDevicePixel, CSSPixel> LayoutDeviceToCSSScale;
|
2013-06-14 13:11:31 -07:00
|
|
|
typedef gfx::ScaleFactor<CSSPixel, LayerPixel> CSSToLayerScale;
|
|
|
|
typedef gfx::ScaleFactor<LayerPixel, CSSPixel> LayerToCSSScale;
|
|
|
|
typedef gfx::ScaleFactor<CSSPixel, ScreenPixel> CSSToScreenScale;
|
|
|
|
typedef gfx::ScaleFactor<ScreenPixel, CSSPixel> ScreenToCSSScale;
|
2013-06-21 14:03:56 -07:00
|
|
|
typedef gfx::ScaleFactor<LayoutDevicePixel, LayerPixel> LayoutDeviceToLayerScale;
|
|
|
|
typedef gfx::ScaleFactor<LayerPixel, LayoutDevicePixel> LayerToLayoutDeviceScale;
|
2013-06-21 14:03:57 -07:00
|
|
|
typedef gfx::ScaleFactor<LayoutDevicePixel, ScreenPixel> LayoutDeviceToScreenScale;
|
|
|
|
typedef gfx::ScaleFactor<ScreenPixel, LayoutDevicePixel> ScreenToLayoutDeviceScale;
|
2013-06-14 13:11:31 -07:00
|
|
|
typedef gfx::ScaleFactor<LayerPixel, ScreenPixel> LayerToScreenScale;
|
|
|
|
typedef gfx::ScaleFactor<ScreenPixel, LayerPixel> ScreenToLayerScale;
|
|
|
|
|
2013-06-10 06:05:43 -07:00
|
|
|
/*
|
|
|
|
* The pixels that content authors use to specify sizes in.
|
|
|
|
*/
|
2013-05-30 18:30:13 -07:00
|
|
|
struct CSSPixel {
|
2013-06-14 13:11:30 -07:00
|
|
|
|
|
|
|
// Conversions from app units
|
|
|
|
|
|
|
|
static CSSPoint FromAppUnits(const nsPoint& aPoint) {
|
2013-09-06 13:15:04 -07:00
|
|
|
return CSSPoint(NSAppUnitsToFloatPixels(aPoint.x, float(AppUnitsPerCSSPixel())),
|
|
|
|
NSAppUnitsToFloatPixels(aPoint.y, float(AppUnitsPerCSSPixel())));
|
2013-06-14 13:11:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static CSSRect FromAppUnits(const nsRect& aRect) {
|
2013-09-06 13:15:04 -07:00
|
|
|
return CSSRect(NSAppUnitsToFloatPixels(aRect.x, float(AppUnitsPerCSSPixel())),
|
|
|
|
NSAppUnitsToFloatPixels(aRect.y, float(AppUnitsPerCSSPixel())),
|
|
|
|
NSAppUnitsToFloatPixels(aRect.width, float(AppUnitsPerCSSPixel())),
|
|
|
|
NSAppUnitsToFloatPixels(aRect.height, float(AppUnitsPerCSSPixel())));
|
2013-05-30 18:30:13 -07:00
|
|
|
}
|
|
|
|
|
2013-09-11 10:20:43 -07:00
|
|
|
static CSSMargin FromAppUnits(const nsMargin& aMargin) {
|
|
|
|
return CSSMargin(NSAppUnitsToFloatPixels(aMargin.top, float(AppUnitsPerCSSPixel())),
|
|
|
|
NSAppUnitsToFloatPixels(aMargin.right, float(AppUnitsPerCSSPixel())),
|
|
|
|
NSAppUnitsToFloatPixels(aMargin.bottom, float(AppUnitsPerCSSPixel())),
|
|
|
|
NSAppUnitsToFloatPixels(aMargin.left, float(AppUnitsPerCSSPixel())));
|
|
|
|
}
|
|
|
|
|
2013-06-14 13:11:30 -07:00
|
|
|
static CSSIntPoint FromAppUnitsRounded(const nsPoint& aPoint) {
|
2013-09-06 13:15:04 -07:00
|
|
|
return CSSIntPoint(NSAppUnitsToIntPixels(aPoint.x, float(AppUnitsPerCSSPixel())),
|
|
|
|
NSAppUnitsToIntPixels(aPoint.y, float(AppUnitsPerCSSPixel())));
|
2013-06-12 00:00:08 -07:00
|
|
|
}
|
|
|
|
|
2013-07-01 00:14:24 -07:00
|
|
|
static CSSIntSize FromAppUnitsRounded(const nsSize& aSize)
|
|
|
|
{
|
2013-09-06 13:15:04 -07:00
|
|
|
return CSSIntSize(NSAppUnitsToIntPixels(aSize.width, float(AppUnitsPerCSSPixel())),
|
|
|
|
NSAppUnitsToIntPixels(aSize.height, float(AppUnitsPerCSSPixel())));
|
2013-07-01 00:14:24 -07:00
|
|
|
}
|
|
|
|
|
2013-06-14 13:11:30 -07:00
|
|
|
static CSSIntRect FromAppUnitsRounded(const nsRect& aRect) {
|
2013-09-06 13:15:04 -07:00
|
|
|
return CSSIntRect(NSAppUnitsToIntPixels(aRect.x, float(AppUnitsPerCSSPixel())),
|
|
|
|
NSAppUnitsToIntPixels(aRect.y, float(AppUnitsPerCSSPixel())),
|
|
|
|
NSAppUnitsToIntPixels(aRect.width, float(AppUnitsPerCSSPixel())),
|
|
|
|
NSAppUnitsToIntPixels(aRect.height, float(AppUnitsPerCSSPixel())));
|
2013-06-14 13:11:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Conversions to app units
|
|
|
|
|
|
|
|
static nsPoint ToAppUnits(const CSSPoint& aPoint) {
|
2013-09-06 13:15:04 -07:00
|
|
|
return nsPoint(NSToCoordRoundWithClamp(aPoint.x * float(AppUnitsPerCSSPixel())),
|
|
|
|
NSToCoordRoundWithClamp(aPoint.y * float(AppUnitsPerCSSPixel())));
|
2013-05-30 18:30:13 -07:00
|
|
|
}
|
2013-06-03 06:52:44 -07:00
|
|
|
|
2013-06-14 13:11:30 -07:00
|
|
|
static nsPoint ToAppUnits(const CSSIntPoint& aPoint) {
|
2013-09-06 13:15:04 -07:00
|
|
|
return nsPoint(NSToCoordRoundWithClamp(float(aPoint.x) * float(AppUnitsPerCSSPixel())),
|
|
|
|
NSToCoordRoundWithClamp(float(aPoint.y) * float(AppUnitsPerCSSPixel())));
|
2013-06-12 00:00:08 -07:00
|
|
|
}
|
|
|
|
|
2013-06-14 13:11:30 -07:00
|
|
|
static nsRect ToAppUnits(const CSSRect& aRect) {
|
2013-09-06 13:15:04 -07:00
|
|
|
return nsRect(NSToCoordRoundWithClamp(aRect.x * float(AppUnitsPerCSSPixel())),
|
|
|
|
NSToCoordRoundWithClamp(aRect.y * float(AppUnitsPerCSSPixel())),
|
|
|
|
NSToCoordRoundWithClamp(aRect.width * float(AppUnitsPerCSSPixel())),
|
|
|
|
NSToCoordRoundWithClamp(aRect.height * float(AppUnitsPerCSSPixel())));
|
2013-06-10 06:05:43 -07:00
|
|
|
}
|
2013-05-30 18:30:13 -07:00
|
|
|
};
|
|
|
|
|
2013-06-21 14:03:56 -07:00
|
|
|
/*
|
|
|
|
* The pixels that are referred to as "device pixels" in layout code. In
|
|
|
|
* general this is obtained by converting a value in app units value by the
|
2013-09-06 13:15:04 -07:00
|
|
|
* AppUnitsPerDevPixel() value. The size of these pixels
|
2013-06-21 14:03:56 -07:00
|
|
|
* are affected by:
|
|
|
|
* 1) the "full zoom" (see nsPresContext::SetFullZoom)
|
|
|
|
* 2) the "widget scale" (see nsIWidget::GetDefaultScale)
|
|
|
|
*/
|
|
|
|
struct LayoutDevicePixel {
|
2013-08-13 08:49:21 -07:00
|
|
|
static LayoutDeviceIntPoint FromUntyped(const nsIntPoint& aPoint) {
|
2013-08-02 00:05:16 -07:00
|
|
|
return LayoutDeviceIntPoint(aPoint.x, aPoint.y);
|
|
|
|
}
|
2013-08-13 08:49:21 -07:00
|
|
|
|
|
|
|
static nsIntPoint ToUntyped(const LayoutDeviceIntPoint& aPoint) {
|
2013-08-02 00:05:16 -07:00
|
|
|
return nsIntPoint(aPoint.x, aPoint.y);
|
|
|
|
}
|
|
|
|
|
2013-08-13 08:49:21 -07:00
|
|
|
static LayoutDeviceIntRect FromUntyped(const nsIntRect& aRect) {
|
|
|
|
return LayoutDeviceIntRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
|
|
|
}
|
|
|
|
|
2013-11-27 09:33:27 -08:00
|
|
|
static nsIntRect ToUntyped(const LayoutDeviceIntRect& aRect) {
|
|
|
|
return nsIntRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
|
|
|
}
|
|
|
|
|
2013-08-30 10:22:33 -07:00
|
|
|
static LayoutDeviceRect FromAppUnits(const nsRect& aRect, nscoord aAppUnitsPerDevPixel) {
|
|
|
|
return LayoutDeviceRect(NSAppUnitsToFloatPixels(aRect.x, float(aAppUnitsPerDevPixel)),
|
|
|
|
NSAppUnitsToFloatPixels(aRect.y, float(aAppUnitsPerDevPixel)),
|
|
|
|
NSAppUnitsToFloatPixels(aRect.width, float(aAppUnitsPerDevPixel)),
|
|
|
|
NSAppUnitsToFloatPixels(aRect.height, float(aAppUnitsPerDevPixel)));
|
|
|
|
}
|
|
|
|
|
|
|
|
static LayoutDeviceIntPoint FromAppUnitsRounded(const nsPoint& aPoint, nscoord aAppUnitsPerDevPixel) {
|
2013-08-02 00:05:16 -07:00
|
|
|
return LayoutDeviceIntPoint(NSAppUnitsToIntPixels(aPoint.x, aAppUnitsPerDevPixel),
|
|
|
|
NSAppUnitsToIntPixels(aPoint.y, aAppUnitsPerDevPixel));
|
|
|
|
}
|
|
|
|
|
2013-08-30 10:22:33 -07:00
|
|
|
static LayoutDeviceIntPoint FromAppUnitsToNearest(const nsPoint& aPoint, nscoord aAppUnitsPerDevPixel) {
|
|
|
|
return FromUntyped(aPoint.ToNearestPixels(aAppUnitsPerDevPixel));
|
2013-07-11 07:43:35 -07:00
|
|
|
}
|
2013-08-13 08:49:21 -07:00
|
|
|
|
2013-08-30 10:22:33 -07:00
|
|
|
static LayoutDeviceIntRect FromAppUnitsToNearest(const nsRect& aRect, nscoord aAppUnitsPerDevPixel) {
|
|
|
|
return FromUntyped(aRect.ToNearestPixels(aAppUnitsPerDevPixel));
|
2013-08-13 08:49:21 -07:00
|
|
|
}
|
2013-06-21 14:03:56 -07:00
|
|
|
};
|
|
|
|
|
2013-06-10 06:05:43 -07:00
|
|
|
/*
|
|
|
|
* The pixels that layout rasterizes and delivers to the graphics code.
|
|
|
|
* These are generally referred to as "device pixels" in layout code. Layer
|
|
|
|
* pixels are affected by:
|
|
|
|
* 1) the "display resolution" (see nsIPresShell::SetResolution)
|
|
|
|
* 2) the "full zoom" (see nsPresContext::SetFullZoom)
|
2013-06-21 14:03:56 -07:00
|
|
|
* 3) the "widget scale" (see nsIWidget::GetDefaultScale)
|
2013-06-10 06:05:43 -07:00
|
|
|
*/
|
2013-06-03 06:52:44 -07:00
|
|
|
struct LayerPixel {
|
|
|
|
};
|
|
|
|
|
2013-06-10 06:05:43 -07:00
|
|
|
/*
|
|
|
|
* The pixels that are displayed on the screen.
|
|
|
|
* On non-OMTC platforms this should be equivalent to LayerPixel units.
|
|
|
|
* On OMTC platforms these may diverge from LayerPixel units temporarily,
|
|
|
|
* while an asynchronous zoom is happening, but should eventually converge
|
|
|
|
* back to LayerPixel units. Some variables (such as those representing
|
|
|
|
* chrome UI element sizes) that are not subject to content zoom should
|
|
|
|
* generally be represented in ScreenPixel units.
|
|
|
|
*/
|
2013-06-03 06:53:32 -07:00
|
|
|
struct ScreenPixel {
|
2014-06-06 15:49:59 -07:00
|
|
|
static ScreenIntPoint FromUntyped(const nsIntPoint& aPoint) {
|
|
|
|
return ScreenIntPoint(aPoint.x, aPoint.y);
|
|
|
|
}
|
2013-06-03 06:53:32 -07:00
|
|
|
};
|
|
|
|
|
2013-09-11 10:20:43 -07:00
|
|
|
// Operators to apply ScaleFactors directly to Points, Rects, Sizes and Margins
|
2013-06-14 13:11:31 -07:00
|
|
|
|
|
|
|
template<class src, class dst>
|
|
|
|
gfx::PointTyped<dst> operator*(const gfx::PointTyped<src>& aPoint, const gfx::ScaleFactor<src, dst>& aScale) {
|
|
|
|
return gfx::PointTyped<dst>(aPoint.x * aScale.scale,
|
|
|
|
aPoint.y * aScale.scale);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class src, class dst>
|
|
|
|
gfx::PointTyped<dst> operator/(const gfx::PointTyped<src>& aPoint, const gfx::ScaleFactor<dst, src>& aScale) {
|
|
|
|
return gfx::PointTyped<dst>(aPoint.x / aScale.scale,
|
|
|
|
aPoint.y / aScale.scale);
|
|
|
|
}
|
|
|
|
|
2013-06-14 13:11:31 -07:00
|
|
|
template<class src, class dst>
|
|
|
|
gfx::RectTyped<dst> operator*(const gfx::RectTyped<src>& aRect, const gfx::ScaleFactor<src, dst>& aScale) {
|
|
|
|
return gfx::RectTyped<dst>(aRect.x * aScale.scale,
|
|
|
|
aRect.y * aScale.scale,
|
|
|
|
aRect.width * aScale.scale,
|
|
|
|
aRect.height * aScale.scale);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class src, class dst>
|
|
|
|
gfx::RectTyped<dst> operator/(const gfx::RectTyped<src>& aRect, const gfx::ScaleFactor<dst, src>& aScale) {
|
|
|
|
return gfx::RectTyped<dst>(aRect.x / aScale.scale,
|
|
|
|
aRect.y / aScale.scale,
|
|
|
|
aRect.width / aScale.scale,
|
|
|
|
aRect.height / aScale.scale);
|
|
|
|
}
|
|
|
|
|
2013-06-14 13:11:44 -07:00
|
|
|
template<class src, class dst>
|
|
|
|
gfx::RectTyped<dst> operator*(const gfx::IntRectTyped<src>& aRect, const gfx::ScaleFactor<src, dst>& aScale) {
|
|
|
|
return gfx::RectTyped<dst>(float(aRect.x) * aScale.scale,
|
|
|
|
float(aRect.y) * aScale.scale,
|
|
|
|
float(aRect.width) * aScale.scale,
|
|
|
|
float(aRect.height) * aScale.scale);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class src, class dst>
|
|
|
|
gfx::RectTyped<dst> operator/(const gfx::IntRectTyped<src>& aRect, const gfx::ScaleFactor<dst, src>& aScale) {
|
|
|
|
return gfx::RectTyped<dst>(float(aRect.x) / aScale.scale,
|
|
|
|
float(aRect.y) / aScale.scale,
|
|
|
|
float(aRect.width) / aScale.scale,
|
|
|
|
float(aRect.height) / aScale.scale);
|
|
|
|
}
|
|
|
|
|
2013-09-03 12:12:24 -07:00
|
|
|
template<class src, class dst>
|
|
|
|
gfx::SizeTyped<dst> operator*(const gfx::SizeTyped<src>& aSize, const gfx::ScaleFactor<src, dst>& aScale) {
|
|
|
|
return gfx::SizeTyped<dst>(aSize.width * aScale.scale,
|
|
|
|
aSize.height * aScale.scale);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class src, class dst>
|
|
|
|
gfx::SizeTyped<dst> operator/(const gfx::SizeTyped<src>& aSize, const gfx::ScaleFactor<dst, src>& aScale) {
|
|
|
|
return gfx::SizeTyped<dst>(aSize.width / aScale.scale,
|
|
|
|
aSize.height / aScale.scale);
|
|
|
|
}
|
|
|
|
|
2014-03-28 07:36:47 -07:00
|
|
|
template<class src, class dst>
|
|
|
|
gfx::SizeTyped<dst> operator*(const gfx::IntSizeTyped<src>& aSize, const gfx::ScaleFactor<src, dst>& aScale) {
|
|
|
|
return gfx::SizeTyped<dst>(float(aSize.width) * aScale.scale,
|
|
|
|
float(aSize.height) * aScale.scale);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class src, class dst>
|
|
|
|
gfx::SizeTyped<dst> operator/(const gfx::IntSizeTyped<src>& aSize, const gfx::ScaleFactor<dst, src>& aScale) {
|
|
|
|
return gfx::SizeTyped<dst>(float(aSize.width) / aScale.scale,
|
|
|
|
float(aSize.height) / aScale.scale);
|
|
|
|
}
|
|
|
|
|
2013-09-11 10:20:43 -07:00
|
|
|
template<class src, class dst>
|
|
|
|
gfx::MarginTyped<dst> operator*(const gfx::MarginTyped<src>& aMargin, const gfx::ScaleFactor<src, dst>& aScale) {
|
|
|
|
return gfx::MarginTyped<dst>(aMargin.top * aScale.scale,
|
|
|
|
aMargin.right * aScale.scale,
|
|
|
|
aMargin.bottom * aScale.scale,
|
|
|
|
aMargin.left * aScale.scale);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class src, class dst>
|
|
|
|
gfx::MarginTyped<dst> operator/(const gfx::MarginTyped<src>& aMargin, const gfx::ScaleFactor<dst, src>& aScale) {
|
|
|
|
return gfx::MarginTyped<dst>(aMargin.top / aScale.scale,
|
|
|
|
aMargin.right / aScale.scale,
|
|
|
|
aMargin.bottom / aScale.scale,
|
|
|
|
aMargin.left / aScale.scale);
|
|
|
|
}
|
|
|
|
|
2014-03-10 14:56:59 -07:00
|
|
|
}
|
2013-05-30 18:30:13 -07:00
|
|
|
|
|
|
|
#endif
|